@kolkrabbi/kol-component 0.333.3 → 0.335.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/atoms/Badge.jsx +5 -1
- package/src/atoms/Button.jsx +15 -2
- package/src/atoms/Delta.jsx +27 -0
- package/src/atoms/Input.jsx +18 -1
- package/src/atoms/LiveDot.jsx +19 -0
- package/src/atoms/Pill.jsx +3 -1
- package/src/atoms/ProgressBar.jsx +7 -4
- package/src/atoms/SectionLabel.jsx +29 -0
- package/src/atoms/SegmentedToggle.jsx +4 -1
- package/src/atoms/SizeChip.jsx +24 -0
- package/src/atoms/Tag.jsx +9 -3
- package/src/atoms/Textarea.jsx +5 -1
- package/src/atoms/ToggleCheckbox.jsx +7 -4
- package/src/atoms/ToggleSwitch.jsx +7 -2
- package/src/atoms/ValueField.jsx +24 -0
- package/src/atoms/ViewToggle.jsx +27 -0
- package/src/index.js +24 -0
- package/src/molecules/AccountMenu.jsx +27 -0
- package/src/molecules/ColorField.jsx +30 -0
- package/src/molecules/ContentRow.jsx +30 -1
- package/src/molecules/ContextMenu.jsx +3 -2
- package/src/molecules/DocsToc.jsx +16 -1
- package/src/molecules/Dropdown.jsx +15 -4
- package/src/molecules/EmptyState.jsx +15 -1
- package/src/molecules/FieldPair.jsx +21 -0
- package/src/molecules/FlyoutRow.jsx +10 -0
- package/src/molecules/IndexRow.jsx +37 -0
- package/src/molecules/InlineAddRow.jsx +38 -0
- package/src/molecules/LabeledControl.jsx +6 -2
- package/src/molecules/LayerRow.jsx +53 -0
- package/src/molecules/LinkAddRow.jsx +52 -0
- package/src/molecules/Menu.jsx +46 -24
- package/src/molecules/MenuItem.jsx +8 -3
- package/src/molecules/Modal.jsx +58 -19
- package/src/molecules/NoticeBanner.jsx +28 -0
- package/src/molecules/PanelsMenu.jsx +34 -0
- package/src/molecules/PasswordInput.jsx +38 -0
- package/src/molecules/QuantityInput.jsx +17 -0
- package/src/molecules/QuickLookFrame.jsx +31 -27
- package/src/molecules/QuickLookHeader.jsx +60 -0
- package/src/molecules/SearchInput.jsx +5 -4
- package/src/molecules/SectionText.jsx +15 -1
- package/src/molecules/Slider.jsx +26 -1
- package/src/molecules/SpecList.jsx +21 -1
- package/src/molecules/SummaryLine.jsx +18 -0
- package/src/molecules/TabsRow.jsx +54 -7
- package/src/molecules/TaskRow.jsx +43 -0
- package/src/molecules/TocRow.jsx +29 -0
- package/src/molecules/TreeRow.jsx +72 -0
- package/src/molecules/WorkspaceSwitcher.jsx +24 -0
- package/src/organisms/ContentFilters.jsx +12 -4
- package/src/organisms/MediaLibrary.jsx +55 -0
- package/src/organisms/NavDrawer.jsx +67 -0
- package/src/organisms/NavRail.jsx +4 -1
- package/src/organisms/NavRailFloat.jsx +110 -0
- package/src/organisms/Table.jsx +50 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import ColorSwatch from './ColorSwatch.jsx'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ColorField — A color as a row: swatch, name, hex. `■ Background #0B0B0B` (float-everything W3 row 44, 2026-11-04 —
|
|
5
|
+
* the exploration's inline color field; KOL had only the picker popover). A 24 `ColorSwatch`, the name in Inter 13
|
|
6
|
+
* taking the room, the hex in mono 11 at fg-64 at the end. With `onClick` the row is a button — the caller opens its
|
|
7
|
+
* `ColorPickerPopover` from it; without one it reads. The hex is uppercased for the readout only; `value` is passed
|
|
8
|
+
* through untouched.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} label the color's name (`Background`)
|
|
11
|
+
* @param {string} value the color, a hex string
|
|
12
|
+
* @param {Function} [onClick] makes the row a button (`(event) => void`)
|
|
13
|
+
* @param {boolean} [swatchFrame] the swatch's hairline (default true — a near-ground swatch needs its edge)
|
|
14
|
+
* @param {string} [className]
|
|
15
|
+
*/
|
|
16
|
+
export default function ColorField({ label, value, onClick, swatchFrame = true, className = '', ...rest }) {
|
|
17
|
+
const El = onClick ? 'button' : 'div'
|
|
18
|
+
return (
|
|
19
|
+
<El
|
|
20
|
+
type={onClick ? 'button' : undefined}
|
|
21
|
+
onClick={onClick}
|
|
22
|
+
className={`flex w-full items-center gap-3 text-left ${onClick ? 'cursor-pointer rounded-full outline-none focus-visible:[box-shadow:var(--kol-float-focus)]' : ''} ${className}`.replace(/\s+/g, ' ').trim()}
|
|
23
|
+
{...rest}
|
|
24
|
+
>
|
|
25
|
+
<ColorSwatch hex={value} size={24} radius="sm" frame={swatchFrame} />
|
|
26
|
+
<span className="flex-1 min-w-0 truncate font-[family-name:var(--kol-font-family-float)] text-[13px] leading-none text-fg-emphasis">{label}</span>
|
|
27
|
+
<span className="shrink-0 font-mono text-[11px] leading-none uppercase text-fg-64">{value}</span>
|
|
28
|
+
</El>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
@@ -2,6 +2,7 @@ import ContentMedia from './ContentMedia.jsx'
|
|
|
2
2
|
import ContentText from './ContentText.jsx'
|
|
3
3
|
import { useAppItem } from './AppItem.jsx'
|
|
4
4
|
import { toneClass } from '../utilities/tone.js'
|
|
5
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* ContentRow — The row form of a content card. the row form of the content-card system: leading thumb (where
|
|
@@ -12,7 +13,9 @@ import { toneClass } from '../utilities/tone.js'
|
|
|
12
13
|
* 36 square thumb when `media` is passed (none without); article rides a 120px 16:9 thumb; work a framed 64px row; typeface a
|
|
13
14
|
* framed no-thumb block.
|
|
14
15
|
*
|
|
15
|
-
* @param {string} variant file | app | catalog | print | article | work | typeface | roster
|
|
16
|
+
* @param {string} variant file | app | catalog | print | article | work | typeface | roster | float
|
|
17
|
+
* (`float` = the link row: `title` · `url` · ↗, float-everything W8 row 124 — props
|
|
18
|
+
* `title`, `url`, `href`, `external`, `onClick`, `className`)
|
|
16
19
|
* (`app` = the file row with `verbs` · `menuItems` slotted — AppItem.jsx)
|
|
17
20
|
* (`default` is an alias of `file`). `roster` is the pickable
|
|
18
21
|
* row: filled tile, no border or divider, a FIXED 56px height the
|
|
@@ -154,6 +157,30 @@ const BOX = {
|
|
|
154
157
|
const ALIAS = { default: 'file', print: 'catalog', work: 'showcase', typeface: 'showcaseCanvas' }
|
|
155
158
|
const LAYOUT_KEY = { column: 'showcaseCanvas', line: 'showcase' }
|
|
156
159
|
|
|
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
|
+
<Icon name="arrow-upright" size={16} className="shrink-0 text-oq-64 group-hover:text-oq-96" />
|
|
180
|
+
</a>
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
|
|
157
184
|
export default function ContentRow({
|
|
158
185
|
variant: variantProp = 'file',
|
|
159
186
|
layout,
|
|
@@ -198,6 +225,8 @@ export default function ContentRow({
|
|
|
198
225
|
* None of them reach ContentText; an app row's `tags` are the rail's, never chips in the row. */
|
|
199
226
|
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 })
|
|
200
227
|
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} />
|
|
201
230
|
if (app) {
|
|
202
231
|
delete text.tags
|
|
203
232
|
variantProp = 'file'
|
|
@@ -40,7 +40,8 @@ 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
|
-
|
|
43
|
+
/** `variant="float"` (float-everything W4 row 55, 2026-11-04): the float list — the list radius, 34 rows, the float flyouts */
|
|
44
|
+
export default function ContextMenu({ menu, children, variant, className = '' }) {
|
|
44
45
|
/* ONE ESCAPE, ONE LEVEL (kol-fxr 2026-10-08: a menu opened inside a FullscreenOverlay took the
|
|
45
46
|
* dialog with it). Open, the menu is the top layer, so the overlay under it ignores that Escape. */
|
|
46
47
|
useEffect(() => {
|
|
@@ -50,7 +51,7 @@ export default function ContextMenu({ menu, children, className = '' }) {
|
|
|
50
51
|
}, [menu.open])
|
|
51
52
|
if (!menu.open) return null
|
|
52
53
|
return (
|
|
53
|
-
<Menu anchor={{ x: menu.x, y: menu.y }} open onOpenChange={(v) => { if (!v) menu.close() }} panelClassName={`min-w-44 ${className}`.trim()}>
|
|
54
|
+
<Menu anchor={{ x: menu.x, y: menu.y }} open onOpenChange={(v) => { if (!v) menu.close() }} variant={variant} panelClassName={`min-w-44 ${className}`.trim()}>
|
|
54
55
|
{/* Any click inside closes — a menu item that leaves the menu open after acting is the one interaction people
|
|
55
56
|
* report as broken. Items keep their own onClick; this runs after it on the way up. */}
|
|
56
57
|
<div onClick={menu.close} role="none" className="flex flex-col">
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef } from 'react'
|
|
2
2
|
import useScrollSpy from '../hooks/useScrollSpy.js'
|
|
3
|
+
import TocRow from './TocRow.jsx'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* DocsToc — A page's table of contents. on-page table of contents for long docs pages: a flat list of
|
|
@@ -74,7 +75,10 @@ import useScrollSpy from '../hooks/useScrollSpy.js'
|
|
|
74
75
|
* knowledge and does not belong in the package.
|
|
75
76
|
*
|
|
76
77
|
* @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`
|
|
77
|
-
* @param {'list'|'rail'} variant render (default 'list' — the docs-sidebar column)
|
|
78
|
+
* @param {'list'|'rail'|'float'} variant render (default 'list' — the docs-sidebar column); `float` (float-everything
|
|
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)
|
|
78
82
|
* @param {Function} onNavigate (event) => void — optional click handler on every link
|
|
79
83
|
* @param {string} rootMargin IntersectionObserver rootMargin passed to the
|
|
80
84
|
* spy. Default keeps the ported source's tighter
|
|
@@ -101,6 +105,7 @@ export default function DocsToc({
|
|
|
101
105
|
position = 'right',
|
|
102
106
|
minSections = 2,
|
|
103
107
|
ariaLabel = 'On this page',
|
|
108
|
+
numbered = true,
|
|
104
109
|
className = '',
|
|
105
110
|
}) {
|
|
106
111
|
/* Children are observed too, in document order; the active SECTION is the
|
|
@@ -111,6 +116,16 @@ export default function DocsToc({
|
|
|
111
116
|
)
|
|
112
117
|
const activeSection = toc.find((item) => item.id === activeId || item.children?.some((c) => c.id === activeId))?.id
|
|
113
118
|
|
|
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
|
+
|
|
114
129
|
if (variant === 'rail') {
|
|
115
130
|
return (
|
|
116
131
|
<TocRail
|
|
@@ -26,6 +26,10 @@ import { glyphSize, indicatorSize } from '../hooks/glyphLadders.js'
|
|
|
26
26
|
* differed by. Use the tone.
|
|
27
27
|
* variant="outline" — bordered trigger; open panel carries the
|
|
28
28
|
* 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, the current row lifted fg-16 with the dot, no hairline. Still rest and open only.
|
|
29
33
|
*
|
|
30
34
|
* Legacy aliases (pre-law variants, kept so call-sites don't break):
|
|
31
35
|
* default → primary · subtle → primary · minimal → outline
|
|
@@ -157,6 +161,7 @@ const Dropdown = ({
|
|
|
157
161
|
/* `variant="raised"` retires into `tone="faint"` (2026-10-31) — the alias, until nobody passes it */
|
|
158
162
|
if (variant === 'raised') { variant = undefined; tone = 'faint' }
|
|
159
163
|
const resolvedVariant = LEGACY_VARIANTS[variant] || variant
|
|
164
|
+
const float = resolvedVariant === 'float'
|
|
160
165
|
|
|
161
166
|
/* The panel is `Menu fused` (plan-2026-10-31-menu-engine W1.3): below the trigger, never flipped (the fused edge
|
|
162
167
|
* assumes below), the trigger's width, a listbox. */
|
|
@@ -212,8 +217,10 @@ const Dropdown = ({
|
|
|
212
217
|
* never leaks into Button's variant set */
|
|
213
218
|
resolvedVariant === 'grey' ? 'kol-dd-trigger--grey' : resolvedVariant === 'raised' ? 'kol-dd-trigger--raised' : resolvedVariant && `kol-btn-${resolvedVariant}`,
|
|
214
219
|
`kol-btn-${resolvedSize}`,
|
|
215
|
-
|
|
220
|
+
/* a float trigger types itself (Inter 500 at the float size) */
|
|
221
|
+
!float && SIZE_TYPE[resolvedSize],
|
|
216
222
|
'kol-dd-trigger',
|
|
223
|
+
float && 'kol-dd-trigger--float',
|
|
217
224
|
/* ICON-ONLY: the pinned square from Button's own class, so a tool-rail
|
|
218
225
|
* dropdown is the same box as the icon button beside it at every rung
|
|
219
226
|
* (editor-set-is-behind-its-source, kol-fxr 2026-09-03 — its ToolPalette
|
|
@@ -258,7 +265,7 @@ const Dropdown = ({
|
|
|
258
265
|
</span>
|
|
259
266
|
{/* chrome lives in .kol-dd-caret (trailing edge + open-state flip) —
|
|
260
267
|
* keyed off the trigger's data-state, no inline styles */}
|
|
261
|
-
<Icon name="chevron-down" size={indicatorSize(resolvedSize)} className="kol-dd-caret" />
|
|
268
|
+
<Icon name="chevron-down" size={float ? 'var(--kol-float-ic)' : indicatorSize(resolvedSize)} className="kol-dd-caret" />
|
|
262
269
|
</>
|
|
263
270
|
)}
|
|
264
271
|
{/* a consumer's own trigger mark — the tool-palette corner fold rides
|
|
@@ -277,7 +284,9 @@ const Dropdown = ({
|
|
|
277
284
|
closeOnSelect={!multiple}
|
|
278
285
|
rootClassName={`kol-dd-root relative inline-block align-middle ${className}`}
|
|
279
286
|
trigger={trig}
|
|
280
|
-
|
|
287
|
+
variant={float ? 'float' : undefined}
|
|
288
|
+
offset={float ? 8 : undefined}
|
|
289
|
+
panelClassName={`${resolvedVariant && !float ? `kol-dd-panel--${resolvedVariant}` : ''} ${toneClass(tone)} ${inPanel ? 'kol-hw-panel' : ''}`.replace(/\s+/g, ' ').trim()}
|
|
281
290
|
panelStyle={{
|
|
282
291
|
'--kol-dd-max-rows': maxRows ?? 10,
|
|
283
292
|
/* a row is the trigger's height; the panel's max-height reads it */
|
|
@@ -299,7 +308,9 @@ const Dropdown = ({
|
|
|
299
308
|
/* NO HOVER STATE ANYWHERE ON A DROPDOWN (user 2026-08-28) — the indicator marks the current value. */
|
|
300
309
|
hover={false}
|
|
301
310
|
size={resolvedSize}
|
|
302
|
-
|
|
311
|
+
/* a float row is the float list's (`.kol-menu-panel--float .kol-menu-row`), whatever the trigger's rung; the
|
|
312
|
+
* current one is lifted (row 54: "selected / checked") — still no hover */
|
|
313
|
+
rowClass={float ? `kol-menu-row${isActive ? ' kol-menu-row--current' : ''}` : (ROW[resolvedSize] ?? ROW.sm)}
|
|
303
314
|
height={rowHeight}
|
|
304
315
|
onPointerEnter={onOptionHover ? () => reportHover(option.value) : undefined}
|
|
305
316
|
onPointerLeave={onOptionHover ? () => reportHover(null) : undefined}
|
|
@@ -17,8 +17,22 @@
|
|
|
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.
|
|
20
24
|
*/
|
|
21
|
-
export default function EmptyState({ eyebrow, title, body, footer, gated = false, className = '' }) {
|
|
25
|
+
export default function EmptyState({ eyebrow, title, body, footer, gated = false, variant, className = '' }) {
|
|
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
|
+
}
|
|
22
36
|
return (
|
|
23
37
|
<div className={`${gated ? 'kol-placeholder' : ''}${className ? ` ${className}` : ''}` || undefined}>
|
|
24
38
|
{/* helper (line-height 1) is single-line chrome ONLY — title and footer
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Input from '../atoms/Input.jsx'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* FieldPair — Two fields on one line. `X 1471 · Y 516` (float-everything W3 row 38, 2026-11-04 — the exploration's
|
|
5
|
+
* two-up position fields). Two `Input`s 8 apart, each led by its letter (`prefix`), sharing one `variant` and `size`;
|
|
6
|
+
* the pair fills its row, each field half. A position, a size, a range — any two values that are read together.
|
|
7
|
+
*
|
|
8
|
+
* @param {Array} fields two Input prop sets — `[{ prefix: 'X', value, onChange, ... }, { prefix: 'Y', ... }]`
|
|
9
|
+
* @param {'float'|'filled'|'outline'} [variant] passed to both
|
|
10
|
+
* @param {'sm'|'md'|'lg'} [size] passed to both
|
|
11
|
+
* @param {string} [className]
|
|
12
|
+
*/
|
|
13
|
+
export default function FieldPair({ fields = [], variant, size, className = '' }) {
|
|
14
|
+
return (
|
|
15
|
+
<div className={`flex items-center gap-2 ${className}`.trim()}>
|
|
16
|
+
{fields.slice(0, 2).map((f, i) => (
|
|
17
|
+
<Input key={f.key ?? f.prefix ?? i} variant={variant} size={size} width="100%" className="flex-1 min-w-0" {...f} />
|
|
18
|
+
))}
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import TreeRow from './TreeRow.jsx'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* FlyoutRow — A destination in a hover flyout: glyph · name · count. `Tasks 5` (float-everything W8 row 123,
|
|
5
|
+
* 2026-11-04 — kol-float--style 48:3904). `TreeRow` at `md` — 34 tall, a 16 glyph, the 12 name, the count in mono —
|
|
6
|
+
* so a flyout lists the same rows as the sidebar it flies out of. Every TreeRow prop passes through.
|
|
7
|
+
*/
|
|
8
|
+
export default function FlyoutRow(props) {
|
|
9
|
+
return <TreeRow size="md" {...props} />
|
|
10
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
|
|
2
|
+
|
|
3
|
+
/* taxonomy-ok: molecule — nests ToggleCheckbox (atom). */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* IndexRow — One line of a dense index: check · title · columns. `□ Design the Tasks tab · Briefs · — · Open`
|
|
7
|
+
* (float-everything W8 row 117, 2026-11-04 — kol-float--style 48:3503). 28 tall on the list radius, 10 in: a float
|
|
8
|
+
* ToggleCheckbox (when `onCheck` is given), the title in `kol-float-hint` on the emphasis ink taking the room, then
|
|
9
|
+
* `cells` — short facts in fixed columns (`kol-float-label` on fg-64; a cell `{ value, mono: true }` is mono, a date or
|
|
10
|
+
* a count). `selected` lifts the row to fg-16; hover lifts it to fg-08. The whole row is the press.
|
|
11
|
+
*
|
|
12
|
+
* @param {ReactNode} title
|
|
13
|
+
* @param {Array<ReactNode|{value: ReactNode, mono?: boolean, width?: number}>} [cells] each 96 wide unless `width`
|
|
14
|
+
* @param {boolean} [checked] · {Function} [onCheck]
|
|
15
|
+
* @param {boolean} [selected]
|
|
16
|
+
* @param {Function} [onClick]
|
|
17
|
+
* @param {string} [className]
|
|
18
|
+
*/
|
|
19
|
+
export default function IndexRow({ title, cells = [], checked = false, onCheck, selected = false, onClick, className = '' }) {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
role={onClick ? 'button' : undefined}
|
|
23
|
+
tabIndex={onClick ? 0 : undefined}
|
|
24
|
+
onClick={onClick}
|
|
25
|
+
onKeyDown={onClick ? (e) => { if (e.key === 'Enter') onClick(e) } : undefined}
|
|
26
|
+
aria-selected={onClick ? selected : undefined}
|
|
27
|
+
className={`flex h-7 w-full items-center gap-3 rounded-[var(--kol-float-list-r)] px-2.5 ${onClick ? 'cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]' : ''} ${selected ? 'bg-fg-16' : 'hover:bg-fg-08'} ${className}`.trim()}
|
|
28
|
+
>
|
|
29
|
+
{onCheck && <span onClick={(e) => e.stopPropagation()} className="inline-flex shrink-0"><ToggleCheckbox variant="float" checked={checked} onChange={onCheck} aria-label="Done" /></span>}
|
|
30
|
+
<span className={`kol-float-hint min-w-0 flex-1 truncate ${checked ? 'text-fg-48' : 'text-fg-emphasis'}`}>{title}</span>
|
|
31
|
+
{cells.map((c, i) => {
|
|
32
|
+
const cell = c && typeof c === 'object' && 'value' in c ? c : { value: c }
|
|
33
|
+
return <span key={i} className={`${cell.mono ? 'kol-float-ruler' : 'kol-float-label'} shrink-0 truncate text-fg-64`} style={{ width: cell.width ?? 96 }}>{cell.value}</span>
|
|
34
|
+
})}
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import Input from '../atoms/Input.jsx'
|
|
3
|
+
import Kbd from '../atoms/Kbd.jsx'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* InlineAddRow — Add a row where the next row would be. `+ New brief · ↵` (float-everything W3 row 41, 2026-11-04 —
|
|
7
|
+
* the exploration's inline add). A full-width `Input` led by the plus and trailed by the return cap: type, press
|
|
8
|
+
* Enter, `onAdd(text)` fires and the field clears; Escape clears it. Nothing opens, nothing moves — the row is the
|
|
9
|
+
* form. `variant="float"` is the capsule on the well; the default is the filled shell.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} label the placeholder — what the row adds (`New brief`)
|
|
12
|
+
* @param {Function} onAdd `(text) => void` on Enter with a non-empty, trimmed value
|
|
13
|
+
* @param {boolean} [kbd] the ↵ cap at the end (default true)
|
|
14
|
+
* @param {'float'|'filled'|'outline'} [variant]
|
|
15
|
+
* @param {'sm'|'md'|'lg'} [size]
|
|
16
|
+
* @param {string} [className]
|
|
17
|
+
*/
|
|
18
|
+
export default function InlineAddRow({ label = 'Add', onAdd, kbd = true, variant, size, className = '', ...rest }) {
|
|
19
|
+
const [text, setText] = useState('')
|
|
20
|
+
return (
|
|
21
|
+
<Input
|
|
22
|
+
variant={variant}
|
|
23
|
+
size={size}
|
|
24
|
+
width="100%"
|
|
25
|
+
iconLeft="plus"
|
|
26
|
+
placeholder={label}
|
|
27
|
+
value={text}
|
|
28
|
+
onChange={(e) => setText(e.target.value)}
|
|
29
|
+
onKeyDown={(e) => {
|
|
30
|
+
if (e.key === 'Enter' && text.trim()) { onAdd?.(text.trim()); setText('') }
|
|
31
|
+
if (e.key === 'Escape') setText('')
|
|
32
|
+
}}
|
|
33
|
+
slotRight={kbd ? <Kbd size="sm" icon="corner-down-left" /> : undefined}
|
|
34
|
+
className={className}
|
|
35
|
+
{...rest}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
* variant — `'panel'` is the hardware panel label (was kol-hardware `PanelLabel`, merged
|
|
32
32
|
* 2026-10-01): `kol-helper-8`, uppercase, hugging the control; it takes
|
|
33
33
|
* `labelPosition` (`top · bottom · left · right`, default bottom), `labelClass` and `gap`.
|
|
34
|
+
* `'float'` (float-everything W3 row 37, 2026-11-04): the label over a capsule — the float hint role
|
|
35
|
+
* (Inter 12) at fg-64, 8 above the control, no uppercase, no tracking; `inline` keeps the same label.
|
|
34
36
|
* children — the control body.
|
|
35
37
|
* className — additional classes on the wrapper.
|
|
36
38
|
*/
|
|
@@ -63,6 +65,8 @@ export default function LabeledControl({
|
|
|
63
65
|
)
|
|
64
66
|
}
|
|
65
67
|
const showLabel = !!label
|
|
68
|
+
const float = variant === 'float'
|
|
69
|
+
const labelType = float ? 'kol-float-hint text-fg-64' : 'kol-helper-10 tracking-widest text-meta'
|
|
66
70
|
const labelInner = (
|
|
67
71
|
<>
|
|
68
72
|
{label}
|
|
@@ -87,7 +91,7 @@ export default function LabeledControl({
|
|
|
87
91
|
<span
|
|
88
92
|
/* A LABEL NEVER WRAPS (review 2, § 6.2 — the helper law by construction, 01-foundations/03-typography.md:29):
|
|
89
93
|
* `whitespace-nowrap truncate`, so a long one ends in an ellipsis instead of breaking onto a second line */
|
|
90
|
-
className={
|
|
94
|
+
className={`${labelType} whitespace-nowrap truncate${text ? ' leading-4' : ''} ${labelAuto ? 'max-w-full min-w-0 sm:flex-1' : 'shrink-0'}`}
|
|
91
95
|
style={labelAuto ? undefined : { width: labelWidth }}
|
|
92
96
|
>
|
|
93
97
|
{labelInner}
|
|
@@ -101,7 +105,7 @@ export default function LabeledControl({
|
|
|
101
105
|
return (
|
|
102
106
|
<div className={`flex flex-col gap-2 ${className}`}>
|
|
103
107
|
{showLabel && (
|
|
104
|
-
<span className=
|
|
108
|
+
<span className={labelType}>{labelInner}</span>
|
|
105
109
|
)}
|
|
106
110
|
{children}
|
|
107
111
|
</div>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
2
|
+
import TreeRow from './TreeRow.jsx'
|
|
3
|
+
|
|
4
|
+
/* taxonomy-ok: molecule — TreeRow (molecule) + kol-icons's Icon. */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* LayerRow — A layer in a layers list: glyph · name · eye · lock. `Orbit field` (float-everything W8 row 119,
|
|
8
|
+
* 2026-11-04 — kol-float--style 48:3546). `TreeRow` at `xs` (26, a 14 glyph, the 11 name) with two toggles at its end:
|
|
9
|
+
* the eye (`visible` · `onToggleVisible`) and the lock (`locked` · `onToggleLock`). The toggles stay on oq-64 and go
|
|
10
|
+
* oq-96 under the pointer; a hidden layer's name drops to fg-48 and its eye shows `eye-off`. `selected` lifts the row
|
|
11
|
+
* to fg-16.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} [icon='layers']
|
|
14
|
+
* @param {ReactNode} name
|
|
15
|
+
* @param {boolean} [selected]
|
|
16
|
+
* @param {boolean} [visible=true] · {Function} [onToggleVisible]
|
|
17
|
+
* @param {boolean} [locked=false] · {Function} [onToggleLock]
|
|
18
|
+
* @param {number} [depth=0]
|
|
19
|
+
* @param {Function} [onClick]
|
|
20
|
+
* @param {string} [className]
|
|
21
|
+
*/
|
|
22
|
+
export default function LayerRow({ icon = 'layers', name, selected = false, visible = true, onToggleVisible, locked = false, onToggleLock, depth = 0, onClick, className = '' }) {
|
|
23
|
+
const ctl = (label, glyph, on, fn) => (
|
|
24
|
+
<span
|
|
25
|
+
role="button"
|
|
26
|
+
tabIndex={0}
|
|
27
|
+
aria-label={label}
|
|
28
|
+
aria-pressed={on}
|
|
29
|
+
onClick={(e) => { e.stopPropagation(); fn?.() }}
|
|
30
|
+
onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); e.stopPropagation(); fn?.() } }}
|
|
31
|
+
className="inline-flex size-5 shrink-0 items-center justify-center rounded-full text-oq-64 hover:text-oq-96 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]"
|
|
32
|
+
>
|
|
33
|
+
<Icon name={glyph} size={12} />
|
|
34
|
+
</span>
|
|
35
|
+
)
|
|
36
|
+
return (
|
|
37
|
+
<TreeRow
|
|
38
|
+
size="xs"
|
|
39
|
+
icon={icon}
|
|
40
|
+
label={<span className={visible ? undefined : 'text-fg-48'}>{name}</span>}
|
|
41
|
+
active={selected}
|
|
42
|
+
depth={depth}
|
|
43
|
+
onClick={onClick}
|
|
44
|
+
className={`gap-2 pr-1.5 ${className}`.trim()}
|
|
45
|
+
trailing={(
|
|
46
|
+
<span className="flex shrink-0 items-center">
|
|
47
|
+
{ctl(visible ? 'Hide layer' : 'Show layer', visible ? 'eye-on' : 'eye-off', !visible, onToggleVisible)}
|
|
48
|
+
{ctl(locked ? 'Unlock layer' : 'Lock layer', locked ? 'lock' : 'unlock', locked, onToggleLock)}
|
|
49
|
+
</span>
|
|
50
|
+
)}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
3
|
+
import Input from '../atoms/Input.jsx'
|
|
4
|
+
import Button from '../atoms/Button.jsx'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* LinkAddRow — Add a named link. `name · URL · Add link` (float-everything W3 row 43, 2026-11-04 — the exploration's
|
|
8
|
+
* project links card). One row: the name field, the URL field (mono, `https://…`) taking the room, and the Add
|
|
9
|
+
* button; Enter in either field adds too. `onAdd({ name, url })` fires with both trimmed and the fields clear; the
|
|
10
|
+
* button is disabled until the URL has something. With `title` the row sits under a head — the title at the float
|
|
11
|
+
* body size with the open-in-new glyph linking to `href` — on a sheet (`--kol-float-menu-r`). `variant="float"`
|
|
12
|
+
* draws the capsules; the default is the filled shell.
|
|
13
|
+
*
|
|
14
|
+
* @param {Function} onAdd `({ name, url }) => void`
|
|
15
|
+
* @param {string} [title] the head's name (`kol-vault`)
|
|
16
|
+
* @param {string} [href] where the head's ↗ goes
|
|
17
|
+
* @param {string} [namePlaceholder] default `Link name`
|
|
18
|
+
* @param {string} [urlPlaceholder] default `https://…`
|
|
19
|
+
* @param {string} [addLabel] default `Add link`
|
|
20
|
+
* @param {'float'|'filled'|'outline'} [variant]
|
|
21
|
+
* @param {string} [className]
|
|
22
|
+
*/
|
|
23
|
+
export default function LinkAddRow({ onAdd, title, href, namePlaceholder = 'Link name', urlPlaceholder = 'https://…', addLabel = 'Add link', variant, className = '' }) {
|
|
24
|
+
const [name, setName] = useState('')
|
|
25
|
+
const [url, setUrl] = useState('')
|
|
26
|
+
const float = variant === 'float'
|
|
27
|
+
const ready = url.trim().length > 0
|
|
28
|
+
const add = () => { if (!ready) return; onAdd?.({ name: name.trim(), url: url.trim() }); setName(''); setUrl('') }
|
|
29
|
+
const onKey = (e) => { if (e.key === 'Enter') add() }
|
|
30
|
+
const row = (
|
|
31
|
+
/* one line where it fits; on a phone the fields wrap, the URL keeping at least 160 */
|
|
32
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
33
|
+
<Input variant={variant} size="md" placeholder={namePlaceholder} value={name} onChange={(e) => setName(e.target.value)} onKeyDown={onKey} className="w-64 max-w-full" />
|
|
34
|
+
<Input variant={variant} size="md" type="url" inputMode="url" placeholder={urlPlaceholder} value={url} onChange={(e) => setUrl(e.target.value)} onKeyDown={onKey} width="100%" className="flex-1 min-w-40" inputClassName="font-mono" />
|
|
35
|
+
<Button variant={float ? 'float' : undefined} size="md" tone={float ? 'secondary' : undefined} disabled={!ready} onClick={add}>{addLabel}</Button>
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
if (!title) return <div className={className}>{row}</div>
|
|
39
|
+
return (
|
|
40
|
+
<div className={`flex flex-col gap-4 ${float ? 'rounded-[var(--kol-float-menu-r)] bg-surface-secondary p-4' : ''} ${className}`.trim()}>
|
|
41
|
+
<div className="flex items-center justify-between gap-4">
|
|
42
|
+
<span className="kol-float-body text-fg-emphasis">{title}</span>
|
|
43
|
+
{href && (
|
|
44
|
+
<a href={href} target="_blank" rel="noreferrer" aria-label={`Open ${title}`} className="inline-flex text-oq-64 hover:text-oq-96 transition-colors">
|
|
45
|
+
<Icon name="arrow-upright" size={18} />
|
|
46
|
+
</a>
|
|
47
|
+
)}
|
|
48
|
+
</div>
|
|
49
|
+
{row}
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
}
|