@kolkrabbi/kol-framework 0.15.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/SideNav.jsx +34 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-framework",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "KOL app shell — sidenav, layout, theme toggle, footer, heroes + brand color layer. SideNav takes nav data as props so the tree stays app-local.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"app-shell"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@kolkrabbi/kol-component": "0.
|
|
30
|
+
"@kolkrabbi/kol-component": "0.28.0",
|
|
31
31
|
"@kolkrabbi/kol-icons": "0.10.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
package/src/SideNav.jsx
CHANGED
|
@@ -63,10 +63,13 @@ export default function SideNav({
|
|
|
63
63
|
const isActiveCat = (cat) => pagesOf(cat).some((p) => isPageActive(p.to))
|
|
64
64
|
|
|
65
65
|
/* Every navigation closes the mobile drawer — the prop sat accepted-but-
|
|
66
|
-
* unread until the kol-website session flagged it (2026-08-09)
|
|
66
|
+
* unread until the kol-website session flagged it (2026-08-09) — and, from
|
|
67
|
+
* the collapsed rail, expands the sidebar ("pressing any icon would expand
|
|
68
|
+
* the sidebar", same ruling as the chip removal). */
|
|
67
69
|
const handleNavigate = (e) => {
|
|
68
70
|
onNavigate?.(e)
|
|
69
71
|
onCloseDrawer?.()
|
|
72
|
+
if (collapsed) toggleCollapsed()
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
/* Which categories are disclosed. INDEPENDENT per category (elder ruling
|
|
@@ -78,6 +81,7 @@ export default function SideNav({
|
|
|
78
81
|
next.has(id) ? next.delete(id) : next.add(id)
|
|
79
82
|
return next
|
|
80
83
|
})
|
|
84
|
+
const discloseCat = (id) => setOpenCats((prev) => new Set(prev).add(id))
|
|
81
85
|
|
|
82
86
|
/* One collapse contract, two gestures — the hook owns the stamp, the
|
|
83
87
|
* storage schema and the state; the chip Button and the grab edge both
|
|
@@ -91,19 +95,24 @@ export default function SideNav({
|
|
|
91
95
|
className={`kol-sidenav sticky top-0 self-start h-dvh flex flex-col z-20${background ? ' bg-surface-primary border-r border-fg-08' : ''}${collapsed ? ' is-collapsed' : ''}${drawerOpen ? ' is-drawer-open' : ''}`}
|
|
92
96
|
>
|
|
93
97
|
{/* The elder A/B (closed 2026-08-01): the DS Button IS the collapse
|
|
94
|
-
* control
|
|
95
|
-
*
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
* control — EXPANDED ONLY (user ruling 2026-08-09, verbatim: "REMOVE
|
|
99
|
+
* chevron from collapsed view … from collapsed view pressing any icon
|
|
100
|
+
* would expand the sidebar!"). The collapsed rail's expand affordance
|
|
101
|
+
* is the rows themselves. Offset is half the pinned sm square,
|
|
102
|
+
* centring it on the rail's edge. */}
|
|
103
|
+
{!collapsed && (
|
|
104
|
+
<Button
|
|
105
|
+
variant="primary"
|
|
106
|
+
size="sm"
|
|
107
|
+
radius="full"
|
|
108
|
+
iconOnly="chevron-left"
|
|
109
|
+
aria-label="Collapse sidebar"
|
|
110
|
+
aria-expanded
|
|
111
|
+
title="Collapse"
|
|
112
|
+
onClick={toggleCollapsed}
|
|
113
|
+
className="kol-sidenav-toggle absolute top-5 right-[-0.875rem] z-[2]"
|
|
114
|
+
/>
|
|
115
|
+
)}
|
|
107
116
|
|
|
108
117
|
<div className="kol-sidenav-scroll flex-1 flex flex-col justify-between overflow-y-auto pt-4 pb-4 [scrollbar-width:thin]">
|
|
109
118
|
<nav aria-label="Sections">
|
|
@@ -139,7 +148,17 @@ export default function SideNav({
|
|
|
139
148
|
type="button"
|
|
140
149
|
className={`${rowCls} bg-transparent border-0 cursor-pointer text-left${isActiveCat(cat) ? ' is-active' : ''}`}
|
|
141
150
|
aria-expanded={isOpen}
|
|
142
|
-
|
|
151
|
+
/* Collapsed rail: the click meant "open this" — expand the
|
|
152
|
+
* rail AND disclose the category, or the tap is wasted on
|
|
153
|
+
* an expand that lands on a closed tree. */
|
|
154
|
+
onClick={() => {
|
|
155
|
+
if (collapsed) {
|
|
156
|
+
toggleCollapsed()
|
|
157
|
+
discloseCat(cat.id)
|
|
158
|
+
} else {
|
|
159
|
+
toggleCat(cat.id)
|
|
160
|
+
}
|
|
161
|
+
}}
|
|
143
162
|
>
|
|
144
163
|
{glyph}
|
|
145
164
|
<span className="kol-sidenav-hop-label flex-1 min-w-0">{cat.label}</span>
|