@kolkrabbi/kol-component 0.333.2 → 0.334.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 +2 -2
- package/src/atoms/Avatar.jsx +1 -1
- 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/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 +13 -0
- package/src/molecules/AccountMenu.jsx +27 -0
- package/src/molecules/ColorField.jsx +30 -0
- package/src/molecules/ContextMenu.jsx +3 -2
- package/src/molecules/Dropdown.jsx +15 -4
- package/src/molecules/FieldPair.jsx +21 -0
- package/src/molecules/InlineAddRow.jsx +38 -0
- package/src/molecules/LabeledControl.jsx +6 -2
- package/src/molecules/LinkAddRow.jsx +52 -0
- package/src/molecules/Menu.jsx +46 -24
- package/src/molecules/MenuItem.jsx +8 -3
- package/src/molecules/PanelsMenu.jsx +34 -0
- package/src/molecules/PasswordInput.jsx +38 -0
- package/src/molecules/QuantityInput.jsx +17 -0
- package/src/molecules/SearchInput.jsx +5 -4
- package/src/molecules/Slider.jsx +26 -1
- package/src/molecules/WorkspaceSwitcher.jsx +24 -0
- package/src/organisms/ContentFilters.jsx +12 -4
|
@@ -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}
|
|
@@ -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,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,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
|
+
}
|
package/src/molecules/Menu.jsx
CHANGED
|
@@ -26,15 +26,28 @@ import { TONE_VARS } from '../utilities/tone.js'
|
|
|
26
26
|
* ]} />
|
|
27
27
|
*
|
|
28
28
|
* row keys: `icon` (kol-icons name or node) · `trailing` (+ `trailingSize`) · `current` fills the row · `indicator`
|
|
29
|
-
* 'dot' (single pick) | 'check' (many-of-N) | 'chevron' · `checked` = 'check' (before the `kbd` cap) · `kbd` · `disabled` + `tooltip` (why) · `items` (a flyout of the same rows)
|
|
29
|
+
* 'dot' (single pick) | 'check' (many-of-N) | 'chevron' · `checked` = 'check' (before the `kbd` cap) · `kbd` · `disabled` + `tooltip` (why) · `items` (a flyout of the same rows)
|
|
30
|
+
* · `tone: 'danger'` the destructive row (the error ink).
|
|
30
31
|
* `search` ({ placeholder, empty }) puts a search field above the rows and filters them by label.
|
|
31
32
|
* `children` sit above the rows.
|
|
33
|
+
*
|
|
34
|
+
* THE FLOAT LOOK (float-everything W4, 2026-11-04 — rows 46–60 of the gap map): `variant="float"` on any of them. The
|
|
35
|
+
* panel is a list on `--kol-float-list-r` (8), 4 in, the float surface and shadow; its rows are 34, 12 in, Inter 12/500,
|
|
36
|
+
* lifted on `--kol-fg-16`; a flyout opens 8 off the row on the same list. `MenuMore variant="float"` is the More sheet —
|
|
37
|
+
* `--kol-float-menu-r` (20), 6 in. `MenuTrigger variant="float"` is a `Button variant="float"` capsule on the float well;
|
|
38
|
+
* `MenuDatePicker variant="float"` sets its value in mono — the date chip (row 33). Today's defaults do not move.
|
|
32
39
|
*/
|
|
33
40
|
|
|
34
41
|
/* the ⋮ — kol-icons `more-vertical` (user 2026-10-31: *"just make a vertical version"* — was `more` turned 90°) */
|
|
35
42
|
const MORE = <Icon name="more-vertical" size={16} />
|
|
36
43
|
|
|
37
|
-
export function MenuTrigger({ open = false, iconOnly, icon, iconComponent, children, ...rest }) {
|
|
44
|
+
export function MenuTrigger({ open = false, iconOnly, icon, iconComponent, variant, mono = false, size, children, ...rest }) {
|
|
45
|
+
/* the float trigger: a capsule on the float well, lit fg-16 while its menu is open; `mono` for a value (the date chip) */
|
|
46
|
+
if (variant === 'float') {
|
|
47
|
+
const cls = `kol-menu-trigger kol-menu-trigger--float${mono ? ' kol-menu-trigger--mono' : ''} ${rest.className ?? ''}`.trim()
|
|
48
|
+
if (iconOnly) return <Button variant="float" size={size ?? 'md'} pressed={open} iconOnly={iconOnly === true ? 'more-vertical' : iconOnly} iconComponent={iconOnly === true ? MORE : iconComponent} {...rest} className={cls} />
|
|
49
|
+
return <Button variant="float" size={size ?? 'md'} pressed={open} iconLeft={icon} iconComponent={iconComponent} {...rest} className={cls}>{children}</Button>
|
|
50
|
+
}
|
|
38
51
|
if (iconOnly) {
|
|
39
52
|
return <Button variant="tab" size="sm" pressed={open} iconOnly={iconOnly === true ? 'more-vertical' : iconOnly} iconComponent={iconOnly === true ? MORE : iconComponent} {...rest} className={`kol-menu-trigger ${rest.className ?? ''}`.trim()} />
|
|
40
53
|
}
|
|
@@ -43,8 +56,11 @@ export function MenuTrigger({ open = false, iconOnly, icon, iconComponent, child
|
|
|
43
56
|
return <Button variant="tab" size="sm" pressed={open} iconLeft={icon} iconComponent={iconComponent} {...rest} className={`kol-menu-trigger kol-menu-trigger--quiet ${rest.className ?? ''}`.trim()}>{children}</Button>
|
|
44
57
|
}
|
|
45
58
|
|
|
46
|
-
|
|
47
|
-
|
|
59
|
+
/* `variant="float"` the list (8) · `sheet` the More sheet (20) on it */
|
|
60
|
+
const panelClass = (variant, sheet) => (variant === 'float' ? `kol-menu-panel--float${sheet ? ' kol-menu-panel--sheet' : ''}` : '')
|
|
61
|
+
|
|
62
|
+
export const MenuPanel = ({ variant, sheet = false, className = '', children, ...rest }) => (
|
|
63
|
+
<div className={`kol-menu-panel ${panelClass(variant, sheet)} ${className}`.replace(/\s+/g, ' ').trim()} {...rest}>{children}</div>
|
|
48
64
|
)
|
|
49
65
|
|
|
50
66
|
export const MenuLabel = ({ children }) => <div className="kol-menu-label kol-helper-12">{children}</div>
|
|
@@ -54,15 +70,17 @@ const glyph = (icon, size) => (typeof icon === 'string' ? <Icon name={icon} size
|
|
|
54
70
|
* `kbd` a key cap, `trailing` an icon name for an action (download) */
|
|
55
71
|
const indicatorOf = (it) => it.indicator ?? (it.checked ? 'check' : undefined)
|
|
56
72
|
|
|
57
|
-
function Rows({ items }) {
|
|
73
|
+
function Rows({ items, variant }) {
|
|
74
|
+
const float = variant === 'float'
|
|
58
75
|
return items.map((it, i) => {
|
|
59
76
|
if (it.divider) return <MenuDivider key={`d${i}`} className="kol-menu-rule" />
|
|
60
77
|
if (it.heading) return <MenuLabel key={`h${i}`}>{it.heading}</MenuLabel>
|
|
61
78
|
const icon = it.icon && <span className="text-oq-88 inline-flex">{glyph(it.icon, 16)}</span>
|
|
62
|
-
const cls = `kol-menu-row kol-helper-12${it.current ? ' kol-menu-row--current' : ''}`
|
|
79
|
+
const cls = `kol-menu-row kol-helper-12${it.current ? ' kol-menu-row--current' : ''}${it.tone === 'danger' ? ' kol-menu-row--danger' : ''}`
|
|
63
80
|
const row = it.items?.length && !it.disabled ? (
|
|
64
|
-
|
|
65
|
-
|
|
81
|
+
/* a float flyout is the same list, 8 off the row (row 55) */
|
|
82
|
+
<MenuFlyout flyout iconLeft={icon} label={it.label} rowClass={cls} panelClassName={`kol-menu-panel ${panelClass(variant)} min-w-[200px]`.replace(/\s+/g, ' ')} panelStyle={{ marginLeft: float ? 8 : 4 }}>
|
|
83
|
+
<Rows items={it.items} variant={variant} />
|
|
66
84
|
</MenuFlyout>
|
|
67
85
|
) : (
|
|
68
86
|
<MenuRow href={it.href} disabled={it.disabled} rowClass={cls} onClick={it.onClick} iconLeft={icon} indicator={indicatorOf(it)} kbd={it.kbd}
|
|
@@ -89,10 +107,12 @@ function Rows({ items }) {
|
|
|
89
107
|
* `kol-tone-*` wrapper floats on that tone's surface
|
|
90
108
|
* closeOnSelect false keeps the panel open while rows toggle (a multiselect)
|
|
91
109
|
* open / onOpenChange controlled, when the caller needs the state
|
|
110
|
+
* variant 'float' — the float list; `sheet` makes it the More sheet (20 radius, 6 in)
|
|
111
|
+
* offset the gap under the trigger (default 4; a fused panel sits at -1, a point anchor at 2 — pass one to override)
|
|
92
112
|
*/
|
|
93
113
|
export function Menu({
|
|
94
|
-
items, trigger, anchor, align = 'start', minWidth, offset
|
|
95
|
-
stayOpen = false, closeOnSelect = true, fused = false, search, role = 'menu',
|
|
114
|
+
items, trigger, anchor, align = 'start', minWidth, offset, defaultOpen = false, open: openProp, onOpenChange,
|
|
115
|
+
stayOpen = false, closeOnSelect = true, fused = false, search, role = 'menu', variant, sheet = false,
|
|
96
116
|
panelClassName = '', panelStyle, rootClassName, className = '', children,
|
|
97
117
|
}) {
|
|
98
118
|
const [own, setOwn] = useState(defaultOpen)
|
|
@@ -104,7 +124,7 @@ export function Menu({
|
|
|
104
124
|
open,
|
|
105
125
|
onOpenChange: setOpen,
|
|
106
126
|
placement: anchor ? 'right-start' : align === 'end' ? 'bottom-end' : 'bottom-start',
|
|
107
|
-
offset: fused ? -1 : anchor ? 2 :
|
|
127
|
+
offset: offset ?? (fused ? -1 : anchor ? 2 : 4),
|
|
108
128
|
flip: !fused,
|
|
109
129
|
matchReferenceWidth: fused,
|
|
110
130
|
click: !anchor,
|
|
@@ -148,13 +168,13 @@ export function Menu({
|
|
|
148
168
|
)}
|
|
149
169
|
{open && (
|
|
150
170
|
<PopoverPanel popover={popover} panel={false} focus={false}
|
|
151
|
-
className={`kol-menu-panel${fused ? ' kol-menu-panel--fused' : ' w-max'} ${panelClassName}`.trim()}
|
|
171
|
+
className={`kol-menu-panel${fused ? ' kol-menu-panel--fused' : ' w-max'} ${panelClass(variant, sheet)} ${panelClassName}`.replace(/\s+/g, ' ').trim()}
|
|
152
172
|
style={{ ...ambient, ...(minWidth ? { minWidth } : null), ...panelStyle }}>
|
|
153
173
|
{/* a row's click closes the menu (it bubbles from `[data-menu-item]`); a flyout row only toggles */}
|
|
154
174
|
<div role="none" className="flex flex-col min-h-0" onClick={(e) => { if (closeOnSelect && e.target.closest('[data-menu-item]')) setOpen(false) }}>
|
|
155
|
-
{search && <div className="pb-1"><SearchInput variant=
|
|
175
|
+
{search && <div className="pb-1"><SearchInput variant={variant === 'float' ? 'float' : 'outline'} size="sm" value={q} onChange={(e) => setQ(e.target?.value ?? e)} onClear={() => setQ('')} placeholder={search.placeholder || 'Search'} /></div>}
|
|
156
176
|
{typeof children === 'function' ? children({ close: () => setOpen(false) }) : children}
|
|
157
|
-
{rows.length > 0 && <Rows items={rows} />}
|
|
177
|
+
{rows.length > 0 && <Rows items={rows} variant={variant} />}
|
|
158
178
|
</div>
|
|
159
179
|
</PopoverPanel>
|
|
160
180
|
)}
|
|
@@ -172,7 +192,7 @@ export function Menu({
|
|
|
172
192
|
* the active filters live INSIDE the menu, an "Active" section on top (a row's click is `onPick` to edit it, its × is
|
|
173
193
|
* `onRemove(f)`, "Clear all" at 2+ is `onClear`), and the trigger holds its pressed ground while any is set. No count.
|
|
174
194
|
*/
|
|
175
|
-
export function MenuFilter({ groups = [], onPick, active = [], onRemove, onClear, label = 'Filter', icon = 'filter-lines', align = 'end', minWidth = 224 }) {
|
|
195
|
+
export function MenuFilter({ groups = [], onPick, active = [], onRemove, onClear, label = 'Filter', icon = 'filter-lines', align = 'end', minWidth = 224, variant }) {
|
|
176
196
|
const items = groups.map((g) => {
|
|
177
197
|
if (g.divider) return g
|
|
178
198
|
const one = g.fields?.length === 1 && !g.disabled
|
|
@@ -185,8 +205,8 @@ export function MenuFilter({ groups = [], onPick, active = [], onRemove, onClear
|
|
|
185
205
|
})
|
|
186
206
|
const rowCls = 'kol-menu-row kol-helper-12'
|
|
187
207
|
return (
|
|
188
|
-
<Menu align={align} minWidth={minWidth} offset={8} items={items}
|
|
189
|
-
trigger={({ open, props }) => <MenuTrigger open={open || active.length > 0} icon={icon} {...props}>{label}</MenuTrigger>}>
|
|
208
|
+
<Menu align={align} minWidth={minWidth} offset={8} items={items} variant={variant}
|
|
209
|
+
trigger={({ open, props }) => <MenuTrigger open={open || active.length > 0} icon={icon} variant={variant} {...props}>{label}</MenuTrigger>}>
|
|
190
210
|
{active.length > 0 && (
|
|
191
211
|
<>
|
|
192
212
|
<MenuLabel>Active</MenuLabel>
|
|
@@ -214,7 +234,7 @@ export function MenuFilter({ groups = [], onPick, active = [], onRemove, onClear
|
|
|
214
234
|
* trigger holds a value, so it wears its chip at rest — the tab's pressed oq-08, the panel's own ground, one family —
|
|
215
235
|
* and the panel opens right-aligned 8px under it (plausible.io measured: 8px, right edges flush).
|
|
216
236
|
*/
|
|
217
|
-
export function MenuDatePicker({ groups = [], value, onChange, label, icon = 'calendar', iconComponent, compare, align = 'end', minWidth = 224 }) {
|
|
237
|
+
export function MenuDatePicker({ groups = [], value, onChange, label, icon = 'calendar', iconComponent, compare, align = 'end', minWidth = 224, variant }) {
|
|
218
238
|
const items = [
|
|
219
239
|
...groups.flatMap((g, i) => [
|
|
220
240
|
...(i > 0 ? [{ divider: true }] : []),
|
|
@@ -222,16 +242,18 @@ export function MenuDatePicker({ groups = [], value, onChange, label, icon = 'ca
|
|
|
222
242
|
]),
|
|
223
243
|
...(compare ? [{ divider: true }, { key: 'compare', label: compare.label, kbd: compare.kbd, onClick: compare.onClick }] : []),
|
|
224
244
|
]
|
|
245
|
+
/* the float date chip (row 33): the value in mono on the well, the calendar glyph 16 */
|
|
225
246
|
return (
|
|
226
|
-
<Menu align={align} minWidth={minWidth} offset={8} items={items}
|
|
227
|
-
trigger={({ open, props }) => <MenuTrigger open={open} icon={icon} iconComponent={iconComponent} {...props}>{label}</MenuTrigger>} />
|
|
247
|
+
<Menu align={align} minWidth={minWidth} offset={8} items={items} variant={variant}
|
|
248
|
+
trigger={({ open, props }) => <MenuTrigger open={open} icon={icon} iconComponent={iconComponent} variant={variant} mono={variant === 'float'} {...props}>{label}</MenuTrigger>} />
|
|
228
249
|
)
|
|
229
250
|
}
|
|
230
251
|
|
|
231
|
-
/** MenuMore — the ⋮ chip and its rows (`items`, as `Menu`'s); `label` names it for a screen reader.
|
|
232
|
-
|
|
252
|
+
/** MenuMore — the ⋮ chip and its rows (`items`, as `Menu`'s); `label` names it for a screen reader. `variant="float"` is
|
|
253
|
+
* the More sheet (row 53): the ⋮ as a float circle, the rows in a sheet on `--kol-float-menu-r`. */
|
|
254
|
+
export function MenuMore({ label, items = [], align = 'end', minWidth = 224, defaultOpen, stayOpen, variant }) {
|
|
233
255
|
return (
|
|
234
|
-
<Menu align={align} minWidth={minWidth} offset={8} items={items} defaultOpen={defaultOpen} stayOpen={stayOpen}
|
|
235
|
-
trigger={({ open, props }) => <MenuTrigger open={open} iconOnly aria-label={label} {...props} />} />
|
|
256
|
+
<Menu align={align} minWidth={minWidth} offset={8} items={items} defaultOpen={defaultOpen} stayOpen={stayOpen} variant={variant} sheet={variant === 'float'}
|
|
257
|
+
trigger={({ open, props }) => <MenuTrigger open={open} iconOnly aria-label={label} variant={variant} {...props} />} />
|
|
236
258
|
)
|
|
237
259
|
}
|
|
@@ -106,6 +106,8 @@ export function MenuItem({
|
|
|
106
106
|
* single picks, definitely"*), `check` a row that is on in a many-of-N, `chevron` a row that opens more.
|
|
107
107
|
* - kbd — a key, drawn as `Kbd`. Nothing trails a row unless the caller passes one of these.
|
|
108
108
|
* - shortcut — @deprecated: the free trailing node the typed ✓ › ⌘S came through. A string renders as `Kbd`.
|
|
109
|
+
* - tone — `'danger'` (float-everything W4 row 50, 2026-11-04): the destructive row — the error ink, the same
|
|
110
|
+
* lift as every row (`.kol-menu-row--danger`). Delete layer, Remove, Sign out.
|
|
109
111
|
*/
|
|
110
112
|
/* the row follows the trigger's rung (DropdownXsList, kol-monitor 2026-09-01):
|
|
111
113
|
* at xs the list kept sm rows — kol-helper-12 in a 32px pitch — inside a panel
|
|
@@ -122,7 +124,7 @@ const ROW_BY_SIZE = { xs: 'kol-mono-8 px-2 h-5', sm: 'kol-helper-12 px-2 h-8', m
|
|
|
122
124
|
* row still fills a fixed panel through `w-full` and lets a content-sized one hug its longest label. */
|
|
123
125
|
const INDICATOR = { dot: 'ascii-dot', check: 'check', chevron: 'chevron-right' }
|
|
124
126
|
|
|
125
|
-
export function MenuRow({ href, onClick, onPointerEnter, onPointerLeave, disabled, prefix, iconLeft, indicator, kbd, shortcut, hover = true, height, size = 'sm', rowClass, children }) {
|
|
127
|
+
export function MenuRow({ href, onClick, onPointerEnter, onPointerLeave, disabled, prefix, iconLeft, indicator, kbd, shortcut, hover = true, height, size = 'sm', rowClass, tone, children }) {
|
|
126
128
|
/* `href` makes the row a real link — cmd/ctrl-click and middle-click open a new tab (DocumentHeader, 2026-10-31);
|
|
127
129
|
* a plain click still runs `onClick` (the app's router), which may preventDefault */
|
|
128
130
|
const Row = href && !disabled ? 'a' : 'button'
|
|
@@ -135,7 +137,7 @@ export function MenuRow({ href, onClick, onPointerEnter, onPointerLeave, disable
|
|
|
135
137
|
disabled={Row === 'button' ? disabled : undefined}
|
|
136
138
|
role="menuitem"
|
|
137
139
|
style={height != null ? { height } : undefined}
|
|
138
|
-
className={`kol-menu-btn w-full ${rowClass ?? ROW_BY_SIZE[size] ?? ROW_BY_SIZE.sm} shrink-0 flex items-center gap-2 text-body ${hover ? 'hover:text-emphasis' : ''} disabled:opacity-40 disabled:cursor-not-allowed text-left
|
|
140
|
+
className={`kol-menu-btn w-full ${rowClass ?? ROW_BY_SIZE[size] ?? ROW_BY_SIZE.sm} shrink-0 flex items-center gap-2 text-body ${hover ? 'hover:text-emphasis' : ''} ${tone === 'danger' ? 'kol-menu-row--danger' : ''} disabled:opacity-40 disabled:cursor-not-allowed text-left`.replace(/\s+/g, ' ')}
|
|
139
141
|
>
|
|
140
142
|
{prefix && <span className="shrink-0 inline-flex items-center">{prefix}</span>}
|
|
141
143
|
{iconLeft && <span className="shrink-0 w-4 inline-flex items-center justify-center">{iconLeft}</span>}
|
|
@@ -151,7 +153,10 @@ export function MenuRow({ href, onClick, onPointerEnter, onPointerLeave, disable
|
|
|
151
153
|
{indicator === 'dot'
|
|
152
154
|
? <Icon name="ascii-dot" size={size === 'xs' ? 16 : 24} style={{ margin: size === 'xs' ? -4 : -5 }} />
|
|
153
155
|
: indicator && <Icon name={INDICATOR[indicator] ?? indicator} size={size === 'xs' ? indicatorSize('xs') : 14} />}
|
|
154
|
-
{
|
|
156
|
+
{/* ⌘ is drawn, never typed — the Kbd's `command` glyph (as SearchInput's and Button's caps; W2 row 27, 2026-11-04) */}
|
|
157
|
+
{kbd != null && (typeof kbd === 'string' && kbd.startsWith('⌘')
|
|
158
|
+
? <Kbd size="md" icon="command" className="kol-menu-kbd">{kbd.slice(1)}</Kbd>
|
|
159
|
+
: <Kbd size="md" className="kol-menu-kbd">{kbd}</Kbd>)}
|
|
155
160
|
{typeof shortcut === 'string' ? <Kbd size="md" className="kol-menu-kbd">{shortcut}</Kbd> : shortcut}
|
|
156
161
|
</span>
|
|
157
162
|
)}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Button from '../atoms/Button.jsx'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* PanelsMenu — Which panels are shown, and the button that changes it. `Side panel · Hidden · Show` (float-everything
|
|
5
|
+
* W4 row 57, 2026-11-04 — the exploration's workspace panels menu). A float sheet (`--kol-float-menu-r`, 16 in) with
|
|
6
|
+
* a title and one row per panel on the list radius: the panel's name over its meta at the left, its state in the
|
|
7
|
+
* middle, its action as a float button at the end — `primary` draws the inverted capsule (the one the user most
|
|
8
|
+
* likely wants: Show), the rest the secondary tone. A press is `onAction(panel)`.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} [title] default `Workspace panels`
|
|
11
|
+
* @param {Array} panels `[{ id, name, meta?, state, action, primary?, onAction? }]` — `state` the word
|
|
12
|
+
* (`Hidden`, `Folded`), `action` the button's (`Show`, `Expand`)
|
|
13
|
+
* @param {Function} [onAction] `(panel) => void`, after the panel's own `onAction`
|
|
14
|
+
* @param {string} [className]
|
|
15
|
+
*/
|
|
16
|
+
export default function PanelsMenu({ title = 'Workspace panels', panels = [], onAction, className = '' }) {
|
|
17
|
+
return (
|
|
18
|
+
<div className={`flex w-full max-w-md flex-col gap-3 rounded-[var(--kol-float-menu-r)] bg-surface-secondary p-4 ${className}`.trim()}>
|
|
19
|
+
<span className="kol-float-panel text-fg-emphasis">{title}</span>
|
|
20
|
+
<ul className="flex flex-col gap-2">
|
|
21
|
+
{panels.map((p) => (
|
|
22
|
+
<li key={p.id ?? p.name} className="flex items-center gap-4 rounded-[var(--kol-float-list-r)] bg-[var(--kol-float-well)] py-2 pl-4 pr-2">
|
|
23
|
+
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
24
|
+
<span className="kol-float-hint truncate text-fg-emphasis">{p.name}</span>
|
|
25
|
+
{p.meta && <span className="kol-float-label truncate text-fg-64">{p.meta}</span>}
|
|
26
|
+
</span>
|
|
27
|
+
{p.state && <span className="kol-float-label shrink-0 text-fg-64">{p.state}</span>}
|
|
28
|
+
<Button variant="float" size="md" tone={p.primary ? 'inverted' : 'secondary'} className="shrink-0 min-w-20" onClick={() => { p.onAction?.(p); onAction?.(p) }}>{p.action}</Button>
|
|
29
|
+
</li>
|
|
30
|
+
))}
|
|
31
|
+
</ul>
|
|
32
|
+
</div>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
3
|
+
import Input from '../atoms/Input.jsx'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* PasswordInput — A password field with its reveal. `•••••••••••• 👁` (float-everything W3 row 39, 2026-11-04 — the
|
|
7
|
+
* exploration's password field). An `Input type="password"` with the eye at its trailing edge (`eye-on` masked,
|
|
8
|
+
* `eye-off` revealed; 16, oq-64 to oq-96): a press flips the type, the field keeps focus. Every Input prop passes
|
|
9
|
+
* through — `variant="float"` is the capsule, `error` the message under it.
|
|
10
|
+
*
|
|
11
|
+
* @param {boolean} [revealed] controlled reveal; omit for internal state
|
|
12
|
+
* @param {Function} [onRevealChange] `(revealed) => void`
|
|
13
|
+
* @param {string} [revealLabel] the eye's aria-label (default `Show password` / `Hide password`)
|
|
14
|
+
*/
|
|
15
|
+
export default function PasswordInput({ revealed, onRevealChange, revealLabel, ...rest }) {
|
|
16
|
+
const [own, setOwn] = useState(false)
|
|
17
|
+
const shown = revealed ?? own
|
|
18
|
+
const toggle = () => { if (revealed === undefined) setOwn(!shown); onRevealChange?.(!shown) }
|
|
19
|
+
return (
|
|
20
|
+
<Input
|
|
21
|
+
type={shown ? 'text' : 'password'}
|
|
22
|
+
autoComplete="current-password"
|
|
23
|
+
{...rest}
|
|
24
|
+
slotRight={
|
|
25
|
+
<button
|
|
26
|
+
type="button"
|
|
27
|
+
aria-label={revealLabel ?? (shown ? 'Hide password' : 'Show password')}
|
|
28
|
+
aria-pressed={shown}
|
|
29
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
30
|
+
onClick={toggle}
|
|
31
|
+
className="inline-flex items-center justify-center shrink-0 cursor-pointer text-oq-64 hover:text-oq-96 transition-colors outline-none focus-visible:[box-shadow:var(--kol-float-focus)] rounded-full"
|
|
32
|
+
>
|
|
33
|
+
<Icon name={shown ? 'eye-off' : 'eye-on'} size={16} />
|
|
34
|
+
</button>
|
|
35
|
+
}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -19,8 +19,12 @@ import { useEffect, useState } from 'react'
|
|
|
19
19
|
* @param {number} max upper bound (default 99)
|
|
20
20
|
* @param {string} controls 'chevron' (default) | 'split'
|
|
21
21
|
* @param {string} size 'sm' | 'md' | 'lg' — pins the responsive size
|
|
22
|
+
* @param {'float'} variant the float stepper (float-everything W2 row 24, 2026-11-04): a 36 capsule on the float
|
|
23
|
+
* well, − value + in Inter 500 (the glyphs oq, 40% at a bound), the float heights by `size`
|
|
22
24
|
* @param {string} className extra classes on the root
|
|
23
25
|
*/
|
|
26
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
27
|
+
const FLOAT_H = { sm: 'h-[var(--kol-float-h-sm)]', md: 'h-[var(--kol-float-h-md)]', lg: 'h-[var(--kol-float-h-lg)]' }
|
|
24
28
|
|
|
25
29
|
const SIZE_MAP = {
|
|
26
30
|
sm: { fontSize: 11, paddingY: 12, paddingX: 24, radius: 20, icon: 10 },
|
|
@@ -35,6 +39,7 @@ const QuantityInput = ({
|
|
|
35
39
|
max = 99,
|
|
36
40
|
controls = 'chevron',
|
|
37
41
|
size,
|
|
42
|
+
variant,
|
|
38
43
|
className = '',
|
|
39
44
|
}) => {
|
|
40
45
|
const [resolvedSize, setResolvedSize] = useState('md')
|
|
@@ -69,6 +74,18 @@ const QuantityInput = ({
|
|
|
69
74
|
const increment = () => { if (value < max) onChange?.(value + 1) }
|
|
70
75
|
const decrement = () => { if (value > min) onChange?.(value - 1) }
|
|
71
76
|
|
|
77
|
+
/* the float stepper: one capsule, the glyphs at each end, the value between */
|
|
78
|
+
if (variant === 'float') {
|
|
79
|
+
const btn = 'inline-flex h-full w-8 shrink-0 items-center justify-center rounded-full text-oq-64 hover:text-oq-96 disabled:opacity-40 disabled:hover:text-oq-64 cursor-pointer disabled:cursor-not-allowed outline-none focus-visible:[box-shadow:var(--kol-float-focus)] transition-colors'
|
|
80
|
+
return (
|
|
81
|
+
<div className={`inline-flex items-center rounded-full bg-[var(--kol-float-well)] px-1 kol-float-panel text-fg-emphasis ${FLOAT_H[size] ?? FLOAT_H.md} ${className}`.trim()}>
|
|
82
|
+
<button type="button" onClick={decrement} disabled={value <= min} className={btn} aria-label="Decrease quantity"><Icon name="minus" size={14} /></button>
|
|
83
|
+
<span className="min-w-6 text-center tabular-nums">{value}</span>
|
|
84
|
+
<button type="button" onClick={increment} disabled={value >= max} className={btn} aria-label="Increase quantity"><Icon name="plus" size={14} /></button>
|
|
85
|
+
</div>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
72
89
|
/* controls="split" — the − value + pill (formerly QuantityStepper). */
|
|
73
90
|
if (controls === 'split') {
|
|
74
91
|
const btn = (disabled) => ({
|
|
@@ -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
|
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}
|