@kolkrabbi/kol-component 0.377.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 +5 -4
- 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/Header.jsx +8 -4
- package/src/molecules/LabeledControl.jsx +51 -0
- package/src/molecules/Menu.jsx +239 -3
- package/src/molecules/Modal.jsx +216 -10
- package/src/molecules/ModalShell.jsx +21 -8
- package/src/molecules/OptionRow.jsx +1 -1
- package/src/molecules/ParamBindDot.jsx +29 -2
- package/src/molecules/QuantityInput.jsx +48 -0
- package/src/molecules/RailFloat.jsx +4 -3
- 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 +64 -6
- 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
|
@@ -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.
|