@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
|
@@ -3,6 +3,9 @@ import ContentMedia from './ContentMedia.jsx'
|
|
|
3
3
|
import ContentText from './ContentText.jsx'
|
|
4
4
|
import { useAppItem } from './AppItem.jsx'
|
|
5
5
|
import { toneClass } from '../utilities/tone.js'
|
|
6
|
+
import Button from '../atoms/Button.jsx'
|
|
7
|
+
import { Tooltip } from '../utilities/Popover.jsx'
|
|
8
|
+
import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* ContentCard — the card form of the content-card system. Variants differ in
|
|
@@ -179,7 +182,7 @@ const MEDIA = {
|
|
|
179
182
|
const ALIAS = { default: 'file', print: 'catalog', work: 'showcase', typeface: 'showcaseCanvas' }
|
|
180
183
|
const LAYOUT_KEY = { canvas: 'showcaseCanvas', drawer: 'showcase' }
|
|
181
184
|
|
|
182
|
-
|
|
185
|
+
function ContentCardDefault({
|
|
183
186
|
variant: variantProp = 'file',
|
|
184
187
|
layout,
|
|
185
188
|
hero = false,
|
|
@@ -543,7 +546,7 @@ export default function ContentCard({
|
|
|
543
546
|
'data-back': backMode && backMode !== 'flip-card' ? backMode : undefined,
|
|
544
547
|
'data-back-hover': backMode && backMode !== 'flip-card' && backHover ? '' : undefined,
|
|
545
548
|
'data-flipped': backMode && backMode !== 'flip-card' && flipped ? '' : undefined,
|
|
546
|
-
className: `kol-card group flex ${toneClass(tone)} ${box.layout === 'canvas' && reveal != null ? 'has-reveal' : ''} ${expanded ? 'flex-col md:flex-row-reverse' : 'flex-col'} ${box.layout === 'drawer' ? 'relative overflow-hidden rounded-[var(--kol-radius-
|
|
549
|
+
className: `kol-card group flex ${toneClass(tone)} ${box.layout === 'canvas' && reveal != null ? 'has-reveal' : ''} ${expanded ? 'flex-col md:flex-row-reverse' : 'flex-col'} ${box.layout === 'drawer' ? 'relative overflow-hidden rounded-[var(--kol-radius-4)]' : ''} ${framed ? 'overflow-hidden rounded-[var(--kol-radius-4)]' : ''} ${box.border ? 'border' : ''} ${box.layout === 'canvas' ? 'relative' : ''} ${interactive ? 'cursor-pointer select-none' : ''} ${hoverBg && interactive ? 'kol-content-hover' : ''} ${interactive && box.frameHover ? 'kol-content-hover-frame' : ''} ${className}`.trim(),
|
|
547
550
|
style: {
|
|
548
551
|
/* same reason as ContentRow: rest colors are PROPERTIES, because an
|
|
549
552
|
* inline background/borderColor outranks the hover class and the step
|
|
@@ -568,7 +571,7 @@ export default function ContentCard({
|
|
|
568
571
|
<div className="kol-card-turn" data-back="flip-card" data-back-hover={backHover ? '' : undefined} data-flipped={flipped ? '' : undefined} style={{ gridColumn: common.style.gridColumn, gridRow: common.style.gridRow }}>
|
|
569
572
|
<div className="kol-card-turn-inner">
|
|
570
573
|
<div className="kol-card-face kol-card-face--front">{root}</div>
|
|
571
|
-
<div className="kol-card-face kol-card-face--back overflow-hidden rounded-[var(--kol-radius-
|
|
574
|
+
<div className="kol-card-face kol-card-face--back overflow-hidden rounded-[var(--kol-radius-4)] bg-surface-secondary" aria-hidden={!flipped || undefined}>
|
|
572
575
|
<ContentMedia ratio={null} radius={false} fit="cover">{backNode}</ContentMedia>
|
|
573
576
|
</div>
|
|
574
577
|
</div>
|
|
@@ -604,3 +607,101 @@ export default function ContentCard({
|
|
|
604
607
|
}
|
|
605
608
|
return turn(<article {...common}>{turned}</article>)
|
|
606
609
|
}
|
|
610
|
+
|
|
611
|
+
/* ── kolbox (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18) ─────────────────────────────────────────────────
|
|
612
|
+
* kolbox's FileCard (Figma `FileCard`; round 4 W13, his card law), carried from apps/kolbox/src/home/FileCard.jsx; its
|
|
613
|
+
* geometry is Figma's file browser card, measured (plan-2026-11-23 W6): the cover 16:9 (167 on Figma's 297 card; the
|
|
614
|
+
* file's thumbnail whole, fitted and centred on oq-08), the 24 mark and buttons 16 in from the cover's corners, the foot
|
|
615
|
+
* 59 with 12 / 16 padding: the file glyph, the name and the meta line 2 under it. Opens on a double click or Enter. kolbox's words, which the
|
|
616
|
+
* default card has no twin for: `file` { id, name, thumb, modified, size, mark: { icon, label } }, `onOpen(file)`,
|
|
617
|
+
* `onDownload(file)` (the download beside the star), `onSettings(file)` (the cog), `onRemove(file)` (the trash under
|
|
618
|
+
* it), `onStar(file)` (the star, lit while `file.starred`), `onMenu(file, event)` (right click); each part drawn only when
|
|
619
|
+
* given. `file.icon` names the foot's glyph (default `file`; a folder card passes `folder`).
|
|
620
|
+
* Folio on kolbox (2026-11-22): `media`, a node drawn centred in the cover in place of `file.thumb` (Folio's generated
|
|
621
|
+
* jacket); `meta`, a node in place of the foot's second line (Folio's call number, shelf and flags). Unset, the card
|
|
622
|
+
* draws as before. */
|
|
623
|
+
|
|
624
|
+
/* "2 hours ago" from a stored time, in the browser's own words; the ISO day */
|
|
625
|
+
const RTF_KOLBOX = new Intl.RelativeTimeFormat('en', { numeric: 'always' })
|
|
626
|
+
const STEPS_KOLBOX = [['year', 31536e6], ['month', 2592e6], ['week', 6048e5], ['day', 864e5], ['hour', 36e5], ['minute', 6e4], ['second', 1e3]]
|
|
627
|
+
export const fileAgo = (t) => {
|
|
628
|
+
if (!t) return ''
|
|
629
|
+
const d = t - Date.now()
|
|
630
|
+
const [unit, ms] = STEPS_KOLBOX.find(([, s]) => Math.abs(d) >= s) ?? STEPS_KOLBOX[STEPS_KOLBOX.length - 1]
|
|
631
|
+
return RTF_KOLBOX.format(Math.round(d / ms), unit)
|
|
632
|
+
}
|
|
633
|
+
export const fileDay = (t) => (t ? new Date(t).toISOString().slice(0, 10) : '')
|
|
634
|
+
|
|
635
|
+
function ContentCardKolbox({ file, media, meta, onOpen, onDownload, onStar, onSettings, onRemove, onMenu }) {
|
|
636
|
+
const stop = (fn) => (e) => { e.stopPropagation(); fn(file, e) }
|
|
637
|
+
return (
|
|
638
|
+
<div
|
|
639
|
+
role="listitem"
|
|
640
|
+
tabIndex={0}
|
|
641
|
+
aria-label={file.name}
|
|
642
|
+
onDoubleClick={() => onOpen?.(file)}
|
|
643
|
+
onKeyDown={(e) => { if (e.key === 'Enter' && e.target === e.currentTarget) onOpen?.(file) }}
|
|
644
|
+
onContextMenu={onMenu ? (e) => { e.preventDefault(); onMenu(file, e) } : undefined}
|
|
645
|
+
className="kol-content-card--kolbox flex cursor-default flex-col overflow-hidden border outline-none"
|
|
646
|
+
data-file-card={file.id}
|
|
647
|
+
>
|
|
648
|
+
<div className="kol-content-card-cover relative aspect-video min-h-0 shrink-0" data-file-cover>
|
|
649
|
+
{media != null ? <div className="flex size-full items-center justify-center">{media}</div> : file.thumb && <img src={file.thumb} alt="" className="size-full object-contain" />}
|
|
650
|
+
{file.mark && (
|
|
651
|
+
<span className="absolute top-4 left-4">
|
|
652
|
+
<Tooltip variant="kolbox" label={file.mark.label}>
|
|
653
|
+
<span role="img" aria-label={file.mark.label} className="kol-content-card-mark kol-content-card-on-panel flex size-6 items-center justify-center" data-file-mark>
|
|
654
|
+
<KolboxGlyph name={file.mark.icon} />
|
|
655
|
+
</span>
|
|
656
|
+
</Tooltip>
|
|
657
|
+
</span>
|
|
658
|
+
)}
|
|
659
|
+
<span className="absolute top-4 right-4 flex gap-1">
|
|
660
|
+
{onDownload && <Tooltip variant="kolbox" label="Download"><Button variant="kolbox" iconOnly="download" aria-label="Download" onClick={stop(onDownload)} onDoubleClick={(e) => e.stopPropagation()} className="kol-content-card-on-panel size-6!" /></Tooltip>}
|
|
661
|
+
{onStar && <Tooltip variant="kolbox" label={file.starred ? 'Unstar' : 'Star'}><Button variant="kolbox" iconOnly="star" aria-label="Star" pressed={!!file.starred} onClick={stop(onStar)} onDoubleClick={(e) => e.stopPropagation()} className="kol-content-card-on-panel size-6!" /></Tooltip>}
|
|
662
|
+
</span>
|
|
663
|
+
</div>
|
|
664
|
+
<div className="kol-content-card-foot flex h-[59px] shrink-0 items-center gap-3 border-t px-4 py-3">
|
|
665
|
+
<KolboxGlyph name={file.icon ?? 'file'} className="kol-content-card-icon" />
|
|
666
|
+
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
667
|
+
<span className="kol-content-card-name truncate">{file.name}</span>
|
|
668
|
+
{meta != null
|
|
669
|
+
? <span className="kol-content-card-meta flex items-center gap-3 truncate" data-file-meta>{meta}</span>
|
|
670
|
+
: file.size != null
|
|
671
|
+
? <span className="kol-content-card-meta flex gap-3 truncate" data-file-meta><span>{fileDay(file.modified)}</span><span>{file.size}</span></span>
|
|
672
|
+
: <span className="kol-content-card-edited truncate">Edited {fileAgo(file.modified)}</span>}
|
|
673
|
+
</div>
|
|
674
|
+
{(onSettings || onRemove) && (
|
|
675
|
+
<span className="-mr-2 flex shrink-0 flex-col" onDoubleClick={(e) => e.stopPropagation()}>
|
|
676
|
+
{onSettings && <Tooltip variant="kolbox" label="Settings"><Button variant="kolbox" iconOnly="settings-01" aria-label="Settings" onClick={stop(onSettings)} className="size-6!" /></Tooltip>}
|
|
677
|
+
{onRemove && <Tooltip variant="kolbox" label="Delete"><Button variant="kolbox" iconOnly="trash" aria-label="Delete" onClick={stop(onRemove)} className="size-6!" /></Tooltip>}
|
|
678
|
+
</span>
|
|
679
|
+
)}
|
|
680
|
+
</div>
|
|
681
|
+
</div>
|
|
682
|
+
)
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/* ── folio (Folio batch E, 2026-11-22) ─────────────────────────────────────────────────────────────────────────────
|
|
686
|
+
* Folio's cover card, carried from apps/folio's FolioShelf ("Fresh on your shelf"): the `media` (Folio's generated
|
|
687
|
+
* jacket, a node the caller draws at the card's width) over three lines 6 apart, 12 under the cover: the `title` in
|
|
688
|
+
* Folio's shelf type, two lines held open and underlined on hover, the `meta` (chapters or call number) and the `label`
|
|
689
|
+
* (the shelf, with its language flags) in Folio's meta type, muted. The whole card is one link: `href`, drawn by
|
|
690
|
+
* `linkComponent` (a router's Link; default `a`); `style` carries the caller's width cap. */
|
|
691
|
+
function ContentCardFolio({ media, title, meta, label, href, linkComponent: L = 'a', style, className = '' }) {
|
|
692
|
+
return (
|
|
693
|
+
<L {...(L === 'a' ? { href } : { to: href })} className={`kol-content-card--folio group flex min-w-0 flex-1 flex-col gap-[12px] ${className}`.trim()} style={style}>
|
|
694
|
+
{media}
|
|
695
|
+
<span className="flex flex-col gap-[6px]">
|
|
696
|
+
<span className="kol-folio-shelf line-clamp-2 min-h-[38px] group-hover:underline">{title}</span>
|
|
697
|
+
{meta != null && <span className="kol-folio-meta kol-content-card-muted">{meta}</span>}
|
|
698
|
+
{label != null && <span className="kol-folio-meta-sm kol-content-card-muted flex items-center gap-[6px]">{label}</span>}
|
|
699
|
+
</span>
|
|
700
|
+
</L>
|
|
701
|
+
)
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
export default function ContentCard(props) {
|
|
705
|
+
if (props.variant === 'folio') return <ContentCardFolio {...props} />
|
|
706
|
+
return props.variant === 'kolbox' ? <ContentCardKolbox {...props} /> : <ContentCardDefault {...props} />
|
|
707
|
+
}
|
|
@@ -122,7 +122,7 @@ export default function ContentMedia({
|
|
|
122
122
|
if (children == null) {
|
|
123
123
|
return <AssetPlaceholder radius={radius} aspectRatio={ratio ?? undefined} className={ratio == null ? `h-full ${className}` : className} />
|
|
124
124
|
}
|
|
125
|
-
const round = radius ? 'rounded-[var(--kol-radius-
|
|
125
|
+
const round = radius ? 'rounded-[var(--kol-radius-4)]' : ''
|
|
126
126
|
return (
|
|
127
127
|
<div
|
|
128
128
|
className={`relative ${fillHeight ? 'h-full w-auto' : 'w-full'} overflow-hidden ${round} ${FIT[fit] ?? FIT.cover} ${frame ? 'bg-fg-04 border border-fg-08' : ''} ${border ? 'border border-fg-08' : ''} ${zoom ? `kol-media-zoom${zoom === 'hero' ? ' is-hero' : ''}` : ''} ${borderHover ? 'transition-colors hover:border-fg-16' : ''} ${ratio == null ? 'h-full' : ''} ${className}`.trim()}
|
|
@@ -13,9 +13,7 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
13
13
|
* 36 square thumb when `media` is passed (none without); article rides a 120px 16:9 thumb; work a framed 64px row; typeface a
|
|
14
14
|
* framed no-thumb block.
|
|
15
15
|
*
|
|
16
|
-
* @param {string} variant file | app | catalog | print | article | work | typeface | roster
|
|
17
|
-
* (`float` = the link row: `title` · `url` · ↗, float-everything W8 row 124 — props
|
|
18
|
-
* `title`, `url`, `href`, `external`, `onClick`, `className`)
|
|
16
|
+
* @param {string} variant file | app | catalog | print | article | work | typeface | roster
|
|
19
17
|
* (`app` = the file row with `verbs` · `menuItems` slotted — AppItem.jsx)
|
|
20
18
|
* (`default` is an alias of `file`). `roster` is the pickable
|
|
21
19
|
* row: filled tile, no border or divider, a FIXED 56px height the
|
|
@@ -93,7 +91,7 @@ const BOX = {
|
|
|
93
91
|
* (136 thumb + 2×16 pad), so this is a change of KIND, not of value; the
|
|
94
92
|
* text has 136 to live in and the tags line goes single-row below md
|
|
95
93
|
* (ContentText's showcase ramp) so the cut lands on the chips, not mid-row. */
|
|
96
|
-
showcase: { thumb: 'fill', ratio: '1 / 1', pad: S4, gap: S4, frame: 'transparent', frameHover: 'var(--kol-fg-08)', bg: 'var(--kol-surface-secondary)', minH: 168, heightSm: 168, align: 'items-stretch', thumbRadius: 'var(--kol-radius-
|
|
94
|
+
showcase: { thumb: 'fill', ratio: '1 / 1', pad: S4, gap: S4, frame: 'transparent', frameHover: 'var(--kol-fg-08)', bg: 'var(--kol-surface-secondary)', minH: 168, heightSm: 168, align: 'items-stretch', thumbRadius: 'var(--kol-radius-2)', thumbBorder: false },
|
|
97
95
|
/* ROSTER — a PICKABLE row (ContentRowRosterVariant, kol-chess 2026-08-31):
|
|
98
96
|
* filled tile, no border, no divider, fixed height, square thumb, two
|
|
99
97
|
* truncated lines that FILL the row rather than setting it.
|
|
@@ -157,30 +155,6 @@ const BOX = {
|
|
|
157
155
|
const ALIAS = { default: 'file', print: 'catalog', work: 'showcase', typeface: 'showcaseCanvas' }
|
|
158
156
|
const LAYOUT_KEY = { column: 'showcaseCanvas', line: 'showcase' }
|
|
159
157
|
|
|
160
|
-
/* THE LINK ROW (`variant="float"`, float-everything W8 row 124, 2026-11-04 — kol-float--style 48:3922): title · url · ↗.
|
|
161
|
-
* A link to somewhere else, on the float: the well's ground (`--kol-float-well`) on the list radius, 16 in, the title
|
|
162
|
-
* in `kol-float-hint` at 13 on the emphasis ink over the address in mono (`kol-float-timecode` at 11, fg-64), the
|
|
163
|
-
* `arrow-upright` glyph at the right on oq-64 — bright with the row under the pointer, which lifts the ground fg-08.
|
|
164
|
-
* `url` is shown as given (strip the scheme yourself); `href` defaults to it. Opens in a new tab when `external`
|
|
165
|
-
* (default: the href is absolute). Its own path — none of the variants' box table applies. */
|
|
166
|
-
function ContentRowFloat({ title, url, href = url, external, onClick, className = '' }) {
|
|
167
|
-
const ext = external ?? /^https?:/.test(href ?? '')
|
|
168
|
-
return (
|
|
169
|
-
<a
|
|
170
|
-
href={href}
|
|
171
|
-
onClick={onClick}
|
|
172
|
-
{...(ext ? { target: '_blank', rel: 'noreferrer' } : {})}
|
|
173
|
-
className={`group flex w-full items-center gap-4 rounded-[var(--kol-float-list-r)] bg-[var(--kol-float-well)] px-4 py-3 no-underline hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] ${className}`.trim()}
|
|
174
|
-
>
|
|
175
|
-
<span className="flex min-w-0 flex-1 flex-col gap-1">
|
|
176
|
-
<span className="kol-float-hint truncate text-fg-emphasis" style={{ fontSize: 13 }}>{title}</span>
|
|
177
|
-
{url && <span className="kol-float-timecode truncate text-fg-64" style={{ fontSize: 11 }}>{url}</span>}
|
|
178
|
-
</span>
|
|
179
|
-
<IconLoader name="arrow-upright" size={16} className="shrink-0 text-oq-64 group-hover:text-oq-96" />
|
|
180
|
-
</a>
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
158
|
export default function ContentRow({
|
|
185
159
|
variant: variantProp = 'file',
|
|
186
160
|
layout,
|
|
@@ -225,8 +199,6 @@ export default function ContentRow({
|
|
|
225
199
|
* None of them reach ContentText; an app row's `tags` are the rail's, never chips in the row. */
|
|
226
200
|
const app = useAppItem(variantProp, { title: text.title, verbs: text.verbs, download: text.download, menuItems: text.menuItems, date: text.date, size: text.size, media, back: text.back, tone, tags: text.tags, details: text.details, onTags: text.onTags, note: text.note, onNote: text.onNote, mark: text.mark, onCover: text.onCover, onInsert: text.onInsert, images: text.images, onImages: text.onImages, onBack: text.onBack, row: true })
|
|
227
201
|
delete text.verbs; delete text.download; delete text.menuItems; delete text.details; delete text.onTags; delete text.note; delete text.onNote; delete text.mark; delete text.onCover; delete text.onInsert; delete text.back; delete text.images; delete text.onImages; delete text.onBack
|
|
228
|
-
/* `float` is the link row — its own path, after the hook so the hook order never depends on the variant */
|
|
229
|
-
if (variantProp === 'float') return <ContentRowFloat title={text.title} url={text.url} href={href ?? text.url} external={text.external} onClick={onClick} className={className} />
|
|
230
202
|
if (app) {
|
|
231
203
|
delete text.tags
|
|
232
204
|
variantProp = 'file'
|
|
@@ -334,7 +306,7 @@ export default function ContentRow({
|
|
|
334
306
|
radius={!box.clip}
|
|
335
307
|
border={box.thumbBorder ?? false}
|
|
336
308
|
bg={box.thumbBg}
|
|
337
|
-
className={box.thumbRadius ? 'rounded-[var(--kol-radius-
|
|
309
|
+
className={box.thumbRadius ? 'rounded-[var(--kol-radius-2)]' : ''}
|
|
338
310
|
>
|
|
339
311
|
{media}
|
|
340
312
|
</ContentMedia>
|
|
@@ -380,7 +352,7 @@ export default function ContentRow({
|
|
|
380
352
|
)
|
|
381
353
|
|
|
382
354
|
const common = {
|
|
383
|
-
className: `kol-row group flex ${toneClass(tone)} ${box.column ? 'flex-col' : ''} ${box.align} ${box.height != null ? 'kol-row--fixed' : ''} ${box.heightSm != null ? 'kol-row--fixed-sm' : ''} ${box.divider ? 'kol-row--divided' : ''} ${box.frame ? 'rounded-[var(--kol-radius-
|
|
355
|
+
className: `kol-row group flex ${toneClass(tone)} ${box.column ? 'flex-col' : ''} ${box.align} ${box.height != null ? 'kol-row--fixed' : ''} ${box.heightSm != null ? 'kol-row--fixed-sm' : ''} ${box.divider ? 'kol-row--divided' : ''} ${box.frame ? 'rounded-[var(--kol-radius-4)] border' : ''} ${box.clip ? 'overflow-hidden rounded-[var(--kol-radius-4)]' : ''} ${interactive ? 'cursor-pointer select-none' : ''} ${interactive && hover ? 'kol-content-hover' : ''} ${interactive && box.frameHover ? 'kol-content-hover-frame' : ''} ${className}`.trim(),
|
|
384
356
|
style: vars,
|
|
385
357
|
}
|
|
386
358
|
|
|
@@ -40,7 +40,6 @@ export function useContextMenu() {
|
|
|
40
40
|
return { open: !!state, x: state?.x, y: state?.y, payload: state?.payload ?? null, openAt, close }
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/** `variant="float"` (float-everything W4 row 55, 2026-11-04): the float list — the list radius, 34 rows, the float flyouts */
|
|
44
43
|
export default function ContextMenu({ menu, children, variant, className = '' }) {
|
|
45
44
|
/* ONE ESCAPE, ONE LEVEL (kol-fxr 2026-10-08: a menu opened inside a FullscreenOverlay took the
|
|
46
45
|
* dialog with it). Open, the menu is the top layer, so the overlay under it ignores that Escape. */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DividerLabel — A label, then a rule to the row's end. a group's name over a list, ruled off: the label in 11 / 15 at
|
|
3
|
+
* oq-64, 8 apart a 1px oq-24 rule that takes the rest of the row (kolbox's GroupLabel over the effect rows,
|
|
4
|
+
* plan-2026-11-18-kolbox-system W31.2, 2026-11-18, carried class for class). A label and a Divider, so a molecule;
|
|
5
|
+
* `Divider` itself takes no label. The family and weight are the row's. Chrome in kol-theme `.kol-divider-label`.
|
|
6
|
+
*
|
|
7
|
+
* <DividerLabel>Vector effects</DividerLabel>
|
|
8
|
+
*
|
|
9
|
+
* @param {ReactNode} children - The label
|
|
10
|
+
* @param {string} [className] - Extra classes on the row
|
|
11
|
+
*/
|
|
12
|
+
export default function DividerLabel({ children, className = '' }) {
|
|
13
|
+
return (
|
|
14
|
+
<div className={`kol-divider-label flex items-center gap-2 ${className}`.trim()}>
|
|
15
|
+
<span className="kol-divider-label-text">{children}</span>
|
|
16
|
+
<span className="kol-divider-label-rule h-px flex-1" />
|
|
17
|
+
</div>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef } from 'react'
|
|
2
2
|
import useScrollSpy from '../hooks/useScrollSpy.js'
|
|
3
|
-
import TocRow from './TocRow.jsx'
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* DocsToc — A page's table of contents. on-page table of contents for long docs pages: a flat list of
|
|
@@ -75,10 +74,7 @@ import TocRow from './TocRow.jsx'
|
|
|
75
74
|
* knowledge and does not belong in the package.
|
|
76
75
|
*
|
|
77
76
|
* @param {Array<{id: string, label: string, children?: Array<{id: string, label: string}>}>} toc headings to render + observe; RAIL: `children` are the section's entries, one tick each in place of `minors`
|
|
78
|
-
* @param {'list'|'rail'
|
|
79
|
-
* W8 row 121, 2026-11-04) — the numbered contents list: one `TocRow` per heading
|
|
80
|
-
* (`01 · First interlude`), the one in view lifted fg-16 as `current`
|
|
81
|
-
* @param {boolean} numbered FLOAT: number the rows 01, 02 … (default true)
|
|
77
|
+
* @param {'list'|'rail'} variant render (default 'list' — the docs-sidebar column)
|
|
82
78
|
* @param {Function} onNavigate (event) => void — optional click handler on every link
|
|
83
79
|
* @param {string} rootMargin IntersectionObserver rootMargin passed to the
|
|
84
80
|
* spy. Default keeps the ported source's tighter
|
|
@@ -105,7 +101,6 @@ export default function DocsToc({
|
|
|
105
101
|
position = 'right',
|
|
106
102
|
minSections = 2,
|
|
107
103
|
ariaLabel = 'On this page',
|
|
108
|
-
numbered = true,
|
|
109
104
|
className = '',
|
|
110
105
|
}) {
|
|
111
106
|
/* Children are observed too, in document order; the active SECTION is the
|
|
@@ -116,16 +111,6 @@ export default function DocsToc({
|
|
|
116
111
|
)
|
|
117
112
|
const activeSection = toc.find((item) => item.id === activeId || item.children?.some((c) => c.id === activeId))?.id
|
|
118
113
|
|
|
119
|
-
if (variant === 'float') {
|
|
120
|
-
return (
|
|
121
|
-
<nav aria-label={ariaLabel} className={`flex flex-col gap-0.5 ${className}`.trim()}>
|
|
122
|
-
{toc.map((item, i) => (
|
|
123
|
-
<TocRow key={item.id} number={numbered ? i + 1 : undefined} label={item.label} href={`#${item.id}`} current={activeSection === item.id} onClick={onNavigate} />
|
|
124
|
-
))}
|
|
125
|
-
</nav>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
114
|
if (variant === 'rail') {
|
|
130
115
|
return (
|
|
131
116
|
<TocRail
|
|
@@ -3,6 +3,7 @@ import { toneClass } from '../utilities/tone.js'
|
|
|
3
3
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
4
4
|
import { MenuList } from './MenuList.jsx'
|
|
5
5
|
import { Menu } from './Menu.jsx'
|
|
6
|
+
import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
|
|
6
7
|
import { glyphSize, indicatorSize } from '../hooks/glyphLadders.js'
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -26,12 +27,6 @@ import { glyphSize, indicatorSize } from '../hooks/glyphLadders.js'
|
|
|
26
27
|
* differed by. Use the tone.
|
|
27
28
|
* variant="outline" — bordered trigger; open panel carries the
|
|
28
29
|
* same border, trigger's bottom edge acts as the divider
|
|
29
|
-
* variant="float" — the float select (float-everything W2 row 25 · W4 row 54, 2026-11-04): the
|
|
30
|
-
* trigger a `kol-btn-float` capsule on the float well (a `tone` still wins), the float heights by `size`
|
|
31
|
-
* (sm 28 · md 36 · lg 44); its list opens 8 under it on `--kol-float-list-r`, the trigger's width, 34 rows
|
|
32
|
-
* in Inter, no hairline. Still rest and open only. The caret is the float spec's chevron for the trigger's size
|
|
33
|
-
* (`--kol-float-chev-*`, 12 at sm — plan-2026-11-12-float-system W3.1); in the list hover is the only fill, the
|
|
34
|
-
* current row carries its dot and no fill (`--kol-float-row-hover` · `-row-selected`).
|
|
35
30
|
*
|
|
36
31
|
* Legacy aliases (pre-law variants, kept so call-sites don't break):
|
|
37
32
|
* default → primary · subtle → primary · minimal → outline
|
|
@@ -66,7 +61,116 @@ const ROW = { xs: `kol-mono-8 ${ROW_PAD.xs} ${ROW_H.xs}`, sm: `kol-mono-12 ${ROW
|
|
|
66
61
|
|
|
67
62
|
const LEGACY_VARIANTS = { default: 'primary', subtle: 'primary', minimal: 'outline' }
|
|
68
63
|
|
|
69
|
-
|
|
64
|
+
/* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 4, 2026-11-18): kolbox's Dropdown carried line for line,
|
|
65
|
+
* the chrome in kol-theme `.kol-dd--kolbox`. The closed field with the 12 chevron at the right: a button that opens
|
|
66
|
+
* `Menu variant="kolbox"` OVER itself (28.5: the chosen row on the field, the left edges together, at least as wide as
|
|
67
|
+
* the field, flipped to the field's right edge near the window's, 4 from it), with a check on the current option.
|
|
68
|
+
* `options` strings or `{ value, label }`; `onChange` gets the value as a string. Enter, Space or ArrowDown opens; in the
|
|
69
|
+
* menu the arrows move, Enter picks, a letter jumps, Escape closes; focus comes back to the field.
|
|
70
|
+
* size sm (unset) the 28 field; xs the 24 filter (Home's), no fill, Figma's filter measured (plan-2026-11-23-editor-
|
|
71
|
+
* measured-against-figma W7): the value 8 in, the chevron's glyph 5 after it and 7 off the right edge
|
|
72
|
+
* tone unset: the outlined field, the oq-24 line only (the master's default), the line the accent while open or
|
|
73
|
+
* focused; `grey`: the unbordered field (oq-16 at sm, bare at xs), padding 12 left and 4 right, the chevron 4
|
|
74
|
+
* after the value, so it hugs its value (the top rail's zoom)
|
|
75
|
+
* menu a trigger for its own overlay instead of the option list (the zoom's): menu({ anchor, open, onClose }) is drawn
|
|
76
|
+
* in place of the Menu, and the field reads `value` as it is
|
|
77
|
+
* ariaLabel what it chooses, as KOL's Dropdown; other props (disabled, data-*) land on the button
|
|
78
|
+
* Folio on kolbox (2026-11-22): a number option's value reaches `onChange` as a number (every other as a string); a
|
|
79
|
+
* `value` no option holds is shown as it is; `align` (folio's) is read and dropped, the list lies over its field */
|
|
80
|
+
function DropdownKolbox({ size, tone, value, options = [], onChange, menu, ariaLabel, align: _align, className = '', variant, ...rest }) {
|
|
81
|
+
const ref = useRef(null)
|
|
82
|
+
const [open, setOpen] = useState(false)
|
|
83
|
+
const outlined = tone !== 'grey'
|
|
84
|
+
const xs = size === 'xs'
|
|
85
|
+
/* `{ divider: true }` starts a new group (Menu draws the line between groups); a `{ heading }` is not a row here */
|
|
86
|
+
const all = options.map((o) => (typeof o === 'string' ? { value: o, label: o } : o)).filter((o) => !o?.heading)
|
|
87
|
+
const opts = all.filter((o) => !o?.divider)
|
|
88
|
+
/* a value that no option holds (a node, or an action's name: Folio's Heading, Save to bucket) is shown as it is */
|
|
89
|
+
const current = opts.find((o) => String(o.value) === String(value)) ?? (value != null && value !== '' && opts.length ? { label: value } : opts[0]) ?? { label: value }
|
|
90
|
+
const close = () => { setOpen(false); ref.current?.focus({ preventScroll: true }) }
|
|
91
|
+
const groups = [[]]
|
|
92
|
+
/* the check column only when the field holds one of its options (an action list, Folio's Save to bucket, has none) */
|
|
93
|
+
const held = opts.includes(current)
|
|
94
|
+
for (const o of all) {
|
|
95
|
+
if (o.divider) { if (groups.at(-1).length) groups.push([]); continue }
|
|
96
|
+
const on = o === current
|
|
97
|
+
groups.at(-1).push({ label: o.label, value: o.value, check: held ? on : undefined, highlighted: on })
|
|
98
|
+
}
|
|
99
|
+
return (
|
|
100
|
+
<>
|
|
101
|
+
<button
|
|
102
|
+
ref={ref}
|
|
103
|
+
type="button"
|
|
104
|
+
aria-haspopup="menu"
|
|
105
|
+
aria-expanded={open}
|
|
106
|
+
aria-label={ariaLabel}
|
|
107
|
+
data-kol-dropdown=""
|
|
108
|
+
onClick={() => (open ? close() : setOpen(true))}
|
|
109
|
+
onKeyDown={(e) => {
|
|
110
|
+
/* the field's own keys, kept from the page's shortcuts as a native select's are */
|
|
111
|
+
if (!['Enter', ' ', 'ArrowDown', 'ArrowUp'].includes(e.key)) return
|
|
112
|
+
e.preventDefault(); e.stopPropagation()
|
|
113
|
+
if (e.key !== 'ArrowUp') setOpen(true)
|
|
114
|
+
}}
|
|
115
|
+
className={`kol-dd--kolbox${outlined ? ' kol-dd--kolbox-outlined' : ''}${outlined && open ? ' is-open' : ''}${!outlined && !xs ? ' kol-dd--kolbox-filled' : ''} relative flex min-w-0 cursor-pointer items-center disabled:cursor-default disabled:opacity-40 ${xs ? 'h-6 bg-transparent' : 'h-(--kol-kolbox-ctl)'} text-left outline-none ${outlined ? (xs ? 'gap-0.5 border pr-[3px] pl-[7px]' : 'gap-2 border px-2') : 'gap-1 pr-1 pl-3 focus-visible:outline-1'} ${className}`}
|
|
116
|
+
{...rest}
|
|
117
|
+
>
|
|
118
|
+
<span className="min-w-0 flex-1 truncate">{current?.label}</span>
|
|
119
|
+
<KolboxGlyph name="chevron-down" className="kol-dd-caret--kolbox pointer-events-none" />
|
|
120
|
+
</button>
|
|
121
|
+
{menu ? menu({ anchor: ref, open, onClose: close }) : <Menu
|
|
122
|
+
variant="kolbox"
|
|
123
|
+
anchor={ref}
|
|
124
|
+
open={open}
|
|
125
|
+
onClose={close}
|
|
126
|
+
onSelect={(row) => onChange?.(typeof row.value === 'number' ? row.value : String(row.value))}
|
|
127
|
+
groups={groups}
|
|
128
|
+
placement="over"
|
|
129
|
+
aria-label={ariaLabel}
|
|
130
|
+
minWidth={ref.current?.offsetWidth}
|
|
131
|
+
/>}
|
|
132
|
+
</>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* `variant="folio"` (Folio migration batch B, 2026-11-22): Folio's Choice carried class for class, the chrome in kol-theme
|
|
137
|
+
* `.kol-dd--folio`. The button is as wide as its text (its type is the caller's or the row's), the ⌄ after it; the list
|
|
138
|
+
* opens under it in place (never portalled, so it keeps the frame's `data-folio-*`), the current row green with its ✓.
|
|
139
|
+
* Esc or a press outside closes. `options` `{ value, label }` (a label may be a node; `value` reaches `onChange` as it
|
|
140
|
+
* is), `ariaLabel`, `disabled`, `className` (the button's). Folio's own word: `align` left (unset), right, bottom-left,
|
|
141
|
+
* bottom-right: the list's edge and side. */
|
|
142
|
+
function DropdownFolio({ value, options = [], onChange, ariaLabel, disabled, align = 'left', className = '' }) {
|
|
143
|
+
const [open, setOpen] = useState(false)
|
|
144
|
+
const box = useRef(null)
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
if (!open) return undefined
|
|
147
|
+
const off = (e) => { if (!box.current?.contains(e.target)) setOpen(false) }
|
|
148
|
+
const esc = (e) => e.key === 'Escape' && setOpen(false)
|
|
149
|
+
addEventListener('mousedown', off); addEventListener('keydown', esc)
|
|
150
|
+
return () => { removeEventListener('mousedown', off); removeEventListener('keydown', esc) }
|
|
151
|
+
}, [open])
|
|
152
|
+
const current = options.find((o) => o.value === value)?.label ?? value
|
|
153
|
+
return (
|
|
154
|
+
<span ref={box} className="relative inline-flex">
|
|
155
|
+
<button type="button" aria-label={ariaLabel} aria-haspopup="listbox" aria-expanded={open} disabled={disabled} onClick={() => setOpen(!open)} className={`kol-dd--folio inline-flex items-center gap-[4px] rounded-[3px] disabled:cursor-default ${className}`}>
|
|
156
|
+
{current}{!disabled && <span aria-hidden className="kol-dd-caret--folio">⌄</span>}
|
|
157
|
+
</button>
|
|
158
|
+
{open && (
|
|
159
|
+
<span role="listbox" aria-label={ariaLabel} className={`kol-dd-list--folio absolute z-50 flex min-w-[160px] flex-col rounded-[3px] border py-[4px] ${/right/.test(align) ? 'right-0' : 'left-0'} ${/bottom/.test(align) ? 'bottom-[calc(100%+6px)]' : 'top-[calc(100%+6px)]'}`}>
|
|
160
|
+
{options.map((o) => (
|
|
161
|
+
<button key={o.value} type="button" role="option" aria-selected={o.value === value} onClick={() => { setOpen(false); onChange?.(o.value) }} className={`kol-dd-option--folio${o.value === value ? ' is-current' : ''} flex items-center gap-[8px] whitespace-nowrap px-[12px] py-[7px] text-left`}>
|
|
162
|
+
<span aria-hidden className="kol-dd-check--folio inline-flex size-[16px] shrink-0 items-center justify-center">{o.value === value ? '✓' : ''}</span>{o.label}
|
|
163
|
+
</button>
|
|
164
|
+
))}
|
|
165
|
+
</span>
|
|
166
|
+
)}
|
|
167
|
+
</span>
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const Dropdown = (props) => (props.variant === 'kolbox' ? <DropdownKolbox {...props} /> : props.variant === 'folio' ? <DropdownFolio {...props} /> : <DropdownOn {...props} />)
|
|
172
|
+
|
|
173
|
+
const DropdownOn = ({
|
|
70
174
|
options = [],
|
|
71
175
|
value,
|
|
72
176
|
onChange,
|
|
@@ -163,7 +267,6 @@ const Dropdown = ({
|
|
|
163
267
|
/* `variant="raised"` retires into `tone="faint"` (2026-10-31) — the alias, until nobody passes it */
|
|
164
268
|
if (variant === 'raised') { variant = undefined; tone = 'faint' }
|
|
165
269
|
const resolvedVariant = LEGACY_VARIANTS[variant] || variant
|
|
166
|
-
const float = resolvedVariant === 'float'
|
|
167
270
|
|
|
168
271
|
/* The panel is `Menu fused` (plan-2026-10-31-menu-engine W1.3): below the trigger, never flipped (the fused edge
|
|
169
272
|
* assumes below), the trigger's width, a listbox. */
|
|
@@ -219,10 +322,8 @@ const Dropdown = ({
|
|
|
219
322
|
* never leaks into Button's variant set */
|
|
220
323
|
resolvedVariant === 'grey' ? 'kol-dd-trigger--grey' : resolvedVariant === 'raised' ? 'kol-dd-trigger--raised' : resolvedVariant && `kol-btn-${resolvedVariant}`,
|
|
221
324
|
`kol-btn-${resolvedSize}`,
|
|
222
|
-
|
|
223
|
-
!float && SIZE_TYPE[resolvedSize],
|
|
325
|
+
SIZE_TYPE[resolvedSize],
|
|
224
326
|
'kol-dd-trigger',
|
|
225
|
-
float && 'kol-dd-trigger--float',
|
|
226
327
|
/* ICON-ONLY: the pinned square from Button's own class, so a tool-rail
|
|
227
328
|
* dropdown is the same box as the icon button beside it at every rung
|
|
228
329
|
* (editor-set-is-behind-its-source, kol-fxr 2026-09-03 — its ToolPalette
|
|
@@ -267,7 +368,7 @@ const Dropdown = ({
|
|
|
267
368
|
</span>
|
|
268
369
|
{/* chrome lives in .kol-dd-caret (trailing edge + open-state flip) —
|
|
269
370
|
* keyed off the trigger's data-state, no inline styles */}
|
|
270
|
-
<IconLoader name="chevron-down" size={
|
|
371
|
+
<IconLoader name="chevron-down" size={indicatorSize(resolvedSize)} className="kol-dd-caret" />
|
|
271
372
|
</>
|
|
272
373
|
)}
|
|
273
374
|
{/* a consumer's own trigger mark — the tool-palette corner fold rides
|
|
@@ -287,9 +388,7 @@ const Dropdown = ({
|
|
|
287
388
|
/* NO HOVER STATE ANYWHERE ON A DROPDOWN (user 2026-08-28) — the indicator marks the current value. */
|
|
288
389
|
hover: false,
|
|
289
390
|
size: resolvedSize,
|
|
290
|
-
|
|
291
|
-
* current one carries its dot and no fill (W3.1, P2: "it dosnt highlight selected, only hover") */
|
|
292
|
-
rowClass: float ? `kol-menu-row${isActive ? ' kol-menu-row--current' : ''}` : (ROW[resolvedSize] ?? ROW.sm),
|
|
391
|
+
rowClass: ROW[resolvedSize] ?? ROW.sm,
|
|
293
392
|
height: rowHeight,
|
|
294
393
|
onPointerEnter: onOptionHover ? () => reportHover(option.value) : undefined,
|
|
295
394
|
onPointerLeave: onOptionHover ? () => reportHover(null) : undefined,
|
|
@@ -321,9 +420,7 @@ const Dropdown = ({
|
|
|
321
420
|
closeOnSelect={!multiple}
|
|
322
421
|
rootClassName={`kol-dd-root relative inline-block align-middle ${className}`}
|
|
323
422
|
trigger={trig}
|
|
324
|
-
|
|
325
|
-
offset={float ? 8 : undefined}
|
|
326
|
-
panelClassName={`${resolvedVariant && !float ? `kol-dd-panel--${resolvedVariant}` : ''} ${toneClass(tone)} ${inPanel ? 'kol-hw-panel' : ''}`.replace(/\s+/g, ' ').trim()}
|
|
423
|
+
panelClassName={`${resolvedVariant ? `kol-dd-panel--${resolvedVariant}` : ''} ${toneClass(tone)} ${inPanel ? 'kol-hw-panel' : ''}`.replace(/\s+/g, ' ').trim()}
|
|
327
424
|
panelStyle={{
|
|
328
425
|
'--kol-dd-max-rows': maxRows ?? 10,
|
|
329
426
|
/* a row is the trigger's height; the panel's max-height reads it */
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Button from '../atoms/Button.jsx'
|
|
2
|
+
import Dropdown from './Dropdown.jsx'
|
|
3
|
+
|
|
4
|
+
/* taxonomy-ok: molecule — a Dropdown with its previous and next Buttons */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* DropdownStepper — A Dropdown with the previous and next buttons round it (plan-2026-11-18-kolbox-system W31.2
|
|
8
|
+
* batch 4, 2026-11-18; kolbox's, Labs' preset stepper): `onStep(-1)` and `onStep(1)` walk the options, the Dropdown picks
|
|
9
|
+
* any. With one option the buttons are not drawn. It renders its three parts with no wrapper, so they sit in the
|
|
10
|
+
* caller's row. `variant` reaches the Buttons (icon-only chevrons) and the Dropdown (`kolbox` is kolbox's look). Input.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} [value]
|
|
13
|
+
* @param {Array} [options] Dropdown's options
|
|
14
|
+
* @param {Function} [onChange] `(value)`
|
|
15
|
+
* @param {Function} [onStep] `(-1 | 1)`
|
|
16
|
+
* @param {string} [prevLabel='Previous'] @param {string} [nextLabel='Next'] the buttons' names
|
|
17
|
+
* @param {string} [variant]
|
|
18
|
+
* @param {string} [className='min-w-0 flex-1'] the Dropdown's
|
|
19
|
+
*/
|
|
20
|
+
export default function DropdownStepper({ value, options = [], onChange, onStep, prevLabel = 'Previous', nextLabel = 'Next', variant, className = 'min-w-0 flex-1' }) {
|
|
21
|
+
const steps = options.length > 1
|
|
22
|
+
return (
|
|
23
|
+
<>
|
|
24
|
+
{steps && <Button variant={variant} iconOnly="chevron-left" aria-label={prevLabel} onClick={() => onStep?.(-1)} />}
|
|
25
|
+
<Dropdown variant={variant} className={className} value={value} options={options} onChange={onChange} />
|
|
26
|
+
{steps && <Button variant={variant} iconOnly="chevron-right" aria-label={nextLabel} onClick={() => onStep?.(1)} />}
|
|
27
|
+
</>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
@@ -17,22 +17,8 @@
|
|
|
17
17
|
* @param {string} footer optional note above a top hairline
|
|
18
18
|
* @param {boolean} gated hide unless placeholders are switched on (default false)
|
|
19
19
|
* @param {string} className extra classes on the wrapper
|
|
20
|
-
* @param {'float'} [variant] `float` (float-everything W6 row 92, 2026-11-04 — kol-float--style 46:3073): the empty panel
|
|
21
|
-
* on a float — the title in `kol-float-window` (Inter 18), the body in `kol-float-body` on fg-64, the
|
|
22
|
-
* footer pinned to the panel's foot in `kol-float-hint` (`Panel stays open.`), no rule above it. It
|
|
23
|
-
* fills its panel's height (`flex-1`) so the footer lands at the bottom.
|
|
24
20
|
*/
|
|
25
|
-
export default function EmptyState({ eyebrow, title, body, footer, gated = false,
|
|
26
|
-
if (variant === 'float') {
|
|
27
|
-
return (
|
|
28
|
-
<div className={`flex min-h-0 flex-1 flex-col${gated ? ' kol-placeholder' : ''} ${className}`.trim()}>
|
|
29
|
-
{eyebrow && <p className="kol-float-label mb-1 text-fg-64">{eyebrow}</p>}
|
|
30
|
-
{title && <p className="kol-float-window mb-3 text-fg-emphasis">{title}</p>}
|
|
31
|
-
{body && <p className="kol-float-body whitespace-pre-line text-fg-64">{body}</p>}
|
|
32
|
-
{footer && <p className="kol-float-hint mt-auto pt-6 text-fg-64">{footer}</p>}
|
|
33
|
-
</div>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
21
|
+
export default function EmptyState({ eyebrow, title, body, footer, gated = false, className = '' }) {
|
|
36
22
|
return (
|
|
37
23
|
<div className={`${gated ? 'kol-placeholder' : ''}${className ? ` ${className}` : ''}` || undefined}>
|
|
38
24
|
{/* helper (line-height 1) is single-line chrome ONLY — title and footer
|
|
@@ -5,12 +5,51 @@ import Input from '../atoms/Input.jsx'
|
|
|
5
5
|
* two-up position fields). Two `Input`s 8 apart, each led by its letter (`prefix`), sharing one `variant` and `size`;
|
|
6
6
|
* the pair fills its row, each field half. A position, a size, a range — any two values that are read together.
|
|
7
7
|
*
|
|
8
|
+
* `variant="kolbox"` (kolbox's PropertyRow, Figma 70:12121, plan-2026-11-18-kolbox-system W31.2, 2026-11-18, carried
|
|
9
|
+
* class for class): two slots instead of two Inputs' props, `first` and `second`, then `trailing` (icons or a tag). THE
|
|
10
|
+
* RAIL'S ONE GRID (plan-2026-11-19-kolbox-whats-left R3.1): the row is a grid on `--kol-kolbox-row-cols`, the tracks
|
|
11
|
+
* LabeledControlSection kolbox sets for every row it holds: two field columns and two 16 icon columns, 8 apart (in the
|
|
12
|
+
* 240 rail: 76, 76, 16, 16, his design's Stroke row, 149:26890). `first` takes column 1 (`span`: columns 1 and 2, a
|
|
13
|
+
* row of one field), `second` column 2, `trailing` the icon columns from the right, so a lone icon sits on the last and
|
|
14
|
+
* a pair on both. Outside a section the tracks are two equal columns and the trailing's own width. Each control fills
|
|
15
|
+
* its cell. It draws nothing of its own; the wrapper carries `data-property-row`.
|
|
16
|
+
*
|
|
17
|
+
* `variant="folio"` (Folio's SettingPair, Folio batch C, 2026-11-22, carried class for class): two 32 fields 8 apart at
|
|
18
|
+
* radius 4, padded 16, Folio's hairline round each (green while it has focus), each led by its `prefix` in the muted
|
|
19
|
+
* ink; the value in mono 12 / 16. `fields` as the default's, each a plain input's props. Chrome in kol-theme
|
|
20
|
+
* `.kol-field-pair--folio`.
|
|
21
|
+
*
|
|
8
22
|
* @param {Array} fields two Input prop sets — `[{ prefix: 'X', value, onChange, ... }, { prefix: 'Y', ... }]`
|
|
9
|
-
* @param {'
|
|
23
|
+
* @param {'filled'|'outline'|'kolbox'|'folio'} [variant] passed to both Inputs; `kolbox` takes the slots below
|
|
10
24
|
* @param {'sm'|'md'|'lg'} [size] passed to both
|
|
25
|
+
* @param {ReactNode} [first] kolbox: the left cell
|
|
26
|
+
* @param {ReactNode} [second] kolbox: the right cell
|
|
27
|
+
* @param {ReactNode} [trailing] kolbox: the icon columns
|
|
28
|
+
* @param {boolean} [span] kolbox: `first` spans both field columns
|
|
11
29
|
* @param {string} [className]
|
|
12
30
|
*/
|
|
13
|
-
export default function FieldPair({ fields = [], variant, size, className = '' }) {
|
|
31
|
+
export default function FieldPair({ fields = [], variant, size, first, second, trailing, span = false, className = '', ...rest }) {
|
|
32
|
+
if (variant === 'kolbox') {
|
|
33
|
+
return (
|
|
34
|
+
<div {...rest} className={`grid min-w-0 grid-cols-[var(--kol-kolbox-row-cols,minmax(0,1fr)_minmax(0,1fr)_auto)] items-center gap-2 ${className}`.trim()} data-property-row>
|
|
35
|
+
<div className={`flex min-w-0 ${span ? 'col-span-2' : ''}`}>{first}</div>
|
|
36
|
+
{!span && <div className="flex min-w-0">{second}</div>}
|
|
37
|
+
{trailing && <div className="col-start-3 -col-end-1 flex items-center justify-end gap-2">{trailing}</div>}
|
|
38
|
+
</div>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
if (variant === 'folio') {
|
|
42
|
+
return (
|
|
43
|
+
<div {...rest} className={`kol-field-pair--folio flex items-center gap-[8px] ${className}`.trim()}>
|
|
44
|
+
{fields.map(({ prefix, ...f }) => (
|
|
45
|
+
<label key={prefix} className="kol-field-pair-field flex h-[32px] min-w-0 flex-1 items-center rounded-[4px] border px-[16px]">
|
|
46
|
+
<span className="kol-field-pair-prefix shrink-0 pr-[4px]">{prefix}</span>
|
|
47
|
+
<input {...f} className="min-w-0 flex-1 bg-transparent outline-none" />
|
|
48
|
+
</label>
|
|
49
|
+
))}
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
14
53
|
return (
|
|
15
54
|
<div className={`flex items-center gap-2 ${className}`.trim()}>
|
|
16
55
|
{fields.slice(0, 2).map((f, i) => (
|
package/src/molecules/Header.jsx
CHANGED
|
@@ -43,9 +43,9 @@ const CHEV = '[--kol-float-ic:var(--kol-float-chev-sm)]'
|
|
|
43
43
|
|
|
44
44
|
export default function Header({ variant = 'property', icon, title, kind, onSwitch, end, onExpand, onCollapseH, collapsedV = false, onCollapseV, onMinimise, onClose, className = '' }) {
|
|
45
45
|
const toggles = <>
|
|
46
|
-
{onExpand && <Button
|
|
47
|
-
{onCollapseH && <Button
|
|
48
|
-
{onCollapseV && <Button
|
|
46
|
+
{onExpand && <Button tone="ghost" size="sm" iconOnly="arrow-upright" aria-label="Expand" onClick={onExpand} />}
|
|
47
|
+
{onCollapseH && <Button tone="ghost" size="sm" iconOnly={variant === 'nav' ? 'panel-left' : 'panel-right'} aria-label="Collapse" onClick={onCollapseH} />}
|
|
48
|
+
{onCollapseV && <Button tone="ghost" size="sm" iconOnly={collapsedV ? 'chevron-down' : 'chevron-up'} className={CHEV}
|
|
49
49
|
aria-label={collapsedV ? 'Expand' : 'Collapse'} aria-expanded={!collapsedV} onClick={onCollapseV} />}
|
|
50
50
|
</>
|
|
51
51
|
const any = end || onExpand || onCollapseH || onCollapseV
|
|
@@ -93,7 +93,7 @@ export default function Header({ variant = 'property', icon, title, kind, onSwit
|
|
|
93
93
|
: <span className="kol-float-panel text-emphasis min-w-0 flex-1 truncate">{slot}</span>)}
|
|
94
94
|
{(any || onClose) && <span className="ml-auto flex shrink-0 items-center gap-1">
|
|
95
95
|
{end}{toggles}
|
|
96
|
-
{onClose && <Button
|
|
96
|
+
{onClose && <Button tone="ghost" size="sm" iconOnly="x" aria-label="Close" onClick={onClose} />}
|
|
97
97
|
</span>}
|
|
98
98
|
</div>
|
|
99
99
|
)
|