@kolkrabbi/kol-shell 0.74.0 → 0.77.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/src/HubHome.jsx CHANGED
@@ -1,6 +1,8 @@
1
1
  import { useState } from 'react'
2
- import { Button } from '@kolkrabbi/kol-component'
2
+ import { Button, PopoverPanel, usePopover, useMediaQuery } from '@kolkrabbi/kol-component'
3
+ import MoreRows from './MoreSheet.jsx'
3
4
  import CatalogPage from './CatalogPage.jsx'
5
+ import { useTouchPrimary } from './TouchDeviceOverlay.jsx'
4
6
 
5
7
  /* taxonomy-ok: organism — nests CatalogPage (relative) + kol-component's Button */
6
8
 
@@ -11,6 +13,23 @@ import CatalogPage from './CatalogPage.jsx'
11
13
  * that button's Close label, a "Get started" last step — and the case of the view
12
14
  * labels had already drifted. They are made here once.
13
15
  *
16
+ * HOME IS A DATA CONTRACT (HubHomeContract, kol-fxr 2026-10-23 — user: *"you 3 share THE SAME HUB
17
+ * it should not DIFFER, that's literally the reason I made the hub"*). Until then the Hub shared only
18
+ * the FRAME: `...rest` reached `CatalogPage`, so every consumer still wrote its own `toCard`, picked
19
+ * its own preset, row, list and filter label, and the three Homes drifted on every one. Now the
20
+ * consumer hands DATA — `files` and the handlers — and the Hub draws every card itself:
21
+ * `preset="app"` (the app card, the app row three across — his 2026-10-22 ruling), grid by default,
22
+ * "All Files", RECENT = the twelve newest, SAVED = every file, `name → title`, `updatedAt → date`,
23
+ * `bytes → size`, `cover → media`, and `tags`, `details`, `onTags` to the file's info rail. No prop
24
+ * reaches `CatalogPage` that is not named below, so a consumer with no knob cannot drift. The Library
25
+ * pages stay per app on `CatalogPage` — only Home closes.
26
+ *
27
+ * FILES ONLY (user ruling 2026-10-23: the blank start — New File, Empty Studio, Empty 7U — rode RECENT
28
+ * as a card with no verbs and read as a file nobody can delete; *"yeah drop it"*). The blank start is
29
+ * the `action` button at the foot. The card carries no summary line either (the `meta` of 0.292.0 was
30
+ * never designed for and broke the plate): a file's counts and dimensions are `details`, shown in the
31
+ * rail the cog opens.
32
+ *
14
33
  * THE WALKTHROUGH IS OPT-IN (user, 2026-09-26, on media-hub): it never opens by
15
34
  * itself. The Walkthrough button at the end of the action row opens it; the X inside
16
35
  * the card and the same button close it.
@@ -18,66 +37,202 @@ import CatalogPage from './CatalogPage.jsx'
18
37
  * @param {Object} app `{ name, subtitle }` — the masthead, when Home is the app's front door
19
38
  * @param {string} title · subtitle Home's own masthead instead — for a Home that is not the front
20
39
  * door (media-hub's Library at `/library`, 2026-09-26: it said "Media")
21
- * @param {Array|Function} items the catalog's items, or `(view) => items` — RECENT
22
- * and SAVED are different sets in every app
23
- * @param {Array} views the view strip (default RECENT · SAVED); rename a set by
24
- * passing your own, e.g. `[…, { value: 'saved', label: 'FAVOURITES' }]`
25
- * @param {Array} walkthrough steps (WalkthroughPanel's); a step whose `actions` is a
26
- * FUNCTION gets `close` — the "Get started" step's buttons
27
- * @param {ReactNode} actions the app's buttons; the Walkthrough button follows them
28
- * THE LIST IS THE FILE ROW, one per line (user, 2026-09-26, on apps/hub: CatalogPage's
29
- * 36px `catalog` row four across "both a bad hover state and using columns wrong"; brand's
30
- * library row is the reference) — `rowVariant="file"` + `listLayout="stack"`: the ruled
31
- * 48px thumb row, `date` · `size` · `actions` from `toCard`. Only the Hub's default —
32
- * CatalogPage's own default does not move, and either prop can be passed back.
40
+ * @param {Array} files the user's files, the ONLY source of cards:
41
+ * `[{ id, name, updatedAt (ms), bytes?, cover? (src | node), tags?: string[],
42
+ * note?: string, mark?: { icon, label, of? }, details?: [{ label, value }] }]` — `mark` is a glyph
43
+ * on the cover's other corner for what the file is (FXR: the chrome it was made with) — newest first wherever they come from; a
44
+ * file may carry the keys its `filterGroups` read (monitor's `type`)
45
+ * @param {Function} onOpen `(file)` — the card and the row click; required with `files`
46
+ * @param {Function} onDownload `(file)` — the cover's download and the rail's button; absent → neither
47
+ * @param {Function} onRename · onDuplicate · onRemove `(file, name)` · `(file)` · `(file)` — the verbs
48
+ * behind Rename · Duplicate · Delete (the menu, the plate's trash, the rail's
49
+ * buttons); a verb not passed is not drawn (CatalogAppVariant's rule); Rename
50
+ * prompts and Delete confirms before the handler runs
51
+ * @param {Function} onTags `(file, tags)` — the rail's tag chips write through it; absent → tags read-only
52
+ * @param {Function} onNote `(file, text)` — the rail's note (a plain description, 2026-10-23) writes through it; absent → read-only
53
+ * @param {Object} touch QUICK LINKS ON A PHONE, opt-in (studio-hub review 2, § 7.2 — *"fxr would use the quicklinks
54
+ * for picking chrome right on mobile, while monitor and mirror wouldn't"*):
55
+ * `{ doors: [{ icon, label, onPress }] }` — on a coarse pointer or below `md`, the doors as a
56
+ * 2 × 2 grid of large buttons ABOVE the catalog, which a phone draws as rows (CatalogPage's
57
+ * `phoneLayout`). Nothing else: the separate touch page (doors, recent rows, All files) of
58
+ * 2026-10-23 is gone. Absent, a phone gets the rows alone
59
+ * @param {Array} filterGroups ContentFilters' `[{ label, key, values, exclusive? }]`, opt-in — declare them or
60
+ * Home is not a catalog for you (user, 2026-10-23). `exclusive` makes a group's
61
+ * chips mutually exclusive. When files carry `tags` and no group claims the key,
62
+ * the Hub derives a Tags group from them, so a tag added in the rail filters at once
63
+ * @param {Object} action `{ label, onClick }` — the app's one action (New File), the first row of the masthead's round
64
+ * button's sheet (2026-10-23; it was a button at the foot); the Hub draws
65
+ * the `Button tone="grey" size="md"`, the consumer writes no JSX (shelf's rule)
66
+ * @param {Array} views the view strip (default RECENT · SAVED); rename a set by passing your own,
67
+ * e.g. `[…, { value: 'saved', label: 'FAVOURITES' }]` — the VALUES are the
68
+ * Hub's (`recent` = the twelve newest · `saved` = every file)
69
+ * @param {string} defaultView which view opens (default the first)
70
+ * @param {Array} walkthrough steps (WalkthroughPanel's: `{ title, text, cover?, illustration?, actions? }`); the
71
+ * "Get started" step's `actions` are DATA `[{ label, onClick, icon? }]` — the Hub draws the
72
+ * buttons and closes the walkthrough before each handler runs (2026-10-24)
73
+ * @param {ElementType} iconComponent icon renderer seam for ContentFilters
33
74
  *
34
- * @param {...*} rest every other CatalogPage prop (`toCard`, `filterGroups`,
35
- * `filtersTitle`, `filtersProps`, …) — spread through
75
+ * Gone, and the Hub warns in dev when it sees one: `toCard` · `items` · `preset` · `cardVariant` ·
76
+ * `rowVariant` · `listLayout` · `defaultLayout` · `filtersTitle` · `filtersProps` · `className` ·
77
+ * `actions` · `minColumn` · `maxColumns` (2026-10-23, the contract) and `template` · `summary`
78
+ * (2026-10-23, his review: files only, no summary line on the card).
36
79
  */
37
80
  const HUB_VIEWS = [
38
81
  { value: 'recent', label: 'RECENT' },
39
82
  { value: 'saved', label: 'SAVED' },
40
83
  ]
41
84
 
85
+ /* RECENT is the newest files — fxr, mirror and monitor each wrote twelve */
86
+ const RECENT_FILES = 12
87
+
88
+ /* dev-only, once per prop — a Home prop that left with the contract, or anything else unknown. A prop
89
+ * that silently does nothing reads as working code at the call site (the props gate's lesson). */
90
+ const warned = new Set()
91
+ function warnUnknown(unknown) {
92
+ for (const key of Object.keys(unknown)) {
93
+ if (warned.has(key)) continue
94
+ warned.add(key)
95
+ console.warn(
96
+ `HubHome: "${key}" is not a Home prop and was ignored — Home is a data contract (HubHomeContract, 2026-10-23). `
97
+ + 'Props: files · onOpen · onDownload · onRename · onDuplicate · onRemove · onTags · onNote · filterGroups · action, '
98
+ + 'plus app · title · subtitle · views · defaultView · walkthrough · iconComponent. '
99
+ + '`template` and `summary` left 2026-10-23: files only, and a file\'s information is `details` in the rail. This warning is dev-only.',
100
+ )
101
+ }
102
+ }
103
+
42
104
  export default function HubHome({
43
105
  app = {},
44
106
  title,
45
107
  subtitle,
46
- items = [],
108
+ files = [],
109
+ onOpen,
110
+ onDownload,
111
+ onRename,
112
+ onDuplicate,
113
+ onRemove,
114
+ onTags,
115
+ onNote,
116
+ filterGroups,
117
+ action,
47
118
  views = HUB_VIEWS,
48
119
  defaultView,
49
120
  walkthrough,
50
- actions,
51
121
  iconComponent,
52
- ...rest
122
+ touch,
123
+ /* AppHub's: the walkthrough's open state, and whether the phone bar's More sheet carries New and Walkthrough */
124
+ touring: touringProp,
125
+ onTouringChange,
126
+ actionsInBar = false,
127
+ ...unknown
53
128
  }) {
129
+ if (import.meta.env.DEV) warnUnknown(unknown)
130
+ const coarse = useTouchPrimary()
131
+ const narrow = useMediaQuery('(max-width: 767px)')
54
132
  const [view, setView] = useState(defaultView ?? views?.[0]?.value)
55
- const [touring, setTouring] = useState(false)
133
+ const [ownTouring, setOwnTouring] = useState(false)
134
+ const touring = touringProp ?? ownTouring
135
+ const setTouring = (v) => { const next = typeof v === 'function' ? v(touring) : v; setOwnTouring(next); onTouringChange?.(next) }
56
136
  const close = () => setTouring(false)
57
- const steps = (walkthrough ?? []).map((s) => (typeof s.actions === 'function' ? { ...s, actions: s.actions(close) } : s))
137
+ /* a step's `actions` as DATA `[{ label, onClick }]` — each press closes the walkthrough, then runs the app's handler
138
+ * (studio-hub's Get started: close, then Create); a function still gets `close` (the old shape), a node is drawn with
139
+ * the panel's warning */
140
+ const steps = (walkthrough ?? []).map((s) => (
141
+ Array.isArray(s.actions) ? { ...s, actions: s.actions.map((a) => ({ ...a, onClick: () => { close(); a.onClick?.() } })) }
142
+ : typeof s.actions === 'function' ? { ...s, actions: s.actions(close) } : s))
143
+
144
+ /* newest first, whatever order the consumer keeps them in */
145
+ const sorted = [...files].sort((a, b) => (b.updatedAt ?? 0) - (a.updatedAt ?? 0))
146
+ const items = view === 'recent' ? sorted.slice(0, RECENT_FILES) : sorted
147
+
148
+ /* the ONE mapping — data in, the `app` card's slots out (AppItem.jsx draws the rest) */
149
+ const toCard = (item) => {
150
+ const verbs = {
151
+ ...(onRename && { rename: (name) => onRename(item, name) }),
152
+ ...(onDuplicate && { duplicate: () => onDuplicate(item) }),
153
+ ...(onRemove && { remove: () => onRemove(item) }),
154
+ }
155
+ return {
156
+ key: item.id,
157
+ title: item.name,
158
+ date: item.updatedAt,
159
+ size: item.bytes,
160
+ media: item.cover,
161
+ tags: item.tags,
162
+ details: item.details,
163
+ onTags: onTags ? (tags) => onTags(item, tags) : undefined,
164
+ note: item.note,
165
+ mark: item.mark,
166
+ onNote: onNote ? (text) => onNote(item, text) : undefined,
167
+ verbs: Object.keys(verbs).length ? verbs : undefined,
168
+ download: onDownload ? () => onDownload(item) : undefined,
169
+ onClick: onOpen ? () => onOpen(item) : undefined,
170
+ }
171
+ }
172
+
173
+ /* the Tags group is derived from the files when they carry tags and no declared group claims the key */
174
+ const tagValues = [...new Set(files.flatMap((f) => f.tags ?? []))]
175
+ const groups = !tagValues.length || filterGroups?.some((g) => g.key === 'tags')
176
+ ? filterGroups
177
+ : [...(filterGroups ?? []), { label: 'Tags', key: 'tags', values: tagValues }]
178
+ /* a group's `exclusive` is ContentFilters' `mutuallyExclusiveFilters`, by key; the flag itself stays here */
179
+ const exclusive = groups?.filter((g) => g.exclusive).map((g) => g.key)
180
+
181
+ /* NEW AND WALKTHROUGH LIVE IN THE MASTHEAD'S ROUND BUTTON (user 2026-10-23: *"New and more should go into a component
182
+ * like apps/catalog"*): the catalog's inverted full-radius Button in PageHeader's `actions` slot, opening the same sheet
183
+ * the phone bar's More draws (MoreRows in `.kol-more-sheet`). The foot row it replaces was a row of buttons under the
184
+ * catalog, hence a bottom pad that read as a clipped last row. With the bar on a phone the bar's More carries both
185
+ * and the button hides below `md`; with the drawer it stays on every width. */
186
+ const menuActions = [
187
+ ...(action ? [{ label: action.label, icon: 'plus', onPress: action.onClick }] : []),
188
+ ...(steps.length ? [{ label: touring ? 'Close walkthrough' : 'Walkthrough', icon: 'book-open', onPress: () => setTouring((t) => !t) }] : []),
189
+ ]
190
+ /* with the drawer the button stays on the phone, stepped left of the shell's drawer trigger (fixed top-right, 32 at 12;
191
+ * the variants gate caught the overlap on editor-hub at 390) */
192
+ const headerMenu = menuActions.length ? <HomeMenu actions={menuActions} className={actionsInBar ? 'max-md:hidden' : 'max-md:mr-11'} /> : undefined
193
+
194
+ /* the quick links — fxr's chromes, a phone's 2 × 2 above the rows; a desk never sees them */
195
+ const doors = touch?.doors?.length && (coarse || narrow) ? (
196
+ <div className="grid grid-cols-2 gap-3 mb-8">
197
+ {touch.doors.map((d) => <Button key={d.label} tone="grey" size="lg" iconLeft={d.icon} className="w-full justify-start" onClick={d.onPress}>{d.label}</Button>)}
198
+ </div>
199
+ ) : undefined
58
200
 
59
201
  return (
60
202
  <CatalogPage
61
- header={{ title: title ?? app.name, subtitle: subtitle ?? app.subtitle, size: 'sm', voice: 'mono' }}
62
- items={typeof items === 'function' ? items(view) : items}
203
+ preset="app"
204
+ header={{ title: title ?? app.name, subtitle: subtitle ?? app.subtitle, size: 'sm', voice: 'mono', actions: headerMenu, actionsPlacement: headerMenu ? 'head' : undefined }}
205
+ items={items}
206
+ toCard={toCard}
207
+ filtersTitle="All Files"
208
+ filterGroups={groups?.map(({ exclusive: _x, ...g }) => g)}
209
+ filtersProps={exclusive?.length ? { mutuallyExclusiveFilters: exclusive } : undefined}
63
210
  views={views}
64
211
  view={view}
65
212
  onViewChange={setView}
213
+ /* grid always (the user, 2026-10-09: "it should always default to grid mode"); the list is the preset's —
214
+ * the app row three across (his 2026-10-22 ruling: "3 columns per row, not one single column") */
215
+ defaultLayout="grid"
66
216
  iconComponent={iconComponent}
67
- rowVariant="file"
68
- listLayout="stack"
69
217
  walkthrough={steps.length ? { open: touring, steps, onClose: close, iconComponent } : undefined}
70
- actions={(actions || steps.length) ? (
71
- <>
72
- {actions}
73
- {steps.length > 0 && (
74
- <Button tone="grey" size="md" onClick={() => setTouring((t) => !t)}>
75
- {touring ? 'Close' : 'Walkthrough'}
76
- </Button>
77
- )}
78
- </>
79
- ) : undefined}
80
- {...rest}
218
+ lead={doors}
81
219
  />
82
220
  )
83
221
  }
222
+
223
+ /* the masthead's round button and its sheet — the catalog's VariantsButton shape, the phone More's rows */
224
+ function HomeMenu({ actions, className = '' }) {
225
+ const [open, setOpen] = useState(false)
226
+ /* 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 × */
227
+ const popover = usePopover({ open, onOpenChange: setOpen, placement: 'left-start', offset: 12 })
228
+ return (
229
+ <div className={className}>
230
+ <span ref={popover.refs.setReference} {...popover.getReferenceProps()} className="inline-flex">
231
+ <Button iconOnly="more" size="lg" tone="inverted" radius="full" aria-label="Actions" pressed={open} />
232
+ </span>
233
+ <PopoverPanel popover={popover} panel={false} className="kol-more-sheet" style={{ minWidth: 220 }}>
234
+ <MoreRows actions={actions} onPick={() => setOpen(false)} />
235
+ </PopoverPanel>
236
+ </div>
237
+ )
238
+ }
@@ -3,6 +3,7 @@ import { Divider, LabeledControlSection, SettingsFooter, SettingsPanel, Settings
3
3
  import SettingsScaffold from './SettingsScaffold.jsx'
4
4
  import SettingsShortcuts from './SettingsShortcuts.jsx'
5
5
  import SettingsLinks, { SettingsColophon } from './SettingsLinks.jsx'
6
+ import About from './About.jsx'
6
7
 
7
8
  /* taxonomy-ok: organism — nests SettingsScaffold / SettingsShortcuts / SettingsLinks (relative) + kol-component's SettingsPanel / SettingsSections */
8
9
 
@@ -47,6 +48,11 @@ import SettingsLinks, { SettingsColophon } from './SettingsLinks.jsx'
47
48
  * footer beside reset, apps/media's arrangement. `drawer` with no drawer
48
49
  * falls back to the masthead, so the toggle is never lost
49
50
  * @param {Function} comboLabel (combo) => string, for SettingsShortcuts
51
+ * @param {boolean} filters the filter bar (default true, the page as it was). `false` is the PAGE TIER without the
52
+ * filters tier (review 2, § 6.3 — *"most of the time you will only need a siderail … if
53
+ * you are super heavy then you might want a page, then when the page is getting heavy you
54
+ * might want filters"*): no bar, no tabs; two columns from `lg` — the sections left on the
55
+ * drawer's row shape, `SettingsShortcuts` then About and Repo right
50
56
  * @param {string} tone the page's control tone (default `sunken`, SettingsScaffold's): the
51
57
  * filter row, the masthead gear AND every control in the settings rows,
52
58
  * which inherit it from a `kol-tone-*` wrapper — `tone: 'primary'` in an
@@ -75,6 +81,7 @@ export default function HubSettings({
75
81
  comboLabel,
76
82
  tone = 'sunken',
77
83
  themeIn = 'masthead',
84
+ filters = true,
78
85
  }) {
79
86
  const [drawerOpen, setDrawerOpen] = useState(false)
80
87
  const [mode, setMode] = useState('options')
@@ -150,7 +157,7 @@ export default function HubSettings({
150
157
  <div className="flex flex-col gap-8">
151
158
  {app.about && (
152
159
  <LabeledControlSection label={app.name}>
153
- <div className="text-fg-48 kol-mono-14" style={{ maxWidth: 640 }}>{app.about}</div>
160
+ <About about={app.about} />
154
161
  </LabeledControlSection>
155
162
  )}
156
163
  <SettingsColophon />
@@ -164,10 +171,34 @@ export default function HubSettings({
164
171
  return tabs.find((t) => t.value === tab)?.content ?? null
165
172
  }
166
173
 
174
+ /* THE PAGE TIER WITHOUT FILTERS — one page, two columns from `lg`: the sections on the drawer's row shape (the column
175
+ * capped as the settings column is), and the keymap, About and Repo beside them */
176
+ const plain = () => (
177
+ <div className={`kol-tone-${tone} grid items-start gap-x-12 gap-y-10 lg:grid-cols-2`}>
178
+ <div className="flex flex-col gap-8" style={{ maxWidth: COLUMN }}>
179
+ {content}
180
+ {sections?.length > 0 && <SettingsSections sections={sections} divided />}
181
+ </div>
182
+ <div className="flex flex-col gap-10 min-w-0">
183
+ {shortcuts.length > 0 && (
184
+ <LabeledControlSection label="Keyboard Shortcuts"><SettingsShortcuts sections={shortcuts} comboLabel={comboLabel} /></LabeledControlSection>
185
+ )}
186
+ {app.about && (
187
+ <LabeledControlSection label={app.name}>
188
+ <About about={app.about} />
189
+ </LabeledControlSection>
190
+ )}
191
+ {app.links?.length > 0 && <LabeledControlSection label="Links"><SettingsLinks links={app.links} /></LabeledControlSection>}
192
+ <SettingsColophon />
193
+ </div>
194
+ </div>
195
+ )
196
+
167
197
  return (
168
198
  <>
169
199
  <SettingsScaffold
170
- tabs={all}
200
+ filters={filters}
201
+ tabs={filters ? all : all.slice(0, 1)}
171
202
  defaultTab="settings"
172
203
  header={{ size: 'sm', voice: 'mono' }}
173
204
  tone={tone}
@@ -185,7 +216,7 @@ export default function HubSettings({
185
216
  <Divider variant="vertical" />
186
217
  </>
187
218
  ) : undefined}
188
- renderContent={render}
219
+ renderContent={filters ? render : plain}
189
220
  />
190
221
  {/* the drawer is the page's other half, a SIBLING of the scaffold — never inside its scroll */}
191
222
  {hasDrawer && (
@@ -0,0 +1,40 @@
1
+ import { Button } from '@kolkrabbi/kol-component'
2
+
3
+ /* taxonomy-ok: molecule — a column of nav Buttons */
4
+
5
+ /**
6
+ * MoreRows — The sheet's rows, wherever the sheet opens. the one list of 44px nav rows (mono-16, 22px glyphs,
7
+ * the pill's rounding on each) that the phone bar's More sheet and Home's masthead button both draw
8
+ * (user 2026-10-23: *"we could even make similar dropdown as we use in phone nav"*). The sheet's chrome is
9
+ * `.kol-more-sheet` — the pill's ground and hairline, a 24px rounding, 8px pad — on whatever box holds the rows.
10
+ *
11
+ * @param {Array} actions `[{ label, icon?, onPress }]` — the page's own buttons, first
12
+ * @param {Array} items `[{ path, label, icon? }]` — destinations, after a divider's worth of nothing
13
+ * @param {string} active the item path that is current
14
+ * @param {Function} onPick `(item | action) => void` — after the row's own press; the sheet closes here
15
+ */
16
+ export default function MoreRows({ actions = [], items = [], active, onPick }) {
17
+ return (
18
+ <>
19
+ {actions.map((a) => (
20
+ <Button key={a.label} variant="nav" size="lg" iconLeft={a.icon} iconSize={22} className="w-full justify-start h-11 gap-3" onClick={() => { onPick?.(a); a.onPress?.() }}>
21
+ {a.label}
22
+ </Button>
23
+ ))}
24
+ {items.map((i) => (
25
+ <Button
26
+ key={i.path}
27
+ variant="nav"
28
+ size="lg"
29
+ iconLeft={i.icon}
30
+ iconSize={22}
31
+ aria-current={i.path === active ? 'page' : undefined}
32
+ className="w-full justify-start h-11 gap-3"
33
+ onClick={() => onPick?.(i)}
34
+ >
35
+ {i.label}
36
+ </Button>
37
+ ))}
38
+ </>
39
+ )
40
+ }
package/src/PhoneNav.jsx CHANGED
@@ -1,5 +1,6 @@
1
1
  import { useEffect, useState } from 'react'
2
- import { Button, TabsRow } from '@kolkrabbi/kol-component'
2
+ import { TabsRow, TABBAR_H, TABBAR_PILL_INSET, tabbarPillWidth } from '@kolkrabbi/kol-component'
3
+ import MoreRows from './MoreSheet.jsx'
3
4
 
4
5
  /* taxonomy-ok: molecule — MobileTabBar + a More sheet of Buttons */
5
6
 
@@ -18,6 +19,9 @@ import { Button, TabsRow } from '@kolkrabbi/kol-component'
18
19
  * @param {Array} items `{ icon, path, label }` in rail order, bottom rows last
19
20
  * @param {string} currentPath
20
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
21
25
  */
22
26
  const MORE = '__more'
23
27
  const MAX = 5
@@ -26,7 +30,7 @@ const activePath = (items, path) => items
26
30
  .filter((i) => (i.path === '/' ? path === '/' : path === i.path || path.startsWith(`${i.path}/`)))
27
31
  .sort((a, b) => b.path.length - a.path.length)[0]?.path
28
32
 
29
- export default function PhoneNav({ items = [], currentPath = '/', onNavigate }) {
33
+ export default function PhoneNav({ items = [], currentPath = '/', onNavigate, actions = [], shape = 'bar' }) {
30
34
  const [open, setOpen] = useState(false)
31
35
  useEffect(() => { setOpen(false) }, [currentPath])
32
36
  useEffect(() => {
@@ -36,14 +40,24 @@ export default function PhoneNav({ items = [], currentPath = '/', onNavigate })
36
40
  return () => window.removeEventListener('keydown', onKey)
37
41
  }, [open])
38
42
 
39
- const overflow = items.length > MAX
43
+ const overflow = items.length > MAX || (actions.length > 0 && items.length >= MAX)
44
+ const hasMore = overflow || actions.length > 0
40
45
  const inBar = overflow ? items.slice(0, MAX - 1) : items
41
46
  const inMore = overflow ? items.slice(MAX - 1) : []
42
47
  const active = activePath(items, currentPath)
43
48
  const value = open || inMore.some((i) => i.path === active) ? MORE : active
44
49
 
45
50
  const tabs = inBar.map((i) => ({ value: i.path, label: i.label, icon: i.icon }))
46
- if (overflow) tabs.push({ value: MORE, label: 'More', icon: 'more' })
51
+ if (hasMore) tabs.push({ value: MORE, label: 'More', icon: 'more' })
52
+ /* THE SHEET HUGS ITS WORDS AND SITS BESIDE THE × (user 2026-10-23, his reference: iOS Photos' menu next to its ×, *"but
53
+ * align to bottom"*) — to the left of the collapsed ×, a 12px gap, the two bottom edges on one line */
54
+ const pill = shape === 'pill'
55
+ const sheetStyle = {
56
+ left: 'auto',
57
+ right: pill ? `calc(50% - ${tabbarPillWidth(tabs.length) / 2}px + ${TABBAR_H + 12}px)` : `calc(${100 / tabs.length}% + 8px)`,
58
+ bottom: pill ? `calc(env(safe-area-inset-bottom, 0px) + ${TABBAR_PILL_INSET}px)` : 'env(safe-area-inset-bottom, 0px)',
59
+ width: 'max-content', minWidth: 220, maxWidth: `calc(100vw - ${TABBAR_H + 36}px)`,
60
+ }
47
61
 
48
62
  return (
49
63
  <>
@@ -52,25 +66,16 @@ export default function PhoneNav({ items = [], currentPath = '/', onNavigate })
52
66
  <button type="button" aria-label="Close more" className="kol-phone-nav-scrim kol-overlay-scrim" onClick={() => setOpen(false)} />
53
67
  )}
54
68
  {open && (
55
- <div className="kol-phone-nav-more" role="menu" aria-label="More">
56
- {inMore.map((i) => (
57
- <Button
58
- key={i.path}
59
- variant="nav"
60
- size="md"
61
- iconLeft={i.icon}
62
- aria-current={i.path === active ? 'page' : undefined}
63
- className="w-full justify-start"
64
- onClick={() => { setOpen(false); onNavigate?.(i.path) }}
65
- >
66
- {i.label}
67
- </Button>
68
- ))}
69
+ <div className="kol-phone-nav-more kol-more-sheet" role="menu" aria-label="More" style={sheetStyle}>
70
+ <MoreRows actions={actions} items={inMore} active={active} onPick={(x) => { setOpen(false); if (x.path) onNavigate?.(x.path) }} />
69
71
  </div>
70
72
  )}
71
73
  <TabsRow
72
74
  look="stacked"
73
75
  placement="phone"
76
+ shape={shape}
77
+ collapsed={open}
78
+ onExpand={() => setOpen(false)}
74
79
  tabs={tabs}
75
80
  value={value}
76
81
  onChange={(v) => (v === MORE ? setOpen((o) => !o) : onNavigate?.(v))}
@@ -10,7 +10,7 @@ export default function SettingsLinks({ links = [], className = '' }) {
10
10
  <div className={className} style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
11
11
  {links.map(({ label, url, text }) => (
12
12
  <div key={label} style={{ display: 'flex', gap: 12, alignItems: 'baseline' }}>
13
- <span className="text-fg-32 kol-helper-12" style={{ width: 72, flexShrink: 0 }}>{label}</span>
13
+ <span className="text-fg-32 kol-helper-12 whitespace-nowrap" style={{ minWidth: 72, flexShrink: 0 }}>{label}</span>
14
14
  <a href={url} target="_blank" rel="noopener noreferrer" className="text-fg-64 kol-helper-12 hover:text-fg-96 hover:underline">{text ?? url}</a>
15
15
  </div>
16
16
  ))}
@@ -62,6 +62,8 @@ import { PageHeader } from '@kolkrabbi/kol-component'
62
62
  * @param {Function} props.onOpenSettings the gear's handler — opens the app's settings
63
63
  * drawer. The scaffold draws the control
64
64
  * @param {Object} props.filtersProps escape hatch — anything else the organism takes
65
+ * @param {boolean} props.filters the filter bar (default true); `false` renders the content alone under the
66
+ * masthead — no tabs, no search (HubSettings' page tier, 2026-10-23)
65
67
  */
66
68
  export default function SettingsScaffold({
67
69
  tabs = [],
@@ -78,6 +80,7 @@ export default function SettingsScaffold({
78
80
  themeToggle,
79
81
  onOpenSettings,
80
82
  filtersProps,
83
+ filters = true,
81
84
  }) {
82
85
  const [tab, setTab] = useState(defaultTab ?? tabs[0]?.value)
83
86
  const active = tabs.find((t) => t.value === tab)
@@ -143,7 +146,10 @@ export default function SettingsScaffold({
143
146
  actions={cluster}
144
147
  {...header}
145
148
  />
146
- <ContentFilters
149
+ {/* NO FILTER BAR (`filters={false}`, review 2 § 6.3 — the page tier without the filters tier): the content alone,
150
+ * in the same scroll region the filter row's render gives it */}
151
+ {!filters && <div style={{ flex: 1, minHeight: 0, overflow: 'auto', paddingTop: 4, paddingBottom: 4 }}>{renderContent?.(tab)}</div>}
152
+ {filters && <ContentFilters
147
153
  tone={tone}
148
154
  title={title}
149
155
  items={items ?? []}
@@ -181,7 +187,7 @@ export default function SettingsScaffold({
181
187
  </div>
182
188
  )}
183
189
  {...filtersProps}
184
- />
190
+ />}
185
191
  </PageShell>
186
192
  )
187
193
  }
@@ -39,7 +39,7 @@ import { SettingsRow } from '@kolkrabbi/kol-component'
39
39
  export default function SettingsShortcuts({ sections = [], comboLabel = (c) => c, className = '' }) {
40
40
  return (
41
41
  <div
42
- className={`grid md:grid-rows-2 md:grid-flow-col gap-x-6 md:gap-x-12 gap-y-6 ${className}`.trim()}
42
+ className={`grid md:grid-rows-[auto_auto] md:grid-flow-col gap-x-6 md:gap-x-12 gap-y-6 ${className}`.trim()}
43
43
  style={{ gridTemplateColumns: 'repeat(auto-fill, minmax(min(100%, max(150px, calc((100% - 5 * 48px) / 6))), 1fr))' }}
44
44
  >
45
45
  {sections.map(({ section, items }) => (