@kolkrabbi/kol-component 0.368.0 → 0.370.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 +1 -1
- package/src/index.js +4 -2
- package/src/molecules/ContextMenu.jsx +1 -1
- package/src/molecules/Dropdown.jsx +1 -1
- package/src/molecules/LabeledControl.jsx +27 -10
- package/src/molecules/LayerRow.jsx +3 -2
- package/src/molecules/Menu.jsx +2 -2
- package/src/molecules/MenuItem.jsx +1 -1
- package/src/molecules/Modal.jsx +9 -6
- package/src/molecules/ReadingSettings.jsx +11 -18
- package/src/molecules/SettingsControls.jsx +54 -52
- package/src/molecules/Slider.jsx +28 -31
- package/src/organisms/CommandOverlay.jsx +1 -1
- package/src/organisms/SettingsPanel.jsx +46 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -184,9 +184,11 @@ export { ModalProvider, useModal, Dialog } from './molecules/Modal.jsx'
|
|
|
184
184
|
export { default as ModalShell } from './molecules/ModalShell.jsx'
|
|
185
185
|
/* the generator settings window's controls (plan-2026-11-05-float-editor W7.2) — `Dialog variant="settings"`'s rows */
|
|
186
186
|
export {
|
|
187
|
-
|
|
188
|
-
SettingsText, SettingsPoint, SettingsRamp, SettingsRampHead, SettingsLights, SettingsFieldMap,
|
|
187
|
+
SettingsGrid, SettingsCell, SettingsSlider, SettingsRange, SettingsSelect, SettingsSegmented, SettingsToggle,
|
|
188
|
+
SettingsText, SettingsPoint, SettingsRamp, SettingsRampHead, SettingsLights, SettingsFieldMap,
|
|
189
189
|
} from './molecules/SettingsControls.jsx'
|
|
190
|
+
/* the window's groups sit beside the section they draw (W13.1); SettingsGroup is deprecated for it */
|
|
191
|
+
export { SettingsGroup, SettingsDisclosure } from './organisms/SettingsPanel.jsx'
|
|
190
192
|
export { default as Combobox } from './molecules/Combobox.jsx'
|
|
191
193
|
export { default as PaletteHarmonyWheel } from './molecules/PaletteHarmonyWheel.jsx'
|
|
192
194
|
export { default as PropertyInput } from './molecules/PropertyInput.jsx'
|
|
@@ -54,7 +54,7 @@ export default function ContextMenu({ menu, children, variant, className = '' })
|
|
|
54
54
|
<Menu anchor={{ x: menu.x, y: menu.y }} open onOpenChange={(v) => { if (!v) menu.close() }} variant={variant} panelClassName={`min-w-44 ${className}`.trim()}>
|
|
55
55
|
{/* Any click inside closes — a menu item that leaves the menu open after acting is the one interaction people
|
|
56
56
|
* report as broken. Items keep their own onClick; this runs after it on the way up. */}
|
|
57
|
-
<div onClick={menu.close} role="none" className="flex flex-col">
|
|
57
|
+
<div onClick={menu.close} role="none" className="flex flex-col gap-[var(--kol-spacing-0-5)]">
|
|
58
58
|
{typeof children === 'function' ? children(menu.payload) : children}
|
|
59
59
|
</div>
|
|
60
60
|
</Menu>
|
|
@@ -334,7 +334,7 @@ const Dropdown = ({
|
|
|
334
334
|
* not"*). One rule: an open dropdown has the line. */}
|
|
335
335
|
<div className="kol-dd-div" />
|
|
336
336
|
|
|
337
|
-
<div ref={listRef} className="kol-dd-list" role="listbox" aria-multiselectable={multiple || undefined} style={scale !== 1 ? { zoom: scale } : undefined}>
|
|
337
|
+
<div ref={listRef} className="kol-dd-list flex flex-col gap-[var(--kol-spacing-0-5)]" role="listbox" aria-multiselectable={multiple || undefined} style={scale !== 1 ? { zoom: scale } : undefined}>
|
|
338
338
|
<MenuList items={items} dividerClassName="my-1" headingClassName={headingCls} />
|
|
339
339
|
</div>
|
|
340
340
|
</Menu>
|
|
@@ -39,9 +39,20 @@
|
|
|
39
39
|
* the same label in the `--kol-float-label-w` column (a `labelWidth` still wins), the row at least the float
|
|
40
40
|
* sm height. Every float row is this (plan-2026-11-12-float-system W2.1); the wrapper carries
|
|
41
41
|
* `data-labeled-control`.
|
|
42
|
+
* `'settings'` (plan-2026-11-12-float-rails-figma W13.1): the generator settings window's row (`Dialog
|
|
43
|
+
* variant="settings"`): the label in Inter 10 at oq-64, 6 over the control; `horizontal` puts it beside the
|
|
44
|
+
* control, 8 apart, the label hugging its text (a `labelWidth` still sets a column).
|
|
45
|
+
* labelClass — the label's type and ink, replacing the variant's (a row that keeps its own label look: Slider's
|
|
46
|
+
* kol-helper-12, a toggle's words in the settings ink). On `panel` it defaults to kol-helper-8.
|
|
42
47
|
* children — the control body.
|
|
43
|
-
* className — additional classes on the wrapper.
|
|
48
|
+
* className — additional classes on the wrapper. A display class in it (`hidden`, `inline-flex`, `grid`…) replaces
|
|
49
|
+
* the wrapper's `flex`, so a caller's `hidden md:flex` holds; a `gap-*` replaces the variant's gap. Any other prop (`style`, `onClick`, `data-*`)
|
|
50
|
+
* lands on the wrapper.
|
|
44
51
|
*/
|
|
52
|
+
/* the settings window's label (Dialog variant="settings"): Inter 10 on a 12 line at oq-64 */
|
|
53
|
+
const SETTINGS_LABEL = 'text-[10px] leading-[12px] text-oq-64 font-(family-name:--kol-font-family-float)'
|
|
54
|
+
const DISPLAY = /(^|\s)(hidden|block|inline-block|flex|inline-flex|grid|inline-grid|contents)(?=\s|$)/
|
|
55
|
+
|
|
45
56
|
export default function LabeledControl({
|
|
46
57
|
label,
|
|
47
58
|
hint,
|
|
@@ -53,13 +64,14 @@ export default function LabeledControl({
|
|
|
53
64
|
text = false,
|
|
54
65
|
variant,
|
|
55
66
|
labelPosition = 'bottom',
|
|
56
|
-
labelClass
|
|
67
|
+
labelClass,
|
|
57
68
|
gap = 0,
|
|
69
|
+
...rest
|
|
58
70
|
}) {
|
|
59
71
|
if (variant === 'panel') {
|
|
60
72
|
const isRow = labelPosition === 'left' || labelPosition === 'right'
|
|
61
73
|
const labelEl = label && (
|
|
62
|
-
<span className={`${labelClass} text-fg-32`} style={{ textTransform: 'uppercase', lineHeight: 1 }}>
|
|
74
|
+
<span className={`${labelClass ?? 'kol-helper-8'} text-fg-32`} style={{ textTransform: 'uppercase', lineHeight: 1 }}>
|
|
63
75
|
{label}
|
|
64
76
|
</span>
|
|
65
77
|
)
|
|
@@ -73,10 +85,15 @@ export default function LabeledControl({
|
|
|
73
85
|
}
|
|
74
86
|
const showLabel = !!label
|
|
75
87
|
const float = variant === 'float'
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const
|
|
88
|
+
const settings = variant === 'settings'
|
|
89
|
+
const lw = labelWidth ?? (float ? 'var(--kol-float-label-w)' : settings ? 'fit-content' : 48)
|
|
90
|
+
const gapClass = float ? 'gap-[var(--kol-float-label-gap)]' : settings ? (horizontal ?? inline ? 'gap-2' : 'gap-1.5') : null
|
|
91
|
+
const mark = { 'data-labeled-control': '', ...rest }
|
|
92
|
+
const labelType = labelClass ?? (float ? 'kol-float-hint text-fg-64' : settings ? SETTINGS_LABEL : 'kol-helper-10 tracking-widest text-meta')
|
|
93
|
+
/* a display class from the caller replaces the wrapper's own (`hidden md:flex` must hold) */
|
|
94
|
+
const display = DISPLAY.test(className) ? '' : 'flex'
|
|
95
|
+
/* …and so does a gap class: the caller's spacing, not two utilities racing */
|
|
96
|
+
const ownGap = /(^|\s)gap-/.test(className)
|
|
80
97
|
const labelInner = (
|
|
81
98
|
<>
|
|
82
99
|
{label}
|
|
@@ -96,7 +113,7 @@ export default function LabeledControl({
|
|
|
96
113
|
* showed as "C" or not at all. Label on its line, the value under it. */
|
|
97
114
|
const labelAuto = lw === 'auto'
|
|
98
115
|
return (
|
|
99
|
-
<div {...mark} className={
|
|
116
|
+
<div {...mark} className={`${display} ${labelAuto ? `flex-col items-start gap-1 sm:flex-row ${text ? 'sm:items-baseline' : 'sm:items-center'} sm:gap-3` : `${text ? 'items-baseline' : 'items-center'} ${ownGap ? '' : gapClass ?? 'gap-3'}`}${float ? ' min-h-[var(--kol-float-h-sm)]' : ''} ${className}`}>
|
|
100
117
|
{showLabel && (
|
|
101
118
|
<span
|
|
102
119
|
/* A LABEL NEVER WRAPS (review 2, § 6.2 — the helper law by construction, 01-foundations/03-typography.md:29):
|
|
@@ -107,13 +124,13 @@ export default function LabeledControl({
|
|
|
107
124
|
{labelInner}
|
|
108
125
|
</span>
|
|
109
126
|
)}
|
|
110
|
-
<div className={`${text ? 'flex ' : ''}${labelAuto ? 'min-w-0 max-w-full sm:overflow-hidden' : 'flex-1 min-w-0'}`}>{children}</div>
|
|
127
|
+
<div className={`${text ? 'flex ' : settings ? 'flex items-center ' : ''}${labelAuto ? 'min-w-0 max-w-full sm:overflow-hidden' : 'flex-1 min-w-0'}`}>{children}</div>
|
|
111
128
|
</div>
|
|
112
129
|
)
|
|
113
130
|
}
|
|
114
131
|
|
|
115
132
|
return (
|
|
116
|
-
<div {...mark} className={
|
|
133
|
+
<div {...mark} className={`${display} flex-col ${ownGap ? '' : gapClass ?? 'gap-2'} ${className}`}>
|
|
117
134
|
{showLabel && (
|
|
118
135
|
<span className={labelType}>{labelInner}</span>
|
|
119
136
|
)}
|
|
@@ -10,7 +10,8 @@ import TreeRow from './TreeRow.jsx'
|
|
|
10
10
|
* the eye (`visible` · `onToggleVisible`) and the lock (`locked` · `onToggleLock`), each drawn only when its handler is
|
|
11
11
|
* given (PropertyRail's selected line has an eye and no lock, plan-2026-11-12-float-rails-figma W8.1). The toggles stay
|
|
12
12
|
* on oq-64 and go oq-96 under the pointer; a hidden layer's name drops to fg-48 and its eye shows `eye-off`. `selected`
|
|
13
|
-
* lifts the row to fg-
|
|
13
|
+
* lifts the row to fg-12 with its name at full emphasis and its glyphs on oq-96, fill only (the LayerStack selected row, the user's pick 2026-11-12;
|
|
14
|
+
* it was fg-16).
|
|
14
15
|
*
|
|
15
16
|
* `variant="head"` is the same part as the selected object's line at the top of an inspector (PropertyRail's `selected`,
|
|
16
17
|
* plan-2026-11-12-float-rails-figma W8.1, the user: *"'select' why is this not a component?!?!"*; decided for his review):
|
|
@@ -60,7 +61,7 @@ export default function LayerRow({ variant = 'row', icon = 'layers', name, selec
|
|
|
60
61
|
active={selected}
|
|
61
62
|
depth={depth}
|
|
62
63
|
onClick={onClick}
|
|
63
|
-
className={`gap-2 pr-1.5 ${className}`.trim()}
|
|
64
|
+
className={`gap-2 pr-1.5 ${selected ? '!bg-(--kol-fg-12) !text-(--kol-fg-emphasis) [&_svg]:!text-(--kol-oq-96)' : ''} ${className}`.replace(/\s+/g, ' ').trim()}
|
|
64
65
|
trailing={(onToggleVisible || onToggleLock) && (
|
|
65
66
|
<span className="flex shrink-0 items-center">
|
|
66
67
|
{onToggleVisible && ctl(visible ? 'Hide layer' : 'Show layer', visible ? 'eye-on' : 'eye-off', !visible, onToggleVisible)}
|
package/src/molecules/Menu.jsx
CHANGED
|
@@ -58,7 +58,7 @@ export function MenuTrigger({ open = false, iconOnly, icon, iconComponent, varia
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export const MenuPanel = ({ variant, sheet = false, className = '', children, ...rest }) => (
|
|
61
|
-
<div className={`kol-menu-panel ${panelClass(variant, sheet)} ${className}`.replace(/\s+/g, ' ').trim()} {...rest}>{children}</div>
|
|
61
|
+
<div className={`kol-menu-panel flex flex-col gap-[var(--kol-spacing-0-5)] ${panelClass(variant, sheet)} ${className}`.replace(/\s+/g, ' ').trim()} {...rest}>{children}</div>
|
|
62
62
|
)
|
|
63
63
|
|
|
64
64
|
export { MenuLabel }
|
|
@@ -138,7 +138,7 @@ export function Menu({
|
|
|
138
138
|
className={`kol-menu-panel${fused ? ' kol-menu-panel--fused' : ' w-max'} ${panelClass(variant, sheet)} ${panelClassName}`.replace(/\s+/g, ' ').trim()}
|
|
139
139
|
style={{ ...ambient, ...(minWidth ? { minWidth } : null), ...panelStyle }}>
|
|
140
140
|
{/* a row's click closes the menu (it bubbles from `[data-menu-item]`); a flyout row only toggles */}
|
|
141
|
-
<div role="none" className="flex flex-col min-h-0" onClick={(e) => { if (closeOnSelect && e.target.closest('[data-menu-item]')) setOpen(false) }}>
|
|
141
|
+
<div role="none" className="flex flex-col gap-[var(--kol-spacing-0-5)] min-h-0" onClick={(e) => { if (closeOnSelect && e.target.closest('[data-menu-item]')) setOpen(false) }}>
|
|
142
142
|
<MenuList items={items} search={search} variant={variant}>
|
|
143
143
|
{typeof children === 'function' ? children({ close: () => setOpen(false) }) : children}
|
|
144
144
|
</MenuList>
|
|
@@ -295,7 +295,7 @@ function MenuFlyoutNest({ prefix, iconLeft, label, disabled, scroll, rowClass, p
|
|
|
295
295
|
<div
|
|
296
296
|
ref={panel}
|
|
297
297
|
role="menu"
|
|
298
|
-
className={`absolute ${fit.flip ? 'right-full' : 'left-full'} flex flex-col w-max min-w-[180px] max-w-[320px] z-10 ${panelClassName ?? 'py-1 bg-surface-secondary rounded border border-oq-08 shadow-lg'} ${scroll ? 'max-h-[60vh] overflow-y-auto' : ''}`}
|
|
298
|
+
className={`absolute ${fit.flip ? 'right-full' : 'left-full'} flex flex-col gap-[var(--kol-spacing-0-5)] w-max min-w-[180px] max-w-[320px] z-10 ${panelClassName ?? 'py-1 bg-surface-secondary rounded border border-oq-08 shadow-lg'} ${scroll ? 'max-h-[60vh] overflow-y-auto' : ''}`}
|
|
299
299
|
style={{ top: -5 + fit.dy, ...(fit.flip && panelStyle?.marginLeft != null ? { ...panelStyle, marginLeft: undefined, marginRight: panelStyle.marginLeft } : panelStyle) }}
|
|
300
300
|
>
|
|
301
301
|
{children}
|
package/src/molecules/Modal.jsx
CHANGED
|
@@ -347,7 +347,8 @@ export function useModal() {
|
|
|
347
347
|
* `variant="settings"` (plan-2026-11-05-float-editor W7.1 — his "Stripe Array settings modal", Figma 7K5v68l4tblHPFuiLdokRu
|
|
348
348
|
* 12:2282, 880 × 656): the generator's settings window. A 60 header (the `title` in Inter 14 semibold, `kind` beside it in
|
|
349
349
|
* the hint ink, `headerEnd` — the preset select — and the ×), a 156 section list on the primary surface (`sections`
|
|
350
|
-
* `[{ key, label, state }]` — the name and a one-line state, the lit one
|
|
350
|
+
* `[{ key, label, state }]` — the name and a one-line state, 6 apart; the lit one carries its 2px marker and no fill,
|
|
351
|
+
* hover the only fill (LAW 16, plan-2026-11-12-float-rails-figma W13.1; it sat on oq-12 until then); `section` /
|
|
351
352
|
* `onSection`), the body (`children`, 24 in, scrolling), an `aside` column 248 wide (the preview), and a 60 `footer`. The
|
|
352
353
|
* secondary surface, a 16 round, oq-16 rules between the parts — his frame draws them. `height` (default 656) and
|
|
353
354
|
* `width` (default 880) are its size; both shrink to the viewport.
|
|
@@ -380,10 +381,12 @@ export function Dialog({ open, onClose, title, width = 560, variant = 'lift', ic
|
|
|
380
381
|
<header className="flex items-center gap-4 h-[60px] shrink-0 pl-6 pr-[22px] border-b border-oq-16">
|
|
381
382
|
<h2 className="text-[14px] font-semibold leading-none">{title}</h2>
|
|
382
383
|
{kind && <span className="text-[11px] text-oq-64 leading-none mt-px">{kind}</span>}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
384
|
+
{/* `end`: the header's right side pushed by its own margin, no spacer (LAW 10) */}
|
|
385
|
+
<div className="ml-auto flex items-center gap-4">
|
|
386
|
+
{headerEnd}
|
|
387
|
+
<button type="button" aria-label="Close" onClick={onClose}
|
|
388
|
+
className="ml-3 size-7 -mr-[7px] inline-flex items-center justify-center rounded-md text-[20px] leading-none text-oq-64 hover:text-(--kol-fg-96) hover:bg-(--kol-oq-08) focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">×</button>
|
|
389
|
+
</div>
|
|
387
390
|
</header>
|
|
388
391
|
)}
|
|
389
392
|
footer={footer && <footer className="flex items-center gap-3 h-[60px] shrink-0 px-6 border-t border-oq-16">{footer}</footer>}>
|
|
@@ -406,7 +409,7 @@ export function Dialog({ open, onClose, title, width = 560, variant = 'lift', ic
|
|
|
406
409
|
return (
|
|
407
410
|
<button key={s.key} type="button" role="tab" aria-selected={lit} data-section={s.key} tabIndex={lit ? 0 : -1}
|
|
408
411
|
onClick={() => onSection?.(s.key)}
|
|
409
|
-
className={`relative h-[45px] shrink-0 flex flex-col items-start justify-center gap-[5px] px-3 rounded-md text-left focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]
|
|
412
|
+
className={`relative h-[45px] shrink-0 flex flex-col items-start justify-center gap-[5px] px-3 rounded-md text-left focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] hover:bg-(--kol-oq-08)`}>
|
|
410
413
|
{lit && <span aria-hidden="true" className="absolute left-0 top-[13px] h-[18px] w-0.5 rounded-[1px] bg-fg-96" />}
|
|
411
414
|
<span className={`text-[11px] leading-[13px] text-fg-96 ${lit ? 'font-medium' : ''}`}>{s.label}</span>
|
|
412
415
|
{s.state != null && <span className="text-[10px] leading-[12px] text-oq-64">{s.state}</span>}
|
|
@@ -2,15 +2,17 @@ import Button from '../atoms/Button.jsx'
|
|
|
2
2
|
import Dropdown from './Dropdown.jsx'
|
|
3
3
|
import QuantityInput from './QuantityInput.jsx'
|
|
4
4
|
import TabsRow from './TabsRow.jsx'
|
|
5
|
+
import LabeledControl from './LabeledControl.jsx'
|
|
5
6
|
|
|
6
|
-
/* taxonomy-ok: molecule — float Dropdowns, QuantityInput, TabsRow and Button
|
|
7
|
+
/* taxonomy-ok: molecule — float Dropdowns, QuantityInput, TabsRow and Button, each in a float LabeledControl */
|
|
7
8
|
|
|
8
9
|
const TRACK = 'w-full rounded-full bg-[var(--kol-float-well)] p-1 [&>button]:flex-1 [&>button]:justify-center'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* ReadingSettings — How the text is set: the Reading side of `ReadingPanel` (float-everything W11 row 151, 2026-11-04 —
|
|
12
|
-
* kol-float--style W2.9 `Contextual reading panel · Reading`). Each setting
|
|
13
|
-
*
|
|
13
|
+
* kol-float--style W2.9 `Contextual reading panel · Reading`). Each setting is a `LabeledControl variant="float"` (the
|
|
14
|
+
* float label, as written, 8 over the control — plan-2026-11-12-float-rails-figma W12.1; it drew its own uppercase
|
|
15
|
+
* `kol-float-ruler` label until then), 24 between: the theme pick (`themes` — a row of kol-styleguide `ThemeTile`s; kol-component cannot import
|
|
14
16
|
* it), the face as a float Dropdown, the size as the float QuantityInput (`22 px`), leading and width as float
|
|
15
17
|
* Dropdowns, the page flow as the float chip track (Scroll · Pages, fg-16 on the well), and `Reset defaults` as the
|
|
16
18
|
* secondary float capsule. Every control is a shipped float part, worn whole.
|
|
@@ -28,25 +30,16 @@ const TRACK = 'w-full rounded-full bg-[var(--kol-float-well)] p-1 [&>button]:fle
|
|
|
28
30
|
const LABELS = { theme: 'Theme', font: 'Font', size: 'Text size', leading: 'Line height', width: 'Reading width', flow: 'Page flow' }
|
|
29
31
|
const FLOWS = [{ value: 'scroll', label: 'Scroll' }, { value: 'pages', label: 'Pages' }]
|
|
30
32
|
|
|
31
|
-
function Field({ label, children }) {
|
|
32
|
-
return (
|
|
33
|
-
<div className="flex flex-col gap-2.5">
|
|
34
|
-
<span className="kol-float-ruler uppercase text-fg-64">{label}</span>
|
|
35
|
-
{children}
|
|
36
|
-
</div>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
33
|
export default function ReadingSettings({ themes, font, fonts = [], onFont, size = 22, onSize, minSize = 12, maxSize = 40, leading, leadings = [], onLeading, width, widths = [], onWidth, flow = 'scroll', flows = FLOWS, onFlow, onReset, resetLabel = 'Reset defaults', labels: l = {}, className = '' }) {
|
|
41
34
|
const L = { ...LABELS, ...l }
|
|
42
35
|
return (
|
|
43
36
|
<div className={`flex flex-col gap-6 ${className}`.trim()}>
|
|
44
|
-
{themes && <
|
|
45
|
-
{fonts.length > 0 && <
|
|
46
|
-
<
|
|
47
|
-
{leadings.length > 0 && <
|
|
48
|
-
{widths.length > 0 && <
|
|
49
|
-
<
|
|
37
|
+
{themes && <LabeledControl variant="float" label={L.theme}><div className="flex gap-2">{themes}</div></LabeledControl>}
|
|
38
|
+
{fonts.length > 0 && <LabeledControl variant="float" label={L.font}><Dropdown variant="float" size="md" options={fonts} value={font} onChange={onFont} className="w-full" /></LabeledControl>}
|
|
39
|
+
<LabeledControl variant="float" label={L.size}><QuantityInput variant="float" unit="px" ariaLabel="text size" value={size} onChange={onSize} min={minSize} max={maxSize} className="w-full" /></LabeledControl>
|
|
40
|
+
{leadings.length > 0 && <LabeledControl variant="float" label={L.leading}><Dropdown variant="float" size="md" options={leadings} value={leading} onChange={onLeading} className="w-full" /></LabeledControl>}
|
|
41
|
+
{widths.length > 0 && <LabeledControl variant="float" label={L.width}><Dropdown variant="float" size="md" options={widths} value={width} onChange={onWidth} className="w-full" /></LabeledControl>}
|
|
42
|
+
<LabeledControl variant="float" label={L.flow}><TabsRow variant="float" size="xs" overflow="wrap" tabs={flows} value={flow} onChange={onFlow} ariaLabel={L.flow} className={TRACK} /></LabeledControl>
|
|
50
43
|
{onReset && <Button variant="float" tone="secondary" size="lg" onClick={onReset} className="mt-4 w-full justify-center">{resetLabel}</Button>}
|
|
51
44
|
</div>
|
|
52
45
|
)
|
|
@@ -4,6 +4,8 @@ import ButtonGroup from './ButtonGroup.jsx'
|
|
|
4
4
|
import ToggleSwitch from '../atoms/ToggleSwitch.jsx'
|
|
5
5
|
import Dropdown from './Dropdown.jsx'
|
|
6
6
|
import Slider from './Slider.jsx'
|
|
7
|
+
import LabeledControl from './LabeledControl.jsx'
|
|
8
|
+
import { useEffect, useState } from 'react'
|
|
7
9
|
|
|
8
10
|
/* taxonomy-ok: molecule — the settings window's controls, each a shipped atom in the window's dense look */
|
|
9
11
|
|
|
@@ -13,20 +15,25 @@ import Slider from './Slider.jsx'
|
|
|
13
15
|
* Inter 11 (readouts JetBrains Mono 10); a label above in Inter 10 at oq-64. Every part is a shipped control dressed for
|
|
14
16
|
* the window — Slider, the dual Slider, Dropdown, SegmentedToggle, ToggleSwitch, Input — not a second set.
|
|
15
17
|
*
|
|
16
|
-
* SettingsGroup
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* (SettingsGroup and SettingsDisclosure live beside LabeledControlSection in organisms/SettingsPanel.jsx)
|
|
19
|
+
* SettingsGroup DEPRECATED 2026-11-12: `LabeledControlSection variant="settings"` (label = the title, end = the
|
|
20
|
+
* note, `divided` the rule under it) — every group is a LabeledControlSection (W13.1)
|
|
21
|
+
* SettingsCell a grid cell: `LabeledControl variant="settings"` (the label over the control) in the fieldset that
|
|
22
|
+
* disables it — a group lays them two-up (`SettingsGrid`)
|
|
23
|
+
* SettingsSlider the boxed slider: the float track and its value as a mono number box (`format`), typed values
|
|
24
|
+
* commit on Enter or blur
|
|
25
|
+
* SettingsRange two handles on one track (From / To) — the dual Slider, boxed, both values number boxes
|
|
21
26
|
* SettingsSelect the boxed Dropdown (`options` `[{ value, label }]`)
|
|
22
27
|
* SettingsSegmented the boxed SegmentedToggle (Rows / Columns), the lit cell on oq-16
|
|
23
|
-
* SettingsToggle
|
|
28
|
+
* SettingsToggle `LabeledControl variant="settings" horizontal`: its words, then the ToggleSwitch
|
|
24
29
|
* SettingsText the boxed Input (text or number)
|
|
25
30
|
* SettingsPoint an X / Y pair of number fields
|
|
26
|
-
* SettingsRamp an A→B row
|
|
31
|
+
* SettingsRamp an A→B row, `LabeledControl variant="settings" horizontal` (an 88 label column): value A · curve ·
|
|
32
|
+
* value B (`SettingsRampHead` the VALUE A · CURVE · VALUE B row)
|
|
27
33
|
* SettingsLights a list of points — X · Y · radius · intensity · delete — and Add light
|
|
28
34
|
* SettingsFieldMap the field's gradient strip: FIELD MAP over a 26 strip (`background`) and two captions
|
|
29
|
-
* SettingsDisclosure a group that starts closed
|
|
35
|
+
* SettingsDisclosure a group that starts closed: `LabeledControlSection variant="settings"` whose label is the toggle
|
|
36
|
+
* (the 12 chevron, More geometry … its note)
|
|
30
37
|
*
|
|
31
38
|
* `disabled` on any of them dims it to 40% and takes it out of the tab order (a control whose engine param does not
|
|
32
39
|
* exist yet). Keyboard is each shipped part's own: ← / → on a slider and on the segmented, Enter / Space on a select.
|
|
@@ -49,37 +56,42 @@ const Dim = ({ disabled, className = '', row, children, ...rest }) => (
|
|
|
49
56
|
</fieldset>
|
|
50
57
|
)
|
|
51
58
|
|
|
52
|
-
export function SettingsGroup({ title, note, ruled = true, className = '', children }) {
|
|
53
|
-
return (
|
|
54
|
-
<section className={`flex flex-col ${ruled ? 'pb-[22px] mb-[18px] border-b border-oq-16 last:border-b-0 last:mb-0' : ''} ${className}`.trim()}>
|
|
55
|
-
{(title || note) && (
|
|
56
|
-
<header className="flex items-baseline justify-between gap-4 pr-3 pb-[15px]">
|
|
57
|
-
{title && <h3 className="text-[12px] leading-[15px] font-semibold text-fg-96 font-(family-name:--kol-font-family-float)">{title}</h3>}
|
|
58
|
-
{note && <span className={LABEL}>{note}</span>}
|
|
59
|
-
</header>
|
|
60
|
-
)}
|
|
61
|
-
{children}
|
|
62
|
-
</section>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
59
|
export const SettingsGrid = ({ className = '', children }) => <div className={`grid grid-cols-2 gap-x-3 gap-y-[7px] ${className}`.trim()}>{children}</div>
|
|
67
60
|
|
|
68
61
|
export function SettingsCell({ label, span = 1, disabled, className = '', children, ...rest }) {
|
|
69
62
|
return (
|
|
70
|
-
<Dim disabled={disabled} className={
|
|
71
|
-
|
|
72
|
-
{children}
|
|
63
|
+
<Dim disabled={disabled} className={`${span === 2 ? 'col-span-2' : ''} ${className}`.trim()} {...rest}>
|
|
64
|
+
<LabeledControl variant="settings" label={label}>{children}</LabeledControl>
|
|
73
65
|
</Dim>
|
|
74
66
|
)
|
|
75
67
|
}
|
|
76
68
|
|
|
69
|
+
/* a slider's value as a number box (the float spec: a slider's value is the caller's number box, never raw text — the
|
|
70
|
+
* user's Figma issue 60, "no Input shown, just raw text"): the formatted value at rest, typed numbers commit on Enter or
|
|
71
|
+
* blur, clamped to the range; Escape reverts */
|
|
72
|
+
function NumberBox({ value, onCommit, min, max, format, disabled, label, fit = false, className = '' }) {
|
|
73
|
+
const [draft, setDraft] = useState(null)
|
|
74
|
+
useEffect(() => { setDraft(null) }, [value])
|
|
75
|
+
const commit = () => {
|
|
76
|
+
const n = parseFloat(String(draft ?? '').replace(',', '.'))
|
|
77
|
+
if (draft != null && Number.isFinite(n)) onCommit?.(Math.min(max, Math.max(min, n)))
|
|
78
|
+
setDraft(null)
|
|
79
|
+
}
|
|
80
|
+
return (
|
|
81
|
+
<input type="text" inputMode="decimal" value={draft ?? format(value)} disabled={disabled} aria-label={label}
|
|
82
|
+
onFocus={(e) => { setDraft(String(value)); requestAnimationFrame(() => e.target.select()) }} onChange={(e) => setDraft(e.target.value)} onBlur={commit}
|
|
83
|
+
onKeyDown={(e) => { if (e.key === 'Enter') e.currentTarget.blur(); if (e.key === 'Escape') { setDraft(null); requestAnimationFrame(() => e.target.blur()) } }}
|
|
84
|
+
style={fit ? { width: `${Math.max(1, String(draft ?? format(value)).length)}ch` } : undefined}
|
|
85
|
+
className={`${MONO} min-w-0 bg-transparent border-0 p-0 focus:outline-none tabular-nums ${className}`.trim()} />
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
77
89
|
export function SettingsSlider({ value, onChange, min = 0, max = 1, step = 0.01, format = (v) => String(v), disabled, 'aria-label': ariaLabel }) {
|
|
78
90
|
return (
|
|
79
91
|
<Dim disabled={disabled} className={FIELD} row="gap-3 pl-[9px] pr-2">
|
|
80
92
|
<Slider variant="float" readout="none" value={value} onChange={onChange} min={min} max={max} step={step} disabled={disabled}
|
|
81
93
|
aria-label={ariaLabel} className="flex-1 min-w-0 [&_.kol-slider-float]:h-4" />
|
|
82
|
-
<
|
|
94
|
+
<NumberBox value={value} onCommit={onChange} min={min} max={max} format={format} disabled={disabled} label={`${ariaLabel ?? 'Value'} value`} className="w-[52px] shrink-0" />
|
|
83
95
|
</Dim>
|
|
84
96
|
)
|
|
85
97
|
}
|
|
@@ -88,11 +100,11 @@ export function SettingsRange({ value = [0, 1], onChange, min = 0, max = 1, step
|
|
|
88
100
|
const [a, b] = value
|
|
89
101
|
return (
|
|
90
102
|
<Dim disabled={disabled} className={FIELD} row="gap-2 px-2">
|
|
91
|
-
<
|
|
103
|
+
<NumberBox value={a} onCommit={(v) => onChange?.([Math.min(v, b), b])} min={min} max={max} format={format} disabled={disabled} label={`${ariaLabel ?? 'Range'} from`} className="shrink-0" fit />
|
|
92
104
|
<Slider variant="dual" value={a} value2={b} min={min} max={max} step={step} aria-label={ariaLabel}
|
|
93
105
|
onChange={(v) => onChange?.([Math.min(v, b), b])} onChange2={(v) => onChange?.([a, Math.max(v, a)])}
|
|
94
106
|
label1="" label2="" className="flex-1 min-w-0" />
|
|
95
|
-
<
|
|
107
|
+
<NumberBox value={b} onCommit={(v) => onChange?.([a, Math.max(v, a)])} min={min} max={max} format={format} disabled={disabled} label={`${ariaLabel ?? 'Range'} to`} className="shrink-0 text-right" fit />
|
|
96
108
|
</Dim>
|
|
97
109
|
)
|
|
98
110
|
}
|
|
@@ -117,9 +129,10 @@ export function SettingsSegmented({ value, onChange, options = [], disabled, ari
|
|
|
117
129
|
|
|
118
130
|
export function SettingsToggle({ label, checked, onChange, disabled }) {
|
|
119
131
|
return (
|
|
120
|
-
<Dim disabled={disabled} className="h-7" row="
|
|
121
|
-
<
|
|
122
|
-
|
|
132
|
+
<Dim disabled={disabled} className="h-7" row="min-w-0">
|
|
133
|
+
<LabeledControl variant="settings" horizontal label={label} labelClass={INK}>
|
|
134
|
+
<ToggleSwitch checked={!!checked} onChange={onChange} aria-label={label} disabled={disabled} />
|
|
135
|
+
</LabeledControl>
|
|
123
136
|
</Dim>
|
|
124
137
|
)
|
|
125
138
|
}
|
|
@@ -169,13 +182,16 @@ export function SettingsRamp({ label, value = { a: 0, b: 1, curve: 'linear' }, o
|
|
|
169
182
|
className={`${FIELD} ${INK} px-2 focus:outline-none focus-visible:shadow-[var(--kol-float-focus)] tabular-nums ${partial?.[k] ? 'opacity-40' : ''}`} />
|
|
170
183
|
)
|
|
171
184
|
return (
|
|
172
|
-
<Dim disabled={disabled}
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
185
|
+
<Dim disabled={disabled} {...rest}>
|
|
186
|
+
<LabeledControl variant="settings" horizontal label={label} labelWidth={88} labelClass={`${INK} !text-(--kol-oq-64) whitespace-nowrap`}>
|
|
187
|
+
<div className="grid grid-cols-[minmax(0,87fr)_minmax(0,122fr)_minmax(0,87fr)] gap-x-2 items-center">
|
|
188
|
+
{num('a')}
|
|
189
|
+
<div className={partial?.curve ? 'opacity-40' : ''}>
|
|
190
|
+
<SettingsSelect value={value.curve} onChange={set('curve')} options={curves} ariaLabel={`${label} curve`} disabled={disabled || partial?.curve} />
|
|
191
|
+
</div>
|
|
192
|
+
{num('b')}
|
|
193
|
+
</div>
|
|
194
|
+
</LabeledControl>
|
|
179
195
|
</Dim>
|
|
180
196
|
)
|
|
181
197
|
}
|
|
@@ -217,17 +233,3 @@ export function SettingsFieldMap({ background, left, right, label = 'Field map'
|
|
|
217
233
|
</div>
|
|
218
234
|
)
|
|
219
235
|
}
|
|
220
|
-
|
|
221
|
-
export function SettingsDisclosure({ label, note, open, onToggle, children }) {
|
|
222
|
-
return (
|
|
223
|
-
<section className="flex flex-col">
|
|
224
|
-
<button type="button" aria-expanded={!!open} onClick={() => onToggle?.(!open)}
|
|
225
|
-
className="flex items-center gap-[11px] h-[19px] pr-3 text-left rounded focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
|
|
226
|
-
<span aria-hidden="true" className={`text-[16px] leading-[19px] text-oq-64 transition-transform ${open ? 'rotate-90' : ''}`}>›</span>
|
|
227
|
-
<span className={`${INK} font-medium`}>{label}</span>
|
|
228
|
-
{note && <span className={`${LABEL} ml-auto`}>{note}</span>}
|
|
229
|
-
</button>
|
|
230
|
-
{open && <div className="pt-4 flex flex-col gap-[7px]">{children}</div>}
|
|
231
|
-
</section>
|
|
232
|
-
)
|
|
233
|
-
}
|
package/src/molecules/Slider.jsx
CHANGED
|
@@ -187,22 +187,35 @@ const Slider = ({
|
|
|
187
187
|
return <SliderPanel value={value} onChange={onChange} min={min} max={max} step={step} label={label} direction={direction} height={height} onHold={onHold} />
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
/* A NAMED SLIDER IS A LabeledControl (plan-2026-11-12-float-rails-figma W12.1, the law: every label beside a control
|
|
191
|
+
* is one): the label slot carries the slider's own label look (kol-helper-12 at fg-80, hugging), the control slot the
|
|
192
|
+
* `.control-slider` row (track and readout) exactly as it drew before. Unlabelled, the row is the whole slider. Called as functions, never as components: a component defined in render
|
|
193
|
+
* remounts the range on every value and drops the drag. */
|
|
194
|
+
const labelEl = label && (
|
|
195
|
+
<label htmlFor={sliderId} style={fontSize ? { fontSize } : undefined}>{label}</label>
|
|
196
|
+
)
|
|
197
|
+
const labelClass = `kol-helper-12 text-fg-80 ${disabled ? 'opacity-50' : ''}`.trim()
|
|
198
|
+
const row = ({ className: cls, style: st, onClick, children }) => {
|
|
199
|
+
if (!label) return <div className={cls} style={st} onClick={onClick}>{children}</div>
|
|
200
|
+
const outer = cls.split(/\s+/).filter((c) => !/^(control-slider|shadow-none|h-7)$/.test(c)).join(' ')
|
|
201
|
+
return (
|
|
202
|
+
<LabeledControl horizontal label={labelEl} labelWidth="fit-content" labelClass={labelClass}
|
|
203
|
+
className={`${/(^|\s)(hidden|block|flex|inline-flex|grid)(?=\s|$)/.test(outer) ? '' : 'inline-flex'} ${outer}`} style={st} onClick={onClick}>
|
|
204
|
+
<div className={`flex w-full ${cls.split(/\s+/).filter((c) => /^(control-slider|shadow-none|h-7|gap-3)$/.test(c)).join(' ')}`}>{children}</div>
|
|
205
|
+
</LabeledControl>
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
const column = ({ className: cls, style: st, onClick, children }) => (label
|
|
209
|
+
? <LabeledControl label={labelEl} labelClass={labelClass} className={cls} style={st} onClick={onClick}>{children}</LabeledControl>
|
|
210
|
+
: <div className={cls} style={st} onClick={onClick}>{children}</div>)
|
|
211
|
+
|
|
190
212
|
if (variant === 'dual') {
|
|
191
213
|
const v1 = value ?? min
|
|
192
214
|
const v2 = value2 ?? max
|
|
193
215
|
/* an empty label is no label: `label1="" label2=""` (SettingsRange, GeneratorRail) drew an empty 16px row that pushed the rail low */
|
|
194
216
|
const showLabels = !!(label1 || label2)
|
|
195
217
|
const ratio = max > min ? (playhead - min) / (max - min) : 0
|
|
196
|
-
return (
|
|
197
|
-
<div className={`control-slider gap-3 shadow-none ${className}`} style={style}>
|
|
198
|
-
{label && (
|
|
199
|
-
<label
|
|
200
|
-
className={`kol-helper-12 whitespace-nowrap shrink-0 w-fit ${disabled ? 'opacity-50' : ''}`}
|
|
201
|
-
style={fontSize ? { fontSize } : undefined}
|
|
202
|
-
>
|
|
203
|
-
{label}
|
|
204
|
-
</label>
|
|
205
|
-
)}
|
|
218
|
+
return row({ className: `control-slider gap-3 shadow-none ${className}`, style, children: <>
|
|
206
219
|
<div className="flex-1">
|
|
207
220
|
{showLabels && (
|
|
208
221
|
<div
|
|
@@ -251,8 +264,7 @@ const Slider = ({
|
|
|
251
264
|
/>
|
|
252
265
|
</div>
|
|
253
266
|
</div>
|
|
254
|
-
|
|
255
|
-
)
|
|
267
|
+
</> })
|
|
256
268
|
}
|
|
257
269
|
|
|
258
270
|
const vertical = direction === 'vertical'
|
|
@@ -286,15 +298,6 @@ const Slider = ({
|
|
|
286
298
|
)
|
|
287
299
|
}
|
|
288
300
|
|
|
289
|
-
const labelNode = label && (
|
|
290
|
-
<label
|
|
291
|
-
htmlFor={sliderId}
|
|
292
|
-
className={`kol-helper-12 whitespace-nowrap shrink-0 w-fit ${disabled ? 'opacity-50' : ''}`}
|
|
293
|
-
style={fontSize ? { fontSize } : undefined}
|
|
294
|
-
>
|
|
295
|
-
{label}
|
|
296
|
-
</label>
|
|
297
|
-
)
|
|
298
301
|
|
|
299
302
|
const range = (
|
|
300
303
|
<input
|
|
@@ -342,23 +345,17 @@ const Slider = ({
|
|
|
342
345
|
) : null
|
|
343
346
|
|
|
344
347
|
if (vertical) {
|
|
345
|
-
return (
|
|
346
|
-
<div className={`inline-flex flex-col items-center gap-2 ${className}`} style={style} onClick={onAltReset}>
|
|
347
|
-
{labelNode}
|
|
348
|
+
return column({ className: `inline-flex flex-col items-center gap-2 ${className}`, style, onClick: onAltReset, children: <>
|
|
348
349
|
{/* a native range turned upright: the box is the track's length tall, the input that long */}
|
|
349
350
|
<div className="w-6 flex items-center justify-center" style={{ height: length }}>{range}</div>
|
|
350
351
|
{readoutNode}
|
|
351
|
-
|
|
352
|
-
)
|
|
352
|
+
</> })
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
return (
|
|
356
|
-
<div className={`control-slider gap-3 shadow-none ${scrub ? 'h-7' : ''} ${className}`} style={style} onClick={onAltReset}>
|
|
357
|
-
{labelNode}
|
|
355
|
+
return row({ className: `control-slider gap-3 shadow-none ${scrub ? 'h-7' : ''} ${className}`, style, onClick: onAltReset, children: <>
|
|
358
356
|
{range}
|
|
359
357
|
{readoutNode}
|
|
360
|
-
|
|
361
|
-
)
|
|
358
|
+
</> })
|
|
362
359
|
}
|
|
363
360
|
|
|
364
361
|
export default Slider
|
|
@@ -444,7 +444,7 @@ export default function CommandOverlay({
|
|
|
444
444
|
<div className="border-t border-fg-08 max-h-[70vh] overflow-y-auto" style={RULE}>{children}</div>
|
|
445
445
|
) : results.length > 0 && (
|
|
446
446
|
/* FIXED BODY HEIGHT — the panel holds still while the list narrows. */
|
|
447
|
-
<ul ref={listRef} id={listId} role="listbox" className="h-80 overflow-y-auto">
|
|
447
|
+
<ul ref={listRef} id={listId} role="listbox" className="flex h-80 flex-col gap-[var(--kol-spacing-0-5)] overflow-y-auto">
|
|
448
448
|
{results.map((item, i) => {
|
|
449
449
|
const heading = (item.group ?? '') !== (results[i - 1]?.group ?? '') || i === 0
|
|
450
450
|
return (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Children } from 'react'
|
|
2
|
+
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
2
3
|
import Button from '../atoms/Button.jsx'
|
|
3
4
|
import Dropdown from '../molecules/Dropdown.jsx'
|
|
4
5
|
import CloseButton from '../molecules/CloseButton.jsx'
|
|
@@ -197,7 +198,27 @@ export function SettingsSwitch({ on = false, onChange, disabled = false, disable
|
|
|
197
198
|
* (0.5 · 1 · 1.5 · 2 · 3) or `'module'` (`--kol-float-module-gap`); float defaults 3 (12) and 2 (8). `as` the element
|
|
198
199
|
* (`nav` for a list of links), the rest of the props on it. */
|
|
199
200
|
const GAP = { 0.5: 'gap-0.5', 1: 'gap-1', 1.5: 'gap-1.5', 2: 'gap-2', 3: 'gap-3', module: 'gap-[var(--kol-float-module-gap)]' }
|
|
201
|
+
const SETTINGS_GAP = { 3: 'gap-3', 4: 'gap-4', settings: 'gap-[7px]' }
|
|
200
202
|
export function LabeledControlSection({ label, end, variant, divided = false, gap, rowGap, as: Tag = 'div', children, className = '', ...rest }) {
|
|
203
|
+
/* `variant="settings"` (plan-2026-11-12-float-rails-figma W13.1): the generator settings window's group — the head is
|
|
204
|
+
* the title (a string in Inter 12 semibold) with `end` (the note) at its right on one baseline, 15 over the items;
|
|
205
|
+
* `divided` rules it off from the next group (22 under the items, an oq-16 rule, 18 to the next; the last none).
|
|
206
|
+
* `gap` 3 · 4 replaces the 15; `rowGap` 3 · 4 · 'settings' (7) spaces the items, unset they sit flush. */
|
|
207
|
+
if (variant === 'settings') {
|
|
208
|
+
const items = Children.toArray(children)
|
|
209
|
+
const hasLabel = label != null && label !== false && label !== ''
|
|
210
|
+
return (
|
|
211
|
+
<Tag data-labeled-control-section="" className={`flex flex-col ${SETTINGS_GAP[gap] ?? 'gap-[15px]'} ${divided ? 'pb-[22px] mb-[18px] border-b border-oq-16 last:border-b-0 last:mb-0' : ''} ${className}`.replace(/\s+/g, ' ').trim()} {...rest}>
|
|
212
|
+
{(hasLabel || end) && (
|
|
213
|
+
<div className="flex items-baseline justify-between gap-4 pr-3">
|
|
214
|
+
{hasLabel && (typeof label === 'string' ? <h3 className="text-[12px] leading-[15px] font-semibold text-fg-96 font-(family-name:--kol-font-family-float)">{label}</h3> : label)}
|
|
215
|
+
{end && (typeof end === 'string' ? <span className="text-[10px] leading-[12px] text-oq-64 font-(family-name:--kol-font-family-float)">{end}</span> : end)}
|
|
216
|
+
</div>
|
|
217
|
+
)}
|
|
218
|
+
{items.length > 0 && <div className={`flex flex-col ${SETTINGS_GAP[rowGap] ?? ''}`.trim()}>{items}</div>}
|
|
219
|
+
</Tag>
|
|
220
|
+
)
|
|
221
|
+
}
|
|
201
222
|
if (variant === 'float') {
|
|
202
223
|
const items = Children.toArray(children)
|
|
203
224
|
const hasLabel = label != null && label !== false && label !== ''
|
|
@@ -333,3 +354,28 @@ export function SettingsFooter({ onReset, resetLabel = 'Reset to defaults', rese
|
|
|
333
354
|
</div>
|
|
334
355
|
)
|
|
335
356
|
}
|
|
357
|
+
|
|
358
|
+
/** @deprecated 2026-11-12 — `LabeledControlSection variant="settings"` (on the retirement ledger) */
|
|
359
|
+
export function SettingsGroup({ title, note, ruled = true, className = '', children }) {
|
|
360
|
+
return <LabeledControlSection variant="settings" label={title} end={note} divided={ruled} className={className}>{children}</LabeledControlSection>
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** SettingsDisclosure — the settings window's group that starts closed (`Dialog variant="settings"`, W7.2):
|
|
364
|
+
* `LabeledControlSection variant="settings"` whose label is the toggle — the 12 chevron, the title, its note right
|
|
365
|
+
* (plan-2026-11-12-float-rails-figma W13.1; it typed a 16px › until then). Lives here beside the section it draws. */
|
|
366
|
+
export function SettingsDisclosure({ label, note, open, onToggle, children }) {
|
|
367
|
+
const head = (
|
|
368
|
+
<button type="button" aria-expanded={!!open} onClick={() => onToggle?.(!open)}
|
|
369
|
+
className="flex flex-1 items-center gap-[11px] h-[19px] text-left rounded focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
|
|
370
|
+
{/* the chevron is the 12 token (LAW 9), never a typed › */}
|
|
371
|
+
<IconLoader name="chevron-right" size="var(--kol-float-chev-sm)" className={`shrink-0 text-oq-64 transition-transform ${open ? 'rotate-90' : ''}`} />
|
|
372
|
+
<span className={`text-[11px] leading-[13px] text-fg-96 font-(family-name:--kol-font-family-float) font-medium`}>{label}</span>
|
|
373
|
+
{note && <span className={`text-[10px] leading-[12px] text-oq-64 font-(family-name:--kol-font-family-float) ml-auto`}>{note}</span>}
|
|
374
|
+
</button>
|
|
375
|
+
)
|
|
376
|
+
return (
|
|
377
|
+
<LabeledControlSection variant="settings" label={head} gap={4} rowGap="settings">
|
|
378
|
+
{open ? children : null}
|
|
379
|
+
</LabeledControlSection>
|
|
380
|
+
)
|
|
381
|
+
}
|