@kolkrabbi/kol-shell 0.119.1 → 0.120.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 +15 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.120.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The application shell",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"./src/*": "./src/*"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@kolkrabbi/kol-component": ">=0.
|
|
15
|
+
"@kolkrabbi/kol-component": ">=0.362.0",
|
|
16
16
|
"@kolkrabbi/kol-framework": ">=0.55.0",
|
|
17
17
|
"@kolkrabbi/kol-icons": ">=0.69.0",
|
|
18
18
|
"@kolkrabbi/kol-theme": ">=0.215.0",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@kolkrabbi/kol-component": "^0.
|
|
24
|
+
"@kolkrabbi/kol-component": "^0.362.0",
|
|
25
25
|
"@kolkrabbi/kol-icons": "^0.70.1",
|
|
26
26
|
"@kolkrabbi/kol-framework": "^0.74.1",
|
|
27
27
|
"@kolkrabbi/kol-theme": "^0.217.0"
|
package/src/PropertyRail.jsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
1
2
|
import { Button, Input, Dropdown, Slider, ToggleSwitch, TabsRow, floatSurfaceClass } from '@kolkrabbi/kol-component'
|
|
2
3
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
3
4
|
|
|
@@ -33,19 +34,30 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
33
34
|
* @param {ReactNode} footer the Rail's foot (a status line, the tool's action), after the sections
|
|
34
35
|
* @param {'solid'|'glass-dark'|'glass-light'} surface what the sheet is made of (default `solid`)
|
|
35
36
|
* @param {number} width the sheet's width (default 272)
|
|
37
|
+
* @param {boolean} foldable the fold ⌃ in the header: the Rail folds to its header pill and opens again — every float
|
|
38
|
+
* panel is a module (the user, 2026-11-12: *"EVERYTHING IS FLOAT everything is MODULES"*)
|
|
39
|
+
* @param {boolean} folded controlled; `defaultFolded` uncontrolled · `onFold(folded)` on every press. Folded, only the
|
|
40
|
+
* header shows, on the same sheet
|
|
41
|
+
* @param {ReactNode} children the body slot, after the sections — a panel that is not rows (ReadingContents' `bare` body,
|
|
42
|
+
* Labs' params)
|
|
36
43
|
* @param {string} className
|
|
37
44
|
*/
|
|
38
|
-
export default function PropertyRail({ title, onCollapse, onExpand, density = 'regular', tabs, tab, onTab, selected, sections = [], footer, surface = 'solid', width = 272, className = '' }) {
|
|
45
|
+
export default function PropertyRail({ title, onCollapse, onExpand, density = 'regular', tabs, tab, onTab, selected, sections = [], footer, surface = 'solid', width = 272, foldable = false, folded, defaultFolded = false, onFold, children, className = '' }) {
|
|
39
46
|
const compact = density === 'compact'
|
|
47
|
+
const [ownFolded, setOwnFolded] = useState(defaultFolded)
|
|
48
|
+
const isFolded = foldable && (folded ?? ownFolded)
|
|
49
|
+
const fold = () => { const next = !isFolded; if (folded === undefined) setOwnFolded(next); onFold?.(next) }
|
|
40
50
|
return (
|
|
41
51
|
<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 }}>
|
|
42
52
|
<div className="flex items-center justify-between">
|
|
43
53
|
<span className="kol-float-panel text-emphasis">{title}</span>
|
|
44
54
|
<span className="flex items-center gap-1">
|
|
55
|
+
{foldable && <Button variant="float" tone="ghost" size="sm" iconOnly={isFolded ? 'chevron-down' : 'chevron-up'} aria-label={isFolded ? 'Open' : 'Fold'} aria-expanded={!isFolded} onClick={fold} />}
|
|
45
56
|
{onExpand && <Button variant="float" tone="ghost" size="sm" iconOnly="arrow-upright" aria-label="Expand" onClick={onExpand} />}
|
|
46
57
|
{onCollapse && <Button variant="float" tone="ghost" size="sm" iconOnly="panel-right" aria-label="Collapse" onClick={onCollapse} />}
|
|
47
58
|
</span>
|
|
48
59
|
</div>
|
|
60
|
+
{!isFolded && <>
|
|
49
61
|
{tabs?.length > 0 && <TabsRow variant="float" size="xs" tabs={tabs} value={tab} onChange={onTab} ariaLabel={`${title} tabs`} />}
|
|
50
62
|
{selected && (
|
|
51
63
|
<div className="flex items-center gap-2">
|
|
@@ -75,7 +87,9 @@ export default function PropertyRail({ title, onCollapse, onExpand, density = 'r
|
|
|
75
87
|
{(!s.collapsible || s.open) && (s.rows ?? []).map((r, j) => <Row key={r.id ?? j} row={r} compact={compact} />)}
|
|
76
88
|
</section>
|
|
77
89
|
))}
|
|
90
|
+
{children}
|
|
78
91
|
{footer && <div className={compact ? 'pt-4' : undefined}>{footer}</div>}
|
|
92
|
+
</>}
|
|
79
93
|
</div>
|
|
80
94
|
)
|
|
81
95
|
}
|