@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,60 @@
|
|
|
1
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
2
|
+
import Button from '../atoms/Button.jsx'
|
|
3
|
+
import CloseButton from '../atoms/CloseButton.jsx'
|
|
4
|
+
|
|
5
|
+
/* taxonomy-ok: molecule — nests Button (atom) + CloseButton (utility). */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* QuickLookHeader — A window's title row. Lifted out of QuickLookFrame (float-everything W6 row 82, 2026-11-04) so a
|
|
9
|
+
* Dialog, a confirm and the utility window wear the same header. Unset `variant` is QuickLookFrame's header as it was,
|
|
10
|
+
* class for class: ‹ › n / N · the file's name · its facts · the actions · the close, on `.kol-quicklook-header`.
|
|
11
|
+
*
|
|
12
|
+
* `variant="float"` is the exploration's window header (kol-float--style 46:2500): the window's glyph (16, oq-64) · its
|
|
13
|
+
* title in `kol-float-panel` (Inter 13/500) · − minimise · × close, 12 apart, the controls quiet on oq-64 and bright
|
|
14
|
+
* under the pointer. No rule under it — the no-borders law holds on float.
|
|
15
|
+
*
|
|
16
|
+
* @param {'float'} [variant]
|
|
17
|
+
* @param {string} [icon] float: the window's glyph (`user`, `alert-triangle`, …)
|
|
18
|
+
* @param {ReactNode} title
|
|
19
|
+
* @param {ReactNode} [meta] default look: the facts after the name
|
|
20
|
+
* @param {ReactNode} [actions] controls before the close
|
|
21
|
+
* @param {Object} [nav] default look: `{ index, total, onPrev, onNext }`
|
|
22
|
+
* @param {Function} [onMinimise] float: shows the − control
|
|
23
|
+
* @param {Function} [onClose] shows the × control
|
|
24
|
+
* @param {string} [className]
|
|
25
|
+
*/
|
|
26
|
+
export default function QuickLookHeader({ variant, icon, title, meta, actions, nav, onMinimise, onClose, className = '' }) {
|
|
27
|
+
if (variant === 'float') {
|
|
28
|
+
const ctl = 'inline-flex size-6 shrink-0 items-center justify-center rounded-full text-oq-64 hover:text-oq-96 hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] cursor-pointer'
|
|
29
|
+
return (
|
|
30
|
+
<div className={`flex min-h-6 w-full items-center gap-3 ${className}`.trim()}>
|
|
31
|
+
{icon && <Icon name={icon} size={16} className="shrink-0 text-oq-64" />}
|
|
32
|
+
<span className="kol-float-panel min-w-0 flex-1 truncate text-fg-emphasis">{title}</span>
|
|
33
|
+
{actions}
|
|
34
|
+
{onMinimise && <button type="button" aria-label="Minimise" onClick={onMinimise} className={ctl}><Icon name="minus" size={14} /></button>}
|
|
35
|
+
{onClose && <button type="button" aria-label="Close" onClick={onClose} className={ctl}><Icon name="x" size={16} /></button>}
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
return (
|
|
40
|
+
<div className={`kol-quicklook-header ${className}`.trim()}>
|
|
41
|
+
{nav?.total > 1 && (
|
|
42
|
+
/* the pager is its own group: the count sits off the chevrons, and the group sits clear of
|
|
43
|
+
* the file's name (user 2026-09-23) */
|
|
44
|
+
<span className="flex items-center gap-1 mr-3">
|
|
45
|
+
<Button variant="nav" size="sm" iconOnly="chevron-left" onClick={nav.onPrev} aria-label="Previous" />
|
|
46
|
+
<Button variant="nav" size="sm" iconOnly="chevron-right" onClick={nav.onNext} aria-label="Next" />
|
|
47
|
+
<span className="kol-mono-12 text-meta tabular-nums ml-3">{nav.index + 1} / {nav.total}</span>
|
|
48
|
+
</span>
|
|
49
|
+
)}
|
|
50
|
+
{title && <span className="kol-mono-12 text-strong truncate">{title}</span>}
|
|
51
|
+
{meta && <span className="kol-mono-12 text-meta truncate">{meta}</span>}
|
|
52
|
+
<span className="flex-1" />
|
|
53
|
+
{actions}
|
|
54
|
+
{/* THE ESTATE'S CLOSE IDIOM, and every header control wears it (user 2026-09-23): bare at
|
|
55
|
+
* rest, a wash on hover — a filled container read as a second surface on the header. LAST, at the
|
|
56
|
+
* far right (user 2026-10-18: *"X should be space between justify on the right"*) */}
|
|
57
|
+
{onClose && <CloseButton size="sm" onClick={onClose} />}
|
|
58
|
+
</div>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
@@ -35,7 +35,7 @@ import Kbd from '../atoms/Kbd.jsx'
|
|
|
35
35
|
* @param {string} shortcutHint caller-authored kbd chip (e.g. "⌘K"); shown while the value is empty
|
|
36
36
|
* @param {Function} onFocus (event) => void — input focus
|
|
37
37
|
* @param {string} size 'xs' | 'sm' | 'md' — kol-control size + matched mono type class (xs = the panel rung, 2026-09-01)
|
|
38
|
-
* @param {string} variant 'filled' | 'ghost' | 'outline' — kol-control variant, same chrome as Input (ignored when bare/expanding)
|
|
38
|
+
* @param {string} variant 'filled' | 'ghost' | 'outline' — kol-control variant, same chrome as Input (ignored when bare/expanding) · `float` (float-everything W3 row 40, 2026-11-04): the capsule on the float well, Inter 500, the glyph 18, the ⌘K cap drawn (`shortcutHint="⌘K"`); the float heights by `size`
|
|
39
39
|
* @param {string} tone 'default' | 'inverse' — the dark chip for a washed plane (ControlToneInverse, 2026-08-27); on the expanding pill it is the OPEN fill
|
|
40
40
|
* @param {boolean} bare borderless inline field for overlay panels (full width, no shell chrome; keeps icon/clear/chip slots)
|
|
41
41
|
* @param {boolean} expanding round icon-button pill that animates open into an inline field
|
|
@@ -215,7 +215,8 @@ export default function SearchInput({
|
|
|
215
215
|
? `kol-control--bare kol-control-${size} flex w-full border border-transparent gap-2`
|
|
216
216
|
: `kol-control${variant ? ` kol-control--${variant}` : ''} kol-control-${size} gap-2${toneClass(tone) ? ` ${toneClass(tone)}` : ''}`,
|
|
217
217
|
'items-center cursor-text',
|
|
218
|
-
|
|
218
|
+
/* the float capsule types itself (Inter 500 at the float size, the theme's `.kol-control--float`) */
|
|
219
|
+
variant !== 'float' && SIZE_TYPE[size],
|
|
219
220
|
className,
|
|
220
221
|
].filter(Boolean).join(' ')
|
|
221
222
|
|
|
@@ -250,8 +251,8 @@ export default function SearchInput({
|
|
|
250
251
|
aria-hidden="true"
|
|
251
252
|
className={`flex items-center shrink-0 ${bare ? 'text-oq-48' : 'text-auto opacity-50'}`}
|
|
252
253
|
>
|
|
253
|
-
{/* ADJACENT — this glyph sits in the field's line box beside the query */}
|
|
254
|
-
<Icon name="search" size={iconSize ?? glyphSize(size)} />
|
|
254
|
+
{/* ADJACENT — this glyph sits in the field's line box beside the query; a float glyph is the float's 18 */}
|
|
255
|
+
<Icon name="search" size={iconSize ?? (variant === 'float' ? 'var(--kol-float-ic)' : glyphSize(size))} />
|
|
255
256
|
</span>
|
|
256
257
|
)}
|
|
257
258
|
<input
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
* to 724px — a document's own page (DocumentIndex). A level sets actions inline, and the bottom rhythm
|
|
49
49
|
* to `--kol-page-header-mb` (40px; content 16px). Unset = the section family as before.
|
|
50
50
|
* @param {ReactNode} media a mark above the eyebrow (a logo, an SVG) — with a `level` only
|
|
51
|
+
* @param {ReactNode} meta a fact at the far end of the HEADLINE's row (float-everything W9 row 140, 2026-11-04 —
|
|
52
|
+
* `Website traffic · kolkrabbi.io · Umami`): the source or scope, in mono on fg-64 (`kol-float-timecode`
|
|
53
|
+
* under `variant="float"`, else `kol-mono-12 text-meta`), baseline-aligned with the title. Unset, nothing
|
|
54
|
+
* `variant="float"` — the float page header (see SECTION_TEXT_LEVELS.float).
|
|
51
55
|
*/
|
|
52
56
|
export const HEADLINE_ROLE = {
|
|
53
57
|
pull: 'kol-section-text-pull',
|
|
@@ -74,6 +78,11 @@ export const SECTION_TEXT_LEVELS = {
|
|
|
74
78
|
/* document (DocumentIndexFigma, kol-atlas 2026-10-31) — the Research page header, the workspace sheet's: 36/1.2 bold
|
|
75
79
|
* display face at −0.005em, 12 under it; the lede 15/1.6 in the body face to a 724 edge */
|
|
76
80
|
document: { title: 'font-[family-name:var(--kol-font-family-sans)] text-[36px] font-bold leading-[1.2] tracking-[-0.005em]', lede: 'm-0 font-[family-name:var(--kol-font-family-sans-neutral)] text-[15px] leading-[1.6] text-fg-96', measure: '724px' },
|
|
81
|
+
/* float (float-everything W9 row 135, 2026-11-04 — kol-float--style 48:4542): the float page header — the eyebrow in
|
|
82
|
+
* mono (`kol-float-ruler`, fg-64, `STUDIO / WORKSPACE`), the title in `kol-float-sheet` (Inter 38/500), the subtitle
|
|
83
|
+
* in `kol-float-body` on fg-64; 8 between, 24 under. A section heading on the float is this with
|
|
84
|
+
* `headlineClass="kol-float-window"` and a `meta` (row 140). */
|
|
85
|
+
float: { title: 'kol-float-sheet', lede: 'kol-float-body text-fg-64', eyebrow: 'kol-float-ruler text-fg-64', gap: 'gap-2', mb: '24px' },
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
export default function SectionText({
|
|
@@ -124,6 +133,7 @@ export default function SectionText({
|
|
|
124
133
|
/* deprecated alias of `variant` (2026-10-31) */
|
|
125
134
|
level,
|
|
126
135
|
media,
|
|
136
|
+
meta,
|
|
127
137
|
}) {
|
|
128
138
|
/* a LEVEL fills the header defaults; an explicit prop always wins */
|
|
129
139
|
const variant = variantProp ?? level
|
|
@@ -153,7 +163,11 @@ export default function SectionText({
|
|
|
153
163
|
* *"more aligned like 'Studio'"* — it sat on the subtitle's line); centred on the title, not on its baseline */
|
|
154
164
|
const headRow = actionsPlacement === 'head' && !!actions && !!headline
|
|
155
165
|
const inlineHead = (actionsPlacement === 'inline' && !!actions && !body && !!headline) || headRow
|
|
156
|
-
const
|
|
166
|
+
const titleNode = headline && <Headline className={cls(`kol-section-text-headline ${headlineClass ?? (HEADLINE_ROLE[headlineSize] ?? HEADLINE_ROLE['heading-02'])}${headlineCase === 'upper' ? ' kol-section-text-caps' : ''}`, 'headline')} style={slotStyle.headline}>{headline}</Headline>
|
|
167
|
+
/* `meta` rides the headline's row, at its far end */
|
|
168
|
+
const headlineNode = titleNode && meta
|
|
169
|
+
? <div className="flex self-stretch items-baseline justify-between gap-6">{titleNode}<span className={`${variant === 'float' ? 'kol-float-timecode text-fg-64' : 'kol-mono-12 text-meta'} shrink-0`}>{meta}</span></div>
|
|
170
|
+
: titleNode
|
|
157
171
|
const bodyNode = body && (typeof body === 'string'
|
|
158
172
|
? <p className={cls(bodyClass, 'body')} style={slotStyle.body}>{body}</p>
|
|
159
173
|
: <div className={cls(bodyClass, 'body')} style={slotStyle.body}>{body}</div>)
|
package/src/molecules/Slider.jsx
CHANGED
|
@@ -44,7 +44,7 @@ import SliderPanel from './SliderPanel.jsx'
|
|
|
44
44
|
* @param {Object} props.style - forwarded to the wrapper; the seam for `--kol-slider-track` / `--kol-slider-playhead`
|
|
45
45
|
* @param {number} props.defaultValue - alt-click the control resets to this (falls back to `min`). Same contract on Knob
|
|
46
46
|
* @param {'input'|'value'|'none'} props.readout - `input` (default) an editable Input · `value` a plain right-aligned span, Knob's own display-only readout · `none`
|
|
47
|
-
* @param {'minimal'|'dual'|'scrub'|'panel'} props.variant - `dual` = two thumbs on one rail · `scrub` = a media scrubber: the thin track with the 4 × 28 pill knob (`.kol-playback-scrub`; `PlaybackBar`'s, 2026-10-02) · `panel` = the rack slider (was kol-hardware `Fader`, merged 2026-10-01): a drawn 2px track for a hardware panel; takes `value · onChange · min · max · step · label` plus `onHold`
|
|
47
|
+
* @param {'minimal'|'dual'|'scrub'|'panel'|'float'} props.variant - `dual` = two thumbs on one rail · `scrub` = a media scrubber: the thin track with the 4 × 28 pill knob (`.kol-playback-scrub`; `PlaybackBar`'s, 2026-10-02) · `panel` = the rack slider (was kol-hardware `Fader`, merged 2026-10-01): a drawn 2px track for a hardware panel; takes `value · onChange · min · max · step · label` plus `onHold` · `float` (float-everything W2 row 23, 2026-11-04): the label and a mono readout on one line, the 3px capsule track under them — the run fg-64 to a 12 thumb (`.kol-slider-float`); `readout` is `value` there, `formatValue` its words (`65%`)
|
|
48
48
|
* @param {'horizontal'|'vertical'} props.direction - `vertical` stands the track upright at `height`, label above and readout below (2026-10-02 — the volume ranges were hand-drawn for want of it). On `panel`, horizontal takes the row and shows a readout
|
|
49
49
|
* @param {number} props.height - vertical only — the track's length in px (default 96; panel 60)
|
|
50
50
|
* @param {string} props['aria-label'] - names the range when there is no visible `label`
|
|
@@ -255,6 +255,31 @@ const Slider = ({
|
|
|
255
255
|
const scrub = variant === 'scrub'
|
|
256
256
|
const length = vertical ? height ?? 96 : size
|
|
257
257
|
|
|
258
|
+
/* the float slider: label · readout above, the capsule track below; the run is the value as a percent on the track */
|
|
259
|
+
if (variant === 'float') {
|
|
260
|
+
const pct = max > min ? ((value - min) / (max - min)) * 100 : 0
|
|
261
|
+
return (
|
|
262
|
+
<div className={`flex flex-col gap-1 ${disabled ? 'opacity-40' : ''} ${className}`.trim()} style={{ ...(length ? { width: length } : null), ...style }} onClick={onAltReset}>
|
|
263
|
+
{(label || readout !== 'none') && (
|
|
264
|
+
<div className="flex items-center justify-between gap-3">
|
|
265
|
+
{label && <label htmlFor={sliderId} className="kol-float-hint text-fg-emphasis whitespace-nowrap">{label}</label>}
|
|
266
|
+
{readout !== 'none' && <span className="kol-float-timecode text-fg-emphasis">{displayValue}</span>}
|
|
267
|
+
</div>
|
|
268
|
+
)}
|
|
269
|
+
<input
|
|
270
|
+
id={sliderId}
|
|
271
|
+
type="range"
|
|
272
|
+
min={min} max={max} step={step} value={value}
|
|
273
|
+
onChange={handleChange}
|
|
274
|
+
disabled={disabled}
|
|
275
|
+
aria-label={ariaLabel}
|
|
276
|
+
className="kol-slider-float w-full min-w-0"
|
|
277
|
+
style={{ '--kol-slider-pct': `${pct}%` }}
|
|
278
|
+
/>
|
|
279
|
+
</div>
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
|
|
258
283
|
const labelNode = label && (
|
|
259
284
|
<label
|
|
260
285
|
htmlFor={sliderId}
|
|
@@ -8,8 +8,28 @@ import Divider from '../atoms/Divider.jsx'
|
|
|
8
8
|
*
|
|
9
9
|
* @param {Array<{label: string, value: ReactNode}>} items rows, keyed by label
|
|
10
10
|
* @param {boolean} framed wrap the list in leading + trailing Divider
|
|
11
|
+
* @param {'float'} [variant] `float` (float-everything W8 row 126, 2026-11-04 — kol-float--style 48:3982): the info
|
|
12
|
+
* sheet — `title` in Inter 16 (`kol-float-body-lg`) over key · value rows on the sheet radius
|
|
13
|
+
* (`--kol-float-menu-r`, surface-secondary, 24 in), no dividers (the no-borders law): the key in
|
|
14
|
+
* `kol-float-hint` on fg-64 in a 126 column, the value beside it in Inter 13 on the emphasis ink, 12 between rows
|
|
15
|
+
* @param {ReactNode} [title] float: the sheet's heading (`Book information`)
|
|
11
16
|
*/
|
|
12
|
-
export default function SpecList({ items = [], framed = false }) {
|
|
17
|
+
export default function SpecList({ items = [], framed = false, variant, title, className = '' }) {
|
|
18
|
+
if (variant === 'float') {
|
|
19
|
+
return (
|
|
20
|
+
<section className={`flex w-full flex-col gap-5 rounded-[var(--kol-float-menu-r)] bg-surface-secondary p-6 ${className}`.trim()}>
|
|
21
|
+
{title && <h3 className="kol-float-body-lg m-0 text-fg-emphasis">{title}</h3>}
|
|
22
|
+
<dl className="m-0 flex flex-col gap-3">
|
|
23
|
+
{items.map((item) => (
|
|
24
|
+
<div key={item.label} className="grid grid-cols-[126px_1fr] items-baseline gap-4">
|
|
25
|
+
<dt className="kol-float-hint text-fg-64">{item.label}</dt>
|
|
26
|
+
<dd className="kol-float-hint m-0 text-fg-emphasis" style={{ fontSize: 13 }}>{item.value}</dd>
|
|
27
|
+
</div>
|
|
28
|
+
))}
|
|
29
|
+
</dl>
|
|
30
|
+
</section>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
13
33
|
return (
|
|
14
34
|
<>
|
|
15
35
|
{framed && <Divider />}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SummaryLine — A label and its value on one line. `Estimated size · 18.4 MB` (float-everything W6 row 91, 2026-11-04 —
|
|
3
|
+
* kol-float--style 46:3057): the label at the left in `kol-float-hint` on fg-64, the value at the right in
|
|
4
|
+
* `kol-float-timecode` (JetBrains Mono 12) in the emphasis ink, tabular. The line under a form that says what the
|
|
5
|
+
* action will produce; no rule above it — a gap does that.
|
|
6
|
+
*
|
|
7
|
+
* @param {ReactNode} label
|
|
8
|
+
* @param {ReactNode} value
|
|
9
|
+
* @param {string} [className]
|
|
10
|
+
*/
|
|
11
|
+
export default function SummaryLine({ label, value, className = '' }) {
|
|
12
|
+
return (
|
|
13
|
+
<div className={`flex w-full items-baseline justify-between gap-4 ${className}`.trim()}>
|
|
14
|
+
<span className="kol-float-hint min-w-0 truncate text-fg-64">{label}</span>
|
|
15
|
+
<span className="kol-float-timecode shrink-0 tabular-nums text-fg-emphasis">{value}</span>
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -79,6 +79,18 @@ import { floatSurfaceClass } from '../utilities/tone.js'
|
|
|
79
79
|
* (FloatFoldBothSidesGrey, kol-fxr 2026-11-03)
|
|
80
80
|
* @param {'ground'|'handle'} [foldTone='ground'] the edge tab's look: `ground` is the pill's own; `handle` is the grey edge
|
|
81
81
|
* handle (iOS's), `--kol-oq-24` with an `--kol-oq-96` chevron, whatever the pill's `surface`
|
|
82
|
+
* THE FLOAT ROW'S PARTS (float-everything W5 rows 67 · 78 and W9 row 137, 2026-11-04 — kol-float--style 46:1948, 46:2316,
|
|
83
|
+
* 48:4586), `variant="float"` only:
|
|
84
|
+
* @param {'xs'|'sm'|'md'|'lg'} [size] `xs` — the inspector's chip tabs: 26 capsules in `kol-float-label`, 10 in, the
|
|
85
|
+
* selected one fg-16 (row 67); sm · md · lg are the float button heights
|
|
86
|
+
* @param {'mono'} [type] `mono` — text tabs: mono labels (`kol-float-timecode`) at the sm height on the list radius, the
|
|
87
|
+
* selected one FILLED fg-16, the rest fg-48 (row 137 — the underline's rule replaced by the fill)
|
|
88
|
+
* A float tab takes `icon` (before the label, oq) and `count` (after it, mono, fg-64) — `Tasks 5` (row 78).
|
|
89
|
+
* @param {'solid'|'glass-dark'|'glass-light'} [surface] on `float`: the row sits in its own capsule — the float material,
|
|
90
|
+
* 6 in, so `size="lg"` tabs make the 56 pill (row 78). Unset, the row is bare as before
|
|
91
|
+
* @param {ReactNode} [trailing] inside the pill, after the tabs: the float capsule's (with `surface`) or the stacked
|
|
92
|
+
* phone pill's — AppFloatNav's transport puts its Timecode here. With `trailing` the phone pill anchors its LEFT
|
|
93
|
+
* edge where a centred pill without it would start, so every slot stays where it was; it grows to the right
|
|
82
94
|
* Tabs are `{ id, label }` or `{ value, label }` (either key), plus `icon` for stacked; a stacked tab's `selected`
|
|
83
95
|
* lights it whatever `value` is — action slots (the transport) light more than one.
|
|
84
96
|
*/
|
|
@@ -106,16 +118,28 @@ export const tabbarPillSlot = (at, { count, labels = false, split = false } = {}
|
|
|
106
118
|
/* the collapse's motion — one duration for the width and the glyph swap (300, user 2026-10-23: 180 read as abrupt) */
|
|
107
119
|
const COLLAPSE_MS = 300
|
|
108
120
|
|
|
109
|
-
export default function TabsRow({ tabs: raw = [], value, onChange, onClose, onMinimise, variant, look: lookLegacy, type
|
|
121
|
+
export default function TabsRow({ tabs: raw = [], value, onChange, onClose, onMinimise, variant, look: lookLegacy, type, trailing, filled = false, placement = 'inline', shape = 'bar', collapsed = false, onExpand, edge, border, shadow, dock, active, foldable, folded, onFoldChange, foldSide, foldTone, surface, split, labels, size, tracked = false, overflow = 'scroll', ariaLabel, className, style }) {
|
|
110
122
|
const tabs = raw.map((t) => ({ ...t, id: t.id ?? t.value }))
|
|
111
123
|
const look = variant ?? lookLegacy ?? 'underline'
|
|
112
124
|
const wrap = overflow === 'wrap'
|
|
113
125
|
/* `float` (W16, round 3): the chip row as capsules — float heights, pills 4 apart, the selected one oq-16 */
|
|
114
|
-
if (look === 'float')
|
|
126
|
+
if (look === 'float') {
|
|
127
|
+
const row = <ChipTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 'md'} float floatType={type} ariaLabel={ariaLabel} className={`${wrap ? 'flex-wrap ' : ''}${surface ? '' : className ?? ''}`} />
|
|
128
|
+
/* the capsule (row 78): the float material, 6 in, the tabs then the trailing slot */
|
|
129
|
+
if (surface) {
|
|
130
|
+
return (
|
|
131
|
+
<div className={`inline-flex max-w-full items-center gap-1 rounded-full p-1.5 ${floatSurfaceClass(surface)} ${className ?? ''}`.trim()}>
|
|
132
|
+
<Overflow mode={overflow} value={value}>{row}</Overflow>
|
|
133
|
+
{trailing && <div className="flex shrink-0 items-center gap-1">{trailing}</div>}
|
|
134
|
+
</div>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
return <Overflow mode={overflow} value={value}>{row}</Overflow>
|
|
138
|
+
}
|
|
115
139
|
if (look === 'chip') return <Overflow mode={overflow} value={value}><ChipTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 'sm'} filled={filled} ariaLabel={ariaLabel} className={`${wrap ? 'flex-wrap ' : ''}${className ?? ''}`} /></Overflow>
|
|
116
140
|
if (look === 'text') return <Overflow mode={overflow} value={value}><TextTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 14} tracked={tracked} className={`${wrap ? 'flex-wrap gap-y-2 ' : ''}${className ?? 'gap-6'}`} style={style} /></Overflow>
|
|
117
|
-
if (look === 'stacked') return <StackedTabs tabs={tabs} value={value} onChange={onChange} placement={placement} shape={shape} collapsed={collapsed} onExpand={onExpand} edge={edge} border={border} shadow={shadow} dock={dock} active={active} foldable={foldable} folded={folded} onFoldChange={onFoldChange} foldSide={foldSide} foldTone={foldTone} surface={surface} split={split} labels={labels} ariaLabel={ariaLabel} className={className ?? ''} />
|
|
118
|
-
return <Overflow mode={overflow} value={value}><UnderlineTabs tabs={tabs} value={value} onChange={onChange} onClose={onClose} onMinimise={onMinimise} wrap={wrap} type={type} /></Overflow>
|
|
141
|
+
if (look === 'stacked') return <StackedTabs trailing={trailing} tabs={tabs} value={value} onChange={onChange} placement={placement} shape={shape} collapsed={collapsed} onExpand={onExpand} edge={edge} border={border} shadow={shadow} dock={dock} active={active} foldable={foldable} folded={folded} onFoldChange={onFoldChange} foldSide={foldSide} foldTone={foldTone} surface={surface} split={split} labels={labels} ariaLabel={ariaLabel} className={className ?? ''} />
|
|
142
|
+
return <Overflow mode={overflow} value={value}><UnderlineTabs tabs={tabs} value={value} onChange={onChange} onClose={onClose} onMinimise={onMinimise} wrap={wrap} type={type ?? 'mono'} /></Overflow>
|
|
119
143
|
}
|
|
120
144
|
|
|
121
145
|
/* `overflow="scroll"`: the row in a sideways scroller that fades its clipped edges and keeps the active tab (`data-active`)
|
|
@@ -138,11 +162,31 @@ function Overflow({ mode, value, children }) {
|
|
|
138
162
|
}
|
|
139
163
|
|
|
140
164
|
/* chip — TabChips verbatim */
|
|
141
|
-
function ChipTabs({ tabs, value, onChange, size, filled, float = false, ariaLabel, className }) {
|
|
165
|
+
function ChipTabs({ tabs, value, onChange, size, filled, float = false, floatType, ariaLabel, className }) {
|
|
166
|
+
/* the float's two plain rows — the inspector's 26 chips (xs) and the mono text tabs — are drawn here, not by Button:
|
|
167
|
+
* neither is a Button rung (26 is not a float height; a mono label is not the float button's type) */
|
|
168
|
+
const plain = float && (size === 'xs' || floatType === 'mono')
|
|
142
169
|
return (
|
|
143
170
|
<div className={`flex items-center ${filled ? 'gap-2' : 'gap-1'}${float ? ' kol-tabs-float' : ''} ${className}`.trim()} role="tablist" aria-label={ariaLabel}>
|
|
144
171
|
{tabs.map((t) => {
|
|
145
172
|
const active = t.id === value
|
|
173
|
+
if (plain) {
|
|
174
|
+
const mono = floatType === 'mono'
|
|
175
|
+
return (
|
|
176
|
+
<button key={t.id} type="button" role="tab" aria-selected={active} data-active={active || undefined} onClick={() => onChange?.(t.id)}
|
|
177
|
+
className={`inline-flex shrink-0 items-center whitespace-nowrap cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] ${mono ? 'kol-float-timecode h-[var(--kol-float-h-sm)] rounded-[var(--kol-float-list-r)] px-3' : 'kol-float-label h-[26px] rounded-full px-2.5'} ${active ? 'bg-fg-16 text-fg-emphasis' : `${mono ? 'text-fg-48' : 'text-fg-64'} hover:bg-fg-08 hover:text-fg-emphasis`}`}>
|
|
178
|
+
{t.label}
|
|
179
|
+
</button>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
if (float && (t.icon || t.count != null)) {
|
|
183
|
+
return (
|
|
184
|
+
<Button key={t.id} variant="float" size={size} iconLeft={t.icon} pressed={active} role="tab" aria-selected={active} aria-pressed={undefined} data-active={active || undefined} onClick={() => onChange?.(t.id)}>
|
|
185
|
+
{t.label}
|
|
186
|
+
{t.count != null && <span className="kol-float-ruler ml-0.5 tabular-nums text-fg-64">{t.count}</span>}
|
|
187
|
+
</Button>
|
|
188
|
+
)
|
|
189
|
+
}
|
|
146
190
|
return (
|
|
147
191
|
/* a tab is selected, not pressed — the role's own attribute replaces Button's aria-pressed */
|
|
148
192
|
<Button key={t.id} variant={float ? 'float' : filled ? 'tab-filled' : 'tab'} size={size} pressed={active} role="tab" aria-selected={active} aria-pressed={undefined} data-active={active || undefined} onClick={() => onChange?.(t.id)}>
|
|
@@ -177,7 +221,7 @@ function TextTabs({ tabs, value, onChange, size, tracked, className, style }) {
|
|
|
177
221
|
/* the fold: a sideways swipe past this folds the pill, as frame E's prototype measures it */
|
|
178
222
|
const FOLD_SWIPE = 40
|
|
179
223
|
|
|
180
|
-
function StackedTabs({ tabs, value, onChange, placement, shape = 'bar', collapsed = false, onExpand, edge = 'bottom', border = true, shadow = false, dock = false, active: activeShape = 'fill', foldable = false, folded: foldedProp, onFoldChange, foldSide: foldSideProp = 'left', foldTone = 'ground', surface = 'solid', split: splitProp = false, labels = false, ariaLabel = 'Sections', className }) {
|
|
224
|
+
function StackedTabs({ trailing, tabs, value, onChange, placement, shape = 'bar', collapsed = false, onExpand, edge = 'bottom', border = true, shadow = false, dock = false, active: activeShape = 'fill', foldable = false, folded: foldedProp, onFoldChange, foldSide: foldSideProp = 'left', foldTone = 'ground', surface = 'solid', split: splitProp = false, labels = false, ariaLabel = 'Sections', className }) {
|
|
181
225
|
const [foldedOwn, setFoldedOwn] = useState(false)
|
|
182
226
|
const swipe = useRef({ x: null, swiped: false })
|
|
183
227
|
const [swipeSide, setSwipeSide] = useState('left')
|
|
@@ -335,6 +379,8 @@ function StackedTabs({ tabs, value, onChange, placement, shape = 'bar', collapse
|
|
|
335
379
|
gap: TABBAR_PILL_SPLIT_GAP,
|
|
336
380
|
...(dock
|
|
337
381
|
? { left: 'calc(var(--kol-shell-rail-width, 48px) + 64px)', bottom: 64 }
|
|
382
|
+
/* with a trailing slot the pill grows rightward from where a centred one would start — the slots never move */
|
|
383
|
+
: trailing ? { left: `calc(50% - ${W / 2}px)`, [top ? 'top' : 'bottom']: inset }
|
|
338
384
|
: { right: `calc(50% - ${W / 2}px)`, [top ? 'top' : 'bottom']: inset }),
|
|
339
385
|
...swipeProps.style,
|
|
340
386
|
}}
|
|
@@ -344,7 +390,7 @@ function StackedTabs({ tabs, value, onChange, placement, shape = 'bar', collapse
|
|
|
344
390
|
className={`relative flex items-center rounded-full overflow-hidden ${material}`.trim()}
|
|
345
391
|
style={{
|
|
346
392
|
height: TABBAR_PILL_H,
|
|
347
|
-
width: isCollapsed && !split ? TABBAR_PILL_H : barW,
|
|
393
|
+
width: isCollapsed && !split ? TABBAR_PILL_H : trailing ? 'auto' : barW,
|
|
348
394
|
padding: labels ? 3 : 4,
|
|
349
395
|
border: edgeLine,
|
|
350
396
|
...solidLook,
|
|
@@ -354,6 +400,7 @@ function StackedTabs({ tabs, value, onChange, placement, shape = 'bar', collapse
|
|
|
354
400
|
}}
|
|
355
401
|
>
|
|
356
402
|
{row}
|
|
403
|
+
{trailing && !isCollapsed && <div className="flex flex-none items-center pl-3 pr-4">{trailing}</div>}
|
|
357
404
|
{closeX}
|
|
358
405
|
</div>
|
|
359
406
|
{split && tip(isCollapsed ? { id: last.id, label: 'Close' } : last, (
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
2
|
+
import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
|
|
3
|
+
|
|
4
|
+
/* taxonomy-ok: molecule — nests ToggleCheckbox (atom) + kol-icons's Icon. */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TaskRow — A task: check · title · date chip. `Design the Tasks tab · 2026-07-01` (float-everything W8 row 118,
|
|
8
|
+
* 2026-11-04 — kol-float--style 48:3522). The float ToggleCheckbox, the title in `kol-float-body-lg` on the emphasis
|
|
9
|
+
* ink (fg-48 and struck once done), and the date as a chip at the right: a capsule on the well (`--kol-float-well`,
|
|
10
|
+
* the field's ground) at the float md height, the calendar glyph on oq-64, the date in `kol-float-timecode`. `onDate`
|
|
11
|
+
* makes the chip a button (open your date picker there); without it the chip is a label. Lists end in an
|
|
12
|
+
* `InlineAddRow variant="float"` — the panel's `+ New brief`.
|
|
13
|
+
*
|
|
14
|
+
* @param {ReactNode} title
|
|
15
|
+
* @param {string} [date]
|
|
16
|
+
* @param {boolean} [done] · {Function} [onDone]
|
|
17
|
+
* @param {Function} [onDate]
|
|
18
|
+
* @param {Function} [onClick] the title's press
|
|
19
|
+
* @param {string} [className]
|
|
20
|
+
*/
|
|
21
|
+
export default function TaskRow({ title, date, done = false, onDone, onDate, onClick, className = '' }) {
|
|
22
|
+
const Chip = onDate ? 'button' : 'span'
|
|
23
|
+
return (
|
|
24
|
+
<div className={`flex min-h-[var(--kol-float-h-md)] w-full items-center gap-3 ${className}`.trim()}>
|
|
25
|
+
<ToggleCheckbox variant="float" checked={done} onChange={onDone} aria-label="Done" className="shrink-0" />
|
|
26
|
+
<span
|
|
27
|
+
onClick={onClick}
|
|
28
|
+
className={`kol-float-body-lg min-w-0 flex-1 truncate ${onClick ? 'cursor-pointer' : ''} ${done ? 'text-fg-48 line-through' : 'text-fg-emphasis'}`.trim()}
|
|
29
|
+
>
|
|
30
|
+
{title}
|
|
31
|
+
</span>
|
|
32
|
+
{date && (
|
|
33
|
+
<Chip
|
|
34
|
+
{...(onDate ? { type: 'button', onClick: onDate } : {})}
|
|
35
|
+
className={`inline-flex h-[var(--kol-float-h-md)] shrink-0 items-center gap-2 rounded-full bg-[var(--kol-float-well)] px-4 ${onDate ? 'cursor-pointer hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]' : ''}`.trim()}
|
|
36
|
+
>
|
|
37
|
+
<Icon name="calendar" size={14} className="text-oq-64" />
|
|
38
|
+
<span className="kol-float-timecode tabular-nums text-fg-64">{date}</span>
|
|
39
|
+
</Chip>
|
|
40
|
+
)}
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TocRow — One entry of a numbered contents list: `01 · First interlude` (float-everything W8 row 121, 2026-11-04 —
|
|
3
|
+
* kol-float--style 48:3582). 32 tall on the list radius, 12 in: the number in mono (`kol-float-ruler`, fg-64, two
|
|
4
|
+
* digits), 16 off it the title in `kol-float-hint`. `current` is where the reader is: the row lifts to fg-16 and the
|
|
5
|
+
* title takes the emphasis ink (`aria-current="location"`); the rest sit at fg-64 and brighten under the pointer.
|
|
6
|
+
* `DocsToc variant="float"` draws its list from these.
|
|
7
|
+
*
|
|
8
|
+
* @param {number|string} [number] padded to two digits when a number
|
|
9
|
+
* @param {ReactNode} label
|
|
10
|
+
* @param {boolean} [current]
|
|
11
|
+
* @param {string} [href]
|
|
12
|
+
* @param {Function} [onClick]
|
|
13
|
+
* @param {string} [className]
|
|
14
|
+
*/
|
|
15
|
+
export default function TocRow({ number, label, current = false, href, onClick, className = '' }) {
|
|
16
|
+
const Tag = href ? 'a' : 'button'
|
|
17
|
+
const n = typeof number === 'number' ? String(number).padStart(2, '0') : number
|
|
18
|
+
return (
|
|
19
|
+
<Tag
|
|
20
|
+
{...(href ? { href } : { type: 'button' })}
|
|
21
|
+
onClick={onClick}
|
|
22
|
+
aria-current={current ? 'location' : undefined}
|
|
23
|
+
className={`group flex h-8 w-full items-center gap-4 rounded-[var(--kol-float-list-r)] px-3 text-left no-underline cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] ${current ? 'bg-fg-16' : 'hover:bg-fg-08'} ${className}`.trim()}
|
|
24
|
+
>
|
|
25
|
+
{n != null && <span className="kol-float-ruler w-4 shrink-0 tabular-nums text-fg-64">{n}</span>}
|
|
26
|
+
<span className={`kol-float-hint min-w-0 flex-1 truncate ${current ? 'text-fg-emphasis' : 'text-fg-64 group-hover:text-fg-emphasis'}`}>{label}</span>
|
|
27
|
+
</Tag>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
2
|
+
|
|
3
|
+
/* taxonomy-ok: molecule — nests kol-icons's Icon. */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* TreeRow — One row of a float tree: glyph · name · count · chevron. (float-everything W8 rows 120 · 122 · 123,
|
|
7
|
+
* 2026-11-04 — kol-float--style 48:3564 tree row, 48:3606 nav item, 48:3904 flyout row.) The navigation rows of the
|
|
8
|
+
* float are one row at four sizes, so the sidebar, its flyout and the drawer read as one list:
|
|
9
|
+
*
|
|
10
|
+
* xs 26 · glyph 14 · `kol-float-label` (11) — a drawer's child row
|
|
11
|
+
* sm 32 · glyph 15 · `kol-float-hint` (12) — a tree's row, the sidebar's child row
|
|
12
|
+
* md 34 · glyph 16 · `kol-float-hint` (12) — a flyout's destination (`FlyoutRow`)
|
|
13
|
+
* lg 40 · glyph 18 · Inter 13 — the sidebar's nav item
|
|
14
|
+
*
|
|
15
|
+
* On the list radius (`--kol-float-list-r`), 10 in. At rest the name is fg-64 and the glyph oq-64; `active` lifts the
|
|
16
|
+
* row to fg-16 with the emphasis ink (the selection rule — translucent, so glass shows through); `open` is the parent
|
|
17
|
+
* of the active row: the emphasis ink, no lift. `count` sits right in mono (`kol-float-ruler`, fg-64). A row with
|
|
18
|
+
* `expanded` defined draws the chevron at its end — right when shut, down when open — and `onToggle` is its press.
|
|
19
|
+
*
|
|
20
|
+
* @param {'xs'|'sm'|'md'|'lg'} [size='sm']
|
|
21
|
+
* @param {string} [icon]
|
|
22
|
+
* @param {ReactNode} label
|
|
23
|
+
* @param {ReactNode} [count]
|
|
24
|
+
* @param {boolean} [active]
|
|
25
|
+
* @param {boolean} [open] the active row's parent — bright, not lifted
|
|
26
|
+
* @param {boolean} [expanded] defined → the chevron; true = down
|
|
27
|
+
* @param {Function} [onToggle] the chevron's press (else the row's own)
|
|
28
|
+
* @param {number} [depth=0] indent, 16 per level
|
|
29
|
+
* @param {string} [href] renders an anchor
|
|
30
|
+
* @param {Function} [onClick]
|
|
31
|
+
* @param {ReactNode} [trailing] controls at the end (LayerRow's eye and lock)
|
|
32
|
+
* @param {string} [className]
|
|
33
|
+
*/
|
|
34
|
+
export const TREE_ROW = {
|
|
35
|
+
xs: { h: 'h-[26px]', ic: 14, type: 'kol-float-label' },
|
|
36
|
+
sm: { h: 'h-8', ic: 15, type: 'kol-float-hint' },
|
|
37
|
+
md: { h: 'h-[34px]', ic: 16, type: 'kol-float-hint' },
|
|
38
|
+
lg: { h: 'h-10', ic: 18, type: 'font-[family-name:var(--kol-font-family-float)] text-[13px] leading-[18px]' },
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default function TreeRow({ size = 'sm', icon, label, count, active = false, open = false, expanded, onToggle, depth = 0, href, onClick, trailing, className = '', ...rest }) {
|
|
42
|
+
const S = TREE_ROW[size] ?? TREE_ROW.sm
|
|
43
|
+
const bright = active || open
|
|
44
|
+
const Tag = href ? 'a' : 'button'
|
|
45
|
+
const toggle = expanded !== undefined && (
|
|
46
|
+
<span
|
|
47
|
+
role={onToggle ? 'button' : undefined}
|
|
48
|
+
aria-label={onToggle ? (expanded ? 'Collapse' : 'Expand') : undefined}
|
|
49
|
+
onClick={onToggle ? (e) => { e.preventDefault(); e.stopPropagation(); onToggle() } : undefined}
|
|
50
|
+
className="inline-flex shrink-0 text-oq-64"
|
|
51
|
+
>
|
|
52
|
+
<Icon name={expanded ? 'chevron-down' : 'chevron-right'} size={12} />
|
|
53
|
+
</span>
|
|
54
|
+
)
|
|
55
|
+
return (
|
|
56
|
+
<Tag
|
|
57
|
+
{...(href ? { href } : { type: 'button' })}
|
|
58
|
+
onClick={onClick ?? (expanded !== undefined && !href ? onToggle : undefined)}
|
|
59
|
+
aria-current={active ? 'page' : undefined}
|
|
60
|
+
aria-expanded={expanded}
|
|
61
|
+
className={`group flex w-full ${S.h} shrink-0 items-center gap-2.5 rounded-[var(--kol-float-list-r)] pr-2.5 text-left no-underline cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] ${active ? 'bg-fg-16' : 'hover:bg-fg-08'} ${className}`.trim()}
|
|
62
|
+
style={{ paddingLeft: 10 + depth * 16 }}
|
|
63
|
+
{...rest}
|
|
64
|
+
>
|
|
65
|
+
{icon && <Icon name={icon} size={S.ic} className={`shrink-0 ${bright ? 'text-oq-96' : 'text-oq-64 group-hover:text-oq-96'}`} />}
|
|
66
|
+
<span className={`${S.type} min-w-0 flex-1 truncate ${bright ? 'text-fg-emphasis' : 'text-fg-64 group-hover:text-fg-emphasis'}`}>{label}</span>
|
|
67
|
+
{count != null && <span className="kol-float-ruler shrink-0 tabular-nums text-fg-64">{count}</span>}
|
|
68
|
+
{trailing}
|
|
69
|
+
{toggle}
|
|
70
|
+
</Tag>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Dropdown from './Dropdown.jsx'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WorkspaceSwitcher — Which workspace you are in. `WORKSPACE · Personal / Kolkrabbi ⌄` (float-everything W4 row 58,
|
|
5
|
+
* 2026-11-04 — the exploration's workspace selector at the top of a rail). A label in the float label role, tracked
|
|
6
|
+
* and uppercased, over a `Dropdown` of the workspaces; `variant="float"` is the float select on the well, the default
|
|
7
|
+
* the sm dropdown. A workspace is `{ value, label, icon? }`; a nested one reads `Studio / Personal` in its label.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} [label] default `Workspace`
|
|
10
|
+
* @param {Array} workspaces Dropdown options
|
|
11
|
+
* @param {string} value
|
|
12
|
+
* @param {Function} onChange `(value) => void`
|
|
13
|
+
* @param {'float'} [variant]
|
|
14
|
+
* @param {string} [className]
|
|
15
|
+
*/
|
|
16
|
+
export default function WorkspaceSwitcher({ label = 'Workspace', workspaces = [], value, onChange, variant, className = '' }) {
|
|
17
|
+
const float = variant === 'float'
|
|
18
|
+
return (
|
|
19
|
+
<div className={`inline-flex flex-col gap-3 ${className}`.trim()}>
|
|
20
|
+
<span className="kol-float-label uppercase tracking-[0.03em] text-fg-64">{label}</span>
|
|
21
|
+
<Dropdown variant={float ? 'float' : undefined} size={float ? 'md' : undefined} options={workspaces} value={value} onChange={onChange} ariaLabel={label} />
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -70,9 +70,13 @@ import { filterItems } from '../utilities/searchItems.js'
|
|
|
70
70
|
* @param {string} props.countClassName — the "N of N" type/ink
|
|
71
71
|
* @param {string} props.tone — 'default' | 'inverse' — forwarded to the search field (ControlToneInverse,
|
|
72
72
|
* 2026-08-27): a page on a wash sets its header row's tone in one place
|
|
73
|
+
* @param {'float'} props.variant — the float filter bar (float-everything W4 row 56, 2026-11-04): each group's
|
|
74
|
+
* chips are `Tag variant="float" size="md"` capsules with the count of items
|
|
75
|
+
* each would show, in a capsule track 5 in. Everything else stays.
|
|
73
76
|
*/
|
|
74
77
|
const ContentFilters = ({
|
|
75
78
|
tone = 'default',
|
|
79
|
+
variant,
|
|
76
80
|
items,
|
|
77
81
|
title,
|
|
78
82
|
totalCount,
|
|
@@ -320,6 +324,9 @@ const ContentFilters = ({
|
|
|
320
324
|
* rule sits in the components layer. */
|
|
321
325
|
const stacked = group.stack ?? index === 0
|
|
322
326
|
const first = index === 0 && stacked
|
|
327
|
+
const float = variant === 'float'
|
|
328
|
+
/* the float chip carries the count of items it would show (row 56) */
|
|
329
|
+
const countOf = (value) => items.filter((item) => { const v = item[group.key]; return Array.isArray(v) ? v.includes(value) : v === value }).length
|
|
323
330
|
return (
|
|
324
331
|
<div key={group.key} className={`flex flex-col gap-3 ${first ? 'kol-filters-first' : stacked ? 'shrink-0' : 'min-w-0 flex-1'} ${group.className ?? ''}`.trim()}>
|
|
325
332
|
{/* THE CATEGORY LABEL IS THE ACTIVE INK — `kol-helper-12` at `text-fg-96`,
|
|
@@ -337,16 +344,17 @@ const ContentFilters = ({
|
|
|
337
344
|
</h4>
|
|
338
345
|
{/* the fluid group keeps 48px of room on its right (it ran flush to the
|
|
339
346
|
* panel's edge); `group.wrapClassName` is the per-group seam */}
|
|
340
|
-
<div className={`${stacked ? 'flex flex-col items-start gap-2' : 'flex flex-wrap gap-2 pr-12'} ${group.wrapClassName ?? ''}`.trim()}>
|
|
347
|
+
<div className={`${float ? 'inline-flex self-start flex-wrap items-center gap-1 rounded-full bg-oq-04 p-[5px]' : stacked ? 'flex flex-col items-start gap-2' : 'flex flex-wrap gap-2 pr-12'} ${group.wrapClassName ?? ''}`.trim()}>
|
|
341
348
|
{group.values.map((value) => (
|
|
342
349
|
<Tag
|
|
343
350
|
key={value}
|
|
344
|
-
size={tagSize}
|
|
345
|
-
variant={tagVariant}
|
|
351
|
+
size={float ? 'md' : tagSize}
|
|
352
|
+
variant={float ? 'float' : tagVariant}
|
|
346
353
|
hash={false}
|
|
354
|
+
count={float ? countOf(value) : undefined}
|
|
347
355
|
active={activeFilters.has(`${group.key}:${value}`)}
|
|
348
356
|
onClick={() => toggleFilter(group.key, value)}
|
|
349
|
-
className={activeFilters.has(`${group.key}:${value}`) ? tagActiveClassName : tagRestClassName}
|
|
357
|
+
className={float ? undefined : activeFilters.has(`${group.key}:${value}`) ? tagActiveClassName : tagRestClassName}
|
|
350
358
|
>
|
|
351
359
|
{value}
|
|
352
360
|
</Tag>
|