@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
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
|
)}
|
package/src/molecules/Modal.jsx
CHANGED
|
@@ -3,6 +3,7 @@ import { createPortal } from 'react-dom'
|
|
|
3
3
|
import Button from '../atoms/Button.jsx'
|
|
4
4
|
import Input from '../atoms/Input.jsx'
|
|
5
5
|
import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
|
|
6
|
+
import QuickLookHeader from './QuickLookHeader.jsx'
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Modal — promise-based prompt + confirm + alert dialogs.
|
|
@@ -58,6 +59,17 @@ import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
|
|
|
58
59
|
* `values` comes back on cancel too (the toggles as left), so a consumer can remember them either
|
|
59
60
|
* way. Without `options`, confirm still resolves a plain boolean — existing callers untouched.
|
|
60
61
|
*
|
|
62
|
+
* THE FLOAT (`variant: 'float'` on any call or on the provider, float-everything W6 rows 84 · 85 · 89 · 90, 2026-11-04 —
|
|
63
|
+
* kol-float--style 46:2795): the window on `kol-float-solid` at `--kol-float-window-r`, 24 in, 18 between its parts.
|
|
64
|
+
* A `header` (with its `icon`) draws `QuickLookHeader variant="float"` over the title; the title is the heading
|
|
65
|
+
* (`kol-float-section`… at 20: Inter 500), `body` a line under it in the hint ink; fields are float Inputs, toggles float
|
|
66
|
+
* ToggleCheckboxes; the actions sit apart — the quiet cancel at the left (`tone="ghost"`), the next step at the right
|
|
67
|
+
* (`inverted`, or `danger` when `tone: 'danger'` — the destructive confirm). Still a blocking task, so the scrim
|
|
68
|
+
* stays: the scrim rule is "only when blocking", and a prompt always blocks.
|
|
69
|
+
*
|
|
70
|
+
* await confirm('Delete “Orbit field”?', { variant: 'float', header: 'Delete layer', icon: 'alert-triangle',
|
|
71
|
+
* body: 'This removes the layer and its 4 keyframes from Scene 01.', tone: 'danger', okLabel: 'Delete layer', cancelLabel: 'Keep layer' })
|
|
72
|
+
*
|
|
61
73
|
* Mounted once at the app root (BrandLayout). Renders into `document.body`
|
|
62
74
|
* via portal, so it floats above any rail / scroll-context.
|
|
63
75
|
*/
|
|
@@ -69,6 +81,8 @@ const ModalCtx = (globalThis[Symbol.for('@kolkrabbi/kol-component/ModalCtx')] ??
|
|
|
69
81
|
* hairline. Each modal keeps its own default (prompts bordered, Dialog lift) until he picks one. */
|
|
70
82
|
const MODAL_VARIANTS = {
|
|
71
83
|
lift: { className: 'kol-overlay-panel', style: {} },
|
|
84
|
+
/* float (W6, 2026-11-04): the float window — solid ground + the float shadow, the window radius, no edge */
|
|
85
|
+
float: { className: 'kol-float-solid !rounded-[var(--kol-float-window-r)] text-fg-emphasis', style: {} },
|
|
72
86
|
bordered: { className: 'border border-fg-08', style: { background: 'var(--kol-surface-primary)', color: 'var(--kol-surface-on-primary)' } },
|
|
73
87
|
}
|
|
74
88
|
const modalVariant = (v, fallback) => MODAL_VARIANTS[v] ?? MODAL_VARIANTS[fallback]
|
|
@@ -83,20 +97,20 @@ export function ModalProvider({ children, variant = 'bordered' }) {
|
|
|
83
97
|
})
|
|
84
98
|
}, [])
|
|
85
99
|
|
|
86
|
-
const prompt = useCallback((title, defaultValue = '', { okLabel, cancelLabel, type = 'text', placeholder, variant } = {}) =>
|
|
87
|
-
new Promise((resolve) => setState({ kind: 'prompt', title, defaultValue, okLabel, cancelLabel, type, placeholder, variant, resolve })),
|
|
100
|
+
const prompt = useCallback((title, defaultValue = '', { okLabel, cancelLabel, type = 'text', placeholder, variant, header, icon, body } = {}) =>
|
|
101
|
+
new Promise((resolve) => setState({ kind: 'prompt', title, defaultValue, okLabel, cancelLabel, type, placeholder, variant, header, icon, body, resolve })),
|
|
88
102
|
[])
|
|
89
103
|
|
|
90
|
-
const confirm = useCallback((title, { okLabel, cancelLabel, options, variant } = {}) =>
|
|
91
|
-
new Promise((resolve) => setState({ kind: 'confirm', title, okLabel, cancelLabel, options: options?.length ? options : null, variant, resolve })),
|
|
104
|
+
const confirm = useCallback((title, { okLabel, cancelLabel, options, variant, header, icon, body, tone } = {}) =>
|
|
105
|
+
new Promise((resolve) => setState({ kind: 'confirm', title, okLabel, cancelLabel, options: options?.length ? options : null, variant, header, icon, body, tone, resolve })),
|
|
92
106
|
[])
|
|
93
107
|
|
|
94
|
-
const alert = useCallback((title, { okLabel, variant } = {}) =>
|
|
95
|
-
new Promise((resolve) => setState({ kind: 'alert', title, okLabel, variant, resolve })),
|
|
108
|
+
const alert = useCallback((title, { okLabel, variant, header, icon, body } = {}) =>
|
|
109
|
+
new Promise((resolve) => setState({ kind: 'alert', title, okLabel, variant, header, icon, body, resolve })),
|
|
96
110
|
[])
|
|
97
111
|
|
|
98
|
-
const form = useCallback((title, fields = [], { okLabel, cancelLabel, variant } = {}) =>
|
|
99
|
-
new Promise((resolve) => setState({ kind: 'form', title, fields, okLabel, cancelLabel, variant, resolve })),
|
|
112
|
+
const form = useCallback((title, fields = [], { okLabel, cancelLabel, variant, header, icon, body } = {}) =>
|
|
113
|
+
new Promise((resolve) => setState({ kind: 'form', title, fields, okLabel, cancelLabel, variant, header, icon, body, resolve })),
|
|
100
114
|
[])
|
|
101
115
|
|
|
102
116
|
return (
|
|
@@ -112,6 +126,7 @@ export function ModalProvider({ children, variant = 'bordered' }) {
|
|
|
112
126
|
|
|
113
127
|
function ModalView({ state, closeWith, variant }) {
|
|
114
128
|
const look = modalVariant(variant, 'bordered')
|
|
129
|
+
const float = variant === 'float'
|
|
115
130
|
const [val, setVal] = useState(state.defaultValue ?? '')
|
|
116
131
|
const [values, setValues] = useState(() => Object.fromEntries((state.options ?? []).map((o) => [o.id, !!o.defaultValue])))
|
|
117
132
|
const [fieldVals, setFieldVals] = useState(() => Object.fromEntries((state.fields ?? []).map((f) => [f.id, f.defaultValue ?? ''])))
|
|
@@ -194,25 +209,28 @@ function ModalView({ state, closeWith, variant }) {
|
|
|
194
209
|
aria-modal="true"
|
|
195
210
|
aria-labelledby="kol-modal-title"
|
|
196
211
|
onMouseDown={(e) => e.stopPropagation()}
|
|
197
|
-
className={`kol-modal flex flex-col gap-4 p-5 rounded ${look.className}`}
|
|
212
|
+
className={float ? `kol-modal flex flex-col gap-[18px] p-6 ${look.className}` : `kol-modal flex flex-col gap-4 p-5 rounded ${look.className}`}
|
|
198
213
|
style={{
|
|
199
214
|
...look.style,
|
|
200
215
|
minWidth: 320,
|
|
201
216
|
maxWidth: '90vw',
|
|
217
|
+
...(float ? { width: 562 } : {}),
|
|
202
218
|
}}
|
|
203
219
|
>
|
|
220
|
+
{float && state.header && <QuickLookHeader variant="float" icon={state.icon} title={state.header} onClose={cancel} />}
|
|
204
221
|
{/* kol-mono-12, not helper: dialog copy WRAPS, and helper's
|
|
205
222
|
* line-height 1 is single-line chrome only (type protocol). */}
|
|
206
223
|
{/* pre-line: an alert can carry a failure list, one per line */}
|
|
207
|
-
<p id="kol-modal-title" className=
|
|
224
|
+
<p id="kol-modal-title" className={float ? 'font-[family-name:var(--kol-font-family-float)] text-[20px] font-medium leading-[28px] text-fg-emphasis whitespace-pre-line' : 'kol-mono-12 text-emphasis whitespace-pre-line'}>{state.title}</p>
|
|
225
|
+
{float && state.body && <p className="kol-float-body text-fg-64 whitespace-pre-line">{state.body}</p>}
|
|
208
226
|
{state.kind === 'prompt' && (
|
|
209
227
|
<Input
|
|
210
228
|
ref={inputRef}
|
|
211
229
|
type={state.type}
|
|
212
230
|
autoComplete={state.type === 'password' ? 'current-password' : undefined}
|
|
213
231
|
placeholder={state.placeholder}
|
|
214
|
-
variant=
|
|
215
|
-
size=
|
|
232
|
+
variant={float ? 'float' : 'outline'}
|
|
233
|
+
size={float ? 'md' : 'sm'}
|
|
216
234
|
value={val}
|
|
217
235
|
onChange={(e) => setVal(e.target.value)}
|
|
218
236
|
className="w-full"
|
|
@@ -226,8 +244,8 @@ function ModalView({ state, closeWith, variant }) {
|
|
|
226
244
|
autoComplete={f.autoComplete}
|
|
227
245
|
placeholder={f.placeholder}
|
|
228
246
|
aria-label={f.placeholder ?? f.id}
|
|
229
|
-
variant=
|
|
230
|
-
size=
|
|
247
|
+
variant={float ? 'float' : 'outline'}
|
|
248
|
+
size={float ? 'md' : 'sm'}
|
|
231
249
|
value={fieldVals[f.id]}
|
|
232
250
|
onChange={(e) => setFieldVals((v) => ({ ...v, [f.id]: e.target.value }))}
|
|
233
251
|
className="w-full"
|
|
@@ -240,18 +258,27 @@ function ModalView({ state, closeWith, variant }) {
|
|
|
240
258
|
key={o.id}
|
|
241
259
|
label={o.label}
|
|
242
260
|
hint={o.hint}
|
|
261
|
+
variant={float ? 'float' : undefined}
|
|
243
262
|
checked={values[o.id]}
|
|
244
263
|
onChange={(next) => setValues((v) => ({ ...v, [o.id]: next }))}
|
|
245
264
|
/>
|
|
246
265
|
))}
|
|
247
266
|
</div>
|
|
248
267
|
)}
|
|
268
|
+
{float ? (
|
|
269
|
+
/* the float's actions sit apart: recovery quiet at the left, the next step at the right */
|
|
270
|
+
<div className="flex items-center justify-between gap-3">
|
|
271
|
+
{state.kind !== 'alert' ? <Button variant="float" tone="ghost" size="md" onClick={cancel}>{state.cancelLabel ?? 'Cancel'}</Button> : <span />}
|
|
272
|
+
<Button variant="float" tone={state.tone === 'danger' ? 'danger' : 'inverted'} size="md" onClick={submit} data-modal-ok>{state.okLabel ?? 'OK'}</Button>
|
|
273
|
+
</div>
|
|
274
|
+
) : (
|
|
249
275
|
<div className="flex gap-2 justify-end">
|
|
250
276
|
{state.kind !== 'alert' && <Button size="sm" onClick={cancel}>{state.cancelLabel ?? 'Cancel'}</Button>}
|
|
251
277
|
{/* inverted, not primary: since tone-is-the-ground-axis (2026-09-03) primary is the
|
|
252
278
|
* dark ground, so OK drew the same as Cancel and nothing showed what Enter does */}
|
|
253
279
|
<Button tone="inverted" size="sm" onClick={submit} data-modal-ok>{state.okLabel ?? 'OK'}</Button>
|
|
254
280
|
</div>
|
|
281
|
+
)}
|
|
255
282
|
</div>
|
|
256
283
|
</div>
|
|
257
284
|
)
|
|
@@ -296,9 +323,20 @@ export function useModal() {
|
|
|
296
323
|
* portal). Esc and a press on the scrim close it; Esc is left to an open float inside first.
|
|
297
324
|
*
|
|
298
325
|
* <Dialog open={open} onClose={() => setOpen(false)} title="Filter by page" width={560}>…</Dialog>
|
|
326
|
+
*
|
|
327
|
+
* `variant="float"` (float-everything W6 rows 83 · 84 · 89, 2026-11-04 — kol-float--style 46:2655): the float window —
|
|
328
|
+
* `kol-float-solid` on `--kol-float-window-r`, 24 in, 18 between its parts, the title drawn as `QuickLookHeader
|
|
329
|
+
* variant="float"` (`icon` · title · − when `onMinimise` · ×) over the children. `blocking` (default true) keeps the
|
|
330
|
+
* scrim: a blocking task dims the scene, a utility window does not (row 89) — `blocking={false}` drops the scrim and the
|
|
331
|
+
* press-outside close and leaves the scene live (QuickLookFrame float is the utility window proper).
|
|
332
|
+
* @param {'lift'|'bordered'|'float'} [variant='lift']
|
|
333
|
+
* @param {string} [icon] float: the header's glyph
|
|
334
|
+
* @param {Function} [onMinimise] float: the − control
|
|
335
|
+
* @param {boolean} [blocking=true]
|
|
299
336
|
*/
|
|
300
|
-
export function Dialog({ open, onClose, title, width = 560, variant = 'lift', children }) {
|
|
337
|
+
export function Dialog({ open, onClose, title, width = 560, variant = 'lift', icon, onMinimise, blocking = true, children }) {
|
|
301
338
|
const look = modalVariant(variant, 'lift')
|
|
339
|
+
const float = variant === 'float'
|
|
302
340
|
useEffect(() => {
|
|
303
341
|
if (!open) return undefined
|
|
304
342
|
const onKey = (e) => { if (e.key === 'Escape' && !document.querySelector('.kol-popover-float')) onClose() }
|
|
@@ -308,22 +346,23 @@ export function Dialog({ open, onClose, title, width = 560, variant = 'lift', ch
|
|
|
308
346
|
if (!open || typeof document === 'undefined') return null
|
|
309
347
|
return createPortal(
|
|
310
348
|
<div
|
|
311
|
-
onMouseDown={onClose}
|
|
312
|
-
className=
|
|
349
|
+
onMouseDown={blocking ? onClose : undefined}
|
|
350
|
+
className={blocking ? 'kol-overlay-scrim' : 'pointer-events-none'}
|
|
313
351
|
style={{ position: 'fixed', inset: 0, zIndex: 150, display: 'flex', alignItems: 'center', justifyContent: 'center' }}
|
|
314
352
|
>
|
|
315
353
|
<div
|
|
316
354
|
role="dialog"
|
|
317
|
-
aria-modal=
|
|
355
|
+
aria-modal={blocking ? 'true' : undefined}
|
|
318
356
|
aria-label={title}
|
|
319
357
|
data-dialog
|
|
320
358
|
onMouseDown={(e) => e.stopPropagation()}
|
|
321
359
|
/* THE OVERLAY PANEL (MetricRebuild, 2026-10-31 — user: the filter dialog read as "a borderless box floating
|
|
322
360
|
* mid-page"): it painted the page's own surface behind an fg-08 hairline, so on a dark page it was the page.
|
|
323
361
|
* `.kol-overlay-panel` is the lift every KOL overlay wears (oq-04, no border — the scrim is the edge). */
|
|
324
|
-
className={`kol-modal flex flex-col rounded max-h-[85vh] ${look.className}`}
|
|
362
|
+
className={float ? `kol-modal pointer-events-auto flex flex-col gap-[18px] p-6 max-h-[85vh] overflow-auto ${look.className}` : `kol-modal flex flex-col rounded max-h-[85vh] ${look.className}${blocking ? '' : ' pointer-events-auto'}`}
|
|
325
363
|
style={{ ...look.style, width: `min(${width}px, calc(100vw - 32px))` }}
|
|
326
364
|
>
|
|
365
|
+
{float && title && <QuickLookHeader variant="float" icon={icon} title={title} onMinimise={onMinimise} onClose={onClose} />}
|
|
327
366
|
{children}
|
|
328
367
|
</div>
|
|
329
368
|
</div>,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Button from '../atoms/Button.jsx'
|
|
2
|
+
|
|
3
|
+
/* taxonomy-ok: molecule — nests Button (atom). */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* NoticeBanner — Something needs attention, and the one thing that fixes it. `Calendar needs attention · Reconnect`
|
|
7
|
+
* (float-everything W6 row 93, 2026-11-04 — kol-float--style 46:3097). A full-width float strip on the sheet radius
|
|
8
|
+
* (`--kol-float-menu-r`), `kol-float-solid`'s ground without its shadow (it sits in the page, not over it), 16 in: the
|
|
9
|
+
* title in `kol-float-hint` on the emphasis ink over the detail in `kol-float-label` on fg-64, the action at the right
|
|
10
|
+
* as a float button in the secondary tone. No icon and no tint — the words carry it; no hairline edge.
|
|
11
|
+
*
|
|
12
|
+
* @param {ReactNode} title
|
|
13
|
+
* @param {ReactNode} [body]
|
|
14
|
+
* @param {string} [action] the button's label (`Reconnect`)
|
|
15
|
+
* @param {Function} [onAction]
|
|
16
|
+
* @param {string} [className]
|
|
17
|
+
*/
|
|
18
|
+
export default function NoticeBanner({ title, body, action, onAction, className = '' }) {
|
|
19
|
+
return (
|
|
20
|
+
<div role="status" className={`flex w-full items-center gap-4 rounded-[var(--kol-float-menu-r)] bg-surface-secondary py-2.5 pl-4 pr-2.5 ${className}`.trim()}>
|
|
21
|
+
<span className="flex min-w-0 flex-1 flex-col">
|
|
22
|
+
<span className="kol-float-hint truncate text-fg-emphasis">{title}</span>
|
|
23
|
+
{body && <span className="kol-float-label truncate text-fg-64">{body}</span>}
|
|
24
|
+
</span>
|
|
25
|
+
{action && <Button variant="float" tone="secondary" size="md" className="shrink-0" onClick={onAction}>{action}</Button>}
|
|
26
|
+
</div>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
@@ -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) => ({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useRef, useState } from 'react'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
3
|
+
import QuickLookHeader from './QuickLookHeader.jsx'
|
|
4
4
|
|
|
5
|
-
/* taxonomy-ok: molecule — nests
|
|
5
|
+
/* taxonomy-ok: molecule — nests QuickLookHeader (molecule) + kol-icons's Icon. */
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* QuickLookFrame — The preview window. the Finder Quick Look window (user 2026-09-23: *"put them in a container LIKE
|
|
@@ -30,8 +30,18 @@ import CloseButton from '../atoms/CloseButton.jsx'
|
|
|
30
30
|
* @param {Function} onResize ({ w, h }) => void while the corner is dragged
|
|
31
31
|
* @param {ReactNode} footer the transport row
|
|
32
32
|
* @param {ReactNode} children the body
|
|
33
|
+
*
|
|
34
|
+
* THE UTILITY WINDOW (`variant="float"`, float-everything W6 rows 86 · 88, 2026-11-04 — kol-float--style 46:2840): a
|
|
35
|
+
* non-modal float window — no scrim, the scene stays live under it. `kol-float-solid` on `--kol-float-window-r`, 20 in,
|
|
36
|
+
* 18 between its parts; the header is `QuickLookHeader variant="float"` (`icon` · title · `onMinimise` · `onClose`); the
|
|
37
|
+
* body is the caller's (chip tabs, float fields); `status` is the footer line (`Changes saved automatically`, the
|
|
38
|
+
* `kol-float-label` role on fg-64) with the resize corner as its glyph at the right — the same drag as the default grip.
|
|
39
|
+
* @param {'float'} [variant]
|
|
40
|
+
* @param {string} [icon] float: the window's glyph
|
|
41
|
+
* @param {Function} [onMinimise] float: the − control
|
|
42
|
+
* @param {ReactNode} [status] float: the footer line
|
|
33
43
|
*/
|
|
34
|
-
export default function QuickLookFrame({ title, meta, actions, onClose, nav, size: sizeProp, onResize, footer, className = '', children }) {
|
|
44
|
+
export default function QuickLookFrame({ variant, icon, onMinimise, status, title, meta, actions, onClose, nav, size: sizeProp, onResize, footer, className = '', children }) {
|
|
35
45
|
const [own, setOwn] = useState(null)
|
|
36
46
|
const size = sizeProp !== undefined ? sizeProp : own
|
|
37
47
|
const setSize = onResize ?? setOwn
|
|
@@ -55,35 +65,29 @@ export default function QuickLookFrame({ title, meta, actions, onClose, nav, siz
|
|
|
55
65
|
}
|
|
56
66
|
const onPointerUp = () => { drag.current = null }
|
|
57
67
|
|
|
68
|
+
const grip = { role: 'separator', 'aria-label': 'Resize', onPointerDown, onPointerMove, onPointerUp, onPointerCancel: onPointerUp }
|
|
69
|
+
if (variant === 'float') {
|
|
70
|
+
return (
|
|
71
|
+
<div ref={ref} style={size ? { width: size.w, height: size.h } : undefined}
|
|
72
|
+
className={`kol-float-solid flex w-full max-w-[562px] flex-col gap-[18px] rounded-[var(--kol-float-window-r)] p-5 text-fg-emphasis ${className}`.trim()}>
|
|
73
|
+
{header && <QuickLookHeader variant="float" icon={icon} title={title} actions={actions} onMinimise={onMinimise} onClose={onClose} />}
|
|
74
|
+
<div className="flex min-h-0 flex-1 flex-col gap-[18px]">{children}</div>
|
|
75
|
+
{footer}
|
|
76
|
+
<div className="flex items-center gap-3">
|
|
77
|
+
<span className="kol-float-label min-w-0 flex-1 truncate text-fg-64">{status}</span>
|
|
78
|
+
<span {...grip} className="inline-flex size-4 cursor-nwse-resize touch-none items-center justify-center text-oq-64 hover:text-oq-96"><Icon name="expand" size={13} /></span>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
58
83
|
const style = size ? { width: size.w, height: size.h, '--kol-ql-frame-h': `${size.h}px`, '--kol-ql-max-w': `${size.w - 2}px` } : undefined
|
|
59
84
|
return (
|
|
60
85
|
<div ref={ref} style={style}
|
|
61
86
|
className={`kol-quicklook${footer ? ' kol-quicklook--footer' : ''}${size ? ' kol-quicklook--sized' : ''} ${className}`.trim()}>
|
|
62
|
-
{header &&
|
|
63
|
-
<div className="kol-quicklook-header">
|
|
64
|
-
{nav?.total > 1 && (
|
|
65
|
-
/* the pager is its own group: the count sits off the chevrons, and the group sits clear of
|
|
66
|
-
* the file's name (user 2026-09-23) */
|
|
67
|
-
<span className="flex items-center gap-1 mr-3">
|
|
68
|
-
<Button variant="nav" size="sm" iconOnly="chevron-left" onClick={nav.onPrev} aria-label="Previous" />
|
|
69
|
-
<Button variant="nav" size="sm" iconOnly="chevron-right" onClick={nav.onNext} aria-label="Next" />
|
|
70
|
-
<span className="kol-mono-12 text-meta tabular-nums ml-3">{nav.index + 1} / {nav.total}</span>
|
|
71
|
-
</span>
|
|
72
|
-
)}
|
|
73
|
-
{title && <span className="kol-mono-12 text-strong truncate">{title}</span>}
|
|
74
|
-
{meta && <span className="kol-mono-12 text-meta truncate">{meta}</span>}
|
|
75
|
-
<span className="flex-1" />
|
|
76
|
-
{actions}
|
|
77
|
-
{/* THE ESTATE'S CLOSE IDIOM, and every header control wears it (user 2026-09-23): bare at
|
|
78
|
-
* rest, a wash on hover — a filled container read as a second surface on the header. LAST, at the
|
|
79
|
-
* far right (user 2026-10-18: *"X should be space between justify on the right"*) */}
|
|
80
|
-
{onClose && <CloseButton size="sm" onClick={onClose} />}
|
|
81
|
-
</div>
|
|
82
|
-
)}
|
|
87
|
+
{header && <QuickLookHeader title={title} meta={meta} actions={actions} nav={nav} onClose={onClose} />}
|
|
83
88
|
<div className="kol-quicklook-body">{children}</div>
|
|
84
89
|
{footer && <div className="kol-quicklook-footer">{footer}</div>}
|
|
85
|
-
<span className="kol-quicklook-grip"
|
|
86
|
-
onPointerDown={onPointerDown} onPointerMove={onPointerMove} onPointerUp={onPointerUp} onPointerCancel={onPointerUp} />
|
|
90
|
+
<span className="kol-quicklook-grip" {...grip} />
|
|
87
91
|
</div>
|
|
88
92
|
)
|
|
89
93
|
}
|