@kolkrabbi/kol-shell 0.106.0 → 0.108.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 +6 -6
- package/src/FloatActionMenu.jsx +47 -0
- package/src/FloatLayout.jsx +29 -14
- package/src/HubHome.jsx +3 -23
- package/src/RailFlyout.jsx +7 -4
- package/src/RailTrigger.jsx +6 -4
- package/src/TopControlsBar.jsx +6 -1
- package/src/index.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.108.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The application shell",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
"./src/*": "./src/*"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@kolkrabbi/kol-component": ">=0.
|
|
15
|
+
"@kolkrabbi/kol-component": ">=0.341.0",
|
|
16
16
|
"@kolkrabbi/kol-framework": ">=0.55.0",
|
|
17
17
|
"@kolkrabbi/kol-icons": ">=0.16.0",
|
|
18
|
-
"@kolkrabbi/kol-theme": ">=0.
|
|
18
|
+
"@kolkrabbi/kol-theme": ">=0.212.0",
|
|
19
19
|
"gsap": "^3.13.0",
|
|
20
20
|
"react": "^18.3.0 || ^19.0.0",
|
|
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.341.0",
|
|
25
|
+
"@kolkrabbi/kol-theme": "^0.212.0",
|
|
25
26
|
"@kolkrabbi/kol-icons": "^0.64.0",
|
|
26
|
-
"@kolkrabbi/kol-framework": "^0.70.0"
|
|
27
|
-
"@kolkrabbi/kol-theme": "^0.211.1"
|
|
27
|
+
"@kolkrabbi/kol-framework": "^0.70.0"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Button, PopoverPanel, usePopover, floatSurfaceClass, floatMotion } from '@kolkrabbi/kol-component'
|
|
3
|
+
import MoreRows from './MoreSheet.jsx'
|
|
4
|
+
|
|
5
|
+
/* taxonomy-ok: molecule — a round Button that opens the More sheet's rows */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* FloatActionMenu — The masthead's round button and its sheet (FloatActionMenuExport, kol-website 2026-11-04 — lifted as is
|
|
9
|
+
* from HubHome's private `HomeMenu`, which it still is): the inverted round button, × while its sheet is open, the sheet
|
|
10
|
+
* beside it to the LEFT, top edges on one line, 12 off (user 2026-10-23), the phone More's rows. The catalog's
|
|
11
|
+
* VariantsButton shape. FloatLayout draws it at the bar's end from `bar.menu`.
|
|
12
|
+
*
|
|
13
|
+
* @param {Array} actions `[{ label, icon?, onPress }]` — MoreRows' actions
|
|
14
|
+
* @param {'more'|'plus'|string} [icon='more'] the button's glyph; anything but `more` turns to × while open
|
|
15
|
+
* @param {'float'} [variant] the sheet in the float look (`kol-more-sheet-float` on `surface`); unset, the plain sheet
|
|
16
|
+
* @param {'solid'|'glass-dark'|'glass-light'} [surface='solid'] what the float sheet is made of — the button never changes
|
|
17
|
+
* @param {'rotate'|'swap'} [iconMotion='rotate'] how a glyph that is not `more` becomes the × while open: `rotate` turns
|
|
18
|
+
* the one glyph 45° (the + into the ×) and back on close; `swap` exchanges the icon
|
|
19
|
+
* @param {boolean|Object} [motion=true] the button's states, the turn and the sheet's enter and leave: `true` the
|
|
20
|
+
* `--kol-float-*` tokens · `false` none · `{ duration, ease }` per app (floatMotion)
|
|
21
|
+
* @param {string} [className]
|
|
22
|
+
*
|
|
23
|
+
* The button's ladder (FloatActionStatesAndMotion, kol-website 2026-11-04): rest the solid inverted circle with the float
|
|
24
|
+
* shadow · hover the same fill at `--kol-float-hover-opacity` · pressed `--kol-float-press-scale` · open the × on the same
|
|
25
|
+
* fill and shadow (`.kol-float-action`; the shadow with `variant="float"`, so Home's plain masthead button is not lifted).
|
|
26
|
+
*/
|
|
27
|
+
export default function FloatActionMenu({ actions, icon = 'more', variant, surface = 'solid', iconMotion = 'rotate', motion = true, className = '' }) {
|
|
28
|
+
const [open, setOpen] = useState(false)
|
|
29
|
+
/* the sheet opens to the LEFT of the button, top edges on one line (user 2026-10-23) — as the phone's sits beside its × */
|
|
30
|
+
const popover = usePopover({ open, onOpenChange: setOpen, placement: 'left-start', offset: 12 })
|
|
31
|
+
const turn = icon !== 'more' && iconMotion === 'rotate'
|
|
32
|
+
const glyph = icon === 'more' ? 'more' : open && !turn ? 'x' : icon
|
|
33
|
+
return (
|
|
34
|
+
<div className={className} style={floatMotion(motion).style}>
|
|
35
|
+
<span ref={popover.refs.setReference} {...popover.getReferenceProps()} className="inline-flex">
|
|
36
|
+
{/* `icon` — `more` on Home, `plus` signed out (frame B2), the × while its sheet is open */}
|
|
37
|
+
{/* always the inverted round button — `surface` dresses its menu only (HomeDockRound4, kol-fxr 2026-10-31 — user: *"this
|
|
38
|
+
* also changed the action button, but it is not supposed to change"*) */}
|
|
39
|
+
<Button iconOnly={glyph} size="lg" tone="inverted" radius="full" aria-label={open ? 'Close' : 'Actions'} pressed={open}
|
|
40
|
+
className={`kol-float-action${variant === 'float' ? ' is-float' : ''}${turn ? ` kol-float-turn${open ? ' is-open' : ''}` : ''}`} />
|
|
41
|
+
</span>
|
|
42
|
+
<PopoverPanel popover={popover} panel={false} motion={motion} className={`kol-more-sheet${variant === 'float' ? ` kol-more-sheet-float ${floatSurfaceClass(surface, true)}` : ''}`} style={{ minWidth: 220 }}>
|
|
43
|
+
<MoreRows actions={actions} variant={variant} onPick={() => setOpen(false)} />
|
|
44
|
+
</PopoverPanel>
|
|
45
|
+
</div>
|
|
46
|
+
)
|
|
47
|
+
}
|
package/src/FloatLayout.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRef, useState } from 'react'
|
|
2
|
-
import { NavRail, CommandOverlay, useMediaQuery, useRailKeys } from '@kolkrabbi/kol-component'
|
|
2
|
+
import { NavRail, CommandOverlay, useMediaQuery, useRailKeys, floatMotion, useFloatPresence } from '@kolkrabbi/kol-component'
|
|
3
3
|
import TopControlsBar from './TopControlsBar.jsx'
|
|
4
4
|
import RailTrigger from './RailTrigger.jsx'
|
|
5
5
|
import RailFlyout from './RailFlyout.jsx'
|
|
@@ -31,7 +31,7 @@ import RailDisplayControls from './RailDisplayControls.jsx'
|
|
|
31
31
|
* @param {Array} [defaultExpanded] paths of the nav's sections open at mount (NavRail's own; nothing auto-expands)
|
|
32
32
|
* @param {ReactNode} [railFooter] the expanded Rail's foot (default RailDisplayControls: theme · Collapse · Hide)
|
|
33
33
|
* @param {string|string[]} [breadcrumb] the words beside RailTrigger while the nav is hidden
|
|
34
|
-
* @param {Object} [bar] TopControlsBar's props (`document` · `tabs` · `tab` · `onTab` · `onSearch` · `action` · `start` · `center` · `end`); `panels` is the frame's
|
|
34
|
+
* @param {Object} [bar] TopControlsBar's props (`document` · `tabs` · `tab` · `onTab` · `onSearch` · `action` · `menu` · `start` · `center` · `end`); `menu` — `[{ label, icon?, onPress }]` — is FloatActionMenu in the top-right corner; `panels` is the frame's
|
|
35
35
|
* @param {ReactNode} [eyebrow] a line in the 40 under the bar (float-operational W4.2, 9:14340's WORKSPACE / TASKS): 25 under
|
|
36
36
|
* the bar, taking no height, so the content still starts 40 down. Below `md` it sits in flow
|
|
37
37
|
* under the bar
|
|
@@ -46,6 +46,10 @@ import RailDisplayControls from './RailDisplayControls.jsx'
|
|
|
46
46
|
* RailTrigger's "Show navigation" row and `⇧\` (FloatSearchAndPanels, 2026-11-04)
|
|
47
47
|
* @param {Object} [search] CommandOverlay's props (`open` · `onClose` · `results` · `query` · `onQueryChange` · `onSelect` …):
|
|
48
48
|
* the search modal, drawn on this frame's `surface`; the app keeps the data
|
|
49
|
+
* @param {boolean|Object} [motion=true] the float family's motion, handed to every piece (FloatActionStatesAndMotion,
|
|
50
|
+
* 2026-11-04): the nav Rail's expand ↔ collapse (width) and hide ↔ show (the width opens from and
|
|
51
|
+
* closes to 0, fading), RailFlyout and RailTrigger's card in and out, the search modal, and the
|
|
52
|
+
* + and its card. `true` the `--kol-float-*` tokens · `false` none · `{ duration, ease }` per app
|
|
49
53
|
* @param {ReactNode} children the content
|
|
50
54
|
* @param {string} [className]
|
|
51
55
|
*/
|
|
@@ -53,7 +57,7 @@ export default function FloatLayout({
|
|
|
53
57
|
nav = [], currentPath = '', onNavigate, title, icon, onSwitch, onSearch,
|
|
54
58
|
rail, defaultRail = 'expanded', onRailChange, railKeys, railMode = 'push', defaultExpanded, railFooter, breadcrumb,
|
|
55
59
|
bar = {}, eyebrow, inspector, bottom, inspectorLabel = 'Inspector', inspectorHidden, defaultInspectorHidden = false, onInspectorHiddenChange,
|
|
56
|
-
surface = 'solid', panels = true, search, children, className = '',
|
|
60
|
+
surface = 'solid', panels = true, search, motion = true, children, className = '',
|
|
57
61
|
}) {
|
|
58
62
|
const [ownRail, setOwnRail] = useState(defaultRail)
|
|
59
63
|
const [ownHidden, setOwnHidden] = useState(defaultInspectorHidden)
|
|
@@ -67,9 +71,19 @@ export default function FloatLayout({
|
|
|
67
71
|
const phone = useMediaQuery('(max-width: 767px)')
|
|
68
72
|
const shown = phone ? 'hidden' : railNow
|
|
69
73
|
const overlay = railMode === 'overlay'
|
|
74
|
+
const fm = floatMotion(motion)
|
|
75
|
+
/* the rail is held while it hides, so its width closes to 0 instead of the page jumping (FloatActionStatesAndMotion) */
|
|
76
|
+
const railShown = shown !== 'hidden'
|
|
77
|
+
const railPresence = useFloatPresence(railShown, fm.rail)
|
|
78
|
+
const lastRail = useRef(shown)
|
|
79
|
+
if (railShown) lastRail.current = shown
|
|
80
|
+
const railState = railShown ? shown : lastRail.current
|
|
70
81
|
|
|
71
82
|
// the hover flyout: a section's rows beside the 72 Rail, kept open while the pointer is on the slot or the card
|
|
72
83
|
const [fly, setFly] = useState(null)
|
|
84
|
+
/* the last card is kept so RailFlyout can play its leave after `fly` clears */
|
|
85
|
+
const lastFly = useRef(null)
|
|
86
|
+
if (fly) lastFly.current = fly
|
|
73
87
|
const timer = useRef(0)
|
|
74
88
|
const hold = () => clearTimeout(timer.current)
|
|
75
89
|
const drop = () => { hold(); timer.current = setTimeout(() => setFly(null), 160) }
|
|
@@ -92,18 +106,19 @@ export default function FloatLayout({
|
|
|
92
106
|
const body = typeof inspector === 'function' ? inspector({ hide: () => setHidden(true) }) : inspector
|
|
93
107
|
|
|
94
108
|
return (
|
|
95
|
-
<div className={`kol-float-layout relative flex h-dvh gap-6 overflow-hidden bg-surface-primary p-6 max-md:p-4 ${className}`.trim()}>
|
|
96
|
-
{
|
|
97
|
-
<NavRail variant="float" items={nav} currentPath={currentPath} onNavigate={onNavigate}
|
|
98
|
-
collapsed={
|
|
109
|
+
<div className={`kol-float-layout relative flex h-dvh gap-6 overflow-hidden bg-surface-primary p-6 max-md:p-4 ${className}`.trim()} style={fm.style}>
|
|
110
|
+
{railPresence.mounted && (
|
|
111
|
+
<NavRail variant="float" items={nav} currentPath={currentPath} onNavigate={onNavigate} motion={motion}
|
|
112
|
+
collapsed={railState === 'collapsed'} onCollapsedChange={(c) => { setFly(null); setRail(c ? 'collapsed' : 'expanded') }}
|
|
99
113
|
title={title} icon={icon} onSwitch={onSwitch} onSearch={onSearch} onHide={() => setRail('hidden')}
|
|
100
114
|
onItemHover={shown === 'collapsed' ? onItemHover : undefined} defaultExpanded={defaultExpanded}
|
|
101
|
-
footer={
|
|
102
|
-
className={overlay ? 'absolute inset-y-6 left-6 z-[var(--kol-z-sticky)] !h-auto' : 'shrink-0'} />
|
|
115
|
+
footer={railState === 'expanded' ? (railFooter ?? <RailDisplayControls onCollapse={() => setRail('collapsed')} onHide={() => setRail('hidden')} />) : undefined}
|
|
116
|
+
className={`${overlay ? 'absolute inset-y-6 left-6 z-[var(--kol-z-sticky)] !h-auto' : 'shrink-0'}${railPresence.entering ? ' is-entering' : ''}${railPresence.exiting ? ' is-exiting' : ''}`} />
|
|
103
117
|
)}
|
|
104
|
-
{shown === 'collapsed' &&
|
|
118
|
+
{shown === 'collapsed' && lastFly.current && (
|
|
105
119
|
<span className="contents" onMouseEnter={hold} onMouseLeave={drop}>
|
|
106
|
-
<RailFlyout icon={
|
|
120
|
+
<RailFlyout icon={lastFly.current.item.icon} title={lastFly.current.item.label} items={lastFly.current.item.sub} active={currentPath}
|
|
121
|
+
anchor={lastFly.current.el} open={!!fly} surface={surface} motion={motion}
|
|
107
122
|
onOpenChange={(o) => { if (!o) setFly(null) }}
|
|
108
123
|
onPick={(i) => { setFly(null); if (i.path) onNavigate?.(i.path) }} />
|
|
109
124
|
</span>
|
|
@@ -111,10 +126,10 @@ export default function FloatLayout({
|
|
|
111
126
|
<div className="flex min-w-0 flex-1 flex-col gap-10 max-md:gap-6">
|
|
112
127
|
<div className="relative min-w-0 shrink-0">
|
|
113
128
|
<div className="flex min-w-0 items-center gap-4">
|
|
114
|
-
{shown === 'hidden' && <RailTrigger items={nav} currentPath={currentPath} onNavigate={onNavigate} title={title} breadcrumb={phone ? undefined : breadcrumb} surface={surface}
|
|
129
|
+
{shown === 'hidden' && <RailTrigger items={nav} currentPath={currentPath} onNavigate={onNavigate} title={title} breadcrumb={phone ? undefined : breadcrumb} surface={surface} motion={motion}
|
|
115
130
|
onRestore={phone ? undefined : () => setRail(lastShown.current)}
|
|
116
131
|
className={overlay && !phone ? 'absolute inset-y-0 left-0 z-[var(--kol-z-sticky)]' : 'shrink-0'} />}
|
|
117
|
-
<TopControlsBar {...bar} panels={panels && restore.length ? { items: restore } : undefined} surface={surface}
|
|
132
|
+
<TopControlsBar motion={motion} {...bar} panels={panels && restore.length ? { items: restore } : undefined} surface={surface}
|
|
118
133
|
className={`min-w-0 flex-1 max-md:overflow-x-auto max-md:[scrollbar-width:none] ${bar.className ?? ''}`.trim()} />
|
|
119
134
|
</div>
|
|
120
135
|
{eyebrow && <div className="kol-float-layout-eyebrow absolute inset-x-0 top-full pt-[25px] max-md:static max-md:pt-6">{eyebrow}</div>}
|
|
@@ -127,7 +142,7 @@ export default function FloatLayout({
|
|
|
127
142
|
{bottom && <div className="kol-float-layout-bottom min-w-0 shrink-0">{bottom}</div>}
|
|
128
143
|
</div>
|
|
129
144
|
</div>
|
|
130
|
-
{search && <CommandOverlay {...search} surface={surface} />}
|
|
145
|
+
{search && <CommandOverlay {...search} surface={surface} motion={motion} />}
|
|
131
146
|
</div>
|
|
132
147
|
)
|
|
133
148
|
}
|
package/src/HubHome.jsx
CHANGED
|
@@ -2,7 +2,7 @@ import { cloneElement, isValidElement, useEffect, useState } from 'react'
|
|
|
2
2
|
import { Button, PopoverPanel, usePopover, useMediaQuery, usePrefersReducedMotion, VectorLoader, floatSurfaceClass } from '@kolkrabbi/kol-component'
|
|
3
3
|
import AppFloatNav from './AppFloatNav.jsx'
|
|
4
4
|
import WalkthroughPanel from './WalkthroughPanel.jsx'
|
|
5
|
-
import
|
|
5
|
+
import FloatActionMenu from './FloatActionMenu.jsx'
|
|
6
6
|
import CatalogPage from './CatalogPage.jsx'
|
|
7
7
|
import AccountForm from './AccountForm.jsx'
|
|
8
8
|
import { useTouchPrimary } from './TouchDeviceOverlay.jsx'
|
|
@@ -281,7 +281,7 @@ export default function HubHome({
|
|
|
281
281
|
const menuActions = typeof menu === 'function' ? menu(menuDefaults) ?? [] : menuDefaults
|
|
282
282
|
/* with the drawer the button stays on the phone, stepped left of the shell's drawer trigger (fixed top-right, 32 at 12;
|
|
283
283
|
* the variants gate caught the overlap on editor-hub at 390) */
|
|
284
|
-
const headerMenu = menuActions.length ? <
|
|
284
|
+
const headerMenu = menuActions.length ? <FloatActionMenu actions={menuActions} className={actionsInBar ? 'max-md:hidden' : 'max-md:mr-11'} /> : undefined
|
|
285
285
|
|
|
286
286
|
/* the quick links — fxr's chromes, a phone's stack above the rows; a desk never sees them. The stack is fxr's EntryScreen
|
|
287
287
|
* verbatim (kol-fxr src/editor/mobile/MobileView.jsx): `kol-eyebrow text-body`, `gap-2`, `tone="primary" size="lg"`, the icon
|
|
@@ -329,7 +329,7 @@ export default function HubHome({
|
|
|
329
329
|
)}
|
|
330
330
|
{/* the + on the phone too (Round 3: the phone had no way to sign in from Home) — top-right on the mark's line, 16 in
|
|
331
331
|
* and 24 down; its menu is the floating style (`variant="float"`, the board's menus), as the dock's sheets are */}
|
|
332
|
-
{outActions.length > 0 && <
|
|
332
|
+
{outActions.length > 0 && <FloatActionMenu actions={outActions} icon="plus" variant="float" surface={surface} className="absolute z-10 right-4 top-6 md:right-16 md:top-16" />}
|
|
333
333
|
{/* over a stage the dock floats: the transport's shadow (HomeDockShadow, kol-fxr 2026-10-31) */}
|
|
334
334
|
{chromes.length > 0 && <AppFloatNav variant="dock" shape="pill" shadow={stage != null} surface={surface} items={chromes.map((c) => ({ id: c.label, label: c.label, icon: c.icon, onPress: c.onPress, sub: c.sub }))} sheetItems={dockMore} />}
|
|
335
335
|
{/* the walkthrough over the stage, where the catalog's would sit — on the mark's left line */}
|
|
@@ -365,23 +365,3 @@ export default function HubHome({
|
|
|
365
365
|
/>
|
|
366
366
|
)
|
|
367
367
|
}
|
|
368
|
-
|
|
369
|
-
/* the masthead's round button and its sheet — the catalog's VariantsButton shape, the phone More's rows */
|
|
370
|
-
function HomeMenu({ actions, icon = 'more', variant, surface = 'solid', className = '' }) {
|
|
371
|
-
const [open, setOpen] = useState(false)
|
|
372
|
-
/* the sheet opens to the LEFT of the button, top edges on one line (user 2026-10-23) — as the phone's sits beside its × */
|
|
373
|
-
const popover = usePopover({ open, onOpenChange: setOpen, placement: 'left-start', offset: 12 })
|
|
374
|
-
return (
|
|
375
|
-
<div className={className}>
|
|
376
|
-
<span ref={popover.refs.setReference} {...popover.getReferenceProps()} className="inline-flex">
|
|
377
|
-
{/* `icon` — `more` on Home, `plus` signed out (frame B2), the × while its sheet is open */}
|
|
378
|
-
{/* always the inverted round button — `surface` dresses its menu only (HomeDockRound4, kol-fxr 2026-10-31 — user: *"this
|
|
379
|
-
* also changed the action button, but it is not supposed to change"*) */}
|
|
380
|
-
<Button iconOnly={icon === 'more' ? 'more' : open ? 'x' : icon} size="lg" tone="inverted" radius="full" aria-label={open ? 'Close' : 'Actions'} pressed={open} />
|
|
381
|
-
</span>
|
|
382
|
-
<PopoverPanel popover={popover} panel={false} className={`kol-more-sheet${variant === 'float' ? ` kol-more-sheet-float ${floatSurfaceClass(surface, true)}` : ''}`} style={{ minWidth: 220 }}>
|
|
383
|
-
<MoreRows actions={actions} variant={variant} onPick={() => setOpen(false)} />
|
|
384
|
-
</PopoverPanel>
|
|
385
|
-
</div>
|
|
386
|
-
)
|
|
387
|
-
}
|
package/src/RailFlyout.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, usePopover, PopoverPanel, floatSurfaceClass } from '@kolkrabbi/kol-component'
|
|
1
|
+
import { Button, usePopover, PopoverPanel, floatSurfaceClass, floatMotion } from '@kolkrabbi/kol-component'
|
|
2
2
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
3
3
|
|
|
4
4
|
/* taxonomy-ok: molecule — a float card of nav Buttons with counts */
|
|
@@ -18,12 +18,15 @@ import { Icon } from '@kolkrabbi/kol-icons'
|
|
|
18
18
|
* @param {boolean} open · {Function} onOpenChange
|
|
19
19
|
* @param {number} width the card's width (default 302)
|
|
20
20
|
* @param {'solid'|'glass-dark'|'glass-light'} surface what the card is made of (default `solid`)
|
|
21
|
+
* @param {boolean|Object} [motion=true] with `anchor`, the card's enter and leave (it is held while it leaves — keep it mounted
|
|
22
|
+
* and set `open` false) and its rows' hover: `true` the `--kol-float-*` tokens · `false` none ·
|
|
23
|
+
* `{ duration, ease }` per app (FloatActionStatesAndMotion, 2026-11-04)
|
|
21
24
|
* @param {string} className
|
|
22
25
|
*/
|
|
23
|
-
export default function RailFlyout({ icon, title, items = [], active, onPick, anchor, open = true, onOpenChange, width = 302, surface = 'solid', className = '' }) {
|
|
26
|
+
export default function RailFlyout({ icon, title, items = [], active, onPick, anchor, open = true, onOpenChange, width = 302, surface = 'solid', motion = true, className = '' }) {
|
|
24
27
|
const popover = usePopover({ open: !!anchor && open, onOpenChange, placement: 'right-start', offset: 8, click: false, referenceElement: anchor ?? null, role: 'menu' })
|
|
25
28
|
const card = (
|
|
26
|
-
<div role="menu" aria-label={title} className={`kol-rail-flyout kol-float-chrome flex flex-col gap-0.5 p-2 rounded-[var(--kol-float-menu-r)] ${floatSurfaceClass(surface, true)} ${anchor ? '' : className}`.trim()} style={{ width }}>
|
|
29
|
+
<div role="menu" aria-label={title} className={`kol-rail-flyout kol-float-chrome flex flex-col gap-0.5 p-2 rounded-[var(--kol-float-menu-r)] ${floatSurfaceClass(surface, true)} ${anchor ? '' : className}`.trim()} style={{ width, ...(anchor ? null : floatMotion(motion).style) }}>
|
|
27
30
|
<div className="flex items-center gap-3 px-2 pt-2 pb-3">
|
|
28
31
|
{icon && <Icon name={icon} size={18} className="text-oq-96" />}
|
|
29
32
|
<span className="kol-float-body text-emphasis">{title}</span>
|
|
@@ -37,5 +40,5 @@ export default function RailFlyout({ icon, title, items = [], active, onPick, an
|
|
|
37
40
|
</div>
|
|
38
41
|
)
|
|
39
42
|
if (!anchor) return card
|
|
40
|
-
return <PopoverPanel popover={popover} panel={false} focus={false} className={className}>{card}</PopoverPanel>
|
|
43
|
+
return <PopoverPanel popover={popover} panel={false} focus={false} motion={motion} className={className}>{card}</PopoverPanel>
|
|
41
44
|
}
|
package/src/RailTrigger.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import { Button, usePopover, PopoverPanel, floatSurfaceClass } from '@kolkrabbi/kol-component'
|
|
2
|
+
import { Button, usePopover, PopoverPanel, floatSurfaceClass, floatMotion } from '@kolkrabbi/kol-component'
|
|
3
3
|
import MoreRows, { FloatMenu } from './MoreSheet.jsx'
|
|
4
4
|
|
|
5
5
|
/* taxonomy-ok: molecule — a float Button that opens the More sheet's rows */
|
|
@@ -20,20 +20,22 @@ import MoreRows, { FloatMenu } from './MoreSheet.jsx'
|
|
|
20
20
|
* @param {'solid'|'glass-dark'|'glass-light'} surface what the button and the card are made of (default `solid`)
|
|
21
21
|
* @param {Function} [onRestore] a "Show navigation" row at the card's foot brings the rail back as it was (FloatRailOverlayShadowRestore,
|
|
22
22
|
* 2026-11-04 — FloatLayout passes its `lastShown`, the same path as Panels ⌄); unset, no row
|
|
23
|
+
* @param {boolean|Object} [motion=true] the card's enter and leave and the button's states: `true` the `--kol-float-*` tokens ·
|
|
24
|
+
* `false` none · `{ duration, ease }` per app (FloatActionStatesAndMotion, 2026-11-04)
|
|
23
25
|
* @param {string} className
|
|
24
26
|
*/
|
|
25
|
-
export default function RailTrigger({ items = [], currentPath = '/', onNavigate, title, breadcrumb, surface = 'solid', onRestore, className = '' }) {
|
|
27
|
+
export default function RailTrigger({ items = [], currentPath = '/', onNavigate, title, breadcrumb, surface = 'solid', onRestore, motion = true, className = '' }) {
|
|
26
28
|
const [open, setOpen] = useState(false)
|
|
27
29
|
const popover = usePopover({ open, onOpenChange: setOpen, placement: 'bottom-start', offset: 8, dismiss: { outsidePress: (e) => !e.target?.closest?.('.kol-float-level') } })
|
|
28
30
|
const card = `kol-more-sheet kol-more-sheet-float ${floatSurfaceClass(surface, true)}`
|
|
29
31
|
const pick = (x) => { setOpen(false); if (x.restore) { onRestore?.(); return } if (x.onPress) { x.onPress(); return } if (x.path) onNavigate?.(x.path) }
|
|
30
32
|
return (
|
|
31
|
-
<div className={`kol-rail-trigger kol-float-chrome inline-flex items-center gap-4 ${className}`.trim()}>
|
|
33
|
+
<div className={`kol-rail-trigger kol-float-chrome inline-flex items-center gap-4 ${className}`.trim()} style={floatMotion(motion).style}>
|
|
32
34
|
<span ref={popover.refs.setReference} {...popover.getReferenceProps()} className="inline-flex">
|
|
33
35
|
<Button variant="float" size="lg" iconOnly="hamburger" aria-label="Open navigation" aria-haspopup="menu" aria-expanded={open} className={floatSurfaceClass(surface)} />
|
|
34
36
|
</span>
|
|
35
37
|
{breadcrumb && <span className="kol-float-hint text-oq-64">{Array.isArray(breadcrumb) ? breadcrumb.join(' / ') : breadcrumb}</span>}
|
|
36
|
-
<PopoverPanel popover={popover} panel={false} focus={false} className={`${card} w-[280px]`} style={{ maxWidth: 'calc(100vw - 24px)' }}>
|
|
38
|
+
<PopoverPanel popover={popover} panel={false} focus={false} motion={motion} className={`${card} w-[280px]`} style={{ maxWidth: 'calc(100vw - 24px)' }}>
|
|
37
39
|
{title && (
|
|
38
40
|
<div className="flex items-center justify-between pl-3 pr-1 pt-1 pb-2">
|
|
39
41
|
<span className="kol-float-body text-emphasis">{title}</span>
|
package/src/TopControlsBar.jsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
+
import FloatActionMenu from './FloatActionMenu.jsx'
|
|
2
3
|
import { Button, TabsRow, usePopover, PopoverPanel, floatSurfaceClass } from '@kolkrabbi/kol-component'
|
|
3
4
|
import DocumentCapsule from './DocumentCapsule.jsx'
|
|
4
5
|
import MoreRows, { FloatMenu } from './MoreSheet.jsx'
|
|
@@ -47,11 +48,14 @@ export function PanelsRestore({ label = 'Panels', children, items, surface = 'so
|
|
|
47
48
|
* @param {Function} onSearch the search glyph's press; unset, no glyph
|
|
48
49
|
* @param {Object} panels PanelsRestore's props (`items` or `children`); unset, no Panels
|
|
49
50
|
* @param {Object} action `{ label, icon?, onPress }` — the primary action (New task), the inverted float capsule
|
|
51
|
+
* @param {Array} menu `[{ label, icon?, onPress }]` — FloatActionMenu at the very end, the + and its float sheet (fxr's Home corner)
|
|
50
52
|
* @param {ReactNode} start · {ReactNode} center · {ReactNode} end the three regions, when the props above are not the bar
|
|
51
53
|
* @param {'solid'|'glass-dark'|'glass-light'} surface what every float on the bar is made of (default `solid`)
|
|
54
|
+
* @param {boolean|Object} [motion=true] FloatActionMenu's (`menu`): `true` the `--kol-float-*` tokens · `false` none ·
|
|
55
|
+
* `{ duration, ease }` per app (FloatActionStatesAndMotion, 2026-11-04)
|
|
52
56
|
* @param {string} className
|
|
53
57
|
*/
|
|
54
|
-
export default function TopControlsBar({ document, tabs, tab, onTab, onSearch, panels, action, start, center, end, surface = 'solid', className = '' }) {
|
|
58
|
+
export default function TopControlsBar({ document, tabs, tab, onTab, onSearch, panels, action, menu, start, center, end, surface = 'solid', motion = true, className = '' }) {
|
|
55
59
|
return (
|
|
56
60
|
<div className={`kol-top-controls kol-float-chrome flex items-center gap-4 h-16 ${className}`.trim()}>
|
|
57
61
|
<div className="flex items-center gap-4">
|
|
@@ -70,6 +74,7 @@ export default function TopControlsBar({ document, tabs, tab, onTab, onSearch, p
|
|
|
70
74
|
<>
|
|
71
75
|
{panels && <PanelsRestore {...panels} surface={surface} />}
|
|
72
76
|
{action && <Button variant="float" tone="inverted" size="lg" iconLeft={action.icon ?? 'plus'} onClick={action.onPress}>{action.label}</Button>}
|
|
77
|
+
{menu?.length > 0 && <FloatActionMenu actions={menu} icon="plus" variant="float" surface={surface} motion={motion} />}
|
|
73
78
|
</>
|
|
74
79
|
)}
|
|
75
80
|
</div>
|
package/src/index.js
CHANGED
|
@@ -28,6 +28,7 @@ export { ZoomReadout, SceneBreadcrumb, CanvasHint, SelectionMeasure } from './Ca
|
|
|
28
28
|
export { default as TopControlsBar, PanelsRestore } from './TopControlsBar.jsx'
|
|
29
29
|
export { default as ReaderBar, ProgressDock } from './ReaderBar.jsx'
|
|
30
30
|
export { default as RailTrigger } from './RailTrigger.jsx'
|
|
31
|
+
export { default as FloatActionMenu } from './FloatActionMenu.jsx'
|
|
31
32
|
export { default as RailFlyout } from './RailFlyout.jsx'
|
|
32
33
|
export { default as RailDisplayControls } from './RailDisplayControls.jsx'
|
|
33
34
|
export { AccountFooter, StatusStrip, Breadcrumb, FooterStrip, PeriodNav, DataStatus } from './WorkspaceStrips.jsx'
|