@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
|
@@ -34,8 +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'|'
|
|
38
|
-
* style's capsules — float heights (28/36/44, touch 36/44/52), 4 apart, the selected one oq-16
|
|
37
|
+
* @param {'underline'|'chip'|'text'|'stacked'|'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.
|
|
39
38
|
* @param {string} [look] @deprecated 2026-10-30 — the old spelling of `variant`; `variant` wins when both are passed
|
|
40
39
|
* @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)
|
|
41
40
|
* @param {boolean} [filled=false] - `chip` only: every chip shows at rest (Button `tab-filled`), so the row reads as choices
|
|
@@ -79,21 +78,45 @@ import { floatSurfaceClass } from '../utilities/tone.js'
|
|
|
79
78
|
* (FloatFoldBothSidesGrey, kol-fxr 2026-11-03)
|
|
80
79
|
* @param {'ground'|'handle'} [foldTone='ground'] the edge tab's look: `ground` is the pill's own; `handle` is the grey edge
|
|
81
80
|
* handle (iOS's), `--kol-oq-24` with an `--kol-oq-96` chevron, whatever the pill's `surface`
|
|
82
|
-
*
|
|
83
|
-
* 48:4586), `variant="float"` only:
|
|
84
|
-
* @param {'xs'|'sm'|'md'|'lg'} [size] `xs` — the inspector's chip tabs: 26 capsules in `kol-float-label`, 10 in, the
|
|
85
|
-
* selected one fg-16 (row 67); sm · md · lg are the float button heights
|
|
86
|
-
* @param {'mono'} [type] `mono` — text tabs: mono labels (`kol-float-timecode`) at the sm height on the list radius, the
|
|
87
|
-
* selected one FILLED fg-16, the rest fg-48 (row 137 — the underline's rule replaced by the fill)
|
|
88
|
-
* A float tab takes `icon` (before the label, oq) and `count` (after it, mono, fg-64) — `Tasks 5` (row 78).
|
|
89
|
-
* @param {'solid'|'glass-dark'|'glass-light'} [surface] on `float`: the row sits in its own capsule — the float material,
|
|
90
|
-
* 6 in, so `size="lg"` tabs make the 56 pill (row 78). Unset, the row is bare as before
|
|
91
|
-
* @param {ReactNode} [trailing] inside the pill, after the tabs: the float capsule's (with `surface`) or the stacked
|
|
81
|
+
* @param {ReactNode} [trailing] inside the pill, after the tabs: the stacked
|
|
92
82
|
* phone pill's — AppFloatNav's transport puts its Timecode here. With `trailing` the phone pill anchors its LEFT
|
|
93
83
|
* edge where a centred pill without it would start, so every slot stays where it was; it grows to the right
|
|
94
84
|
* Tabs are `{ id, label }` or `{ value, label }` (either key), plus `icon` for stacked; a stacked tab's `selected`
|
|
95
85
|
* lights it whatever `value` is — action slots (the transport) light more than one.
|
|
96
86
|
*/
|
|
87
|
+
/* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's Tabs carried class for class,
|
|
88
|
+
* 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,
|
|
89
|
+
* 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
|
|
90
|
+
* 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
|
|
91
|
+
* rest oq-64, the ink on hover. Tabs are strings or `{ value, label, disabled, tooltip }`: a disabled tab is 40%, takes
|
|
92
|
+
* 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
|
|
93
|
+
* equally and the padding gives way. */
|
|
94
|
+
function TabsKolbox({ tabs = [], value, onChange, size = 'sm', className = '' }) {
|
|
95
|
+
const md = size === 'md'
|
|
96
|
+
return (
|
|
97
|
+
<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}`}>
|
|
98
|
+
{tabs.map((t) => {
|
|
99
|
+
const { value: v, label, disabled, tooltip } = typeof t === 'string' ? { value: t, label: t } : t
|
|
100
|
+
const on = v === value
|
|
101
|
+
const tab = (
|
|
102
|
+
<button
|
|
103
|
+
key={v}
|
|
104
|
+
type="button"
|
|
105
|
+
role="tab"
|
|
106
|
+
aria-selected={on}
|
|
107
|
+
disabled={disabled}
|
|
108
|
+
onClick={() => onChange?.(v)}
|
|
109
|
+
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`}
|
|
110
|
+
>
|
|
111
|
+
{label}
|
|
112
|
+
</button>
|
|
113
|
+
)
|
|
114
|
+
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
|
|
115
|
+
})}
|
|
116
|
+
</div>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
97
120
|
export const TABBAR_H = 56
|
|
98
121
|
/* 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
122
|
export const TABBAR_PILL_H = 66
|
|
@@ -119,23 +142,10 @@ export const tabbarPillSlot = (at, { count, labels = false, split = false } = {}
|
|
|
119
142
|
const COLLAPSE_MS = 300
|
|
120
143
|
|
|
121
144
|
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 }) {
|
|
145
|
+
if (variant === 'kolbox') return <TabsKolbox tabs={raw} value={value} onChange={onChange} size={size} className={className} />
|
|
122
146
|
const tabs = raw.map((t) => ({ ...t, id: t.id ?? t.value }))
|
|
123
147
|
const look = variant ?? lookLegacy ?? 'underline'
|
|
124
148
|
const wrap = overflow === 'wrap'
|
|
125
|
-
/* `float` (W16, round 3): the chip row as capsules — float heights, pills 4 apart, the selected one oq-16 */
|
|
126
|
-
if (look === 'float') {
|
|
127
|
-
const row = <ChipTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 'md'} float floatType={type} ariaLabel={ariaLabel} className={`${wrap ? 'flex-wrap ' : ''}${surface ? '' : className ?? ''}`} />
|
|
128
|
-
/* the capsule (row 78): the float material, 6 in, the tabs then the trailing slot */
|
|
129
|
-
if (surface) {
|
|
130
|
-
return (
|
|
131
|
-
<div className={`inline-flex max-w-full items-center gap-1 rounded-full p-1.5 ${floatSurfaceClass(surface)} ${className ?? ''}`.trim()}>
|
|
132
|
-
<Overflow mode={overflow} value={value}>{row}</Overflow>
|
|
133
|
-
{trailing && <div className="flex shrink-0 items-center gap-1">{trailing}</div>}
|
|
134
|
-
</div>
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
return <Overflow mode={overflow} value={value}>{row}</Overflow>
|
|
138
|
-
}
|
|
139
149
|
if (look === 'chip') return <Overflow mode={overflow} value={value}><ChipTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 'sm'} filled={filled} ariaLabel={ariaLabel} className={`${wrap ? 'flex-wrap ' : ''}${className ?? ''}`} /></Overflow>
|
|
140
150
|
if (look === 'text') return <Overflow mode={overflow} value={value}><TextTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 14} tracked={tracked} className={`${wrap ? 'flex-wrap gap-y-2 ' : ''}${className ?? 'gap-6'}`} style={style} /></Overflow>
|
|
141
151
|
if (look === 'stacked') return <StackedTabs trailing={trailing} tabs={tabs} value={value} onChange={onChange} placement={placement} shape={shape} collapsed={collapsed} onExpand={onExpand} edge={edge} border={border} shadow={shadow} dock={dock} active={active} foldable={foldable} folded={folded} onFoldChange={onFoldChange} foldSide={foldSide} foldTone={foldTone} surface={surface} split={split} labels={labels} ariaLabel={ariaLabel} className={className ?? ''} />
|
|
@@ -162,34 +172,14 @@ function Overflow({ mode, value, children }) {
|
|
|
162
172
|
}
|
|
163
173
|
|
|
164
174
|
/* chip — TabChips verbatim */
|
|
165
|
-
function ChipTabs({ tabs, value, onChange, size, filled,
|
|
166
|
-
/* the float's two plain rows — the inspector's 26 chips (xs) and the mono text tabs — are drawn here, not by Button:
|
|
167
|
-
* neither is a Button rung (26 is not a float height; a mono label is not the float button's type) */
|
|
168
|
-
const plain = float && (size === 'xs' || floatType === 'mono')
|
|
175
|
+
function ChipTabs({ tabs, value, onChange, size, filled, ariaLabel, className }) {
|
|
169
176
|
return (
|
|
170
|
-
<div className={`flex items-center ${filled ? 'gap-2' : 'gap-1'}
|
|
177
|
+
<div className={`flex items-center ${filled ? 'gap-2' : 'gap-1'} ${className}`.trim()} role="tablist" aria-label={ariaLabel}>
|
|
171
178
|
{tabs.map((t) => {
|
|
172
179
|
const active = t.id === value
|
|
173
|
-
if (plain) {
|
|
174
|
-
const mono = floatType === 'mono'
|
|
175
|
-
return (
|
|
176
|
-
<button key={t.id} type="button" role="tab" aria-selected={active} data-active={active || undefined} onClick={() => onChange?.(t.id)}
|
|
177
|
-
className={`inline-flex shrink-0 items-center whitespace-nowrap cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] ${mono ? 'kol-float-timecode h-[var(--kol-float-h-sm)] rounded-[var(--kol-float-list-r)] px-3' : 'kol-float-label h-[26px] rounded-full px-2.5'} ${active ? 'bg-fg-16 text-fg-emphasis' : `${mono ? 'text-fg-48' : 'text-fg-64'} hover:bg-fg-08 hover:text-fg-emphasis`}`}>
|
|
178
|
-
{t.label}
|
|
179
|
-
</button>
|
|
180
|
-
)
|
|
181
|
-
}
|
|
182
|
-
if (float && (t.icon || t.count != null)) {
|
|
183
|
-
return (
|
|
184
|
-
<Button key={t.id} variant="float" size={size} iconLeft={t.icon} pressed={active} role="tab" aria-selected={active} aria-pressed={undefined} data-active={active || undefined} onClick={() => onChange?.(t.id)}>
|
|
185
|
-
{t.label}
|
|
186
|
-
{t.count != null && <span className="kol-float-ruler ml-0.5 tabular-nums text-fg-64">{t.count}</span>}
|
|
187
|
-
</Button>
|
|
188
|
-
)
|
|
189
|
-
}
|
|
190
180
|
return (
|
|
191
181
|
/* a tab is selected, not pressed — the role's own attribute replaces Button's aria-pressed */
|
|
192
|
-
<Button key={t.id} variant={
|
|
182
|
+
<Button key={t.id} variant={filled ? 'tab-filled' : 'tab'} size={size} pressed={active} role="tab" aria-selected={active} aria-pressed={undefined} data-active={active || undefined} onClick={() => onChange?.(t.id)}>
|
|
193
183
|
{t.label}
|
|
194
184
|
</Button>
|
|
195
185
|
)
|
|
@@ -280,7 +270,7 @@ function StackedTabs({ trailing, tabs, value, onChange, placement, shape = 'bar'
|
|
|
280
270
|
const slotW = labels ? TABBAR_PILL_LABEL_TAB : TABBAR_PILL_TAB
|
|
281
271
|
const slotH = labels ? 58 : TABBAR_PILL_TAB
|
|
282
272
|
const ink = (on) => (phone ? (on ? RAIL_ROW.active : RAIL_ROW.rest) : (on ? 'var(--kol-fg-default)' : 'var(--kol-fg-48)'))
|
|
283
|
-
const tip = (t, el) => <Tooltip key={t.id} label={t.label} placement={top ? 'bottom' : 'top'} offset={10}
|
|
273
|
+
const tip = (t, el) => <Tooltip key={t.id} label={t.label} placement={top ? 'bottom' : 'top'} offset={10} asChild>{el}</Tooltip>
|
|
284
274
|
const slot = (t) => {
|
|
285
275
|
const active = t.selected ?? t.id === value
|
|
286
276
|
if (pill) {
|
|
@@ -9,7 +9,7 @@ import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
|
|
|
9
9
|
* ink (fg-48 and struck once done), and the date as a chip at the right: a capsule on the well (`--kol-float-well`,
|
|
10
10
|
* the field's ground) at the float md height, the calendar glyph on oq-64, the date in `kol-float-timecode`. `onDate`
|
|
11
11
|
* makes the chip a button (open your date picker there); without it the chip is a label. Lists end in an
|
|
12
|
-
* `InlineAddRow
|
|
12
|
+
* `InlineAddRow` — the panel's `+ New brief`.
|
|
13
13
|
*
|
|
14
14
|
* @param {ReactNode} title
|
|
15
15
|
* @param {string} [date]
|
|
@@ -22,7 +22,7 @@ export default function TaskRow({ title, date, done = false, onDone, onDate, onC
|
|
|
22
22
|
const Chip = onDate ? 'button' : 'span'
|
|
23
23
|
return (
|
|
24
24
|
<div className={`flex min-h-[var(--kol-float-h-md)] w-full items-center gap-3 ${className}`.trim()}>
|
|
25
|
-
<ToggleCheckbox
|
|
25
|
+
<ToggleCheckbox checked={done} onChange={onDone} aria-label="Done" className="shrink-0" />
|
|
26
26
|
<span
|
|
27
27
|
onClick={onClick}
|
|
28
28
|
className={`kol-float-body-lg min-w-0 flex-1 truncate ${onClick ? 'cursor-pointer' : ''} ${done ? 'text-fg-48 line-through' : 'text-fg-emphasis'}`.trim()}
|
|
@@ -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
|
+
}
|
package/src/molecules/TocRow.jsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* kol-float--style 48:3582). 32 tall on the list radius, 12 in: the number in mono (`kol-float-ruler`, fg-64, two
|
|
4
4
|
* digits), 16 off it the title in `kol-float-hint`. `current` is where the reader is: the row lifts to fg-16 and the
|
|
5
5
|
* title takes the emphasis ink (`aria-current="location"`); the rest sit at fg-64 and brighten under the pointer.
|
|
6
|
-
* `DocsToc
|
|
6
|
+
* `DocsToc` draws its list from these.
|
|
7
7
|
*
|
|
8
8
|
* @param {number|string} [number] padded to two digits when a number
|
|
9
9
|
* @param {ReactNode} label
|
|
@@ -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
|
+
}
|
|
@@ -4,18 +4,15 @@ import Dropdown from './Dropdown.jsx'
|
|
|
4
4
|
* WorkspaceSwitcher — Which workspace you are in. `Personal / Kolkrabbi ⌄` (float-everything W4 row 58, 2026-11-04 —
|
|
5
5
|
* the exploration's workspace selector at the top of a rail). A `Dropdown` of the workspaces — a button, no label of
|
|
6
6
|
* its own (plan-2026-11-07-menu-system W1.2): the caller names it with `LabeledControl`
|
|
7
|
-
* (`<LabeledControl label="Workspace"
|
|
8
|
-
* the float select on the well, the default the sm dropdown. A workspace is `{ value, label, icon? }`; a nested one
|
|
7
|
+
* (`<LabeledControl label="Workspace"><WorkspaceSwitcher … /></LabeledControl>`). A workspace is `{ value, label, icon? }`; a nested one
|
|
9
8
|
* reads `Studio / Personal` in its label.
|
|
10
9
|
*
|
|
11
10
|
* @param {string} [label] what it chooses, for a screen reader — default `Workspace`
|
|
12
11
|
* @param {Array} workspaces Dropdown options
|
|
13
12
|
* @param {string} value
|
|
14
13
|
* @param {Function} onChange `(value) => void`
|
|
15
|
-
* @param {'float'} [variant]
|
|
16
14
|
* @param {string} [className]
|
|
17
15
|
*/
|
|
18
|
-
export default function WorkspaceSwitcher({ label = 'Workspace', workspaces = [], value, onChange,
|
|
19
|
-
|
|
20
|
-
return <Dropdown variant={float ? 'float' : undefined} size={float ? 'md' : undefined} options={workspaces} value={value} onChange={onChange} ariaLabel={label} className={className} />
|
|
16
|
+
export default function WorkspaceSwitcher({ label = 'Workspace', workspaces = [], value, onChange, className = '' }) {
|
|
17
|
+
return <Dropdown options={workspaces} value={value} onChange={onChange} ariaLabel={label} className={className} />
|
|
21
18
|
}
|
|
@@ -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.
|