@kolkrabbi/kol-component 0.295.0 → 0.296.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.
@@ -1,59 +1,49 @@
1
1
  import { createContext, useContext } from 'react'
2
2
  import { Icon } from '@kolkrabbi/kol-icons'
3
3
  import ActionButton from './ActionButton.jsx'
4
- import ContextMenu, { useContextMenu } from './ContextMenu.jsx'
5
- import { MenuDropdownItem } from './MenuItem.jsx'
4
+ import { Tooltip } from '../utilities/Popover.jsx'
6
5
  import { useModal } from './Modal.jsx'
7
6
  import formatSize from '../utilities/formatSize.js'
8
7
 
9
8
  /**
10
9
  * The `app` variant of ContentCard and ContentRow (CatalogAppVariant, kol-fxr 2026-10-23): kol-fxr's
11
10
  * approved saved-file card, so every app's library takes it by a bump. It is the `file` card and row
12
- * with the parts slotted — download on the cover, a cog over a trash in the plate, Rename · Duplicate ·
13
- * Delete on the cog and on right-click. The consumer passes raw writes (`verbs`); the dialogs are asked
14
- * here. A verb not passed is not drawn.
11
+ * with the parts slotted — download on the cover, a cog over a trash in the plate, Rename, Duplicate and
12
+ * Delete on right-click. The consumer passes raw writes (`verbs`); the dialogs are asked here. A verb not
13
+ * passed is not drawn. The card's text is the file's — title, then date and size — and nothing else
14
+ * (user ruling 2026-10-23: the `meta` line of 0.292.0 was never designed for and broke the plate).
15
15
  *
16
- * The menu is ONE per page: `AppItemMenuProvider` (CatalogPage mounts it) holds it, and every app card
17
- * and row opens it. Without a provider the card still draws download and trash, but no cog and no
18
- * right-click menu.
16
+ * THE COG OPENS THE FILE'S RAIL (user ruling 2026-10-23: *"if each card/project had a settings/info
17
+ * maybe an overlay or siderail then you could have edit tags there, along with much more metadata"* —
18
+ * the side rail, ruled): name, tags, `details` `[{ label, value }]` and the verbs, on the settings drawer
19
+ * (studio-hub review 2, § 2.1). The card is an access point; the rail is where the file's information
20
+ * lives. Right-click keeps the one context menu.
21
+ *
22
+ * Both are ONE per page: `AppItemMenuProvider` (organisms/AppItemMenuProvider.jsx — the drawer is an
23
+ * organism, so the provider lives there; CatalogPage mounts it) reads `MenuCtx` from here, and every app
24
+ * card and row opens them. Without a provider the card still draws download and trash, but no cog, no
25
+ * rail and no right-click menu.
19
26
  */
20
27
 
21
- const MenuCtx = createContext(null)
28
+ export const MenuCtx = createContext(null)
22
29
 
23
- const useAsk = () => {
30
+ export const useAsk = () => {
24
31
  const modal = useModal()
25
32
  return {
26
33
  rename: async (name, verbs) => {
27
34
  const next = await modal.prompt('Rename:', name ?? '')
28
35
  if (next != null && next.trim() && next.trim() !== name) verbs.rename(next.trim())
29
36
  },
37
+ /* returns whether it happened — the rail closes on a confirmed delete */
30
38
  remove: async (name, verbs) => {
31
- if (await modal.confirm(`Delete “${name || 'Untitled'}”?`, { okLabel: 'Delete' })) verbs.remove()
39
+ const ok = await modal.confirm(`Delete “${name || 'Untitled'}”?`, { okLabel: 'Delete' })
40
+ if (ok) verbs.remove()
41
+ return ok
32
42
  },
33
43
  }
34
44
  }
35
45
 
36
- const glyph = (name) => <Icon name={name} size={14} />
37
-
38
- export function AppItemMenuProvider({ children }) {
39
- const menu = useContextMenu()
40
- const ask = useAsk()
41
- return (
42
- <MenuCtx.Provider value={menu}>
43
- {children}
44
- <ContextMenu menu={menu}>
45
- {(item) => item && (
46
- <>
47
- {item.verbs?.rename && <MenuDropdownItem iconLeft={glyph('edit')} onClick={() => ask.rename(item.name, item.verbs)}>Rename</MenuDropdownItem>}
48
- {item.verbs?.duplicate && <MenuDropdownItem iconLeft={glyph('copy')} onClick={item.verbs.duplicate}>Duplicate</MenuDropdownItem>}
49
- {item.verbs?.remove && <MenuDropdownItem iconLeft={glyph('trash')} onClick={() => ask.remove(item.name, item.verbs)}>Delete</MenuDropdownItem>}
50
- {item.menuItems}
51
- </>
52
- )}
53
- </ContextMenu>
54
- </MenuCtx.Provider>
55
- )
56
- }
46
+ export const glyph = (name) => <Icon name={name} size={14} />
57
47
 
58
48
  /* the plate's two actions, stacked over its padded height; a plate press never opens the card */
59
49
  function AppPlate({ name, verbs, onSettings }) {
@@ -67,20 +57,25 @@ function AppPlate({ name, verbs, onSettings }) {
67
57
  }
68
58
 
69
59
  const placeholder = (
70
- <div className="size-full flex items-center justify-center bg-oq-04 text-fg-24" aria-label="No preview yet">
60
+ <div className="size-full flex items-center justify-center bg-oq-04 text-oq-24" aria-label="No preview yet">
71
61
  <Icon name="image" size={24} />
72
62
  </div>
73
63
  )
74
64
 
75
65
  /**
76
66
  * useAppItem(variant, props) — the `file` props an `app` item draws with, or null for any other variant.
77
- * Always runs the same hooks (one context read), so ContentCard / ContentRow call it unconditionally.
67
+ * `tags`, `details`, `onTags`, `note` and `onNote` go to the rail, never to the card; `mark` `{ icon, label, of? }` marks the
68
+ * cover's other corner and reads in the rail. Always runs the same hooks (one
69
+ * context read), so ContentCard / ContentRow call it unconditionally.
78
70
  */
79
- export function useAppItem(variant, { title, verbs, download, menuItems, date, size, media, tone }) {
80
- const menu = useContext(MenuCtx)
71
+ export function useAppItem(variant, { title, verbs, download, menuItems, date, size, media, tone, tags, details, onTags, note, onNote, mark }) {
72
+ const ctx = useContext(MenuCtx)
81
73
  if (variant !== 'app') return null
74
+ const menu = ctx?.menu
82
75
  const hasMenu = !!menu && !!(verbs?.rename || verbs?.duplicate || verbs?.remove || menuItems)
83
76
  const openMenu = hasMenu ? (e) => menu.openAt(e, { name: title, verbs, menuItems }) : undefined
77
+ /* the cog opens the file's info rail (user ruling 2026-10-23); right-click keeps the menu */
78
+ const openInfo = ctx ? () => ctx.openInfo({ name: title, verbs, download, tags, details, onTags, note, onNote, mark }) : undefined
84
79
  /* the cover's download stops its click at the control, as the plate does — a card that opens on click
85
80
  * opened under the download too (AppCardDownloadClickBubbles, kol-monitor 2026-10-23) */
86
81
  return {
@@ -89,7 +84,19 @@ export function useAppItem(variant, { title, verbs, download, menuItems, date, s
89
84
  size: typeof size === 'number' ? formatSize(size) : size,
90
85
  media: typeof media === 'string' ? <img src={media} alt={title ?? ''} className="size-full object-cover" /> : media ?? placeholder,
91
86
  control: download ? <ActionButton chrome="media" icon="download" confirmIcon="check" label="Download" confirmLabel="Downloaded" onAction={(e) => { e?.stopPropagation(); return download(e) }} /> : undefined,
92
- actions: openMenu || verbs?.remove ? <AppPlate name={title} verbs={verbs} onSettings={openMenu} /> : undefined,
87
+ /* THE MARK (user 2026-10-24, FXR's files: *"show together with a label on the card … an icon of each chrome as an
88
+ * indicator"*): the cover's other corner, in THE DOWNLOAD'S BOX — `.kol-media-control`, 32 square, the oq-12 plate,
89
+ * the 20 glyph at its rest scale (user 2026-10-24: *"why would the indicator of chrome in the cards not be the same
90
+ * size as the other icon frame"* — it was an IconFrame sm, 26). Not a button: a mark reads, it does nothing.
91
+ * A color per mark is a visual call for the open-questions page, not this file's. */
92
+ controlStart: mark?.icon ? (
93
+ <Tooltip label={mark.label}>
94
+ <span className="kol-media-control" role="img" aria-label={mark.label} style={{ cursor: 'default' }}>
95
+ <span className="kol-action-glyph inline-grid place-items-center" style={{ width: 20, height: 20 }}><Icon name={mark.icon} size={20} /></span>
96
+ </span>
97
+ </Tooltip>
98
+ ) : undefined,
99
+ actions: openInfo || verbs?.remove ? <AppPlate name={title} verbs={verbs} onSettings={openInfo} /> : undefined,
93
100
  onContextMenu: openMenu,
94
101
  }
95
102
  }
@@ -211,14 +211,17 @@ export default function ContentCard({
211
211
  ...text
212
212
  }) {
213
213
  /* `app` (CatalogAppVariant, kol-fxr 2026-10-23) is the `file` card with its parts slotted from
214
- * `verbs` · `download` · `menuItems` — AppItem.jsx. They never reach ContentText. */
215
- const app = useAppItem(variantProp, { title: text.title, verbs: text.verbs, download: text.download, menuItems: text.menuItems, date: text.date, size: text.size, media, tone })
216
- delete text.verbs; delete text.download; delete text.menuItems
214
+ * `verbs`, `download`, `menuItems`, and `tags`, `details`, `onTags` for the info rail — AppItem.jsx.
215
+ * None of them reach ContentText; an app card's `tags` are the rail's, never chips on the plate. */
216
+ const app = useAppItem(variantProp, { title: text.title, verbs: text.verbs, download: text.download, menuItems: text.menuItems, date: text.date, size: text.size, media, tone, tags: text.tags, details: text.details, onTags: text.onTags, note: text.note, onNote: text.onNote, mark: text.mark })
217
+ delete text.verbs; delete text.download; delete text.menuItems; delete text.details; delete text.onTags; delete text.note; delete text.onNote; delete text.mark
217
218
  if (app) {
219
+ delete text.tags
218
220
  variantProp = 'file'
219
221
  tone = app.tone
220
222
  media = app.media
221
223
  control = app.control ?? control
224
+ controlStart = app.controlStart ?? controlStart
222
225
  actions = app.actions ?? actions
223
226
  onContextMenu = app.onContextMenu ?? onContextMenu
224
227
  text.date = app.date
@@ -194,10 +194,12 @@ export default function ContentRow({
194
194
  ...text
195
195
  }) {
196
196
  /* `app` (CatalogAppVariant, kol-fxr 2026-10-23) is the `file` row with its parts slotted from
197
- * `verbs` · `download` · `menuItems` — AppItem.jsx. They never reach ContentText. */
198
- const app = useAppItem(variantProp, { title: text.title, verbs: text.verbs, download: text.download, menuItems: text.menuItems, date: text.date, size: text.size, media, tone })
199
- delete text.verbs; delete text.download; delete text.menuItems
197
+ * `verbs`, `download`, `menuItems`, and `tags`, `details`, `onTags` for the info rail — AppItem.jsx.
198
+ * None of them reach ContentText; an app row's `tags` are the rail's, never chips in the row. */
199
+ const app = useAppItem(variantProp, { title: text.title, verbs: text.verbs, download: text.download, menuItems: text.menuItems, date: text.date, size: text.size, media, tone, tags: text.tags, details: text.details, onTags: text.onTags, note: text.note, onNote: text.onNote, mark: text.mark })
200
+ delete text.verbs; delete text.download; delete text.menuItems; delete text.details; delete text.onTags; delete text.note; delete text.onNote; delete text.mark
200
201
  if (app) {
202
+ delete text.tags
201
203
  variantProp = 'file'
202
204
  tone = app.tone
203
205
  media = app.media
@@ -22,7 +22,7 @@
22
22
  * @param {ReactNode} date default · article · typeface
23
23
  * @param {'card'|'row'|'hero'} form the block's form; `hero` is article's featured text (ContentCard `hero`)
24
24
  * @param {ReactNode} size default · article (file size / read length)
25
- * @param {ReactNode} meta work · slide · app (a line under the title)
25
+ * @param {ReactNode} meta work · slide (a line under the title) — never `app`, whose text is the file's (2026-10-23)
26
26
  * @param {number} gap inner line gap in px (defaults per variant/form)
27
27
  * @param {string} tagVariant the Tag variant the `tags` slot draws (default `primary` — a soft ink wash that reads as a chip
28
28
  * on a plain surface; CardTagsNoVisibleFill, kol-website 2026-09-01: `tertiary` is surface-primary with no border and was
@@ -59,12 +59,10 @@ const RAMP = {
59
59
  card: { title: 'kol-sans-heading-05 text-emphasis truncate', date: 'kol-mono-12 text-meta whitespace-nowrap', size: 'kol-mono-12 text-meta whitespace-nowrap' },
60
60
  row: { title: 'kol-sans-heading-05 text-emphasis truncate', date: 'kol-mono-12 text-meta whitespace-nowrap', size: 'kol-mono-12 text-meta whitespace-nowrap' },
61
61
  },
62
- /* APP — the `file` text with a `meta` line under the title (AppCardMeta, kol-monitor 2026-10-23: a module's
63
- * `6HP 3U — Control`, a patch's `12 modules, 9 connections`). Without `meta` it is the file text. */
64
- app: {
65
- card: { title: 'kol-sans-heading-05 text-emphasis truncate', meta: 'kol-mono-12 text-meta truncate', date: 'kol-mono-12 text-meta whitespace-nowrap', size: 'kol-mono-12 text-meta whitespace-nowrap' },
66
- row: { title: 'kol-sans-heading-05 text-emphasis truncate', meta: 'kol-mono-12 text-meta truncate', date: 'kol-mono-12 text-meta whitespace-nowrap', size: 'kol-mono-12 text-meta whitespace-nowrap' },
67
- },
62
+ /* APP IS THE FILE TEXT, exactly (user ruling 2026-10-23: the `meta` line 0.292.0 put under the title — a patch's
63
+ * `12 modules, 9 connections` — was never designed for; a card with it and one without put date and size on
64
+ * different baselines, *"ILLEGAL and layout BREAKING"*). `app` aliases to `file` below; what the card no longer
65
+ * carries lives in the file's info rail (AppItem.jsx). */
68
66
  /* SLIDE — a deck (slide-variant-and-shelf-preset, kol-client-olina 2026-09-03;
69
67
  * user: "they are genuinely different with 16:9 layout and those exposed
70
68
  * properties"). file's voices plus a `meta` line — the slide count. */
@@ -160,7 +158,6 @@ const RAMP = {
160
158
  * read off the shipped components and the live pages they render on. */
161
159
  const ORDER = {
162
160
  file: { card: ['title', ['group', 'date', 'size']], row: ['title', ['group', 'date', 'size']] },
163
- app: { card: ['title', 'meta', ['group', 'date', 'size']], row: ['title', 'meta', ['group', 'date', 'size']] },
164
161
  /* slide: title, then date · size · slide count on one baseline (read off olina's /slide-deck) */
165
162
  slide: { card: ['title', ['group', 'date', 'size', 'meta']], row: ['title', ['group', 'date', 'size', 'meta']] },
166
163
  catalog: { card: ['title', 'detail'], row: [['lead', 'title', 'detail']] },
@@ -227,7 +224,8 @@ const GAPS = {
227
224
 
228
225
  /* `default` → `file` (user 2026-08-29) — kept working as an alias here too,
229
226
  * because ContentText is exported and a consumer can drive it directly. */
230
- const ALIAS = { default: 'file', print: 'catalog', work: 'showcase', typeface: 'showcaseCanvas' }
227
+ /* `app` → `file` (2026-10-23): an app card's text IS the file's — title, date, size — by ruling */
228
+ const ALIAS = { default: 'file', app: 'file', print: 'catalog', work: 'showcase', typeface: 'showcaseCanvas' }
231
229
 
232
230
  /* dev-only, and warns ONCE per offending prop — a card family renders these by
233
231
  * the hundred in a list and a per-render warning would bury the first one. */
@@ -331,8 +329,11 @@ export default function ContentText({
331
329
  * flat slot list cannot express and which was previously collapsed into one
332
330
  * `date` slot that lost a value. */
333
331
  /* a file's date · size never break inside a value (AppCardDateSizeWrap, kol-mirror 2026-10-23: `2026-10-` /
334
- * `23` at ~170px columns): each value is nowrap, and when the pair does not fit the size drops to the next line */
335
- const wrapGroup = variant === 'file' || variant === 'app'
332
+ * `23` at ~170px columns): each value is nowrap, and when the pair does not fit the size drops to the next line.
333
+ * NOT THE `app` CARD (user 2026-10-24: *"the layout of the card CAN NOT CHANGE on resolution available, the field can
334
+ * not line break"*): its group is one line at every width — the `app` grid's floor (CatalogPage, 208) is what makes
335
+ * the pair fit, so a narrower page drops a column instead of breaking the line */
336
+ const wrapGroup = variant === 'file' && variantProp !== 'app'
336
337
  const render = (entry, i, trailing = false) => {
337
338
  if (typeof entry === 'string') return line(entry)
338
339
  const [kind, ...slots] = entry
@@ -85,7 +85,9 @@ export default function LabeledControl({
85
85
  <div className={`flex ${labelAuto ? `flex-col items-start gap-1 sm:flex-row ${text ? 'sm:items-baseline' : 'sm:items-center'} sm:gap-3` : `${text ? 'items-baseline' : 'items-center'} gap-3`} ${className}`}>
86
86
  {showLabel && (
87
87
  <span
88
- className={`kol-helper-10 tracking-widest text-meta${text ? ' leading-4' : ''} ${labelAuto ? 'max-w-full min-w-0 truncate sm:flex-1' : 'shrink-0'}`}
88
+ /* A LABEL NEVER WRAPS (review 2, § 6.2 — the helper law by construction, 01-foundations/03-typography.md:29):
89
+ * `whitespace-nowrap truncate`, so a long one ends in an ellipsis instead of breaking onto a second line */
90
+ className={`kol-helper-10 tracking-widest text-meta whitespace-nowrap truncate${text ? ' leading-4' : ''} ${labelAuto ? 'max-w-full min-w-0 sm:flex-1' : 'shrink-0'}`}
89
91
  style={labelAuto ? undefined : { width: labelWidth }}
90
92
  >
91
93
  {labelInner}
@@ -164,7 +164,7 @@ export function MenuDropdownDivider() {
164
164
  }
165
165
 
166
166
  /**
167
- * MenuDropdownNest — a row inside a dropdown panel that holds a submenu.
167
+ * MenuDropdownNest — A dropdown row that opens a submenu. a row inside a dropdown panel that holds a submenu.
168
168
  *
169
169
  * Default — ACCORDION: click the row to expand/collapse its children inline
170
170
  * (below the row, in the same panel); the trailing chevron rotates 90°.
@@ -12,7 +12,7 @@ import SectionText, { SECTION_TEXT_LEVELS } from './SectionText.jsx'
12
12
  /** @deprecated → `SECTION_TEXT_LEVELS` */
13
13
  export const PAGE_HEADER_ROLES = SECTION_TEXT_LEVELS
14
14
 
15
- export default function PageHeader({ title, subtitle, description, subtitleMaxWidth, titleClass, level = 'page', eyebrow, actions, media, className = '' }) {
15
+ export default function PageHeader({ title, subtitle, description, subtitleMaxWidth, titleClass, level = 'page', eyebrow, actions, actionsPlacement, media, className = '' }) {
16
16
  return (
17
17
  <SectionText
18
18
  level={level}
@@ -21,6 +21,7 @@ export default function PageHeader({ title, subtitle, description, subtitleMaxWi
21
21
  headlineClass={titleClass}
22
22
  body={subtitle ?? description}
23
23
  actions={actions}
24
+ actionsPlacement={actionsPlacement}
24
25
  media={media}
25
26
  slotStyle={subtitleMaxWidth ? { body: { maxWidth: subtitleMaxWidth } } : undefined}
26
27
  className={className}
@@ -12,7 +12,7 @@ const FOCUSABLE =
12
12
  'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
13
13
 
14
14
  /**
15
- * Rail — A surface docked to an edge (RailOverlay, kol-monitor 2026-10-17 — user ruling: *"rail and overlay"*).
15
+ * Rail — A surface docked to an edge. A surface docked to an edge (RailOverlay, kol-monitor 2026-10-17 — user ruling: *"rail and overlay"*).
16
16
  * Anything docked to an edge — left, right, top or bottom — that collapses and expands is a rail; anything
17
17
  * floating over the page that closes is an overlay. Drawer, shelf, panel and sheet are retired as names
18
18
  * (`ShellDrawer` is this component's old name, an alias).
@@ -52,6 +52,7 @@ const FOCUSABLE =
52
52
  * @param {ReactNode} header header-row content beside the close button (replaces the source's baked-in wordmark)
53
53
  * @param {boolean} backdrop render the dimming scrim (default true); false = panel alone, no darken/blur, close via × / Esc
54
54
  * @param {'xs'|'sm'|'md'|'lg'} closeSize the close control's rung (default 'sm' — match the controls in the panel)
55
+ * @param {boolean} closeHover the close's hover wash (default true); `false` keeps its box, drops the wash (CloseButton `hover`)
55
56
  * @param {ReactNode} children scrollable panel body
56
57
  * @param {string} className extra classes on the panel
57
58
  */
@@ -80,6 +81,7 @@ export default function Rail({
80
81
  * `sm` is the default because a drawer header sits over its own controls.
81
82
  * Named `closeSize`, not `size` — `size` is already the panel's own box. */
82
83
  closeSize = 'sm',
84
+ closeHover = true,
83
85
  children,
84
86
  className = '',
85
87
  /* SettingsPanelApproved (2026-08-27): the settings drawer has neither */
@@ -278,7 +280,7 @@ export default function Rail({
278
280
  {closeSide === 'start' && (
279
281
  /* bare glyph, no container (user 2026-08-09: "the X close icon
280
282
  * does not need a container") — body ink at rest, emphasis on hover */
281
- <CloseButton onClick={onClose} size={closeSize} className="shrink-0" />
283
+ <CloseButton onClick={onClose} size={closeSize} hover={closeHover} className="shrink-0" />
282
284
  )}
283
285
  {header != null && <div className="min-w-0 flex-1">{header}</div>}
284
286
  {/* A NORMAL ICON BUTTON (user 2026-09-02: *"it should just be like a
@@ -288,7 +290,7 @@ export default function Rail({
288
290
  * the md rung's 32px around a glyph six under it, and it read as an
289
291
  * oversized empty square. No override: the rung sets both. */}
290
292
  {closeSide !== 'start' && (
291
- <CloseButton onClick={onClose} size={closeSize} className="ml-auto shrink-0" />
293
+ <CloseButton onClick={onClose} size={closeSize} hover={closeHover} className="ml-auto shrink-0" />
292
294
  )}
293
295
  </div>
294
296
  <div className="flex-1 overflow-y-auto pr-1" style={{ overflowAnchor: 'none' }}>
@@ -26,6 +26,7 @@
26
26
  * a ROLE on the molecule, never a hero-side class)
27
27
  * @param {ReactNode} body lede / paragraph(s)
28
28
  * @param {ReactNode} actions row of Buttons / links / Tags
29
+ * @param {'inline'|'below'|'head'} actionsPlacement where the cluster sits — a level's default; `head` puts it on the headline's row whatever the body
29
30
  * @param {'start'|'center'} [align='start'] text-align + item alignment
30
31
  * @param {string} [gap='gap-4'] inner rhythm (a Tailwind gap step)
31
32
  * @param {ReactNode} children extra slots rendered between body and actions
@@ -140,7 +141,10 @@ export default function SectionText({
140
141
  const cls = (base, slot) => `${base} ${slotClass[slot] ?? (slot === 'eyebrow' ? slotClass.label : undefined) ?? ''}`.trim()
141
142
  const alignCls = align === 'center' ? 'items-center text-center' : 'items-start text-left'
142
143
  const inlineActions = actionsPlacement === 'inline' && !!actions && !!body
143
- const inlineHead = actionsPlacement === 'inline' && !!actions && !body && !!headline
144
+ /* `head` — the cluster shares the HEADLINE's row whatever the body (the Hub's masthead button, user 2026-10-23:
145
+ * *"more aligned like 'Studio'"* — it sat on the subtitle's line); centred on the title, not on its baseline */
146
+ const headRow = actionsPlacement === 'head' && !!actions && !!headline
147
+ const inlineHead = (actionsPlacement === 'inline' && !!actions && !body && !!headline) || headRow
144
148
  const headlineNode = headline && <Headline className={cls(`kol-section-text-headline ${headlineClass ?? (HEADLINE_ROLE[headlineSize] ?? HEADLINE_ROLE['heading-02'])}${headlineCase === 'upper' ? ' kol-section-text-caps' : ''}`, 'headline')} style={slotStyle.headline}>{headline}</Headline>
145
149
  const bodyNode = body && (typeof body === 'string'
146
150
  ? <p className={cls(bodyClass, 'body')} style={slotStyle.body}>{body}</p>
@@ -160,7 +164,7 @@ export default function SectionText({
160
164
  * comment used to sit on the fallthrough below, which stacked the cluster under the
161
165
  * headline instead: the docstring promised a row the code never drew. It WRAPS: on a
162
166
  * phone a wide cluster drops under the title rather than pushing the page sideways. */
163
- <div className="flex flex-wrap self-stretch items-baseline justify-between gap-x-6 gap-y-3">
167
+ <div className={`flex flex-wrap self-stretch ${headRow ? 'items-center' : 'items-baseline'} justify-between gap-x-6 gap-y-3`}>
164
168
  {headlineNode}
165
169
  <div className={cls(`${actionsClass} shrink-0`, 'actions')} style={slotStyle.actions}>{actions}</div>
166
170
  </div>
@@ -2,6 +2,7 @@ import { useRef } from 'react'
2
2
  import CloseButton from '../atoms/CloseButton.jsx'
3
3
  import Button from '../atoms/Button.jsx'
4
4
  import { Icon } from '@kolkrabbi/kol-icons'
5
+ import { RAIL_ROW } from '../hooks/railRow.js'
5
6
 
6
7
  /* taxonomy-ok: nests kol-icons's Icon */
7
8
 
@@ -31,15 +32,28 @@ import { Icon } from '@kolkrabbi/kol-icons'
31
32
  * stacked — icon over label (was `MobileTabBar`); tabs take `icon`
32
33
  * @param {'inline'|'phone'} [placement='inline'] `phone` floats a stacked bar fixed to the bottom below `md`
33
34
  * (MobileTabBar's placement — the consumer owes the list `--kol-tabbar-h` of bottom padding)
35
+ * @param {'bar'|'pill'} [shape='bar'] the phone bar's shape: `bar` spans the bottom edge; `pill` floats a rounded,
36
+ * centred bar `TABBAR_PILL_INSET` off it, hugging its tabs, the active tab a filled pill (user 2026-10-23, iOS Files)
37
+ * @param {boolean} [collapsed=false] THE COLLAPSE (user 2026-10-23: *"why not the entire rail? closing it gives it back"*): the
38
+ * phone bar collapses into one round × at its right end — the pill shrinks to a 56 circle where More was, the bar
39
+ * keeps its width and shows the × in More's slot — while a sheet is open; `onExpand` is the ×. It expands back
40
+ * @param {Function} [onExpand] the ×'s press
34
41
  * Tabs are `{ id, label }` or `{ value, label }` (either key), plus `icon` for stacked.
35
42
  */
36
43
  export const TABBAR_H = 56
44
+ /* the pill's air off the bottom edge — a page under it owes TABBAR_H + this */
45
+ export const TABBAR_PILL_INSET = 16
46
+ /* the pill's geometry, shared with the sheet that aligns to it: 56 per tab, 6px pad and 1px hairline each side */
47
+ export const TABBAR_PILL_TAB = 56
48
+ export const tabbarPillWidth = (count) => count * TABBAR_PILL_TAB + 14
49
+ /* the collapse's motion — one duration for the width and the glyph swap (300, user 2026-10-23: 180 read as abrupt) */
50
+ const COLLAPSE_MS = 300
37
51
 
38
- export default function TabsRow({ tabs: raw = [], value, onChange, onClose, onMinimise, look = 'underline', placement = 'inline', size, tracked = false, ariaLabel, className, style }) {
52
+ export default function TabsRow({ tabs: raw = [], value, onChange, onClose, onMinimise, look = 'underline', placement = 'inline', shape = 'bar', collapsed = false, onExpand, size, tracked = false, ariaLabel, className, style }) {
39
53
  const tabs = raw.map((t) => ({ ...t, id: t.id ?? t.value }))
40
54
  if (look === 'chip') return <ChipTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 'sm'} ariaLabel={ariaLabel} className={className ?? ''} />
41
55
  if (look === 'text') return <TextTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 14} tracked={tracked} className={className ?? 'gap-6'} style={style} />
42
- if (look === 'stacked') return <StackedTabs tabs={tabs} value={value} onChange={onChange} placement={placement} className={className ?? ''} />
56
+ if (look === 'stacked') return <StackedTabs tabs={tabs} value={value} onChange={onChange} placement={placement} shape={shape} collapsed={collapsed} onExpand={onExpand} className={className ?? ''} />
43
57
  return <UnderlineTabs tabs={tabs} value={value} onChange={onChange} onClose={onClose} onMinimise={onMinimise} />
44
58
  }
45
59
 
@@ -79,13 +93,29 @@ function TextTabs({ tabs, value, onChange, size, tracked, className, style }) {
79
93
  }
80
94
 
81
95
  /* stacked — MobileTabBar's tab verbatim; its fixed bottom pill is `placement="phone"`, inline is a plain row */
82
- function StackedTabs({ tabs, value, onChange, placement, className }) {
96
+ function StackedTabs({ tabs, value, onChange, placement, shape = 'bar', collapsed = false, onExpand, className }) {
83
97
  if (tabs.length === 0) return null
84
98
  const phone = placement === 'phone'
99
+ const pill = phone && shape === 'pill'
100
+ const isCollapsed = phone && collapsed
101
+ const W = tabbarPillWidth(tabs.length)
85
102
  return (
86
103
  <nav
87
- className={`${phone ? 'kol-mobile-tabbar md:hidden fixed inset-x-0 bottom-0 z-[var(--kol-z-sticky)] ' : ''}flex items-stretch ${className}`.trim()}
88
- style={phone ? {
104
+ className={`${pill
105
+ ? 'kol-mobile-tabbar kol-mobile-tabbar-pill md:hidden fixed z-[calc(var(--kol-z-sticky)+1)] rounded-full p-1.5 overflow-hidden '
106
+ : phone ? 'kol-mobile-tabbar md:hidden fixed inset-x-0 bottom-0 z-[var(--kol-z-sticky)] ' : ''}flex items-stretch ${className}`.trim()}
107
+ style={pill ? {
108
+ /* THE PILL (user 2026-10-23, iOS Files beside the full-width bar): floats off the bottom edge, hugs its tabs,
109
+ * the same ground and hairline as the bar, no shadow (user 2026-10-23). Anchored by its RIGHT edge at the
110
+ * centre line, so the collapse shrinks it toward where More was and the × lands under the same thumb. */
111
+ height: TABBAR_H,
112
+ width: isCollapsed ? TABBAR_H : W,
113
+ right: `calc(50% - ${W / 2}px)`,
114
+ bottom: `calc(env(safe-area-inset-bottom, 0px) + ${TABBAR_PILL_INSET}px)`,
115
+ background: 'var(--kol-surface-secondary)',
116
+ border: '1px solid var(--kol-oq-08)',
117
+ transition: `width ${COLLAPSE_MS}ms ease`,
118
+ } : phone ? {
89
119
  height: TABBAR_H,
90
120
  /* the pill's own ground, not the page's — it floats OVER content, so a
91
121
  * transparent bar would show rows sliding through the labels */
@@ -95,6 +125,7 @@ function StackedTabs({ tabs, value, onChange, placement, className }) {
95
125
  } : { height: TABBAR_H }}
96
126
  aria-label="Sections"
97
127
  >
128
+ <div className={`flex items-stretch ${pill ? 'flex-none' : 'flex-1 min-w-0'}`} style={{ width: pill ? W - 14 : undefined, opacity: isCollapsed ? 0 : 1, pointerEvents: isCollapsed ? 'none' : 'auto', transition: `opacity ${COLLAPSE_MS}ms ease` }}>
98
129
  {tabs.map((t) => {
99
130
  const active = t.id === value
100
131
  return (
@@ -103,15 +134,40 @@ function StackedTabs({ tabs, value, onChange, placement, className }) {
103
134
  type="button"
104
135
  onClick={() => onChange?.(t.id)}
105
136
  aria-current={active ? 'page' : undefined}
106
- className="flex-1 min-w-0 flex flex-col items-center justify-center gap-1 cursor-pointer"
107
- style={{ background: 'transparent', border: 'none', color: active ? 'var(--kol-fg-default)' : 'var(--kol-fg-48)' }}
137
+ /* the PHONE bar is icons alone (user 2026-10-23: *"skip the title and show just the icon bigger"*) — the
138
+ * label is the button's accessible name */
139
+ aria-label={phone ? t.label : undefined}
140
+ className={pill ? 'flex items-center justify-center rounded-full cursor-pointer' : 'flex-1 min-w-0 flex flex-col items-center justify-center gap-1 cursor-pointer'}
141
+ /* the PHONE bar wears the rail's row type and ink (review 2, § 7.1 — RAIL_ROW, the one constant the rail reads);
142
+ * an inline stacked row keeps MobileTabBar's own */
143
+ style={{ background: pill && active ? 'var(--kol-oq-08)' : 'transparent', border: 'none', width: pill ? 56 : undefined, color: phone ? (active ? RAIL_ROW.active : RAIL_ROW.rest) : (active ? 'var(--kol-fg-default)' : 'var(--kol-fg-48)') }}
108
144
  >
109
- {t.icon && <Icon name={t.icon} size={18} />}
145
+ {t.icon && <Icon name={t.icon} size={pill ? 28 : phone ? 24 : 18} />}
110
146
  {/* helper is single-line chrome, which a tab label always is */}
111
- <span className="kol-helper-10 truncate max-w-full px-1">{t.label}</span>
147
+ {!phone && <span className="kol-helper-10 truncate max-w-full px-1">{t.label}</span>}
112
148
  </button>
113
149
  )
114
150
  })}
151
+ </div>
152
+ {phone && (
153
+ /* the isCollapsed × — the pill's one tab-sized circle, the bar's More slot; present always so it cross-fades */
154
+ <button
155
+ type="button"
156
+ aria-label="Close"
157
+ aria-hidden={!isCollapsed}
158
+ tabIndex={isCollapsed ? 0 : -1}
159
+ onClick={onExpand}
160
+ className="absolute flex items-center justify-center rounded-full cursor-pointer"
161
+ style={{
162
+ /* no fill — the × is the only glyph, a filled circle inside the circle read as two rings (user 2026-10-23) */
163
+ ...(pill ? { right: 6, top: 6, width: TABBAR_H - 14, height: TABBAR_H - 14 } : { right: 0, top: 0, bottom: 0, width: `${100 / tabs.length}%` }),
164
+ background: 'transparent', border: 'none', color: RAIL_ROW.active,
165
+ opacity: isCollapsed ? 1 : 0, pointerEvents: isCollapsed ? 'auto' : 'none', transition: `opacity ${COLLAPSE_MS}ms ease`,
166
+ }}
167
+ >
168
+ <Icon name="x" size={pill ? 28 : 24} />
169
+ </button>
170
+ )}
115
171
  </nav>
116
172
  )
117
173
  }
@@ -5,7 +5,7 @@ import Button from '../atoms/Button.jsx'
5
5
  const CLAMP = { 2: 'max-md:line-clamp-2', 3: 'max-md:line-clamp-3', 4: 'max-md:line-clamp-4', 6: 'max-md:line-clamp-6' }
6
6
 
7
7
  /**
8
- * TextFold — Long text folded to a few lines on phones. (TextFold, kol-branding 2026-10-22 — the
8
+ * TextFold — Long text folded short on phones. (TextFold, kol-branding 2026-10-22 — the
9
9
  * user: *"on mobile text heavy blocks are not always relevant but good to know more information
10
10
  * is there if you want it"*.) Below md the text clamps to `lines` with a More / Less ghost button;
11
11
  * md and up shows it whole. The button only appears when the text is actually cut — measured,