@kolkrabbi/kol-shell 0.90.0 → 0.91.1
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/AccountForm.jsx +69 -0
- package/src/AppFloatNav.jsx +297 -0
- package/src/AppHub.jsx +24 -7
- package/src/AppShell.jsx +6 -6
- package/src/HubDev.jsx +1 -1
- package/src/HubHome.jsx +42 -9
- package/src/HubSettingsRail.jsx +1 -1
- package/src/MoreSheet.jsx +6 -3
- package/src/PhoneNav.jsx +8 -163
- package/src/TabStrip.jsx +3 -3
- package/src/TransportPill.jsx +5 -78
- package/src/index.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.91.1",
|
|
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.318.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.201.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.318.0",
|
|
25
|
+
"@kolkrabbi/kol-icons": "^0.53.5",
|
|
24
26
|
"@kolkrabbi/kol-framework": "^0.65.0",
|
|
25
|
-
"@kolkrabbi/kol-
|
|
26
|
-
"@kolkrabbi/kol-component": "^0.317.1",
|
|
27
|
-
"@kolkrabbi/kol-theme": "^0.200.1"
|
|
27
|
+
"@kolkrabbi/kol-theme": "^0.201.0"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Button, Input } from '@kolkrabbi/kol-component'
|
|
3
|
+
|
|
4
|
+
/* taxonomy-ok: molecule — Inputs + a Button */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* AccountForm — Sign in, sign up, request an invite, drawn from data. (FloatingStyleAndSignInDemos, kol-fxr 2026-10-30,
|
|
8
|
+
* canvas Round 3 — fxr's FrameC form, carried: *"fxr can pass data (its rows, its sign-in page) with no local styling"*.)
|
|
9
|
+
* The order is the frames': the eyebrow, the fields, the line linking the other page, then the button.
|
|
10
|
+
*
|
|
11
|
+
* Two looks, one form:
|
|
12
|
+
* - `column` (default) — style A, 360 wide: the desk's sign-in column over Home (HubHome) and the phone column.
|
|
13
|
+
* - `box` — style B, the user's phone sign-in box: surface-secondary, 24 round, 16 in, 6 between rows; it passes
|
|
14
|
+
* `variant="float"` to its fields and button (44, an 18 radius), so the consumer never does.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} title the eyebrow ("Sign in", "Create account", "Request an invite")
|
|
17
|
+
* @param {Array} fields `[{ id, placeholder, type?, autoComplete? }]` — the placeholder is the field's name
|
|
18
|
+
* @param {string} okLabel the button
|
|
19
|
+
* @param {Object} footer `{ text, link, href?, onPress? }` — "Don't have an account? Sign up"
|
|
20
|
+
* @param {Function} onSubmit `(values) => Promise` — a throw shows its `message` under the fields
|
|
21
|
+
* @param {Function} check `(values) => string | null` — a message stops the submit
|
|
22
|
+
* @param {string} done a line shown after success (Request sent.); the button disables
|
|
23
|
+
* @param {'column'|'box'} variant
|
|
24
|
+
* @param {string} className
|
|
25
|
+
*/
|
|
26
|
+
export default function AccountForm({ title, fields = [], okLabel, footer, onSubmit, check, done, variant = 'column', className = '' }) {
|
|
27
|
+
const [vals, setVals] = useState(() => Object.fromEntries(fields.map((f) => [f.id, ''])))
|
|
28
|
+
const [error, setError] = useState('')
|
|
29
|
+
const [busy, setBusy] = useState(false)
|
|
30
|
+
const box = variant === 'box'
|
|
31
|
+
const submit = async (e) => {
|
|
32
|
+
e.preventDefault()
|
|
33
|
+
const bad = check?.(vals)
|
|
34
|
+
if (bad) { setError(bad); return }
|
|
35
|
+
setBusy(true); setError('')
|
|
36
|
+
try { await onSubmit?.(vals) } catch (err) { setError(err?.message ?? String(err)) } finally { setBusy(false) }
|
|
37
|
+
}
|
|
38
|
+
const body = (
|
|
39
|
+
<>
|
|
40
|
+
<span className={`kol-eyebrow text-body${box ? ' px-3.5 pt-3 pb-1.5' : ''}`}>{title}</span>
|
|
41
|
+
{fields.map((f, i) => (
|
|
42
|
+
<Input
|
|
43
|
+
key={f.id}
|
|
44
|
+
type={f.type ?? 'text'}
|
|
45
|
+
autoComplete={f.autoComplete}
|
|
46
|
+
autoFocus={i === 0}
|
|
47
|
+
placeholder={f.placeholder}
|
|
48
|
+
aria-label={f.placeholder}
|
|
49
|
+
size="md"
|
|
50
|
+
variant={box ? 'float' : undefined}
|
|
51
|
+
value={vals[f.id]}
|
|
52
|
+
onChange={(e) => setVals((v) => ({ ...v, [f.id]: e.target.value }))}
|
|
53
|
+
className="w-full"
|
|
54
|
+
/>
|
|
55
|
+
))}
|
|
56
|
+
{error && <p className={`kol-mono-12 text-ui-error${box ? ' px-3.5' : ''}`}>{error}</p>}
|
|
57
|
+
{done && <p className={`kol-mono-12 text-emphasis${box ? ' px-3.5' : ''}`}>{done}</p>}
|
|
58
|
+
{footer && (
|
|
59
|
+
<p className={`kol-mono-12 text-meta ${box ? 'px-3.5 pt-2 pb-6' : 'mt-2'}`}>
|
|
60
|
+
{footer.text} <a href={footer.href ?? '#'} onClick={(e) => { if (footer.onPress) { e.preventDefault(); footer.onPress() } }} className="text-emphasis underline">{footer.link}</a>
|
|
61
|
+
</p>
|
|
62
|
+
)}
|
|
63
|
+
<Button type="submit" variant={box ? 'float' : undefined} tone="inverted" size="md" className={`self-start${box ? '' : ' mt-4'}`} disabled={busy || !!done}>{okLabel}</Button>
|
|
64
|
+
</>
|
|
65
|
+
)
|
|
66
|
+
return box
|
|
67
|
+
? <form onSubmit={submit} aria-label={title} className={`flex flex-col gap-1.5 p-4 rounded-3xl bg-surface-secondary ${className}`.trim()}>{body}</form>
|
|
68
|
+
: <form onSubmit={submit} aria-label={title} className={`flex flex-col gap-2 w-[360px] max-w-full ${className}`.trim()}>{body}</form>
|
|
69
|
+
}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import { TabsRow, TABBAR_H, TABBAR_PILL_INSET, TABBAR_PILL_TAB, tabbarPillWidth } from '@kolkrabbi/kol-component'
|
|
3
|
+
import MoreRows from './MoreSheet.jsx'
|
|
4
|
+
|
|
5
|
+
/* taxonomy-ok: molecule — TabsRow's pill + MoreRows sheets of Buttons */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* AppFloatNav — The floating nav, one family. (AppFloatNav, kol-fxr 2026-10-30 — the user's name, canvas Round 3's board:
|
|
9
|
+
* *"AppFloatNav"*.) What shipped as `PhoneNav` (the phone's pill and bar, the desk's `dock`, frame E's `panel`) and
|
|
10
|
+
* `TransportPill` (Labs' transport) is one component now; both names stay as deprecated aliases on the retirement ledger
|
|
11
|
+
* (PhoneNav's `nav` is `mobile` here, TransportPill is `variant="transport"`). The
|
|
12
|
+
* board's variants: the app's rail rows in rail order, then ··· which opens the whole nav and turns into ×, on a desk
|
|
13
|
+
* (`dock`) and a phone; a row with `sub` opens its rows above it; Labs' top pill (`panel`) and its transport
|
|
14
|
+
* (`transport`); each slot named on hover by the KOL Tooltip (TabsRow's pill).
|
|
15
|
+
*
|
|
16
|
+
* Was PhoneNav — The rail as a phone tab bar. the rail, on a phone, as a bottom bar (AppShell `touch="bar"`, apps review
|
|
17
|
+
* 2026-09-29). The user: *"what about when there are like 10 pages? … this seems like something
|
|
18
|
+
* shell or hub should account for and ship, but not have per app fixes."*
|
|
19
|
+
*
|
|
20
|
+
* Up to FIVE destinations sit in the bar. More than five → the first FOUR, then **More**, a sheet
|
|
21
|
+
* holding the rest (Settings included). Ten pages = four + More. The bar is kol-component's
|
|
22
|
+
* `MobileTabBar` — the pill media already floated — not a second bar.
|
|
23
|
+
*
|
|
24
|
+
* Active = the rail's rule: `/` exact, anything else by prefix, the longest match wins. A
|
|
25
|
+
* destination inside More lights More.
|
|
26
|
+
*
|
|
27
|
+
* @param {Array} items `{ icon, path, label }` in rail order, bottom rows last
|
|
28
|
+
* @param {string} currentPath
|
|
29
|
+
* @param {Function} onNavigate `(path) => void`
|
|
30
|
+
* @param {Array} actions `[{ label, icon?, onPress }]` — the page's own buttons, at the top of More (Home's New and
|
|
31
|
+
* Walkthrough on a phone, user 2026-10-23); with any, More shows even with five or fewer rows
|
|
32
|
+
* @param {'bar'|'pill'} shape TabsRow's phone shape (AppShell `touch="pill"`); the More sheet floats above either
|
|
33
|
+
*
|
|
34
|
+
* THE PANEL PICKER (PhoneNavTopAndFold, kol-fxr 2026-10-27, frame E — the nav on top, the open panel at the bottom). The
|
|
35
|
+
* pill only; a `bar` ignores these:
|
|
36
|
+
* @param {'bottom'|'top'} placement the pill's edge; at `top` the More sheet opens below it
|
|
37
|
+
* @param {boolean} border the pill's hairline (default true; frame E has none)
|
|
38
|
+
* @param {'fill'|'circle'} active the lit slot's shape (TabsRow `active`); frame E is `circle`
|
|
39
|
+
* @param {boolean} foldable a sideways swipe folds the pill into a left edge tab; a tap on the tab restores it
|
|
40
|
+
* @param {boolean} folded · {Function} onFoldChange the folded state, so the app can keep it (else PhoneNav holds it)
|
|
41
|
+
* @param {boolean} moreKeepsOpen More opens its sheet without collapsing the pill to the ×, and More lights only while
|
|
42
|
+
* its sheet is open; nothing else closes
|
|
43
|
+
* An item may carry `onPress` (a panel, not a route — the app owns what it opens and whether a second tap closes it) and
|
|
44
|
+
* `selected` (lit whatever the route says; more than one may be).
|
|
45
|
+
*
|
|
46
|
+
* VARIANTS (PhoneNavVariants, kol-fxr 2026-10-28 — user: *"So we should ship variants? or presets? because if we only ship
|
|
47
|
+
* props then each repo has to tune to the same settiings and we get drift"*). A variant is a preset of the pill props above;
|
|
48
|
+
* any prop still overrides it. `PHONE_NAV_VARIANTS` is the table, and TransportPill reads its own row from it.
|
|
49
|
+
* @param {'mobile'|'dock'|'panel'|'transport'} variant `mobile` (was `nav`) — an app's phone nav: no hairline, no shadow, the lit slot a circle
|
|
50
|
+
* (AppShell's default). `panel` — frame E's panel picker: on top, foldable, More keeps the panel
|
|
51
|
+
* open, no hairline. `transport` — TransportPill's look: the shadow, it floats over content.
|
|
52
|
+
* Unset, the props alone decide, as before
|
|
53
|
+
* @param {boolean} shadow the pill's drop shadow (TabsRow `shadow`) — for a pill that floats over content
|
|
54
|
+
*
|
|
55
|
+
* MORE IS THE WHOLE NAV (PhoneMoreWholeNav, kol-fxr 2026-10-28 — user: *"when you press [...] you should get the entire Nav
|
|
56
|
+
* menu list … but also ship with prop so you can customise"*). The sheet lists every row the rail has, the ones in the pill
|
|
57
|
+
* included and the pinned foot last, then the page's actions. Before, it held only what did not fit.
|
|
58
|
+
* @param {string[]|Function} moreItems which rows More lists — an allow-list of paths, or `(item) => boolean`. Unset: all
|
|
59
|
+
* @param {Array} sheetItems the More rows themselves, when they are not the pill's (HubHomeSignedOut, 2026-10-28: the pill holds
|
|
60
|
+
* the app's chromes and More holds the rail). Rows flagged `foot` (the pinned Media · Sign in · Settings)
|
|
61
|
+
* sit AFTER the page's actions, the rest before — frame A2's order
|
|
62
|
+
*
|
|
63
|
+
* `dock` (PhoneNavDock, kol-fxr 2026-10-28, frame B2): the pill on a DESK — md and up, at the content's bottom-left (TabsRow
|
|
64
|
+
* `dock`). An app shows it beside the rail, not instead of it. With `sheetItems` or `actions` it has a More (the Round 3
|
|
65
|
+
* board, 2026-10-30: the signed-out desk has no rail, so ··· is the whole nav); its sheet opens above the pill, on its left
|
|
66
|
+
* edge, and More turns to × while it is open.
|
|
67
|
+
*
|
|
68
|
+
* THE FLOAT (AppFloatNav, 2026-10-30):
|
|
69
|
+
* @param {Array} items[].sub `[{ label, icon?, onPress }]` — a row that opens its own rows above its slot instead of
|
|
70
|
+
* routing (fxr: Randomiser → Generate, Effects); lit while they are open
|
|
71
|
+
* Its menus are the floating style B (`variant="float"` on the rows, `.kol-more-sheet-float`) — the board's.
|
|
72
|
+
* @param {boolean} menuBorder the sheets' 1px hairline (`.kol-more-sheet-bordered`) — off by default, the board's menus have none
|
|
73
|
+
* THE FOUR VARIANTS (user ruling 2026-10-30): `mobile` · `dock` · `panel` · `transport` — nothing else.
|
|
74
|
+
* @param {'transport'} variant `transport` — Labs' transport, what TransportPill drew: `items` are actions
|
|
75
|
+
* `[{ id, icon, label, onPress?, selected? }]`, `sheetFor` `{ [id]: rows }` opens rows above a
|
|
76
|
+
* slot, it folds to the RIGHT edge; see `Transport` below
|
|
77
|
+
*/
|
|
78
|
+
export const APP_FLOAT_NAV_VARIANTS = {
|
|
79
|
+
/* `mobile` was PhoneNav's `nav` (user ruling 2026-10-30: renamed so it is not reached for off mobile); there is no `nav` */
|
|
80
|
+
mobile: { border: false, shadow: false, active: 'circle' },
|
|
81
|
+
panel: { placement: 'top', foldable: true, moreKeepsOpen: true, border: false, shadow: false, active: 'circle' },
|
|
82
|
+
transport: { border: false, shadow: true, active: 'circle' },
|
|
83
|
+
dock: { dock: true, border: false, shadow: false, active: 'circle' },
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const MORE = '__more'
|
|
87
|
+
const MAX = 5
|
|
88
|
+
|
|
89
|
+
const activePath = (items, path) => items
|
|
90
|
+
.filter((i) => (i.path === '/' ? path === '/' : path === i.path || path.startsWith(`${i.path}/`)))
|
|
91
|
+
.sort((a, b) => b.path.length - a.path.length)[0]?.path
|
|
92
|
+
|
|
93
|
+
export default function AppFloatNav(props) {
|
|
94
|
+
return props.variant === 'transport' ? <Transport {...props} /> : <FloatNav {...props} />
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function FloatNav({ items = [], currentPath = '/', onNavigate, actions = [], shape = 'bar', variant, placement: placementProp, border: borderProp, shadow: shadowProp, active: activeProp, foldable: foldableProp, folded, onFoldChange, moreKeepsOpen: keepsOpenProp, moreItems, sheetItems, dock: dockProp, menuBorder = false }) {
|
|
98
|
+
const preset = APP_FLOAT_NAV_VARIANTS[variant] ?? {}
|
|
99
|
+
const placement = placementProp ?? preset.placement ?? 'bottom'
|
|
100
|
+
const border = borderProp ?? preset.border ?? true
|
|
101
|
+
const shadow = shadowProp ?? preset.shadow ?? false
|
|
102
|
+
const activeShape = activeProp ?? preset.active
|
|
103
|
+
const foldable = foldableProp ?? preset.foldable ?? false
|
|
104
|
+
const dock = dockProp ?? preset.dock ?? false
|
|
105
|
+
/* the dock keeps its pill whole: More turns to × in place (the board) */
|
|
106
|
+
const moreKeepsOpen = keepsOpenProp ?? preset.moreKeepsOpen ?? dock
|
|
107
|
+
const [open, setOpen] = useState(false)
|
|
108
|
+
/* the row whose `sub` rows are open */
|
|
109
|
+
const [sub, setSub] = useState(null)
|
|
110
|
+
useEffect(() => { setOpen(false); setSub(null) }, [currentPath])
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (!open && !sub) return undefined
|
|
113
|
+
const onKey = (e) => { if (e.key === 'Escape') { setOpen(false); setSub(null) } }
|
|
114
|
+
window.addEventListener('keydown', onKey)
|
|
115
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
116
|
+
}, [open, sub])
|
|
117
|
+
|
|
118
|
+
const overflow = items.length > MAX || (actions.length > 0 && items.length >= MAX)
|
|
119
|
+
const hasMore = (dock ? false : overflow) || actions.length > 0 || (sheetItems?.length ?? 0) > 0
|
|
120
|
+
const inBar = overflow ? items.slice(0, MAX - 1) : items
|
|
121
|
+
const inMore = overflow ? items.slice(MAX - 1) : []
|
|
122
|
+
/* the sheet's rows: the whole nav, filtered by `moreItems` */
|
|
123
|
+
const allow = typeof moreItems === 'function' ? moreItems : Array.isArray(moreItems) ? (i) => moreItems.includes(i.path) : () => true
|
|
124
|
+
const moreRows = (sheetItems ?? items).filter(allow)
|
|
125
|
+
const before = moreRows.filter((i) => !i.foot)
|
|
126
|
+
const after = moreRows.filter((i) => i.foot)
|
|
127
|
+
const active = activePath(items, currentPath)
|
|
128
|
+
const value = open || inMore.some((i) => i.path === active) ? MORE : active
|
|
129
|
+
|
|
130
|
+
const key = (i) => i.path ?? i.id ?? i.label
|
|
131
|
+
const tabs = inBar.map((i) => ({ value: key(i), label: i.label, icon: i.icon, selected: sub === key(i) || (i.selected ?? (moreKeepsOpen ? key(i) === active : undefined)) }))
|
|
132
|
+
/* with the pill kept whole, the More slot itself turns to × while its sheet is open, and a press closes it
|
|
133
|
+
* (PhonePillMoreTurnsToClose, kol-fxr 2026-10-28 — frame A2: *"[...] that makes a list and nav turns to (X)"*) */
|
|
134
|
+
if (hasMore) tabs.push({ value: MORE, label: open && moreKeepsOpen ? 'Close' : 'More', icon: open && moreKeepsOpen ? 'x' : 'more', selected: moreKeepsOpen ? open : undefined })
|
|
135
|
+
/* THE SHEET HUGS ITS WORDS AND SITS BESIDE THE × (user 2026-10-23, his reference: iOS Photos' menu next to its ×, *"but
|
|
136
|
+
* align to bottom"*) — to the left of the collapsed ×, a 12px gap, the two bottom edges on one line */
|
|
137
|
+
const pill = shape === 'pill'
|
|
138
|
+
const top = pill && placement === 'top'
|
|
139
|
+
/* a sheet over one slot — a row's `sub`, the dock's More: the pill's left edge (the dock's 64 in, else centred), its 7px
|
|
140
|
+
* pad, then the slot; the sheet stands 12 off the pill's face */
|
|
141
|
+
const W = tabbarPillWidth(tabs.length)
|
|
142
|
+
const pillLeft = dock ? 'calc(var(--kol-shell-rail-width, 48px) + 64px)' : `calc(50% - ${W / 2}px)`
|
|
143
|
+
const face = dock ? `${64 + TABBAR_H + 12}px` : `calc(env(safe-area-inset-${top ? 'top' : 'bottom'}, 0px) + ${TABBAR_PILL_INSET + TABBAR_H + 12}px)`
|
|
144
|
+
const overSlot = (at) => (pill ? {
|
|
145
|
+
left: `calc(${pillLeft} + 7px + ${at * TABBAR_PILL_TAB + TABBAR_PILL_TAB / 2}px)`, right: 'auto', transform: 'translateX(-50%)',
|
|
146
|
+
[top ? 'top' : 'bottom']: face, ...(top ? { bottom: 'auto' } : {}), width: 'max-content', minWidth: 220,
|
|
147
|
+
} : {
|
|
148
|
+
/* the bar: over the slot's share of the width, 8 off the bar */
|
|
149
|
+
left: `${((at + 0.5) * 100) / tabs.length}%`, right: 'auto', transform: 'translateX(-50%)',
|
|
150
|
+
bottom: `calc(env(safe-area-inset-bottom, 0px) + ${TABBAR_H + 8}px)`, width: 'max-content', minWidth: 220,
|
|
151
|
+
})
|
|
152
|
+
const sheetStyle = dock ? {
|
|
153
|
+
left: pillLeft, right: 'auto', bottom: face, width: 'max-content', minWidth: 220, maxWidth: 'calc(100vw - 24px)',
|
|
154
|
+
} : moreKeepsOpen && pill ? {
|
|
155
|
+
/* the pill stays whole, so the sheet hangs off its right end, 12 off its face (frame E: below a top pill) */
|
|
156
|
+
left: 'auto',
|
|
157
|
+
right: `calc(50% - ${tabbarPillWidth(tabs.length) / 2}px)`,
|
|
158
|
+
[top ? 'top' : 'bottom']: `calc(env(safe-area-inset-${top ? 'top' : 'bottom'}, 0px) + ${TABBAR_PILL_INSET + TABBAR_H + 12}px)`,
|
|
159
|
+
...(top ? { bottom: 'auto' } : {}),
|
|
160
|
+
width: 'max-content', minWidth: 220, maxWidth: 'calc(100vw - 24px)',
|
|
161
|
+
} : {
|
|
162
|
+
left: 'auto',
|
|
163
|
+
right: pill ? `calc(50% - ${tabbarPillWidth(tabs.length) / 2}px + ${TABBAR_H + 12}px)` : `calc(${100 / tabs.length}% + 8px)`,
|
|
164
|
+
...(top
|
|
165
|
+
? { top: `calc(env(safe-area-inset-top, 0px) + ${TABBAR_PILL_INSET}px)`, bottom: 'auto' }
|
|
166
|
+
: { bottom: pill ? `calc(env(safe-area-inset-bottom, 0px) + ${TABBAR_PILL_INSET}px)` : 'env(safe-area-inset-bottom, 0px)' }),
|
|
167
|
+
width: 'max-content', minWidth: 220, maxWidth: `calc(100vw - ${TABBAR_H + 36}px)`,
|
|
168
|
+
}
|
|
169
|
+
const press = (v) => {
|
|
170
|
+
if (v === MORE) { setSub(null); setOpen((o) => !o); return }
|
|
171
|
+
const item = inBar.find((i) => key(i) === v)
|
|
172
|
+
if (item?.sub?.length) { setOpen(false); setSub((s) => (s === v ? null : v)); return }
|
|
173
|
+
setSub(null)
|
|
174
|
+
if (item?.onPress) { item.onPress(); return }
|
|
175
|
+
onNavigate?.(v)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<>
|
|
180
|
+
{sub && (
|
|
181
|
+
<button type="button" aria-label="Close" className="kol-phone-nav-scrim" onClick={() => setSub(null)} />
|
|
182
|
+
)}
|
|
183
|
+
{sub && (
|
|
184
|
+
<div className={`kol-phone-nav-more kol-more-sheet kol-more-sheet-float${menuBorder ? ' kol-more-sheet-bordered' : ''}`} role="menu" aria-label={inBar.find((i) => key(i) === sub)?.label} style={overSlot(inBar.findIndex((i) => key(i) === sub))}>
|
|
185
|
+
<MoreRows variant="float" actions={inBar.find((i) => key(i) === sub)?.sub} onPick={() => setSub(null)} />
|
|
186
|
+
</div>
|
|
187
|
+
)}
|
|
188
|
+
{open && (
|
|
189
|
+
/* a BUTTON scrim — iOS does not bubble a tap from a div (OverlayScrimTapDismiss, 2026-09-01) */
|
|
190
|
+
/* with `moreKeepsOpen` the panel under it stays in view: a clear scrim, a tap off the sheet still closes it */
|
|
191
|
+
<button type="button" aria-label="Close more" className={`kol-phone-nav-scrim${moreKeepsOpen ? '' : ' kol-overlay-scrim'}`} onClick={() => setOpen(false)} />
|
|
192
|
+
)}
|
|
193
|
+
{open && (
|
|
194
|
+
<div className={`kol-phone-nav-more kol-more-sheet kol-more-sheet-float${menuBorder ? ' kol-more-sheet-bordered' : ''}`} role="menu" aria-label="More" style={sheetStyle}>
|
|
195
|
+
{/* the nav, the page's actions, then the pinned foot (frame A2) */}
|
|
196
|
+
<MoreRows variant="float" actions={actions} items={before} itemsFirst active={active} onPick={(x) => { setOpen(false); if (x.onPress && !actions.includes(x)) { x.onPress(); return } if (x.path) onNavigate?.(x.path) }} />
|
|
197
|
+
{after.length > 0 && <MoreRows variant="float" items={after} active={active} onPick={(x) => { setOpen(false); if (x.onPress) { x.onPress(); return } if (x.path) onNavigate?.(x.path) }} />}
|
|
198
|
+
</div>
|
|
199
|
+
)}
|
|
200
|
+
<TabsRow
|
|
201
|
+
variant="stacked"
|
|
202
|
+
placement="phone"
|
|
203
|
+
shape={shape}
|
|
204
|
+
collapsed={open && !moreKeepsOpen}
|
|
205
|
+
onExpand={() => setOpen(false)}
|
|
206
|
+
edge={top ? 'top' : 'bottom'}
|
|
207
|
+
border={border}
|
|
208
|
+
shadow={shadow}
|
|
209
|
+
dock={dock}
|
|
210
|
+
active={activeShape}
|
|
211
|
+
foldable={foldable}
|
|
212
|
+
folded={folded}
|
|
213
|
+
onFoldChange={(v) => { if (v) setOpen(false); onFoldChange?.(v) }}
|
|
214
|
+
foldSide="left"
|
|
215
|
+
tabs={tabs}
|
|
216
|
+
value={value}
|
|
217
|
+
onChange={press}
|
|
218
|
+
/>
|
|
219
|
+
</>
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Transport (`variant="transport"`, was TransportPill) — The transport, on a phone, as a pill (TransportPill, kol-fxr 2026-10-27, frame E). PhoneNav's pill —
|
|
225
|
+
* the same TabsRow, so the slots, the 28px glyphs and the 44×44 circle are the nav's — holding ACTIONS instead of
|
|
226
|
+
* destinations. It floats over the open panel, so it carries the shadow the nav does not, and folds to a RIGHT edge tab.
|
|
227
|
+
*
|
|
228
|
+
* A slot fires `onPress`; `selected` lights it (play and pause are a radio pair the consumer owns, so both are just
|
|
229
|
+
* `selected`). A slot named in `sheetFor` opens a sheet of rows anchored above it instead, lit while open; a row runs its
|
|
230
|
+
* `onPress` and closes the sheet.
|
|
231
|
+
*
|
|
232
|
+
* @param {Array} items `[{ id, icon, label, onPress?, selected? }]` in pill order
|
|
233
|
+
* @param {Object} sheetFor `{ [id]: [{ label, icon?, onPress, checked? }] }` — rows for a slot that opens a sheet;
|
|
234
|
+
* `checked` marks the current pick with the 22px check (MoreRows)
|
|
235
|
+
* @param {'bottom'|'top'} placement the pill's edge (default bottom)
|
|
236
|
+
* @param {boolean} foldable a sideways swipe folds it into the right edge tab
|
|
237
|
+
* @param {boolean} folded · {Function} onFoldChange the folded state, controlled (else the pill holds it)
|
|
238
|
+
*/
|
|
239
|
+
function Transport({ items = [], sheetFor = {}, placement = 'bottom', foldable = false, folded, onFoldChange, menuBorder = false }) {
|
|
240
|
+
const [sheet, setSheet] = useState(null)
|
|
241
|
+
useEffect(() => {
|
|
242
|
+
if (!sheet) return undefined
|
|
243
|
+
const onKey = (e) => { if (e.key === 'Escape') setSheet(null) }
|
|
244
|
+
window.addEventListener('keydown', onKey)
|
|
245
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
246
|
+
}, [sheet])
|
|
247
|
+
|
|
248
|
+
const top = placement === 'top'
|
|
249
|
+
const tabs = items.map((i) => ({ value: i.id, label: i.label, icon: i.icon, selected: sheet === i.id || !!i.selected }))
|
|
250
|
+
const press = (id) => {
|
|
251
|
+
if (sheetFor[id]) { setSheet((s) => (s === id ? null : id)); return }
|
|
252
|
+
setSheet(null)
|
|
253
|
+
items.find((i) => i.id === id)?.onPress?.()
|
|
254
|
+
}
|
|
255
|
+
/* the sheet centres on its slot: the pill's left edge + its 7px pad + the slot's centre */
|
|
256
|
+
const W = tabbarPillWidth(items.length)
|
|
257
|
+
const at = items.findIndex((i) => i.id === sheet)
|
|
258
|
+
const sheetStyle = {
|
|
259
|
+
left: `calc(50% - ${W / 2}px + 7px + ${at * TABBAR_PILL_TAB + TABBAR_PILL_TAB / 2}px)`,
|
|
260
|
+
right: 'auto',
|
|
261
|
+
transform: 'translateX(-50%)',
|
|
262
|
+
[top ? 'top' : 'bottom']: `calc(env(safe-area-inset-${top ? 'top' : 'bottom'}, 0px) + ${TABBAR_PILL_INSET + TABBAR_H + 12}px)`,
|
|
263
|
+
...(top ? { bottom: 'auto' } : {}),
|
|
264
|
+
width: 'max-content', minWidth: 160,
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return (
|
|
268
|
+
<>
|
|
269
|
+
{sheet && (
|
|
270
|
+
/* a clear BUTTON scrim — the panel under it stays in view, a tap off the sheet closes it */
|
|
271
|
+
<button type="button" aria-label="Close" className="kol-phone-nav-scrim" onClick={() => setSheet(null)} />
|
|
272
|
+
)}
|
|
273
|
+
{sheet && (
|
|
274
|
+
<div className={`kol-phone-nav-more kol-more-sheet kol-more-sheet-float${menuBorder ? ' kol-more-sheet-bordered' : ''}`} role="menu" aria-label={items[at]?.label} style={sheetStyle}>
|
|
275
|
+
<MoreRows variant="float" actions={sheetFor[sheet]} onPick={() => setSheet(null)} />
|
|
276
|
+
</div>
|
|
277
|
+
)}
|
|
278
|
+
<TabsRow
|
|
279
|
+
variant="stacked"
|
|
280
|
+
placement="phone"
|
|
281
|
+
shape="pill"
|
|
282
|
+
edge={top ? 'top' : 'bottom'}
|
|
283
|
+
/* the `transport` row of APP_FLOAT_NAV_VARIANTS (2026-10-28) — one table, not a second tuning */
|
|
284
|
+
border={APP_FLOAT_NAV_VARIANTS.transport.border}
|
|
285
|
+
shadow={APP_FLOAT_NAV_VARIANTS.transport.shadow}
|
|
286
|
+
active={APP_FLOAT_NAV_VARIANTS.transport.active}
|
|
287
|
+
foldable={foldable}
|
|
288
|
+
folded={folded}
|
|
289
|
+
onFoldChange={(v) => { if (v) setSheet(null); onFoldChange?.(v) }}
|
|
290
|
+
foldSide="right"
|
|
291
|
+
ariaLabel="Transport"
|
|
292
|
+
tabs={tabs}
|
|
293
|
+
onChange={press}
|
|
294
|
+
/>
|
|
295
|
+
</>
|
|
296
|
+
)
|
|
297
|
+
}
|
package/src/AppHub.jsx
CHANGED
|
@@ -97,6 +97,10 @@ import { Avatar, CommandOverlay, MediaLibrary, ModalProvider, RAIL_PRESETS, Shor
|
|
|
97
97
|
* use, we made a artifact!!!"*): a path, or a function — signed out, every Sign in the Hub draws goes
|
|
98
98
|
* there instead of the DS dialog: the rail's foot row, the signed-out + and the phone's More (fxr's
|
|
99
99
|
* `/signin`, frame C). Signed in, nothing changes
|
|
100
|
+
* `form` (FloatingStyleAndSignInDemos, kol-fxr 2026-10-30, canvas Round 3): AccountForm's props
|
|
101
|
+
* `{ title, fields, okLabel, footer, onSubmit, check? }` — signed out, every Sign in opens the sign-in
|
|
102
|
+
* column over Home on a desk and the style-B box on a phone (HubHome `signInForm`), going Home first
|
|
103
|
+
* from anywhere else. It wins over `page`
|
|
100
104
|
* `account: { sections, content?, footer? }` (SettingsAccountTab, kol-fxr 2026-10-29 — *"why isnt
|
|
101
105
|
* account just in settings in account tab?"*): an Account tab, first in the settings rail while
|
|
102
106
|
* signed in — typed rows (`sections`), a node for what rows cannot say (`content`: the
|
|
@@ -195,6 +199,9 @@ function HubFrame({
|
|
|
195
199
|
const settingsDrawer = !!settings && !settingsPage
|
|
196
200
|
const [settingsTab, setSettingsTab] = useState('settings')
|
|
197
201
|
const account = signIn?.signedIn && signIn.account ? signIn.account : null
|
|
202
|
+
/* the sign-in column over Home (`signIn.form`) — closes when signing in lands */
|
|
203
|
+
const [formOpen, setFormOpen] = useState(false)
|
|
204
|
+
useEffect(() => { setFormOpen(false) }, [signIn?.signedIn])
|
|
198
205
|
const modal = useModal()
|
|
199
206
|
/* THE DEFAULT THEME IS A ROOT ATTRIBUTE kol-framework's theme reads (`data-theme-default`): reset (`theme.clear()`)
|
|
200
207
|
* and the toggle's alt-click hand the page to it, not to the OS — a dark-first app stays dark on a light-mode Mac */
|
|
@@ -216,6 +223,11 @@ function HubFrame({
|
|
|
216
223
|
if (!signIn) return
|
|
217
224
|
/* SIGN IN CAN BE A PAGE (HubSignedOutGutterAndSeams, kol-fxr 2026-10-29 — frame C): every Sign in the Hub draws comes
|
|
218
225
|
* through here — the rail's foot row, the signed-out +, the phone's More — so one seam routes them all */
|
|
226
|
+
if (!signIn.signedIn && signIn.form) {
|
|
227
|
+
setFormOpen(true)
|
|
228
|
+
if (!onHome) onNavigate?.(homePath)
|
|
229
|
+
return
|
|
230
|
+
}
|
|
219
231
|
if (!signIn.signedIn && signIn.page) {
|
|
220
232
|
if (typeof signIn.page === 'function') signIn.page()
|
|
221
233
|
else onNavigate?.(signIn.page)
|
|
@@ -322,13 +334,9 @@ function HubFrame({
|
|
|
322
334
|
const { railHidden: railHiddenOpt, ...homeData } = home ?? {}
|
|
323
335
|
const railHidden = !!onHome && (railHiddenOpt ?? signedOutHome)
|
|
324
336
|
const signInAction = signIn && !signIn.signedIn ? { label: 'Sign in', icon: 'user', onPress: () => askSignIn() } : undefined
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
:
|
|
328
|
-
? <HubSettings app={app} shortcuts={shortcuts} themeToggle={toggle} filters={settingsFilters} {...settingsProps} drawer={settingsProps.drawer ?? true} />
|
|
329
|
-
: devOn && (currentPath === devPath || currentPath?.startsWith(`${devPath}/`))
|
|
330
|
-
? <HubDev storageKey={`kol-dev-tab:${app.name ?? 'app'}`} {...devProps} />
|
|
331
|
-
: children
|
|
337
|
+
/* the desk dock's ··· on the signed-out Home: the whole nav, as the phone's More lists it, each row pressing through `go` */
|
|
338
|
+
const dockMore = () => [...rows, ...bottom.map((r) => ({ ...r, icon: r.icon === ACCOUNT_GLYPH ? 'user' : r.icon, foot: true }))]
|
|
339
|
+
.map((r) => ({ ...r, onPress: r.onPress ?? (() => go(r.path)) }))
|
|
332
340
|
/* the Dev row closes the app's own rows — under Stage in monitor (HubDevChrome, kol-monitor 2026-10-18 — user:
|
|
333
341
|
* *"why did the dev tab move? it was fine where it was. below stage"*); Settings keeps the bottom alone */
|
|
334
342
|
const rows = devOn ? [...items, { icon: 'code', path: devPath, label: 'Dev' }] : items
|
|
@@ -369,6 +377,15 @@ function HubFrame({
|
|
|
369
377
|
if (pressed[path]) { pressed[path](); return }
|
|
370
378
|
return onNavigate?.(path, ...rest)
|
|
371
379
|
}
|
|
380
|
+
const page = onHome
|
|
381
|
+
? <HubHome app={app} iconComponent={iconComponent} walkthrough={walkthrough} {...homeData} touring={touring} onTouringChange={setTouring} actionsInBar={barOn} signInAction={signInAction} accountAction={accountAction}
|
|
382
|
+
signInForm={signIn?.form && !signIn.signedIn ? { ...signIn.form, open: formOpen, onClose: () => setFormOpen(false) } : undefined}
|
|
383
|
+
dockMore={signedOutHome ? dockMore() : undefined} />
|
|
384
|
+
: settingsPage && currentPath === settingsPath
|
|
385
|
+
? <HubSettings app={app} shortcuts={shortcuts} themeToggle={toggle} filters={settingsFilters} {...settingsProps} drawer={settingsProps.drawer ?? true} />
|
|
386
|
+
: devOn && (currentPath === devPath || currentPath?.startsWith(`${devPath}/`))
|
|
387
|
+
? <HubDev storageKey={`kol-dev-tab:${app.name ?? 'app'}`} {...devProps} />
|
|
388
|
+
: children
|
|
372
389
|
|
|
373
390
|
/* ⌘K's rows: Files, Pages, Shortcuts — the pages are the rail as drawn, mark first */
|
|
374
391
|
const pages = [...(home ? [{ icon: 'home-01', path: homePath, label: 'Home' }] : []), ...rows, ...bottom]
|
package/src/AppShell.jsx
CHANGED
|
@@ -4,7 +4,7 @@ import { NavRail } from '@kolkrabbi/kol-component'
|
|
|
4
4
|
import { NavHiddenContext } from './navHidden.js'
|
|
5
5
|
import { SettingsToggleContext } from './settingsToggle.js'
|
|
6
6
|
import TouchDeviceOverlay, { useTouchPrimary } from './TouchDeviceOverlay.jsx'
|
|
7
|
-
import
|
|
7
|
+
import AppFloatNav from './AppFloatNav.jsx'
|
|
8
8
|
import { TABBAR_H, TABBAR_PILL_INSET, MastheadContext, RAIL_PRESETS } from '@kolkrabbi/kol-component'
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -79,9 +79,9 @@ import { TABBAR_H, TABBAR_PILL_INSET, MastheadContext, RAIL_PRESETS } from '@kol
|
|
|
79
79
|
* every page renders as its own props say, so a consumer's bump moves nothing
|
|
80
80
|
* (fxr · mirror · monitor are mono by ruling).
|
|
81
81
|
* @param {Array} [props.barActions] `[{ label, icon?, onPress }]` — the page's buttons in the bar's More sheet, under the nav (PhoneNav `actions`)
|
|
82
|
-
* @param {'
|
|
83
|
-
* the Home pill kept its hairline while Labs tuned its own by hand): `nav` is no hairline,
|
|
84
|
-
* no shadow, the circle;
|
|
82
|
+
* @param {'mobile'|'panel'|'transport'} [props.navVariant='mobile'] THE PHONE PILL'S PRESET (PhoneNavVariants, kol-fxr 2026-10-28 —
|
|
83
|
+
* the Home pill kept its hairline while Labs tuned its own by hand): `mobile` (was `nav`) is no hairline,
|
|
84
|
+
* no shadow, the circle; AppFloatNav's `APP_FLOAT_NAV_VARIANTS` is the table
|
|
85
85
|
* @param {Object} [props.phoneNav] any further PhoneNav prop for the pill (`sheetItems`, `moreKeepsOpen`, …) — the Hub's
|
|
86
86
|
* signed-out Home passes the rail as More's rows (2026-10-28)
|
|
87
87
|
* @param {string[]|Function} [props.moreItems] which rail rows the More sheet lists (PhoneNav `moreItems`) — unset, all of them
|
|
@@ -170,7 +170,7 @@ export default function AppShell({
|
|
|
170
170
|
drawerOpenOn = NO_PATHS,
|
|
171
171
|
barItems,
|
|
172
172
|
barActions,
|
|
173
|
-
navVariant = '
|
|
173
|
+
navVariant = 'mobile',
|
|
174
174
|
moreItems,
|
|
175
175
|
phoneNav,
|
|
176
176
|
barHiddenOn = NO_PATHS,
|
|
@@ -403,7 +403,7 @@ export default function AppShell({
|
|
|
403
403
|
onClick={() => setDrawerOpen(false)}
|
|
404
404
|
/>
|
|
405
405
|
)}
|
|
406
|
-
{bar && <
|
|
406
|
+
{bar && <AppFloatNav items={barItems ?? [...(items ?? []), ...(bottomItems ?? [])]} actions={barActions} shape={touch === 'pill' ? 'pill' : 'bar'} variant={navVariant} moreItems={moreItems} {...phoneNav} currentPath={currentPath} onNavigate={navigate} />}
|
|
407
407
|
{!navHidden && !bar && !barAside && (
|
|
408
408
|
<Rail
|
|
409
409
|
items={items}
|
package/src/HubDev.jsx
CHANGED
|
@@ -36,7 +36,7 @@ export default function HubDev({ tabs = [], title = 'Dev', subtitle = 'Experimen
|
|
|
36
36
|
{tabs.length > 1 && (
|
|
37
37
|
/* chip tabs — the ones ui.kolkrabbi.io's component pages use — and nothing between them and the
|
|
38
38
|
* content (HubDevChrome, kol-monitor 2026-10-18 — user: *"why are we puttin sub description below the tabs?"*) */
|
|
39
|
-
<TabsRow
|
|
39
|
+
<TabsRow variant="chip" tabs={tabs.map(({ value, label }) => ({ value, label }))} value={active?.value} onChange={pick} ariaLabel={title} />
|
|
40
40
|
)}
|
|
41
41
|
{active && <div className="min-w-0">{active.content}</div>}
|
|
42
42
|
</PageShell>
|
package/src/HubHome.jsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { useState } from 'react'
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
2
|
import { Button, PopoverPanel, usePopover, useMediaQuery, VectorLoader } from '@kolkrabbi/kol-component'
|
|
3
|
-
import
|
|
3
|
+
import AppFloatNav from './AppFloatNav.jsx'
|
|
4
4
|
import WalkthroughPanel from './WalkthroughPanel.jsx'
|
|
5
5
|
import MoreRows from './MoreSheet.jsx'
|
|
6
6
|
import CatalogPage from './CatalogPage.jsx'
|
|
7
|
+
import AccountForm from './AccountForm.jsx'
|
|
7
8
|
import { useTouchPrimary } from './TouchDeviceOverlay.jsx'
|
|
8
9
|
|
|
9
10
|
/* taxonomy-ok: organism — nests CatalogPage (relative) + kol-component's Button */
|
|
@@ -167,9 +168,25 @@ export default function HubHome({
|
|
|
167
168
|
* `signedOutActions` the + on the signed-out page. */
|
|
168
169
|
menu,
|
|
169
170
|
signedOutActions,
|
|
171
|
+
/* SIGN IN OVER HOME (FloatingStyleAndSignInDemos, kol-fxr 2026-10-30, canvas Round 3) — AppHub's, from `signIn.form`:
|
|
172
|
+
* `{ open, onClose, ...AccountForm's props }`. Signed out and open: on a desk the sign-in column (672, surface-primary)
|
|
173
|
+
* slides in from the left over Home, the mark stays where it is above it, the rest of Home turns surface-secondary and
|
|
174
|
+
* the stage re-centres in what is left, the + and the nav stay; on a phone the form is the style-B box, centred over the
|
|
175
|
+
* stage at the 16 gutter, the nav stays. Escape closes it */
|
|
176
|
+
signInForm,
|
|
177
|
+
/* AppHub's: the whole nav, the desk dock's ··· (the board — the signed-out desk has no rail). A chrome may carry `sub`
|
|
178
|
+
* `[{ label, icon?, onPress }]`: its rows open above its slot (fxr: Randomiser → Generate, Effects) */
|
|
179
|
+
dockMore,
|
|
170
180
|
...unknown
|
|
171
181
|
}) {
|
|
172
182
|
if (import.meta.env.DEV) warnUnknown(unknown)
|
|
183
|
+
const formOpen = !!signInForm?.open
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
if (!formOpen) return undefined
|
|
186
|
+
const onKey = (e) => { if (e.key === 'Escape') signInForm.onClose?.() }
|
|
187
|
+
window.addEventListener('keydown', onKey)
|
|
188
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
189
|
+
}, [formOpen]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
173
190
|
const coarse = useTouchPrimary()
|
|
174
191
|
const narrow = useMediaQuery('(max-width: 767px)')
|
|
175
192
|
const [view, setView] = useState(defaultView ?? views?.[0]?.value)
|
|
@@ -258,19 +275,35 @@ export default function HubHome({
|
|
|
258
275
|
if (signedOut ?? (stage != null && files.length === 0)) {
|
|
259
276
|
const outDefaults = [...baseActions, ...(signInAction ? [signInAction] : [])]
|
|
260
277
|
const outActions = typeof signedOutActions === 'function' ? signedOutActions(outDefaults) ?? [] : outDefaults
|
|
278
|
+
const { open: _o, onClose: _c, ...form } = signInForm ?? {}
|
|
261
279
|
return (
|
|
262
280
|
<div className="relative min-h-dvh overflow-hidden" data-hub-signed-out>
|
|
263
|
-
{
|
|
281
|
+
{/* the rest of Home turns surface-secondary under an open sign-in column (a desk only) */}
|
|
282
|
+
<div className={`absolute inset-0 bg-surface-secondary transition-opacity duration-300 max-md:hidden ${formOpen ? 'opacity-100' : 'opacity-0'}`} aria-hidden="true" />
|
|
283
|
+
{/* the stage re-centres in what the column leaves */}
|
|
284
|
+
{stage && <div className={`absolute inset-y-0 right-0 left-0 transition-[left] duration-300 ${formOpen ? 'md:left-[672px]' : ''}`} aria-hidden="true">{stage}</div>}
|
|
285
|
+
{signInForm && (
|
|
286
|
+
<aside aria-label={form.title} aria-hidden={!formOpen} inert={!formOpen} className={`absolute inset-y-0 left-0 w-[672px] px-16 flex flex-col justify-center bg-surface-primary transition-transform duration-300 max-md:hidden ${formOpen ? 'translate-x-0' : '-translate-x-full'}`}>
|
|
287
|
+
{formOpen && <AccountForm {...form} />}
|
|
288
|
+
</aside>
|
|
289
|
+
)}
|
|
290
|
+
{formOpen && (
|
|
291
|
+
<div className="md:hidden absolute inset-x-4 top-1/2 -translate-y-1/2">
|
|
292
|
+
<AccountForm {...form} variant="box" />
|
|
293
|
+
</div>
|
|
294
|
+
)}
|
|
264
295
|
{/* ONE 64 GUTTER ON A DESK (HubSignedOutGutterAndSeams, kol-fxr 2026-10-29 — user: *"cavnas 'padding' is a bit off"*): the
|
|
265
296
|
* mark 64 in and 64 down, the + 64 in and 64 down on the mark's line, the dock 64 in and 64 up — the mark sat at 80 and
|
|
266
297
|
* the + at 72. The phone's values are not part of it */}
|
|
267
298
|
{app.logomark && (
|
|
268
|
-
<div className="absolute left-4 top-6 w-12 h-12 md:left-16 md:top-16 md:w-28 md:h-28 text-emphasis">
|
|
299
|
+
<div className="absolute z-10 left-4 top-6 w-12 h-12 md:left-16 md:top-16 md:w-28 md:h-28 text-emphasis">
|
|
269
300
|
<VectorLoader src={app.logomark} size="100%" role="img" aria-label={app.name} />
|
|
270
301
|
</div>
|
|
271
302
|
)}
|
|
272
|
-
{
|
|
273
|
-
|
|
303
|
+
{/* 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
|
|
304
|
+
* and 24 down; its menu is the floating style (`variant="float"`, the board's menus), as the dock's sheets are */}
|
|
305
|
+
{outActions.length > 0 && <HomeMenu actions={outActions} icon="plus" variant="float" className="absolute z-10 right-4 top-6 md:right-16 md:top-16" />}
|
|
306
|
+
{chromes.length > 0 && <AppFloatNav variant="dock" shape="pill" items={chromes.map((c) => ({ id: c.label, label: c.label, icon: c.icon, onPress: c.onPress, sub: c.sub }))} sheetItems={dockMore} />}
|
|
274
307
|
{/* the walkthrough over the stage, where the catalog's would sit — on the mark's left line */}
|
|
275
308
|
{touring && steps.length > 0 && (
|
|
276
309
|
<div className="absolute inset-x-4 top-24 md:left-16 md:right-auto md:top-52 md:w-[560px]">
|
|
@@ -306,7 +339,7 @@ export default function HubHome({
|
|
|
306
339
|
}
|
|
307
340
|
|
|
308
341
|
/* the masthead's round button and its sheet — the catalog's VariantsButton shape, the phone More's rows */
|
|
309
|
-
function HomeMenu({ actions, icon = 'more', className = '' }) {
|
|
342
|
+
function HomeMenu({ actions, icon = 'more', variant, className = '' }) {
|
|
310
343
|
const [open, setOpen] = useState(false)
|
|
311
344
|
/* 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 × */
|
|
312
345
|
const popover = usePopover({ open, onOpenChange: setOpen, placement: 'left-start', offset: 12 })
|
|
@@ -316,8 +349,8 @@ function HomeMenu({ actions, icon = 'more', className = '' }) {
|
|
|
316
349
|
{/* `icon` — `more` on Home, `plus` signed out (frame B2), the × while its sheet is open */}
|
|
317
350
|
<Button iconOnly={icon === 'more' ? 'more' : open ? 'x' : icon} size="lg" tone="inverted" radius="full" aria-label={open ? 'Close' : 'Actions'} pressed={open} />
|
|
318
351
|
</span>
|
|
319
|
-
<PopoverPanel popover={popover} panel={false} className=
|
|
320
|
-
<MoreRows actions={actions} onPick={() => setOpen(false)} />
|
|
352
|
+
<PopoverPanel popover={popover} panel={false} className={`kol-more-sheet${variant === 'float' ? ' kol-more-sheet-float' : ''}`} style={{ minWidth: 220 }}>
|
|
353
|
+
<MoreRows actions={actions} variant={variant} onPick={() => setOpen(false)} />
|
|
321
354
|
</PopoverPanel>
|
|
322
355
|
</div>
|
|
323
356
|
)
|
package/src/HubSettingsRail.jsx
CHANGED
|
@@ -97,7 +97,7 @@ export default function HubSettingsRail({ open, onClose, title = 'Settings', sec
|
|
|
97
97
|
: <SettingsFooter onReset={reset}>{hubThemeToggle}</SettingsFooter>}
|
|
98
98
|
>
|
|
99
99
|
{/* the tab row wraps in the 380 rail — five tabs (Mirror's Performance beside the Hub's three) overran it */}
|
|
100
|
-
{tabs.length > 1 && <TabsRow
|
|
100
|
+
{tabs.length > 1 && <TabsRow variant="text" size={12} tracked overflow="wrap" className="gap-x-6" tabs={tabs} value={tab} onChange={setTab} ariaLabel="Settings tabs" />}
|
|
101
101
|
{tab === 'account'
|
|
102
102
|
? (
|
|
103
103
|
<div className="flex flex-col gap-8">
|
package/src/MoreSheet.jsx
CHANGED
|
@@ -15,14 +15,17 @@ import { Icon } from '@kolkrabbi/kol-icons'
|
|
|
15
15
|
* @param {Array} items `[{ path, label, icon? }]` — destinations, after a divider's worth of nothing
|
|
16
16
|
* @param {string} active the item path that is current
|
|
17
17
|
* @param {Function} onPick `(item | action) => void` — after the row's own press; the sheet closes here
|
|
18
|
+
* @param {'float'} variant the floating style B (2026-10-30): each row `kol-btn-float` — 44, an 18 radius, 14 in — in a
|
|
19
|
+
* `.kol-more-sheet-float`; AppFloatNav and the signed-out Home pass it. Unset, the rows are A
|
|
18
20
|
* @param {boolean} itemsFirst the destinations above the actions (PhoneNav's More, 2026-10-28: the whole nav, then the
|
|
19
21
|
* page's buttons); Home's masthead button keeps actions first
|
|
20
22
|
*/
|
|
21
|
-
export default function MoreRows({ actions = [], items = [], active, onPick, itemsFirst = false }) {
|
|
23
|
+
export default function MoreRows({ actions = [], items = [], active, onPick, itemsFirst = false, variant }) {
|
|
24
|
+
const shape = variant === 'float' ? ' kol-btn-float' : ''
|
|
22
25
|
const acts = (
|
|
23
26
|
<>
|
|
24
27
|
{actions.map((a) => (
|
|
25
|
-
<Button key={a.label} variant="nav" size="lg" iconLeft={a.checked === undefined && !a.avatar ? a.icon : undefined} iconSize={22} className=
|
|
28
|
+
<Button key={a.label} variant="nav" size="lg" iconLeft={a.checked === undefined && !a.avatar ? a.icon : undefined} iconSize={22} className={`w-full justify-start h-11 gap-3${shape}`} onClick={() => { onPick?.(a); a.onPress?.() }}>
|
|
26
29
|
{a.avatar && <Avatar src={a.avatar} alt="" size="xs" />}
|
|
27
30
|
{a.checked !== undefined && (
|
|
28
31
|
<span className="inline-flex items-center justify-center shrink-0" style={{ width: 22, height: 22 }}>{a.checked && <Icon name="check" size={22} />}</span>
|
|
@@ -42,7 +45,7 @@ export default function MoreRows({ actions = [], items = [], active, onPick, ite
|
|
|
42
45
|
iconLeft={i.icon}
|
|
43
46
|
iconSize={22}
|
|
44
47
|
aria-current={i.path === active ? 'page' : undefined}
|
|
45
|
-
className=
|
|
48
|
+
className={`w-full justify-start h-11 gap-3${shape}`}
|
|
46
49
|
onClick={() => onPick?.(i)}
|
|
47
50
|
>
|
|
48
51
|
{i.label}
|
package/src/PhoneNav.jsx
CHANGED
|
@@ -1,168 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TabsRow, TABBAR_H, TABBAR_PILL_INSET, tabbarPillWidth } from '@kolkrabbi/kol-component'
|
|
3
|
-
import MoreRows from './MoreSheet.jsx'
|
|
4
|
-
|
|
5
|
-
/* taxonomy-ok: molecule — MobileTabBar + a More sheet of Buttons */
|
|
1
|
+
import AppFloatNav, { APP_FLOAT_NAV_VARIANTS } from './AppFloatNav.jsx'
|
|
6
2
|
|
|
7
3
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Up to FIVE destinations sit in the bar. More than five → the first FOUR, then **More**, a sheet
|
|
13
|
-
* holding the rest (Settings included). Ten pages = four + More. The bar is kol-component's
|
|
14
|
-
* `MobileTabBar` — the pill media already floated — not a second bar.
|
|
15
|
-
*
|
|
16
|
-
* Active = the rail's rule: `/` exact, anything else by prefix, the longest match wins. A
|
|
17
|
-
* destination inside More lights More.
|
|
18
|
-
*
|
|
19
|
-
* @param {Array} items `{ icon, path, label }` in rail order, bottom rows last
|
|
20
|
-
* @param {string} currentPath
|
|
21
|
-
* @param {Function} onNavigate `(path) => void`
|
|
22
|
-
* @param {Array} actions `[{ label, icon?, onPress }]` — the page's own buttons, at the top of More (Home's New and
|
|
23
|
-
* Walkthrough on a phone, user 2026-10-23); with any, More shows even with five or fewer rows
|
|
24
|
-
* @param {'bar'|'pill'} shape TabsRow's phone shape (AppShell `touch="pill"`); the More sheet floats above either
|
|
25
|
-
*
|
|
26
|
-
* THE PANEL PICKER (PhoneNavTopAndFold, kol-fxr 2026-10-27, frame E — the nav on top, the open panel at the bottom). The
|
|
27
|
-
* pill only; a `bar` ignores these:
|
|
28
|
-
* @param {'bottom'|'top'} placement the pill's edge; at `top` the More sheet opens below it
|
|
29
|
-
* @param {boolean} border the pill's hairline (default true; frame E has none)
|
|
30
|
-
* @param {'fill'|'circle'} active the lit slot's shape (TabsRow `active`); frame E is `circle`
|
|
31
|
-
* @param {boolean} foldable a sideways swipe folds the pill into a left edge tab; a tap on the tab restores it
|
|
32
|
-
* @param {boolean} folded · {Function} onFoldChange the folded state, so the app can keep it (else PhoneNav holds it)
|
|
33
|
-
* @param {boolean} moreKeepsOpen More opens its sheet without collapsing the pill to the ×, and More lights only while
|
|
34
|
-
* its sheet is open; nothing else closes
|
|
35
|
-
* An item may carry `onPress` (a panel, not a route — the app owns what it opens and whether a second tap closes it) and
|
|
36
|
-
* `selected` (lit whatever the route says; more than one may be).
|
|
37
|
-
*
|
|
38
|
-
* VARIANTS (PhoneNavVariants, kol-fxr 2026-10-28 — user: *"So we should ship variants? or presets? because if we only ship
|
|
39
|
-
* props then each repo has to tune to the same settiings and we get drift"*). A variant is a preset of the pill props above;
|
|
40
|
-
* any prop still overrides it. `PHONE_NAV_VARIANTS` is the table, and TransportPill reads its own row from it.
|
|
41
|
-
* @param {'nav'|'panel'|'transport'} variant `nav` — an app's phone nav: no hairline, no shadow, the lit slot a circle
|
|
42
|
-
* (AppShell's default). `panel` — frame E's panel picker: on top, foldable, More keeps the panel
|
|
43
|
-
* open, no hairline. `transport` — TransportPill's look: the shadow, it floats over content.
|
|
44
|
-
* Unset, the props alone decide, as before
|
|
45
|
-
* @param {boolean} shadow the pill's drop shadow (TabsRow `shadow`) — for a pill that floats over content
|
|
46
|
-
*
|
|
47
|
-
* MORE IS THE WHOLE NAV (PhoneMoreWholeNav, kol-fxr 2026-10-28 — user: *"when you press [...] you should get the entire Nav
|
|
48
|
-
* menu list … but also ship with prop so you can customise"*). The sheet lists every row the rail has, the ones in the pill
|
|
49
|
-
* included and the pinned foot last, then the page's actions. Before, it held only what did not fit.
|
|
50
|
-
* @param {string[]|Function} moreItems which rows More lists — an allow-list of paths, or `(item) => boolean`. Unset: all
|
|
51
|
-
* @param {Array} sheetItems the More rows themselves, when they are not the pill's (HubHomeSignedOut, 2026-10-28: the pill holds
|
|
52
|
-
* the app's chromes and More holds the rail). Rows flagged `foot` (the pinned Media · Sign in · Settings)
|
|
53
|
-
* sit AFTER the page's actions, the rest before — frame A2's order
|
|
54
|
-
*
|
|
55
|
-
* `dock` (PhoneNavDock, kol-fxr 2026-10-28, frame B2): the pill on a DESK — md and up, at the content's bottom-left (TabsRow
|
|
56
|
-
* `dock`), no More (the rail is right there). An app shows it beside the rail, not instead of it.
|
|
4
|
+
* @deprecated 2026-10-30 → `AppFloatNav` — the same nav, the same props (AppFloatNav, kol-fxr: the floating nav is one
|
|
5
|
+
* family). PhoneNav's `variant="nav"` is AppFloatNav's `mobile`; the alias maps it, AppFloatNav does not take `nav`. The
|
|
6
|
+
* old file is in `_tmp/2026-10-30-phone-nav-transport-pill/`.
|
|
57
7
|
*/
|
|
58
|
-
export
|
|
59
|
-
|
|
60
|
-
panel: { placement: 'top', foldable: true, moreKeepsOpen: true, border: false, shadow: false, active: 'circle' },
|
|
61
|
-
transport: { border: false, shadow: true, active: 'circle' },
|
|
62
|
-
dock: { dock: true, border: false, shadow: false, active: 'circle' },
|
|
8
|
+
export default function PhoneNav({ variant, ...props }) {
|
|
9
|
+
return <AppFloatNav {...props} variant={variant === 'nav' ? 'mobile' : variant} />
|
|
63
10
|
}
|
|
64
11
|
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const activePath = (items, path) => items
|
|
69
|
-
.filter((i) => (i.path === '/' ? path === '/' : path === i.path || path.startsWith(`${i.path}/`)))
|
|
70
|
-
.sort((a, b) => b.path.length - a.path.length)[0]?.path
|
|
71
|
-
|
|
72
|
-
export default function PhoneNav({ items = [], currentPath = '/', onNavigate, actions = [], shape = 'bar', variant, placement: placementProp, border: borderProp, shadow: shadowProp, active: activeProp, foldable: foldableProp, folded, onFoldChange, moreKeepsOpen: keepsOpenProp, moreItems, sheetItems, dock: dockProp }) {
|
|
73
|
-
const preset = PHONE_NAV_VARIANTS[variant] ?? {}
|
|
74
|
-
const placement = placementProp ?? preset.placement ?? 'bottom'
|
|
75
|
-
const border = borderProp ?? preset.border ?? true
|
|
76
|
-
const shadow = shadowProp ?? preset.shadow ?? false
|
|
77
|
-
const activeShape = activeProp ?? preset.active
|
|
78
|
-
const foldable = foldableProp ?? preset.foldable ?? false
|
|
79
|
-
const moreKeepsOpen = keepsOpenProp ?? preset.moreKeepsOpen ?? false
|
|
80
|
-
const dock = dockProp ?? preset.dock ?? false
|
|
81
|
-
const [open, setOpen] = useState(false)
|
|
82
|
-
useEffect(() => { setOpen(false) }, [currentPath])
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
if (!open) return undefined
|
|
85
|
-
const onKey = (e) => { if (e.key === 'Escape') setOpen(false) }
|
|
86
|
-
window.addEventListener('keydown', onKey)
|
|
87
|
-
return () => window.removeEventListener('keydown', onKey)
|
|
88
|
-
}, [open])
|
|
89
|
-
|
|
90
|
-
const overflow = items.length > MAX || (actions.length > 0 && items.length >= MAX)
|
|
91
|
-
const hasMore = !dock && (overflow || actions.length > 0 || (sheetItems?.length ?? 0) > 0)
|
|
92
|
-
const inBar = overflow ? items.slice(0, MAX - 1) : items
|
|
93
|
-
const inMore = overflow ? items.slice(MAX - 1) : []
|
|
94
|
-
/* the sheet's rows: the whole nav, filtered by `moreItems` */
|
|
95
|
-
const allow = typeof moreItems === 'function' ? moreItems : Array.isArray(moreItems) ? (i) => moreItems.includes(i.path) : () => true
|
|
96
|
-
const moreRows = (sheetItems ?? items).filter(allow)
|
|
97
|
-
const before = moreRows.filter((i) => !i.foot)
|
|
98
|
-
const after = moreRows.filter((i) => i.foot)
|
|
99
|
-
const active = activePath(items, currentPath)
|
|
100
|
-
const value = open || inMore.some((i) => i.path === active) ? MORE : active
|
|
101
|
-
|
|
102
|
-
const key = (i) => i.path ?? i.id ?? i.label
|
|
103
|
-
const tabs = inBar.map((i) => ({ value: key(i), label: i.label, icon: i.icon, selected: i.selected ?? (moreKeepsOpen ? key(i) === active : undefined) }))
|
|
104
|
-
/* with the pill kept whole, the More slot itself turns to × while its sheet is open, and a press closes it
|
|
105
|
-
* (PhonePillMoreTurnsToClose, kol-fxr 2026-10-28 — frame A2: *"[...] that makes a list and nav turns to (X)"*) */
|
|
106
|
-
if (hasMore) tabs.push({ value: MORE, label: open && moreKeepsOpen ? 'Close' : 'More', icon: open && moreKeepsOpen ? 'x' : 'more', selected: moreKeepsOpen ? open : undefined })
|
|
107
|
-
/* THE SHEET HUGS ITS WORDS AND SITS BESIDE THE × (user 2026-10-23, his reference: iOS Photos' menu next to its ×, *"but
|
|
108
|
-
* align to bottom"*) — to the left of the collapsed ×, a 12px gap, the two bottom edges on one line */
|
|
109
|
-
const pill = shape === 'pill'
|
|
110
|
-
const top = pill && placement === 'top'
|
|
111
|
-
const sheetStyle = moreKeepsOpen && pill ? {
|
|
112
|
-
/* the pill stays whole, so the sheet hangs off its right end, 12 off its face (frame E: below a top pill) */
|
|
113
|
-
left: 'auto',
|
|
114
|
-
right: `calc(50% - ${tabbarPillWidth(tabs.length) / 2}px)`,
|
|
115
|
-
[top ? 'top' : 'bottom']: `calc(env(safe-area-inset-${top ? 'top' : 'bottom'}, 0px) + ${TABBAR_PILL_INSET + TABBAR_H + 12}px)`,
|
|
116
|
-
...(top ? { bottom: 'auto' } : {}),
|
|
117
|
-
width: 'max-content', minWidth: 220, maxWidth: 'calc(100vw - 24px)',
|
|
118
|
-
} : {
|
|
119
|
-
left: 'auto',
|
|
120
|
-
right: pill ? `calc(50% - ${tabbarPillWidth(tabs.length) / 2}px + ${TABBAR_H + 12}px)` : `calc(${100 / tabs.length}% + 8px)`,
|
|
121
|
-
...(top
|
|
122
|
-
? { top: `calc(env(safe-area-inset-top, 0px) + ${TABBAR_PILL_INSET}px)`, bottom: 'auto' }
|
|
123
|
-
: { bottom: pill ? `calc(env(safe-area-inset-bottom, 0px) + ${TABBAR_PILL_INSET}px)` : 'env(safe-area-inset-bottom, 0px)' }),
|
|
124
|
-
width: 'max-content', minWidth: 220, maxWidth: `calc(100vw - ${TABBAR_H + 36}px)`,
|
|
125
|
-
}
|
|
126
|
-
const press = (v) => {
|
|
127
|
-
if (v === MORE) { setOpen((o) => !o); return }
|
|
128
|
-
const item = inBar.find((i) => key(i) === v)
|
|
129
|
-
if (item?.onPress) { item.onPress(); return }
|
|
130
|
-
onNavigate?.(v)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return (
|
|
134
|
-
<>
|
|
135
|
-
{open && (
|
|
136
|
-
/* a BUTTON scrim — iOS does not bubble a tap from a div (OverlayScrimTapDismiss, 2026-09-01) */
|
|
137
|
-
/* with `moreKeepsOpen` the panel under it stays in view: a clear scrim, a tap off the sheet still closes it */
|
|
138
|
-
<button type="button" aria-label="Close more" className={`kol-phone-nav-scrim${moreKeepsOpen ? '' : ' kol-overlay-scrim'}`} onClick={() => setOpen(false)} />
|
|
139
|
-
)}
|
|
140
|
-
{open && (
|
|
141
|
-
<div className="kol-phone-nav-more kol-more-sheet" role="menu" aria-label="More" style={sheetStyle}>
|
|
142
|
-
{/* the nav, the page's actions, then the pinned foot (frame A2) */}
|
|
143
|
-
<MoreRows actions={actions} items={before} itemsFirst active={active} onPick={(x) => { setOpen(false); if (x.onPress && !actions.includes(x)) { x.onPress(); return } if (x.path) onNavigate?.(x.path) }} />
|
|
144
|
-
{after.length > 0 && <MoreRows items={after} active={active} onPick={(x) => { setOpen(false); if (x.onPress) { x.onPress(); return } if (x.path) onNavigate?.(x.path) }} />}
|
|
145
|
-
</div>
|
|
146
|
-
)}
|
|
147
|
-
<TabsRow
|
|
148
|
-
look="stacked"
|
|
149
|
-
placement="phone"
|
|
150
|
-
shape={shape}
|
|
151
|
-
collapsed={open && !moreKeepsOpen}
|
|
152
|
-
onExpand={() => setOpen(false)}
|
|
153
|
-
edge={top ? 'top' : 'bottom'}
|
|
154
|
-
border={border}
|
|
155
|
-
shadow={shadow}
|
|
156
|
-
dock={dock}
|
|
157
|
-
active={activeShape}
|
|
158
|
-
foldable={foldable}
|
|
159
|
-
folded={folded}
|
|
160
|
-
onFoldChange={(v) => { if (v) setOpen(false); onFoldChange?.(v) }}
|
|
161
|
-
foldSide="left"
|
|
162
|
-
tabs={tabs}
|
|
163
|
-
value={value}
|
|
164
|
-
onChange={press}
|
|
165
|
-
/>
|
|
166
|
-
</>
|
|
167
|
-
)
|
|
168
|
-
}
|
|
12
|
+
/** @deprecated 2026-10-30 → `APP_FLOAT_NAV_VARIANTS` (`nav` is `mobile` there) */
|
|
13
|
+
export const PHONE_NAV_VARIANTS = { ...APP_FLOAT_NAV_VARIANTS, nav: APP_FLOAT_NAV_VARIANTS.mobile }
|
package/src/TabStrip.jsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TabsRow } from '@kolkrabbi/kol-component'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @deprecated 2026-10-17 — alias of kol-component's `TabsRow
|
|
5
|
-
* TabStrip — Old name for TabsRow's text
|
|
4
|
+
* @deprecated 2026-10-17 — alias of kol-component's `TabsRow variant="text"` (TabsStackedLayout: one tab component). Drops when nobody imports it (04-retirements.md).
|
|
5
|
+
* TabStrip — Old name for TabsRow's text variant. Same props: `options` (`{ value, label }`) · `value` · `onChange` · `size` · `tracked` · `className` · `style`.
|
|
6
6
|
*/
|
|
7
7
|
export default function TabStrip({ options = [], className = 'gap-6', ...rest }) {
|
|
8
|
-
return <TabsRow
|
|
8
|
+
return <TabsRow variant="text" tabs={options} className={className} {...rest} />
|
|
9
9
|
}
|
package/src/TransportPill.jsx
CHANGED
|
@@ -1,82 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PHONE_NAV_VARIANTS } from './PhoneNav.jsx'
|
|
3
|
-
import { TabsRow, TABBAR_H, TABBAR_PILL_INSET, TABBAR_PILL_TAB, tabbarPillWidth } from '@kolkrabbi/kol-component'
|
|
4
|
-
import MoreRows from './MoreSheet.jsx'
|
|
5
|
-
|
|
6
|
-
/* taxonomy-ok: molecule — TabsRow's phone pill of action slots + a MoreRows sheet */
|
|
1
|
+
import AppFloatNav from './AppFloatNav.jsx'
|
|
7
2
|
|
|
8
3
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* destinations. It floats over the open panel, so it carries the shadow the nav does not, and folds to a RIGHT edge tab.
|
|
12
|
-
*
|
|
13
|
-
* A slot fires `onPress`; `selected` lights it (play and pause are a radio pair the consumer owns, so both are just
|
|
14
|
-
* `selected`). A slot named in `sheetFor` opens a sheet of rows anchored above it instead, lit while open; a row runs its
|
|
15
|
-
* `onPress` and closes the sheet.
|
|
16
|
-
*
|
|
17
|
-
* @param {Array} items `[{ id, icon, label, onPress?, selected? }]` in pill order
|
|
18
|
-
* @param {Object} sheetFor `{ [id]: [{ label, icon?, onPress, checked? }] }` — rows for a slot that opens a sheet;
|
|
19
|
-
* `checked` marks the current pick with the 22px check (MoreRows)
|
|
20
|
-
* @param {'bottom'|'top'} placement the pill's edge (default bottom)
|
|
21
|
-
* @param {boolean} foldable a sideways swipe folds it into the right edge tab
|
|
22
|
-
* @param {boolean} folded · {Function} onFoldChange the folded state, controlled (else the pill holds it)
|
|
4
|
+
* @deprecated 2026-10-30 → `AppFloatNav variant="transport"` — the same pill, the same props (AppFloatNav, kol-fxr: the
|
|
5
|
+
* floating nav is one family). The old file is in `_tmp/2026-10-30-phone-nav-transport-pill/`.
|
|
23
6
|
*/
|
|
24
|
-
export default function TransportPill(
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (!sheet) return undefined
|
|
28
|
-
const onKey = (e) => { if (e.key === 'Escape') setSheet(null) }
|
|
29
|
-
window.addEventListener('keydown', onKey)
|
|
30
|
-
return () => window.removeEventListener('keydown', onKey)
|
|
31
|
-
}, [sheet])
|
|
32
|
-
|
|
33
|
-
const top = placement === 'top'
|
|
34
|
-
const tabs = items.map((i) => ({ value: i.id, label: i.label, icon: i.icon, selected: sheet === i.id || !!i.selected }))
|
|
35
|
-
const press = (id) => {
|
|
36
|
-
if (sheetFor[id]) { setSheet((s) => (s === id ? null : id)); return }
|
|
37
|
-
setSheet(null)
|
|
38
|
-
items.find((i) => i.id === id)?.onPress?.()
|
|
39
|
-
}
|
|
40
|
-
/* the sheet centres on its slot: the pill's left edge + its 7px pad + the slot's centre */
|
|
41
|
-
const W = tabbarPillWidth(items.length)
|
|
42
|
-
const at = items.findIndex((i) => i.id === sheet)
|
|
43
|
-
const sheetStyle = {
|
|
44
|
-
left: `calc(50% - ${W / 2}px + 7px + ${at * TABBAR_PILL_TAB + TABBAR_PILL_TAB / 2}px)`,
|
|
45
|
-
right: 'auto',
|
|
46
|
-
transform: 'translateX(-50%)',
|
|
47
|
-
[top ? 'top' : 'bottom']: `calc(env(safe-area-inset-${top ? 'top' : 'bottom'}, 0px) + ${TABBAR_PILL_INSET + TABBAR_H + 12}px)`,
|
|
48
|
-
...(top ? { bottom: 'auto' } : {}),
|
|
49
|
-
width: 'max-content', minWidth: 160,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<>
|
|
54
|
-
{sheet && (
|
|
55
|
-
/* a clear BUTTON scrim — the panel under it stays in view, a tap off the sheet closes it */
|
|
56
|
-
<button type="button" aria-label="Close" className="kol-phone-nav-scrim" onClick={() => setSheet(null)} />
|
|
57
|
-
)}
|
|
58
|
-
{sheet && (
|
|
59
|
-
<div className="kol-phone-nav-more kol-more-sheet" role="menu" aria-label={items[at]?.label} style={sheetStyle}>
|
|
60
|
-
<MoreRows actions={sheetFor[sheet]} onPick={() => setSheet(null)} />
|
|
61
|
-
</div>
|
|
62
|
-
)}
|
|
63
|
-
<TabsRow
|
|
64
|
-
look="stacked"
|
|
65
|
-
placement="phone"
|
|
66
|
-
shape="pill"
|
|
67
|
-
edge={top ? 'top' : 'bottom'}
|
|
68
|
-
/* the `transport` row of PHONE_NAV_VARIANTS (2026-10-28) — one table, not a second tuning */
|
|
69
|
-
border={PHONE_NAV_VARIANTS.transport.border}
|
|
70
|
-
shadow={PHONE_NAV_VARIANTS.transport.shadow}
|
|
71
|
-
active={PHONE_NAV_VARIANTS.transport.active}
|
|
72
|
-
foldable={foldable}
|
|
73
|
-
folded={folded}
|
|
74
|
-
onFoldChange={(v) => { if (v) setSheet(null); onFoldChange?.(v) }}
|
|
75
|
-
foldSide="right"
|
|
76
|
-
ariaLabel="Transport"
|
|
77
|
-
tabs={tabs}
|
|
78
|
-
onChange={press}
|
|
79
|
-
/>
|
|
80
|
-
</>
|
|
81
|
-
)
|
|
7
|
+
export default function TransportPill(props) {
|
|
8
|
+
return <AppFloatNav {...props} variant="transport" />
|
|
82
9
|
}
|
package/src/index.js
CHANGED
|
@@ -14,6 +14,9 @@ export { default as AppShell } from './AppShell.jsx'
|
|
|
14
14
|
export { NavHiddenContext, useNavHidden } from './navHidden.js'
|
|
15
15
|
export { SettingsToggleContext, useSettingsToggle } from './settingsToggle.js'
|
|
16
16
|
export { NavRail } from '@kolkrabbi/kol-component' // lives in kol-component since 2026-10-22
|
|
17
|
+
// the floating nav, one family (AppFloatNav, kol-fxr 2026-10-30) — PhoneNav and TransportPill are its deprecated aliases
|
|
18
|
+
// on the retirement ledger (PhoneNav's `nav` is `mobile`; TransportPill is `variant="transport"`)
|
|
19
|
+
export { default as AppFloatNav, APP_FLOAT_NAV_VARIANTS } from './AppFloatNav.jsx'
|
|
17
20
|
export { default as PhoneNav, PHONE_NAV_VARIANTS } from './PhoneNav.jsx'
|
|
18
21
|
export { default as TransportPill } from './TransportPill.jsx'
|
|
19
22
|
export { default as PageShell, PageBleed } from './PageShell.jsx'
|
|
@@ -38,6 +41,7 @@ export { default as TouchDeviceOverlay, useTouchPrimary } from './TouchDeviceOve
|
|
|
38
41
|
// the Hub — Shell + Home + Settings + keys, made once (the app anatomy, 2026-09-26)
|
|
39
42
|
export { default as AppHub } from './AppHub.jsx'
|
|
40
43
|
export { default as HubHome } from './HubHome.jsx'
|
|
44
|
+
export { default as AccountForm } from './AccountForm.jsx'
|
|
41
45
|
export { default as HubSettings } from './HubSettings.jsx'
|
|
42
46
|
export { default as HubSettingsRail, hubThemeToggle } from './HubSettingsRail.jsx'
|
|
43
47
|
export { default as HubDev } from './HubDev.jsx'
|