@kolkrabbi/kol-component 0.378.0 → 0.379.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -3
- package/src/atoms/BezierPathEditor.jsx +1 -1
- package/src/atoms/Button.jsx +84 -1
- package/src/atoms/Figure.jsx +19 -1
- package/src/atoms/FunctionPlot.jsx +1 -1
- package/src/atoms/Input.jsx +105 -1
- package/src/atoms/Kbd.jsx +42 -2
- package/src/atoms/Link.jsx +20 -0
- package/src/atoms/OriginPicker.jsx +9 -5
- package/src/atoms/SectionFooter.jsx +22 -0
- package/src/atoms/SectionHeader.jsx +24 -0
- package/src/atoms/SizeOrDownload.jsx +1 -1
- package/src/atoms/Textarea.jsx +11 -2
- package/src/atoms/ToggleCheckbox.jsx +23 -1
- package/src/atoms/ToggleSwitch.jsx +39 -0
- package/src/atoms/ViewToggle.jsx +2 -2
- package/src/atoms/XYPad.jsx +25 -0
- package/src/hooks/useDragResize.js +1 -1
- package/src/index.js +26 -3
- package/src/molecules/AccountMenu.jsx +14 -1
- package/src/molecules/AlignmentGrid.jsx +13 -1
- package/src/molecules/ButtonGroup.jsx +73 -1
- package/src/molecules/ButtonSplit.jsx +64 -3
- package/src/molecules/Chip.jsx +26 -0
- package/src/molecules/CodeBlock.jsx +39 -2
- package/src/molecules/ColorInputRow.jsx +125 -4
- package/src/molecules/ColorSwatch.jsx +43 -2
- package/src/molecules/ContentCard.jsx +104 -3
- package/src/molecules/ContentMedia.jsx +1 -1
- package/src/molecules/ContentRow.jsx +3 -3
- package/src/molecules/DividerLabel.jsx +19 -0
- package/src/molecules/Dropdown.jsx +111 -1
- package/src/molecules/DropdownStepper.jsx +29 -0
- package/src/molecules/FieldPair.jsx +41 -2
- package/src/molecules/LabeledControl.jsx +51 -0
- package/src/molecules/Menu.jsx +239 -3
- package/src/molecules/Modal.jsx +214 -9
- package/src/molecules/ModalShell.jsx +18 -5
- package/src/molecules/OptionRow.jsx +1 -1
- package/src/molecules/ParamBindDot.jsx +29 -2
- package/src/molecules/QuantityInput.jsx +48 -0
- package/src/molecules/RailHeader.jsx +32 -2
- package/src/molecules/SectionText.jsx +54 -1
- package/src/molecules/Slider.jsx +101 -2
- package/src/molecules/SplitToolButton.jsx +4 -6
- package/src/molecules/SwatchControls.jsx +28 -0
- package/src/molecules/SwatchGrid.jsx +39 -0
- package/src/molecules/TabsDocument.jsx +131 -0
- package/src/molecules/TabsRow.jsx +35 -1
- package/src/molecules/Toast.jsx +55 -0
- package/src/molecules/TreeRow.jsx +87 -1
- package/src/organisms/AppItemMenuProvider.jsx +2 -2
- package/src/organisms/ColorPickerPopover.jsx +133 -4
- package/src/organisms/ColumnBrowser.jsx +1 -1
- package/src/organisms/CommandOverlay.jsx +396 -21
- package/src/organisms/FindBar.jsx +70 -0
- package/src/organisms/FramedMediaBand.jsx +2 -2
- package/src/organisms/GalleryCarousel.jsx +1 -1
- package/src/organisms/LogoSystem.jsx +38 -0
- package/src/organisms/LogoTuner.jsx +32 -0
- package/src/organisms/MediaLibrary.jsx +1 -1
- package/src/organisms/MediaLibraryPages.jsx +1 -1
- package/src/organisms/Rail.jsx +33 -1
- package/src/organisms/RailSwitcher.jsx +62 -0
- package/src/organisms/ReadingContents.jsx +63 -1
- package/src/organisms/SectionSplit.jsx +1 -1
- package/src/organisms/SettingsPanel.jsx +45 -1
- package/src/organisms/ShortcutsOverlay.jsx +46 -2
- package/src/organisms/SpectrumControls.jsx +112 -19
- package/src/organisms/StatusBar.jsx +30 -0
- package/src/organisms/Table.jsx +141 -2
- package/src/organisms/TimelineDock.jsx +281 -1
- package/src/organisms/logoBoard.jsx +61 -0
- package/src/utilities/AssetPlaceholder.jsx +1 -1
- package/src/utilities/EditorShell.jsx +42 -1
- package/src/utilities/OverlayGlassPanel.jsx +1 -1
- package/src/utilities/Popover.jsx +298 -2
- package/src/utilities/SelectionOverlay.jsx +74 -1
- package/src/utilities/kolboxGlyph.jsx +10 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
2
|
+
import Button from '../atoms/Button.jsx'
|
|
3
|
+
import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* TabsDocument — A strip of open documents. One tab per open document (its glyph, its name, its close), the current one
|
|
7
|
+
* on its own ground, a plus after the last that opens a new one (plan-2026-11-22 folio-on-kolbox; drawn after Figma's
|
|
8
|
+
* desktop tab strip, his reference). Holds no document state and no router: the host passes the tabs and answers the
|
|
9
|
+
* callbacks. `TabsRow` switches views inside a page; this strip switches documents, so it carries close, unsaved, open
|
|
10
|
+
* beside and drag, which TabsRow does not.
|
|
11
|
+
*
|
|
12
|
+
* A tablist of tabs: arrow keys, Home and End move between the tabs (Enter or Space opens one); each tab's close button
|
|
13
|
+
* is in the Tab order, named "Close <name>".
|
|
14
|
+
*
|
|
15
|
+
* <TabsDocument variant="kolbox" tabs={[{ value: '/a', label: 'notes.md', icon: 'file-md', dirty: true }]}
|
|
16
|
+
* value="/a" onChange={open} onClose={close} onNew={create} />
|
|
17
|
+
*
|
|
18
|
+
* @param {'kolbox'|'folio'} [variant='folio'] - The look. `kolbox` (the editor style): a 40 strip on the panel ground with
|
|
19
|
+
* the field line under it, tabs 12 / 16, the current one on the field wash (light: the top rail's track pair, canvas
|
|
20
|
+
* strip and ground tab), the others flat in oq-64; the glyph 16, the close a kolbox icon button; an unsaved tab shows a
|
|
21
|
+
* dot in the close's place until hovered. `folio` (the default): Folio's own strip, carried class for class from
|
|
22
|
+
* apps/folio's FolioWrite (44 high, 36 tabs on the paper, Inter 11, a text "New"); it draws no glyph.
|
|
23
|
+
* @param {Array<{ value: string, label: string, icon?: string, dirty?: boolean }>} tabs - The open documents, in order.
|
|
24
|
+
* `icon` is the document kind's glyph by your icons' name (kolbox only; `file` when unset); `dirty` shows the unsaved dot
|
|
25
|
+
* @param {string} [value] - The current tab's value
|
|
26
|
+
* @param {(value: string) => void} [onChange] - A tab pressed (the current one included, as Folio's tab button is)
|
|
27
|
+
* @param {(value: string) => void} [onClose] - A tab's close pressed; no close button without it
|
|
28
|
+
* @param {() => void} [onNew] - The plus after the last tab; none without it
|
|
29
|
+
* @param {string} [newLabel='New'] - The plus's name (folio: its visible text)
|
|
30
|
+
* @param {string} [paired] - The tab open beside the current one (a split): drawn on the current ground; folio chains the two
|
|
31
|
+
* with its green line
|
|
32
|
+
* @param {(value: string) => void} [onOpenBeside] - A tab's "Open beside" button (shown on hover, not on the current or the
|
|
33
|
+
* paired tab); none without it
|
|
34
|
+
* @param {() => void} [onCloseSplit] - With `paired`, a "Close split" button after the tabs
|
|
35
|
+
* @param {(event: MouseEvent, tab: object) => void} [onTabContextMenu] - A tab's context menu; the host opens its menu
|
|
36
|
+
* @param {(event: DragEvent, tab: object) => void} [onTabDragStart] - Makes the other tabs draggable (not the current one);
|
|
37
|
+
* the host sets the drag data
|
|
38
|
+
* @param {string} [ariaLabel='Open documents'] - Names the tablist
|
|
39
|
+
* @param {string} [className] - Extra classes on the strip
|
|
40
|
+
*/
|
|
41
|
+
export default function TabsDocument({
|
|
42
|
+
variant = 'folio', tabs = [], value, onChange, onClose, onNew, newLabel = 'New', paired,
|
|
43
|
+
onOpenBeside, onCloseSplit, onTabContextMenu, onTabDragStart, ariaLabel = 'Open documents', className = '',
|
|
44
|
+
}) {
|
|
45
|
+
const kolbox = variant === 'kolbox'
|
|
46
|
+
const focusable = tabs.some((t) => t.value === value) ? value : tabs[0]?.value
|
|
47
|
+
/* arrows, Home and End move the focus between the tabs; the host opens one on Enter or Space (the tab is a button) */
|
|
48
|
+
const onKeyDown = (e) => {
|
|
49
|
+
const all = [...e.currentTarget.querySelectorAll('[role="tab"]')]
|
|
50
|
+
const at = all.indexOf(document.activeElement)
|
|
51
|
+
if (at < 0) return
|
|
52
|
+
const to = { ArrowRight: at + 1, ArrowLeft: at - 1, Home: 0, End: all.length - 1 }[e.key]
|
|
53
|
+
if (to == null) return
|
|
54
|
+
e.preventDefault()
|
|
55
|
+
all[(to + all.length) % all.length]?.focus()
|
|
56
|
+
}
|
|
57
|
+
const cell = (t) => ({
|
|
58
|
+
onContextMenu: onTabContextMenu ? (e) => onTabContextMenu(e, t) : undefined,
|
|
59
|
+
draggable: Boolean(onTabDragStart) && t.value !== value,
|
|
60
|
+
onDragStart: onTabDragStart ? (e) => onTabDragStart(e, t) : undefined,
|
|
61
|
+
})
|
|
62
|
+
const tabProps = (t) => ({
|
|
63
|
+
type: 'button', role: 'tab', 'aria-selected': t.value === value, tabIndex: t.value === focusable ? 0 : -1,
|
|
64
|
+
onClick: () => onChange?.(t.value),
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
if (kolbox) {
|
|
68
|
+
return (
|
|
69
|
+
<div role="tablist" aria-label={ariaLabel} onKeyDown={onKeyDown}
|
|
70
|
+
className={`kol-tabs-document--kolbox relative flex h-10 shrink-0 items-stretch overflow-x-auto [scrollbar-width:none] after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:h-px after:content-[''] ${className}`.trim()}>
|
|
71
|
+
{tabs.map((t) => {
|
|
72
|
+
const on = t.value === value
|
|
73
|
+
const lit = on || t.value === paired
|
|
74
|
+
const closeShown = on && !t.dirty
|
|
75
|
+
return (
|
|
76
|
+
<div key={t.value} role="presentation" {...cell(t)}
|
|
77
|
+
className={`kol-tabs-document-tab${lit ? ' is-active' : ''} group relative flex shrink-0 items-center gap-1 pr-2 pl-3`}>
|
|
78
|
+
<button {...tabProps(t)} className="kol-tabs-document-label flex min-w-0 items-center gap-2 self-stretch outline-none focus-visible:outline-solid focus-visible:outline-1">
|
|
79
|
+
<KolboxGlyph name={t.icon || 'file'} className="kol-tabs-document-glyph" />
|
|
80
|
+
<span className="max-w-[220px] truncate">{t.label}</span>
|
|
81
|
+
</button>
|
|
82
|
+
{onOpenBeside && !lit && (
|
|
83
|
+
<Button variant="kolbox" iconOnly="panel-right" aria-label={`Open ${t.label} beside`} onClick={() => onOpenBeside(t.value)}
|
|
84
|
+
className="opacity-0 group-hover:opacity-100 focus-visible:opacity-100" />
|
|
85
|
+
)}
|
|
86
|
+
{onClose && (
|
|
87
|
+
<span className="relative flex size-(--kol-kolbox-ctl) items-center justify-center">
|
|
88
|
+
{t.dirty && <span aria-label="Unsaved changes" role="img" className="kol-tabs-document-dot pointer-events-none absolute size-1.5 rounded-full group-hover:opacity-0 group-focus-within:opacity-0" />}
|
|
89
|
+
<Button variant="kolbox" iconOnly="x" aria-label={`Close ${t.label}`} onClick={() => onClose(t.value)}
|
|
90
|
+
className={closeShown ? '' : 'opacity-0 group-hover:opacity-100 group-focus-within:opacity-100'} />
|
|
91
|
+
</span>
|
|
92
|
+
)}
|
|
93
|
+
</div>
|
|
94
|
+
)
|
|
95
|
+
})}
|
|
96
|
+
{paired && onCloseSplit && (
|
|
97
|
+
<span className="flex shrink-0 items-center px-2">
|
|
98
|
+
<Button variant="kolbox" tone="ghost" iconLeft="panel-right" onClick={onCloseSplit}>Close split</Button>
|
|
99
|
+
</span>
|
|
100
|
+
)}
|
|
101
|
+
{onNew && (
|
|
102
|
+
<span className="flex shrink-0 items-center px-2">
|
|
103
|
+
<Button variant="kolbox" iconOnly="plus" aria-label={newLabel} onClick={onNew} />
|
|
104
|
+
</span>
|
|
105
|
+
)}
|
|
106
|
+
</div>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* folio: FolioWrite's strip (13.3, W18) class for class; its colors are rules on the folio tokens (kol-components-molecules.css) */
|
|
111
|
+
return (
|
|
112
|
+
<div role="tablist" aria-label={ariaLabel} onKeyDown={onKeyDown}
|
|
113
|
+
className={`kol-tabs-document--folio flex h-[44px] shrink-0 items-end gap-[2px] overflow-x-auto px-[56px] [scrollbar-width:none] ${className}`.trim()}>
|
|
114
|
+
{tabs.map((t) => {
|
|
115
|
+
const on = t.value === value
|
|
116
|
+
const chained = paired && (on || t.value === paired)
|
|
117
|
+
return (
|
|
118
|
+
<div key={t.value} role="presentation" {...cell(t)}
|
|
119
|
+
className={`kol-tabs-document-tab${on || t.value === paired ? ' is-active' : ''}${chained ? ' is-chained' : ''} group flex h-[36px] shrink-0 items-center gap-[8px] rounded-t-[3px] pl-[14px] pr-[6px]`}>
|
|
120
|
+
<button {...tabProps(t)} className={`kol-tabs-document-label kol-folio-meta max-w-[220px] truncate${on ? ' is-current font-semibold' : ''}`}>{t.label}</button>
|
|
121
|
+
{t.dirty && <span aria-label="Unsaved changes" role="img" className="kol-tabs-document-dot size-[6px] rounded-full" />}
|
|
122
|
+
{onOpenBeside && !on && t.value !== paired && <button type="button" aria-label={`Open ${t.label} beside`} title="Open beside" onClick={() => onOpenBeside(t.value)} className="kol-tabs-document-btn flex size-[20px] items-center justify-center rounded-[3px] opacity-0 group-hover:opacity-100"><IconLoader name="panel-right" size={12} /></button>}
|
|
123
|
+
{onClose && <button type="button" aria-label={`Close ${t.label}`} onClick={() => onClose(t.value)} className="kol-tabs-document-btn flex size-[20px] items-center justify-center rounded-[3px] opacity-60 hover:opacity-100"><IconLoader name="x" size={12} /></button>}
|
|
124
|
+
</div>
|
|
125
|
+
)
|
|
126
|
+
})}
|
|
127
|
+
{paired && onCloseSplit && <button type="button" onClick={onCloseSplit} className="kol-tabs-document-text kol-folio-meta flex h-[36px] shrink-0 items-center gap-[6px] px-[12px]"><IconLoader name="panel-right" size={12} />Close split</button>}
|
|
128
|
+
{onNew && <button type="button" onClick={onNew} className="kol-tabs-document-text kol-folio-meta flex h-[36px] shrink-0 items-center gap-[6px] px-[12px]"><IconLoader name="plus" size={12} />{newLabel}</button>}
|
|
129
|
+
</div>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
@@ -34,7 +34,7 @@ import { floatSurfaceClass } from '../utilities/tone.js'
|
|
|
34
34
|
* keeps one line that scrolls sideways with no scrollbar, `.kol-scroll-fade--x` fading the clipped edge(s), and the
|
|
35
35
|
* active tab scrolled into view when it changes — arrow keys included; `wrap` breaks the tabs onto a second line.
|
|
36
36
|
* Every variant but `stacked`, which has its phone bar
|
|
37
|
-
* @param {'underline'|'chip'|'text'|'stacked'|'float'} [variant='underline'] `float` (W16, round 3): `chip`'s row as the floating
|
|
37
|
+
* @param {'underline'|'chip'|'text'|'stacked'|'float'|'kolbox'} [variant='underline'] `kolbox` (W31.2 batch 3): kolbox's tab track, see `TabsKolbox` below; takes `tabs`, `value`, `onChange`, `size` (sm, md) and `className` only. `float` (W16, round 3): `chip`'s row as the floating
|
|
38
38
|
* style's capsules — float heights (28/36/44, touch 36/44/52), 4 apart, the selected one oq-16
|
|
39
39
|
* @param {string} [look] @deprecated 2026-10-30 — the old spelling of `variant`; `variant` wins when both are passed
|
|
40
40
|
* @param {'mono'|'sans'|'mono-light'} [type='mono'] `underline` only: the tab's type — `mono-light` is `sans`'s row on JetBrains Mono at 300 (his word, 2026-10-30)
|
|
@@ -94,6 +94,39 @@ import { floatSurfaceClass } from '../utilities/tone.js'
|
|
|
94
94
|
* Tabs are `{ id, label }` or `{ value, label }` (either key), plus `icon` for stacked; a stacked tab's `selected`
|
|
95
95
|
* lights it whatever `value` is — action slots (the transport) light more than one.
|
|
96
96
|
*/
|
|
97
|
+
/* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's Tabs carried class for class,
|
|
98
|
+
* chrome in kol-theme `.kol-tabs--kolbox`. `size` sm (its default) the tab track: the kolbox control height (`--kol-kolbox-ctl`, 24) on the oq-16 field, radius 6,
|
|
99
|
+
* 2 in, the tabs 1 apart at radius 4, 12 in, the current one oq-24 in the ink; md the top rail's mode track: 32 on the
|
|
100
|
+
* ground (24 tabs, as every control; 36 until 2026-11-19, plan-2026-11-19 C9.1), radius 8, 4 in, the tabs touching, 8 in, the current one oq-16 with the accent label. Inter 12 / 16 / 500, the
|
|
101
|
+
* rest oq-64, the ink on hover. Tabs are strings or `{ value, label, disabled, tooltip }`: a disabled tab is 40%, takes
|
|
102
|
+
* no hover or focus and shows its `tooltip` in `Tooltip variant="kolbox"` (batch 4; the `tooltipComponent` seam is gone). In a track narrower than the labels and their padding the tabs share it
|
|
103
|
+
* equally and the padding gives way. */
|
|
104
|
+
function TabsKolbox({ tabs = [], value, onChange, size = 'sm', className = '' }) {
|
|
105
|
+
const md = size === 'md'
|
|
106
|
+
return (
|
|
107
|
+
<div role="tablist" className={`kol-tabs--kolbox kol-tabs--kolbox-${md ? 'md' : 'sm'} inline-flex items-center ${md ? 'h-8 p-1' : 'h-(--kol-kolbox-ctl) gap-px p-0.5'} ${className}`}>
|
|
108
|
+
{tabs.map((t) => {
|
|
109
|
+
const { value: v, label, disabled, tooltip } = typeof t === 'string' ? { value: t, label: t } : t
|
|
110
|
+
const on = v === value
|
|
111
|
+
const tab = (
|
|
112
|
+
<button
|
|
113
|
+
key={v}
|
|
114
|
+
type="button"
|
|
115
|
+
role="tab"
|
|
116
|
+
aria-selected={on}
|
|
117
|
+
disabled={disabled}
|
|
118
|
+
onClick={() => onChange?.(v)}
|
|
119
|
+
className={`kol-tabs-tab${on ? ' is-active' : ''} flex h-full min-w-0 flex-1 items-center justify-center ${md ? 'px-2' : 'px-3'} whitespace-nowrap outline-none focus-visible:outline-solid focus-visible:outline-1 disabled:opacity-40`}
|
|
120
|
+
>
|
|
121
|
+
{label}
|
|
122
|
+
</button>
|
|
123
|
+
)
|
|
124
|
+
return tooltip ? <span key={v} className="flex h-full flex-1 [&>span]:h-full [&>span]:flex-1 [&_button]:w-full">{<Tooltip variant="kolbox" label={tooltip}>{tab}</Tooltip>}</span> : tab
|
|
125
|
+
})}
|
|
126
|
+
</div>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
97
130
|
export const TABBAR_H = 56
|
|
98
131
|
/* the pill's height (W16, round 3 — fxr's live nav: was TABBAR_H) — a page under it owes TABBAR_PILL_H + TABBAR_PILL_INSET */
|
|
99
132
|
export const TABBAR_PILL_H = 66
|
|
@@ -119,6 +152,7 @@ export const tabbarPillSlot = (at, { count, labels = false, split = false } = {}
|
|
|
119
152
|
const COLLAPSE_MS = 300
|
|
120
153
|
|
|
121
154
|
export default function TabsRow({ tabs: raw = [], value, onChange, onClose, onMinimise, variant, look: lookLegacy, type, trailing, filled = false, placement = 'inline', shape = 'bar', collapsed = false, onExpand, edge, border, shadow, dock, active, foldable, folded, onFoldChange, foldSide, foldTone, surface, split, labels, size, tracked = false, overflow = 'scroll', ariaLabel, className, style }) {
|
|
155
|
+
if (variant === 'kolbox') return <TabsKolbox tabs={raw} value={value} onChange={onChange} size={size} className={className} />
|
|
122
156
|
const tabs = raw.map((t) => ({ ...t, id: t.id ?? t.value }))
|
|
123
157
|
const look = variant ?? lookLegacy ?? 'underline'
|
|
124
158
|
const wrap = overflow === 'wrap'
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import Link from '../atoms/Link.jsx'
|
|
3
|
+
|
|
4
|
+
/* taxonomy-ok: molecule — a message and a Link on one floating row */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Toast — One short message on a floating row, with one action (plan-2026-11-18-kolbox-system W31.2 batch 4,
|
|
8
|
+
* 2026-11-18; kolbox's Toast, Figma 288:7452). One row: the message (Inter 11 / 15 medium, the ink) then one `Link`,
|
|
9
|
+
* 12 apart; padding 8 top and bottom, 12 right, 16 left; radius 12; the secondary surface on the one floating surface
|
|
10
|
+
* (`.kol-kolbox-surface`), clipped. Its one look. Feedback.
|
|
11
|
+
*
|
|
12
|
+
* toast({ message: 'Saved', action: 'Show in Files', onAction }) // from anywhere: raises it in the ToastHost
|
|
13
|
+
* <ToastHost /> // once, at the app's root
|
|
14
|
+
*
|
|
15
|
+
* @param {string} [message] the message
|
|
16
|
+
* @param {string} [action] the Link's words; none, no Link
|
|
17
|
+
* @param {Function} [onAction] the Link's press
|
|
18
|
+
*/
|
|
19
|
+
export default function Toast({ message = 'File moved', action = 'Show in kol-ds-ui [library files]', onAction }) {
|
|
20
|
+
return (
|
|
21
|
+
<div role="status" data-toast
|
|
22
|
+
className="kol-toast kol-kolbox-surface flex items-center gap-3 overflow-clip py-2 pr-3 pl-4">
|
|
23
|
+
<span className="kol-toast-message shrink-0 whitespace-nowrap">{message}</span>
|
|
24
|
+
{action && <Link onClick={onAction}>{action}</Link>}
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* The window event a toast rides on (kolbox's was `kolbox:toast`; KOL's events are `kol:`). */
|
|
30
|
+
const TOAST_EVENT = 'kol:toast'
|
|
31
|
+
|
|
32
|
+
/** toast — raise one Toast in the ToastHost: `toast({ message, action, onAction })`. */
|
|
33
|
+
export const toast = (detail) => window.dispatchEvent(new CustomEvent(TOAST_EVENT, { detail }))
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* ToastHost — The one toast on screen: at the foot of the window, centred, 80 up so it clears an editor's dock, for
|
|
37
|
+
* 4 s or until the next one. Mount it once.
|
|
38
|
+
*/
|
|
39
|
+
export function ToastHost() {
|
|
40
|
+
const [t, setT] = useState(null)
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
let timer
|
|
43
|
+
const on = (e) => { clearTimeout(timer); setT({ ...e.detail, key: Date.now() }); timer = setTimeout(() => setT(null), 4000) }
|
|
44
|
+
window.addEventListener(TOAST_EVENT, on)
|
|
45
|
+
return () => { window.removeEventListener(TOAST_EVENT, on); clearTimeout(timer) }
|
|
46
|
+
}, [])
|
|
47
|
+
if (!t) return null
|
|
48
|
+
return (
|
|
49
|
+
<div className="pointer-events-none fixed inset-x-0 bottom-20 z-50 flex justify-center">
|
|
50
|
+
<div className="pointer-events-auto">
|
|
51
|
+
<Toast key={t.key} message={t.message} action={t.action} onAction={() => { t.onAction?.(); setT(null) }} />
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
2
|
+
import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
|
|
2
3
|
|
|
3
4
|
/* taxonomy-ok: molecule — nests kol-icons's Icon. */
|
|
4
5
|
|
|
@@ -17,6 +18,11 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
17
18
|
* of the active row: the emphasis ink, no lift. `count` sits right in mono (`kol-float-ruler`, fg-64). A row with
|
|
18
19
|
* `expanded` defined draws the chevron at its end — right when shut, down when open — and `onToggle` is its press.
|
|
19
20
|
*
|
|
21
|
+
* `variant="kolbox"` (W31.2 batch 5): kolbox's ListRow, below.
|
|
22
|
+
*
|
|
23
|
+
* `variant="folio"` (Folio migration batch D): Folio's library tree rows, below; `linkComponent` is its router seam.
|
|
24
|
+
*
|
|
25
|
+
* @param {'default'|'kolbox'|'folio'} [variant]
|
|
20
26
|
* @param {'xs'|'sm'|'md'|'lg'} [size='sm']
|
|
21
27
|
* @param {string} [icon]
|
|
22
28
|
* @param {ReactNode} label
|
|
@@ -38,7 +44,7 @@ export const TREE_ROW = {
|
|
|
38
44
|
lg: { h: 'h-10', ic: 18, type: 'font-[family-name:var(--kol-font-family-float)] text-[13px] leading-[18px]' },
|
|
39
45
|
}
|
|
40
46
|
|
|
41
|
-
|
|
47
|
+
function TreeRowDefault({ size = 'sm', icon, label, count, active = false, open = false, expanded, onToggle, depth = 0, href, onClick, trailing, className = '', ...rest }) {
|
|
42
48
|
const S = TREE_ROW[size] ?? TREE_ROW.sm
|
|
43
49
|
const bright = active || open
|
|
44
50
|
const Tag = href ? 'a' : 'button'
|
|
@@ -70,3 +76,83 @@ export default function TreeRow({ size = 'sm', icon, label, count, active = fals
|
|
|
70
76
|
</Tag>
|
|
71
77
|
)
|
|
72
78
|
}
|
|
79
|
+
|
|
80
|
+
/* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18): kolbox's ListRow (the file's ListRow
|
|
81
|
+
* 27:9332), carried from apps/kolbox/src/ui/ListRow.jsx. Its four rows are `size`: xs 24 (the plain row, 8 in, a 16
|
|
82
|
+
* glyph), sm 28 (HomeRail's row, a 20 glyph, 6 in), md 30 (the Styles rows, 6 in), lg 40 (the search modal's result, a
|
|
83
|
+
* 20 glyph, 12 in). `active` is the field fill and, on xs and sm, the accent label with a 2 by 14 accent bar at the left
|
|
84
|
+
* edge. `tree` is a 32 row (Figma's layer row, W3) with a 36 lead (the 12 chevron at its left, the 16 type glyph at its right), 8 in, and 24 of indent
|
|
85
|
+
* per `depth`; `expanded` turns the chevron, and a row with no children (`expanded` undefined) keeps its place empty.
|
|
86
|
+
* `onToggle` makes the chevron its own target (the row's click still selects). `dimmed`: the lead and label at 40%.
|
|
87
|
+
* Glyphs are your icons by the set's name (KolboxGlyph). Other props land on the row's button. */
|
|
88
|
+
const TREE_ROW_KOLBOX = {
|
|
89
|
+
xs: { row: 'h-6 gap-2', bar: 'before:absolute before:top-1/2 before:-translate-y-1/2 before:left-0 before:h-3.5 before:w-0.5 before:rounded-xs', icon: 16, pad: 'var(--kol-spacing-2)' },
|
|
90
|
+
sm: { row: 'relative h-7 gap-2.5', bar: 'before:absolute before:top-1.75 before:left-0 before:h-3.5 before:w-0.5', icon: 18, pad: '6px' },
|
|
91
|
+
lg: { row: 'h-10 gap-3', bar: '', icon: 20, pad: 'var(--kol-spacing-3)' },
|
|
92
|
+
md: { row: 'h-7.5 gap-2', bar: '', icon: 16, pad: '6px' },
|
|
93
|
+
}
|
|
94
|
+
function TreeRowKolbox({ size = 'xs', icon, label, depth = 0, tree: treeProp = false, expanded, onToggle, active = false, dimmed = false, disabled = false, onClick, trailing, count, href, linkComponent: Link = 'a', className = '', ...rest }) {
|
|
95
|
+
const v = TREE_ROW_KOLBOX[size] ?? TREE_ROW_KOLBOX.xs
|
|
96
|
+
/* Folio on kolbox (2026-11-22): a folder row (`expanded` defined) or a link row (`href`) of a caller that does not say
|
|
97
|
+
`tree` is drawn on the tree lead, so a library tree's shelves and their documents share kolbox's layer tree's column;
|
|
98
|
+
the folder's press is its toggle. `href` makes the row a link through `linkComponent` (a router's Link, given `to`;
|
|
99
|
+
else an anchor). `count` (when the caller does not say `tree`) sits at the right in the meta role. */
|
|
100
|
+
const implied = !treeProp && (expanded !== undefined || href != null)
|
|
101
|
+
const tree = treeProp || implied
|
|
102
|
+
const Tag = href != null ? Link : 'button'
|
|
103
|
+
const own = href != null ? (Link === 'a' ? { href } : { to: href }) : { type: 'button', disabled }
|
|
104
|
+
return (
|
|
105
|
+
<Tag
|
|
106
|
+
{...own}
|
|
107
|
+
aria-current={active || undefined}
|
|
108
|
+
aria-expanded={tree && expanded !== undefined ? expanded : undefined}
|
|
109
|
+
onClick={onClick ?? (implied && expanded !== undefined ? onToggle : undefined)}
|
|
110
|
+
className={`kol-tree-row--kolbox kol-tree-row--kolbox-${size} kol-tree-row--type-${tree ? 'xs' : size}${active ? ` is-active ${v.bar}` : ''} relative flex w-full min-w-0 shrink-0 items-center ${tree ? 'h-8 gap-2' : v.row} pr-2 text-left outline-none focus-visible:outline-solid focus-visible:outline-1 disabled:opacity-40 ${className}`.trim()}
|
|
111
|
+
style={{ paddingLeft: `calc(${tree ? 'var(--kol-spacing-2)' : v.pad} + ${depth} * var(--kol-spacing-6))` }}
|
|
112
|
+
{...rest}
|
|
113
|
+
>
|
|
114
|
+
{tree ? (
|
|
115
|
+
<span className={`relative h-4 w-9 shrink-0 ${dimmed ? 'opacity-40' : ''}`}>
|
|
116
|
+
{expanded !== undefined && (onToggle ? (
|
|
117
|
+
<span
|
|
118
|
+
role="button"
|
|
119
|
+
aria-label={expanded ? 'Collapse' : 'Expand'}
|
|
120
|
+
aria-expanded={expanded}
|
|
121
|
+
onClick={(e) => { e.stopPropagation(); onToggle() }}
|
|
122
|
+
onDoubleClick={(e) => e.stopPropagation()}
|
|
123
|
+
className="kol-tree-row-toggle absolute -top-0.5 -left-1 flex size-5 items-center justify-center"
|
|
124
|
+
>
|
|
125
|
+
<KolboxGlyph name={expanded ? 'chevron-down' : 'chevron-right'} />
|
|
126
|
+
</span>
|
|
127
|
+
) : <KolboxGlyph name={expanded ? 'chevron-down' : 'chevron-right'} className="absolute top-0.5 left-0" />)}
|
|
128
|
+
{icon && <KolboxGlyph name={icon} className="kol-tree-row-type absolute top-0 right-0" />}
|
|
129
|
+
</span>
|
|
130
|
+
) : icon && <KolboxGlyph name={icon} size={v.icon} className={size === 'sm' && !active ? 'kol-tree-row-icon--muted' : ''} />}
|
|
131
|
+
<span className={`min-w-0 flex-1 truncate ${dimmed ? 'opacity-40' : ''}`}>{label}</span>
|
|
132
|
+
{!treeProp && count != null && <span className="kol-tree-row-count--kolbox shrink-0 tabular-nums">{count}</span>}
|
|
133
|
+
{trailing}
|
|
134
|
+
</Tag>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
/* `variant="folio"` (Folio migration batch D, 2026-11-22): the library tree's two rows, carried from apps/folio's
|
|
138
|
+
* EditorChrome.jsx LibraryTree. A row with `expanded` defined is a shelf: 32 high, 8 in, the 12 chevron leading (right
|
|
139
|
+
* when shut, down when open), the label in the ink, `count` at the right in the muted ink, `onToggle` its press. A row
|
|
140
|
+
* without is a document: 6 over and under, 28 in (under the shelf's label), truncated, the muted ink brightening on
|
|
141
|
+
* hover; `active` is the mint fill and the green ink. `href` makes it a link, through `linkComponent` (a router's Link,
|
|
142
|
+
* given `to`; else an anchor, given `href`). Type 11 / 400 (`kol-folio-meta`), in its own rule. Other props land on the
|
|
143
|
+
* row (Folio's `title`, `onContextMenu`). */
|
|
144
|
+
function TreeRowFolio({ label, count, expanded, onToggle, active = false, href, linkComponent: Link = 'a', className = '', ...rest }) {
|
|
145
|
+
const { variant: _v, ...own } = rest
|
|
146
|
+
if (expanded !== undefined) return (
|
|
147
|
+
<button type="button" aria-expanded={Boolean(expanded)} onClick={onToggle} className={`kol-tree-row--folio kol-tree-row--folio-shelf flex h-[32px] w-full items-center gap-[8px] rounded-[3px] px-[8px] text-left ${className}`.trim()} {...own}>
|
|
148
|
+
<IconLoader name={expanded ? 'chevron-down' : 'chevron-right'} size={12} />{label}{count != null && <span className="kol-tree-row-count ml-auto">{count}</span>}
|
|
149
|
+
</button>
|
|
150
|
+
)
|
|
151
|
+
const target = Link === 'a' ? { href } : { to: href }
|
|
152
|
+
return <Link {...target} aria-current={active ? 'page' : undefined} className={`kol-tree-row--folio${active ? ' is-active' : ''} block truncate rounded-[3px] py-[6px] pl-[28px] pr-[8px] ${className}`.trim()} {...own}>{label}</Link>
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export default function TreeRow(props) {
|
|
156
|
+
if (props.variant === 'folio') return <TreeRowFolio {...props} />
|
|
157
|
+
return props.variant === 'kolbox' ? <TreeRowKolbox {...props} /> : <TreeRowDefault {...props} />
|
|
158
|
+
}
|
|
@@ -98,7 +98,7 @@ function FileImages({ images, cover, back, editing, onImages, onCover, onBack })
|
|
|
98
98
|
return (
|
|
99
99
|
<figure key={img.id} className="flex min-w-0 flex-col gap-1.5">
|
|
100
100
|
<div className="relative">
|
|
101
|
-
<button type="button" className="block aspect-square w-full overflow-hidden rounded-[var(--kol-radius-
|
|
101
|
+
<button type="button" className="block aspect-square w-full overflow-hidden rounded-[var(--kol-radius-4)] bg-fg-04" onClick={() => setLook(i)} aria-label={`Open ${label}`}>
|
|
102
102
|
<img src={img.src} alt="" className="size-full object-cover" style={{ objectPosition: 'var(--kol-media-focus, center)' }} />
|
|
103
103
|
</button>
|
|
104
104
|
{/* the × in the card's own media-corner chrome (the download's plate), so it reads on a dark picture —
|
|
@@ -124,7 +124,7 @@ function FileImages({ images, cover, back, editing, onImages, onCover, onBack })
|
|
|
124
124
|
{canEdit && (
|
|
125
125
|
<figure className="flex min-w-0 flex-col gap-1.5">
|
|
126
126
|
<button type="button" onClick={add} aria-label="Upload image"
|
|
127
|
-
className="flex aspect-square w-full items-center justify-center rounded-[var(--kol-radius-
|
|
127
|
+
className="flex aspect-square w-full items-center justify-center rounded-[var(--kol-radius-4)] border border-dashed border-[var(--kol-fg-24)] bg-[var(--kol-fg-02)] text-fg-48">
|
|
128
128
|
<IconLoader name="plus" size={20} />
|
|
129
129
|
</button>
|
|
130
130
|
<figcaption className="kol-mono-12 text-meta">Upload image</figcaption>
|
|
@@ -3,8 +3,11 @@ import ColorSwatch from '../molecules/ColorSwatch.jsx'
|
|
|
3
3
|
import Input from '../atoms/Input.jsx'
|
|
4
4
|
import Slider from '../molecules/Slider.jsx'
|
|
5
5
|
import Dropdown from '../molecules/Dropdown.jsx'
|
|
6
|
+
import Button from '../atoms/Button.jsx'
|
|
7
|
+
import TabsRow from '../molecules/TabsRow.jsx'
|
|
8
|
+
import SwatchGrid from '../molecules/SwatchGrid.jsx'
|
|
6
9
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
7
|
-
import { usePopover, PopoverPanel } from '../utilities/Popover.jsx'
|
|
10
|
+
import { usePopover, PopoverPanel, Tooltip } from '../utilities/Popover.jsx'
|
|
8
11
|
import { HueStrip, SBSquare, AlphaStrip } from './SpectrumControls.jsx'
|
|
9
12
|
import { hexToHsva, hsvaToHex } from '../hooks/colorMath.js'
|
|
10
13
|
import { resolveCssColor } from '../hooks/cssVar.js'
|
|
@@ -121,7 +124,7 @@ function cssToHex(css) {
|
|
|
121
124
|
* or `({ close }) => node` so a pick can close the panel (lobby ColorPickerPopoverExtras,
|
|
122
125
|
* kol-fxr 2026-10-31). Inline, it sits last and `close` does nothing
|
|
123
126
|
*/
|
|
124
|
-
|
|
127
|
+
function ColorPickerPopoverDefault({ color, onChange, defaultValue, size = 'xs', label = 'Color', trigger, placement = 'bottom-end', alpha = true, brightness = false, inline = false, hexEnd, modes = false, title, footer, className = '' }) {
|
|
125
128
|
const [mode, setMode] = useState('hex')
|
|
126
129
|
const isNone = !color || color === 'transparent'
|
|
127
130
|
const [open, setOpen] = useState(false)
|
|
@@ -185,7 +188,7 @@ export default function ColorPickerPopover({ color, onChange, defaultValue, size
|
|
|
185
188
|
)
|
|
186
189
|
const strips = hsva && (
|
|
187
190
|
<>
|
|
188
|
-
<div className="rounded-[var(--kol-radius-
|
|
191
|
+
<div className="rounded-[var(--kol-radius-2)] overflow-hidden" style={{ width: inline || modes ? '100%' : PANEL_W, height: inline || modes ? 160 : 140 }}>
|
|
189
192
|
<SBSquare hue={hsva.hue} sat={hsva.sat} val={hsva.val} onChange={(sat, val) => commit({ ...hsva, sat, val })} />
|
|
190
193
|
</div>
|
|
191
194
|
<HueStrip hue={hsva.hue} onChange={(hue) => commit({ ...hsva, hue })} />
|
|
@@ -220,7 +223,7 @@ export default function ColorPickerPopover({ color, onChange, defaultValue, size
|
|
|
220
223
|
{modes && <Dropdown size="sm" value={mode} onChange={setMode} options={PICKER_MODES} ariaLabel={`${label} mode`} />}
|
|
221
224
|
</div>
|
|
222
225
|
{hexField}
|
|
223
|
-
<div className="w-full overflow-hidden rounded-[var(--kol-radius-
|
|
226
|
+
<div className="w-full overflow-hidden rounded-[var(--kol-radius-2)]" style={{ height: 200 }}>
|
|
224
227
|
<SBSquare hue={hsva.hue} sat={hsva.sat} val={hsva.val} onChange={(sat, val) => commit({ ...hsva, sat, val })} />
|
|
225
228
|
</div>
|
|
226
229
|
<HueStrip hue={hsva.hue} onChange={(hue) => commit({ ...hsva, hue })} />
|
|
@@ -269,3 +272,129 @@ export default function ColorPickerPopover({ color, onChange, defaultValue, size
|
|
|
269
272
|
</>
|
|
270
273
|
)
|
|
271
274
|
}
|
|
275
|
+
|
|
276
|
+
/* ── kolbox (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18) ─────────────────────────────────────────────────
|
|
277
|
+
* kolbox's PopoverColor, carried from apps/kolbox/src/ui/PopoverColor.jsx (W13 state 4): beside the rail; tabs Custom
|
|
278
|
+
* and Libraries with the plus; the paint type row; the square with its handle; the eyedropper, hue and opacity; the
|
|
279
|
+
* format dropdown with the hex and the opacity; "On this page" and the page's swatches. It opens at an `anchor` it does
|
|
280
|
+
* not own (PopoverPanel kolbox's words: `anchor`, `open`, `onClose`, `placement`). `color` a hex, `opacity` 0 to 100,
|
|
281
|
+
* `paint`; `swatches` (default: the page's own colors, read from the tokens at run time); onChange({ value, opacity,
|
|
282
|
+
* paint }). */
|
|
283
|
+
|
|
284
|
+
/* the page's own colors, read from the theme's tokens when it opens, so no color is written here */
|
|
285
|
+
const PAGE_TOKENS = ['--kol-surface-primary', '--kol-surface-secondary', '--kol-oq-08', '--kol-oq-16', '--kol-oq-24', '--kol-surface-on-primary', '--kol-oq-64', '--kol-accent-primary', '--ui-info', '--ui-success', '--ui-error', '--color-link']
|
|
286
|
+
const pageColor = (n) => getComputedStyle(document.documentElement).getPropertyValue(n).trim().toUpperCase()
|
|
287
|
+
/* Paint types: Figma's row (guessed in kolbox); Gradient borrows contrast, Pattern ptrn-dot from your icons */
|
|
288
|
+
const PAINTS = [
|
|
289
|
+
{ value: 'Solid', icon: 'square' },
|
|
290
|
+
{ value: 'Gradient', icon: 'contrast' },
|
|
291
|
+
{ value: 'Pattern', icon: 'ptrn-dot' },
|
|
292
|
+
{ value: 'Image', icon: 'image' },
|
|
293
|
+
{ value: 'Video', icon: 'video' },
|
|
294
|
+
]
|
|
295
|
+
const toHsv = (hex) => hexToHsva(hex) ?? { hue: 0, sat: 0, val: 0 }
|
|
296
|
+
|
|
297
|
+
function ColorPickerPopoverKolbox({ anchor, open, onClose, placement, color, opacity: opacityIn = 100, paint: paintIn = 'Solid', swatches, onChange }) {
|
|
298
|
+
const [hsv, setHsv] = useState(() => toHsv(color ?? pageColor('--kol-accent-primary')))
|
|
299
|
+
const [opacity, setOpacity] = useState(opacityIn)
|
|
300
|
+
const [paint, setPaint] = useState(paintIn)
|
|
301
|
+
useEffect(() => setOpacity(opacityIn), [opacityIn])
|
|
302
|
+
useEffect(() => setPaint(paintIn), [paintIn])
|
|
303
|
+
const [tab, setTab] = useState('Custom')
|
|
304
|
+
const [format, setFormat] = useState('Hex')
|
|
305
|
+
const hex = hsvaToHex({ ...hsv, alpha: 1 })
|
|
306
|
+
useEffect(() => { if (color && color.toUpperCase() !== hsvaToHex({ ...hsv, alpha: 1 })) setHsv(toHsv(color)) }, [color]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
307
|
+
const colors = swatches ?? PAGE_TOKENS.map(pageColor)
|
|
308
|
+
|
|
309
|
+
const set = (next = hsv, o = opacity, p = paint) => { setHsv(next); setOpacity(o); setPaint(p); onChange?.({ value: hsvaToHex({ ...next, alpha: 1 }), opacity: o, paint: p }) }
|
|
310
|
+
const eyedrop = async () => {
|
|
311
|
+
if (!window.EyeDropper) return
|
|
312
|
+
try { const { sRGBHex } = await new window.EyeDropper().open(); set(toHsv(sRGBHex)) } catch { /* cancelled */ }
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return (
|
|
316
|
+
<PopoverPanel variant="kolbox"
|
|
317
|
+
anchor={anchor}
|
|
318
|
+
open={open}
|
|
319
|
+
onClose={onClose}
|
|
320
|
+
placement={placement}
|
|
321
|
+
aria-label="Color"
|
|
322
|
+
leading={<TabsRow variant="kolbox" tabs={['Custom', 'Libraries']} value={tab} onChange={setTab} className="mr-auto" />}
|
|
323
|
+
actions={<Tooltip variant="kolbox" label="No styles yet"><Button variant="kolbox" iconOnly="plus" aria-label="Add style" disabled /></Tooltip>}
|
|
324
|
+
>
|
|
325
|
+
<div className="flex flex-col gap-3 px-4 pb-4">
|
|
326
|
+
<div className="flex gap-1">
|
|
327
|
+
{PAINTS.map((p) => (
|
|
328
|
+
<Button variant="kolbox" key={p.value} iconOnly={p.icon} aria-label={p.value} pressed={p.value === paint} onClick={() => set(hsv, opacity, p.value)} />
|
|
329
|
+
))}
|
|
330
|
+
</div>
|
|
331
|
+
<SBSquare variant="kolbox" hue={hsv.hue} sat={hsv.sat} val={hsv.val} onChange={(sat, val) => set({ ...hsv, sat, val })} className="rounded-sm" />
|
|
332
|
+
<div className="flex items-center gap-2">
|
|
333
|
+
<Button variant="kolbox" iconOnly="eyedropper" aria-label="Eyedropper" onClick={eyedrop} />
|
|
334
|
+
<div className="flex flex-1 flex-col gap-2">
|
|
335
|
+
<HueStrip variant="kolbox" hue={hsv.hue} onChange={(h) => set({ ...hsv, hue: h })} />
|
|
336
|
+
<AlphaStrip variant="kolbox" alpha={opacity / 100} color={hex} onChange={(a) => set(hsv, Math.round(a * 100))} />
|
|
337
|
+
</div>
|
|
338
|
+
</div>
|
|
339
|
+
<div className="flex gap-1">
|
|
340
|
+
<Dropdown variant="kolbox" value={format} onChange={setFormat} options={['Hex', 'RGB', 'HSL', 'HSB']} className="w-16 shrink-0" />
|
|
341
|
+
<Input variant="kolbox"
|
|
342
|
+
key={hex}
|
|
343
|
+
aria-label="Hex"
|
|
344
|
+
defaultValue={hex.slice(1)}
|
|
345
|
+
onBlur={(e) => /^[0-9a-f]{6}$/i.test(e.target.value) && set(toHsv(e.target.value))}
|
|
346
|
+
onKeyDown={(e) => e.key === 'Enter' && e.currentTarget.blur()}
|
|
347
|
+
className="flex-1"
|
|
348
|
+
/>
|
|
349
|
+
<Input variant="kolbox"
|
|
350
|
+
key={`o${opacity}`}
|
|
351
|
+
aria-label="Opacity"
|
|
352
|
+
defaultValue={`${opacity}%`}
|
|
353
|
+
onBlur={(e) => { const o = parseInt(e.target.value, 10); if (o >= 0 && o <= 100) set(hsv, o) }}
|
|
354
|
+
onKeyDown={(e) => e.key === 'Enter' && e.currentTarget.blur()}
|
|
355
|
+
className="w-16 shrink-0"
|
|
356
|
+
/>
|
|
357
|
+
</div>
|
|
358
|
+
</div>
|
|
359
|
+
<div role="separator" className="kol-color-popover-rule--kolbox h-px shrink-0" />
|
|
360
|
+
<div className="flex flex-col gap-3 px-4 py-3">
|
|
361
|
+
<Dropdown variant="kolbox" value="On this page" options={['On this page']} className="w-full" />
|
|
362
|
+
<SwatchGrid colors={colors} value={hex} onChange={(c) => set(toHsv(c))} />
|
|
363
|
+
</div>
|
|
364
|
+
</PopoverPanel>
|
|
365
|
+
)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/* ── folio (Folio batch C, 2026-11-22): Folio's SwatchMenu, carried class for class. The 24 swatch (ColorSwatch folio)
|
|
369
|
+
* opens, 6 under it, a panel padded 8 of the `swatches` ([name, hex]) as a row (SwatchGrid folio); a pick closes it.
|
|
370
|
+
* Folio picks from a set: no spectrum. Esc or a press outside closes. It renders in place, never in a portal, so it keeps
|
|
371
|
+
* the frame's `data-folio-*`. `color` the current hex, `onChange(hex)`, `label` names the swatch and the panel. Chrome
|
|
372
|
+
* in kol-theme `.kol-color-picker--folio`. ── */
|
|
373
|
+
function ColorPickerPopoverFolio({ color, swatches = [], onChange, label }) {
|
|
374
|
+
const [open, setOpen] = useState(false)
|
|
375
|
+
const box = useRef(null)
|
|
376
|
+
useEffect(() => {
|
|
377
|
+
if (!open) return
|
|
378
|
+
const off = (e) => { if (!box.current?.contains(e.target)) setOpen(false) }
|
|
379
|
+
const esc = (e) => e.key === 'Escape' && setOpen(false)
|
|
380
|
+
addEventListener('mousedown', off); addEventListener('keydown', esc)
|
|
381
|
+
return () => { removeEventListener('mousedown', off); removeEventListener('keydown', esc) }
|
|
382
|
+
}, [open])
|
|
383
|
+
return (
|
|
384
|
+
<span ref={box} className="kol-color-picker--folio relative inline-flex">
|
|
385
|
+
<ColorSwatch variant="folio" hex={color} aria-label={`${label} ${color}`} aria-pressed={undefined} aria-haspopup="dialog" aria-expanded={open} onClick={() => setOpen(!open)} />
|
|
386
|
+
{open && (
|
|
387
|
+
<span role="dialog" aria-label={label} className="kol-color-picker-panel absolute left-0 top-[calc(100%+6px)] z-50 flex rounded-[4px] border p-[8px]">
|
|
388
|
+
<SwatchGrid variant="folio" aria-label={label}>
|
|
389
|
+
{swatches.map(([name, hex]) => <ColorSwatch variant="folio" key={name} hex={hex} title={`${name} ${hex}`} aria-label={`${name} ${hex}`} selected={color === hex} onClick={() => { setOpen(false); onChange?.(hex) }} />)}
|
|
390
|
+
</SwatchGrid>
|
|
391
|
+
</span>
|
|
392
|
+
)}
|
|
393
|
+
</span>
|
|
394
|
+
)
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export default function ColorPickerPopover(props) {
|
|
398
|
+
if (props.variant === 'folio') return <ColorPickerPopoverFolio {...props} />
|
|
399
|
+
return props.variant === 'kolbox' ? <ColorPickerPopoverKolbox {...props} /> : <ColorPickerPopoverDefault {...props} />
|
|
400
|
+
}
|
|
@@ -208,7 +208,7 @@ const COL_ICON = { image: 'image', video: 'video', audio: 'file', playlist: 'vid
|
|
|
208
208
|
* files?"). `muted` stays a prop for other callers; the file rows no longer pass it.
|
|
209
209
|
* NO ROW DIVIDERS (BrowsePageRulingsAndSeams, kol-r2b2 2026-09-02): the `border-b last:border-b-0
|
|
210
210
|
* only:border-b` utilities and their inline `borderColor` are gone. The row is a PILL now — a
|
|
211
|
-
* constant 4px inset on every row so selecting never shifts the layout, radius-
|
|
211
|
+
* constant 4px inset on every row so selecting never shifts the layout, radius-4 on the fill —
|
|
212
212
|
* and a hairline under a rounded pill draws the box the pill is trying not to be. The shape lives
|
|
213
213
|
* in kol-components-molecules.css with the fill, not as utilities racing it (ARCHITECTURE §5);
|
|
214
214
|
* this supersedes the `only:` hairline half of the 08-28 corrections, by the same repo's ruling.
|