@kolkrabbi/kol-shell 0.111.0 → 0.112.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 +3 -3
- package/src/PropertyRail.jsx +44 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.112.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The application shell",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
+
"@kolkrabbi/kol-framework": "^0.70.0",
|
|
24
25
|
"@kolkrabbi/kol-component": "^0.343.0",
|
|
25
26
|
"@kolkrabbi/kol-icons": "^0.66.0",
|
|
26
|
-
"@kolkrabbi/kol-
|
|
27
|
-
"@kolkrabbi/kol-theme": "^0.212.0"
|
|
27
|
+
"@kolkrabbi/kol-theme": "^0.213.0"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
package/src/PropertyRail.jsx
CHANGED
|
@@ -22,16 +22,29 @@ import { Icon } from '@kolkrabbi/kol-icons'
|
|
|
22
22
|
* `{ type: 'slider', id?, label, value, onChange, min?, max?, step?, formatValue? }` (Slider float) ·
|
|
23
23
|
* `{ type: 'switch', id?, label, icon?, on, onChange }` (ToggleSwitch float) ·
|
|
24
24
|
* `{ id?, render }` — anything else
|
|
25
|
+
* `{ type: 'labeled', id?, label, render }` — the tool Rail's row (generator Rails, plan-2026-11-05-float-editor
|
|
26
|
+
* W7.6): the label in a 110 column, the control in the rest ·
|
|
27
|
+
* `{ type: 'subhead', id?, label, meta? }` — a group's caps head inside a section (LIGHTS / POINT EDITOR) ·
|
|
28
|
+
* a section may also be `collapsible` (`open` · `onToggle(open)`): its head is the chevron and the
|
|
29
|
+
* title in `kol-float-panel`, `meta` at the far end, its rows shown while open
|
|
30
|
+
* @param {'regular'|'compact'} density `compact` — the tool Rail's rhythm (his generator frames 32:16215): 8 between rows,
|
|
31
|
+
* 24 before a section, 20 before a subhead; `regular` (default) the inspector's 18
|
|
32
|
+
* @param {Function} onExpand the ↗ in the header — the tool's expanded form (the settings dialog); unset, none
|
|
33
|
+
* @param {ReactNode} footer the Rail's foot (a status line, the tool's action), after the sections
|
|
25
34
|
* @param {'solid'|'glass-dark'|'glass-light'} surface what the sheet is made of (default `solid`)
|
|
26
35
|
* @param {number} width the sheet's width (default 272)
|
|
27
36
|
* @param {string} className
|
|
28
37
|
*/
|
|
29
|
-
export default function PropertyRail({ title, onCollapse, tabs, tab, onTab, selected, sections = [], surface = 'solid', width = 272, className = '' }) {
|
|
38
|
+
export default function PropertyRail({ title, onCollapse, onExpand, density = 'regular', tabs, tab, onTab, selected, sections = [], footer, surface = 'solid', width = 272, className = '' }) {
|
|
39
|
+
const compact = density === 'compact'
|
|
30
40
|
return (
|
|
31
|
-
<div className={`kol-property-rail kol-float-chrome flex flex-col gap-[18px] p-4 rounded-[var(--kol-float-menu-r)] ${floatSurfaceClass(surface, true)} ${className}`.trim()} style={{ width }}>
|
|
41
|
+
<div className={`kol-property-rail kol-float-chrome flex flex-col ${compact ? 'gap-2' : 'gap-[18px]'} p-4 rounded-[var(--kol-float-menu-r)] ${floatSurfaceClass(surface, true)} ${className}`.trim()} style={{ width }}>
|
|
32
42
|
<div className="flex items-center justify-between">
|
|
33
43
|
<span className="kol-float-panel text-emphasis">{title}</span>
|
|
34
|
-
|
|
44
|
+
<span className="flex items-center gap-1">
|
|
45
|
+
{onExpand && <Button variant="float" tone="ghost" size="sm" iconOnly="arrow-upright" aria-label="Expand" onClick={onExpand} />}
|
|
46
|
+
{onCollapse && <Button variant="float" tone="ghost" size="sm" iconOnly="skip-end" aria-label="Collapse" onClick={onCollapse} />}
|
|
47
|
+
</span>
|
|
35
48
|
</div>
|
|
36
49
|
{tabs?.length > 0 && <TabsRow variant="float" size="xs" tabs={tabs} value={tab} onChange={onTab} ariaLabel={`${title} tabs`} />}
|
|
37
50
|
{selected && (
|
|
@@ -44,22 +57,46 @@ export default function PropertyRail({ title, onCollapse, tabs, tab, onTab, sele
|
|
|
44
57
|
</div>
|
|
45
58
|
)}
|
|
46
59
|
{sections.map((s, i) => (
|
|
47
|
-
<section key={s.id ?? s.label ?? i} className=
|
|
48
|
-
{
|
|
60
|
+
<section key={s.id ?? s.label ?? i} className={`flex flex-col ${compact ? `gap-2${i > 0 ? ' pt-4' : ''}` : 'gap-[18px]'}`} data-section={s.id ?? s.label}>
|
|
61
|
+
{s.collapsible ? (
|
|
62
|
+
<button type="button" aria-expanded={!!s.open} onClick={() => s.onToggle?.(!s.open)}
|
|
63
|
+
className="flex items-center gap-1.5 text-left focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] rounded-sm">
|
|
64
|
+
<Icon name="chevron-down" size={12} className={`text-oq-64 transition-transform ${s.open ? '' : '-rotate-90'}`} />
|
|
65
|
+
<span className="kol-float-panel text-emphasis flex-1 min-w-0">{s.label}</span>
|
|
66
|
+
{s.meta && <span className="kol-float-timecode text-oq-64">{s.meta}</span>}
|
|
67
|
+
</button>
|
|
68
|
+
) : (s.label || s.onAdd || s.meta) && (
|
|
49
69
|
<div className="flex items-center justify-between">
|
|
50
70
|
<span className="kol-float-label text-oq-64">{s.label}</span>
|
|
51
71
|
{s.onAdd && <Button variant="float" tone="ghost" size="sm" iconOnly="plus" aria-label={`Add to ${s.label}`} onClick={s.onAdd} />}
|
|
52
72
|
{s.meta && <span className="kol-float-timecode text-emphasis">{s.meta}</span>}
|
|
53
73
|
</div>
|
|
54
74
|
)}
|
|
55
|
-
{(s.rows ?? []).map((r, j) => <Row key={r.id ?? j} row={r} />)}
|
|
75
|
+
{(!s.collapsible || s.open) && (s.rows ?? []).map((r, j) => <Row key={r.id ?? j} row={r} compact={compact} />)}
|
|
56
76
|
</section>
|
|
57
77
|
))}
|
|
78
|
+
{footer && <div className={compact ? 'pt-4' : undefined}>{footer}</div>}
|
|
58
79
|
</div>
|
|
59
80
|
)
|
|
60
81
|
}
|
|
61
82
|
|
|
62
|
-
function Row({ row: r }) {
|
|
83
|
+
function Row({ row: r, compact }) {
|
|
84
|
+
if (r.type === 'labeled') {
|
|
85
|
+
return (
|
|
86
|
+
<div className="flex items-center gap-1.5 min-h-7" data-control={r.label}>
|
|
87
|
+
<span className="kol-float-hint text-oq-64 w-[110px] shrink-0 truncate">{r.label}</span>
|
|
88
|
+
<div className="flex-1 min-w-0 flex items-center gap-1.5">{r.render()}</div>
|
|
89
|
+
</div>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
if (r.type === 'subhead') {
|
|
93
|
+
return (
|
|
94
|
+
<div className={`flex items-center justify-between ${compact ? 'pt-3' : 'pt-1'}`}>
|
|
95
|
+
<span className="kol-float-label text-oq-64">{r.label}</span>
|
|
96
|
+
{r.meta && <span className="kol-float-label text-fg-emphasis">{r.meta}</span>}
|
|
97
|
+
</div>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
63
100
|
if (r.render) return r.render()
|
|
64
101
|
if (r.type === 'fields') {
|
|
65
102
|
return (
|