@kolkrabbi/kol-component 0.336.1 → 0.337.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.337.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"embla-carousel-react": "^8.6.0",
|
|
30
30
|
"pdfjs-dist": "^6.3.289",
|
|
31
31
|
"react-syntax-highlighter": "^16.1.1",
|
|
32
|
+
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
32
33
|
"@kolkrabbi/kol-search": "^0.3.0",
|
|
33
|
-
"@kolkrabbi/kol-growth": "^0.5.0"
|
|
34
|
-
"@kolkrabbi/kol-markdown": "^0.2.0"
|
|
34
|
+
"@kolkrabbi/kol-growth": "^0.5.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@kolkrabbi/kol-icons": ">=0.61.1",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@kolkrabbi/kol-icons": "^0.
|
|
45
|
+
"@kolkrabbi/kol-icons": "^0.64.0"
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
|
48
48
|
"src",
|
|
@@ -31,10 +31,12 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
31
31
|
* @param {Function} [onHide] the rail's hide slot (expanded: put kol-shell's RailDisplayControls in `footer`)
|
|
32
32
|
* @param {Array} [defaultExpanded] paths of sections open at mount
|
|
33
33
|
* @param {ReactNode} [footer]
|
|
34
|
+
* @param {Function} [onItemHover] collapsed only: `(item, element)` when the pointer enters a slot, `(null, null)` when it
|
|
35
|
+
* leaves — the seam a hover flyout hangs off (kol-shell's RailFlyout, FloatLayout 2026-11-04)
|
|
34
36
|
*/
|
|
35
37
|
const isOn = (path, current) => !!path && path === current
|
|
36
38
|
|
|
37
|
-
export default function NavRailFloat({ items = [], currentPath = '', onNavigate, collapsed = false, onCollapsedChange, title, icon = 'grid', onSwitch, switcher, onSearch, onHide, defaultExpanded = [], footer, className = '' }) {
|
|
39
|
+
export default function NavRailFloat({ items = [], currentPath = '', onNavigate, collapsed = false, onCollapsedChange, title, icon = 'grid', onSwitch, switcher, onSearch, onHide, defaultExpanded = [], footer, onItemHover, className = '' }) {
|
|
38
40
|
const [open, setOpen] = useState(() => new Set(defaultExpanded))
|
|
39
41
|
const toggle = (path) => setOpen((s) => { const n = new Set(s); n.has(path) ? n.delete(path) : n.add(path); return n })
|
|
40
42
|
const go = (path) => () => onNavigate?.(path)
|
|
@@ -56,7 +58,8 @@ export default function NavRailFloat({ items = [], currentPath = '', onNavigate,
|
|
|
56
58
|
if (it.heading) return i === 0 ? null : <span key={`h${i}`} className="h-4 shrink-0" aria-hidden />
|
|
57
59
|
const on = isOn(it.path, currentPath) || !!it.sub?.some((c) => isOn(c.path, currentPath))
|
|
58
60
|
return (
|
|
59
|
-
<span key={it.path ?? it.label} className="relative flex w-full justify-center"
|
|
61
|
+
<span key={it.path ?? it.label} className="relative flex w-full justify-center"
|
|
62
|
+
onMouseEnter={onItemHover && ((e) => onItemHover(it, e.currentTarget))} onMouseLeave={onItemHover && (() => onItemHover(null, null))}>
|
|
60
63
|
{on && <span className="absolute left-[5px] top-1/2 h-3.5 w-[3px] -translate-y-1/2 rounded-full bg-[var(--kol-surface-on-primary)]" aria-hidden />}
|
|
61
64
|
{slot(it.path ?? it.label, it.label, it.icon, { on, onClick: go(it.path) })}
|
|
62
65
|
</span>
|