@kolkrabbi/kol-component 0.295.1 → 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.
- package/package.json +2 -2
- package/src/atoms/CloseButton.jsx +24 -4
- package/src/atoms/IconToggle.jsx +1 -1
- package/src/hooks/canvasViewport.js +400 -0
- package/src/hooks/railRow.js +11 -0
- package/src/index.js +9 -4
- package/src/molecules/AppItem.jsx +43 -36
- package/src/molecules/ContentCard.jsx +6 -3
- package/src/molecules/ContentRow.jsx +5 -3
- package/src/molecules/ContentText.jsx +12 -11
- package/src/molecules/LabeledControl.jsx +3 -1
- package/src/molecules/MenuItem.jsx +1 -1
- package/src/molecules/PageHeader.jsx +2 -1
- package/src/molecules/Rail.jsx +5 -3
- package/src/molecules/SectionText.jsx +6 -2
- package/src/molecules/TabsRow.jsx +65 -9
- package/src/molecules/TextFold.jsx +1 -1
- package/src/organisms/AppItemMenuProvider.jsx +144 -0
- package/src/organisms/Canvas.jsx +49 -258
- package/src/organisms/CanvasStudio.jsx +128 -0
- package/src/organisms/CommandOverlay.jsx +7 -5
- package/src/organisms/CurveEditor.jsx +1 -1
- package/src/organisms/MediaGalleryModes.jsx +1 -1
- package/src/organisms/MediaLibrary.jsx +31 -9
- package/src/organisms/MediaLibraryPages.jsx +30 -6
- package/src/organisms/NavRail.jsx +68 -56
- package/src/organisms/SettingsPanel.jsx +16 -9
- package/src/organisms/SettingsSections.jsx +31 -6
|
@@ -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
|
|
215
|
-
|
|
216
|
-
|
|
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
|
|
198
|
-
|
|
199
|
-
|
|
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
|
|
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
|
|
63
|
-
* `
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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}
|
package/src/molecules/Rail.jsx
CHANGED
|
@@ -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
|
-
|
|
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=
|
|
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={`${
|
|
88
|
-
|
|
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
|
-
|
|
107
|
-
|
|
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
|
|
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,
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { MenuCtx, useAsk, glyph } from '../molecules/AppItem.jsx'
|
|
3
|
+
import ContextMenu, { useContextMenu } from '../molecules/ContextMenu.jsx'
|
|
4
|
+
import { MenuDropdownItem } from '../molecules/MenuItem.jsx'
|
|
5
|
+
import Tag from '../atoms/Tag.jsx'
|
|
6
|
+
import Input from '../atoms/Input.jsx'
|
|
7
|
+
import Textarea from '../atoms/Textarea.jsx'
|
|
8
|
+
import IconFrame from '../atoms/IconFrame.jsx'
|
|
9
|
+
import { Tooltip } from '../utilities/Popover.jsx'
|
|
10
|
+
import SettingsPanel, { SettingsFooter } from './SettingsPanel.jsx'
|
|
11
|
+
import SettingsSections from './SettingsSections.jsx'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* AppItemMenuProvider — One menu and one file rail. the page's ONE right-click menu and ONE file
|
|
15
|
+
* rail for every `app` card and row (AppItem.jsx). CatalogPage and HubHome mount it.
|
|
16
|
+
*
|
|
17
|
+
* THE FILE RAIL IS THE SETTINGS DRAWER (studio-hub review 2, § 2.1 — user: *"why is there border on the siderail? …
|
|
18
|
+
* rethink this entire siderail based on settings rail and based on labs rail, convention, standards, padding,
|
|
19
|
+
* width"*). It was a bare `Rail` with `backdrop={false}` (hence the edge) and its own section labels and buttons;
|
|
20
|
+
* it is now `SettingsPanel variant="rail" title="File"` — the drawer the settings gear opens, 380 wide, the scrim, no
|
|
21
|
+
* edge, the header row with its × — holding `SettingsSections divided`: Name (an `Input` committing through
|
|
22
|
+
* `verbs.rename` on Enter or blur), Tags (the chips with ×, then the add-a-tag `Input`, both through `onTags`),
|
|
23
|
+
* Details (one row per `{ label, value }`). The foot is `SettingsFooter` with three icon buttons in reset's control —
|
|
24
|
+
* download, duplicate, delete; Delete confirms through `useModal`. It lives here, an organism, because the drawer is
|
|
25
|
+
* one; the card and row keep reading the context from the molecule.
|
|
26
|
+
*
|
|
27
|
+
* READ AND EDIT (user 2026-10-23): the rail opens read-only — name, tags, note, details as text — and the pencil on its
|
|
28
|
+
* header line (Create's rename glyph, `IconFrame nav`) toggles edit mode. `note` / `onNote` arrived the same day: a plain
|
|
29
|
+
* description on a file, HubHome's `note` and `onNote(file, text)`.
|
|
30
|
+
*/
|
|
31
|
+
/* the rail's body — READ MODE by default, the header's pencil opens EDIT MODE (user 2026-10-23: *"use the same edit icon
|
|
32
|
+
* from create? to edit mode or read mode?"*): read shows the name, the tag chips and the note as text; edit swaps in the
|
|
33
|
+
* Input, the chips with × over the add-a-tag Input, and the note's Textarea. Drafts are the rail's own, so what you typed
|
|
34
|
+
* stays while the consumer's state catches up. ONE row per field, no section label over a lone row of the same name
|
|
35
|
+
* (user 2026-10-23: the rail read NAME / NAME, TAGS / TAGS / ADD). */
|
|
36
|
+
function FileRailBody({ item, editing, onRenamed }) {
|
|
37
|
+
const { name, verbs, tags, details, note, onTags, onNote, mark } = item
|
|
38
|
+
const [draftName, setDraftName] = useState(name ?? '')
|
|
39
|
+
const [draftTags, setDraftTags] = useState(tags ?? [])
|
|
40
|
+
const [newTag, setNewTag] = useState('')
|
|
41
|
+
const [draftNote, setDraftNote] = useState(note ?? '')
|
|
42
|
+
const commitName = (v) => {
|
|
43
|
+
const next = (v ?? draftName).trim()
|
|
44
|
+
if (next && next !== name && verbs?.rename) { verbs.rename(next); onRenamed?.(next) }
|
|
45
|
+
}
|
|
46
|
+
const setTags = (next) => { setDraftTags(next); onTags?.(next) }
|
|
47
|
+
const addTag = (v) => {
|
|
48
|
+
const t = (v ?? newTag).trim()
|
|
49
|
+
if (t && !draftTags.includes(t)) setTags([...draftTags, t])
|
|
50
|
+
setNewTag('')
|
|
51
|
+
}
|
|
52
|
+
const commitNote = () => { const next = draftNote.trim(); if (next !== (note ?? '').trim()) onNote?.(next) }
|
|
53
|
+
const editName = editing && !!verbs?.rename
|
|
54
|
+
const editTags = editing && !!onTags
|
|
55
|
+
const editNote = editing && !!onNote
|
|
56
|
+
const text = (v, cls = '') => <span className={`kol-mono-12 text-body ${cls}`.trim()}>{v}</span>
|
|
57
|
+
/* READ MODE RIGHT-ALIGNS (user 2026-10-24: *"why is tags in the middle"*): every value — the name, the tag chips, the
|
|
58
|
+
* note — sits on the value column's right edge, as a text row does; in edit mode the rows fill with their controls */
|
|
59
|
+
const rows = [
|
|
60
|
+
editName
|
|
61
|
+
? { label: 'Name', align: 'fill', render: () => <Input size="sm" className="w-full" value={draftName} onChange={(e) => setDraftName(e.target.value)} onCommit={commitName} aria-label="Name" /> }
|
|
62
|
+
: { label: 'Name', text: true, value: text(name, 'truncate') },
|
|
63
|
+
...((editTags || draftTags.length > 0) ? [editTags
|
|
64
|
+
? { label: 'Tags', align: 'fill', render: () => (
|
|
65
|
+
<div className="flex w-full flex-col gap-2">
|
|
66
|
+
{draftTags.length > 0 && (
|
|
67
|
+
<div className="flex flex-wrap gap-2">
|
|
68
|
+
{draftTags.map((t) => <Tag key={t} size="sm" hash={false} onRemove={() => setTags(draftTags.filter((x) => x !== t))}>{t}</Tag>)}
|
|
69
|
+
</div>
|
|
70
|
+
)}
|
|
71
|
+
<Input size="sm" className="w-full" placeholder="Add a tag" value={newTag} onChange={(e) => setNewTag(e.target.value)} onCommit={addTag} aria-label="Add a tag" />
|
|
72
|
+
</div>
|
|
73
|
+
) }
|
|
74
|
+
: { label: 'Tags', text: true, value: (
|
|
75
|
+
<span className="flex flex-wrap justify-end gap-2">
|
|
76
|
+
{draftTags.map((t) => <Tag key={t} size="sm" hash={false}>{t}</Tag>)}
|
|
77
|
+
</span>
|
|
78
|
+
) }] : []),
|
|
79
|
+
/* read mode shows the DRAFT, as the tags do — the item is a snapshot, so a note just committed would read stale */
|
|
80
|
+
...((editNote || draftNote.trim()) ? [editNote
|
|
81
|
+
? { label: 'Note', align: 'fill', render: () => <Textarea size="sm" rows={3} value={draftNote} onChange={(e) => setDraftNote(e.target.value)} onBlur={commitNote} placeholder="Add a note" aria-label="Note" /> }
|
|
82
|
+
: { label: 'Note', text: true, value: text(draftNote.trim(), 'text-right') }] : []),
|
|
83
|
+
]
|
|
84
|
+
const sections = [
|
|
85
|
+
{ rows },
|
|
86
|
+
...((mark || details?.length) ? [{ label: 'Details', rows: [
|
|
87
|
+
/* the mark first — FXR's chrome: Chrome, Editor (`of` names the axis; `label` the value) */
|
|
88
|
+
...(mark ? [{ label: mark.of ?? 'Kind', text: true, value: text(mark.label) }] : []),
|
|
89
|
+
...(details ?? []).map(({ label, value }) => ({ label, text: true, value: text(value) })),
|
|
90
|
+
] }] : []),
|
|
91
|
+
]
|
|
92
|
+
return <SettingsSections sections={sections} divided />
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* the foot: SettingsFooter's row, three icon buttons in reset's control */
|
|
96
|
+
function fileRailFoot(item, ask, onClose) {
|
|
97
|
+
const { name, verbs, download } = item
|
|
98
|
+
if (!(download || verbs?.duplicate || verbs?.remove)) return undefined
|
|
99
|
+
const verb = (icon, label, onClick) => (
|
|
100
|
+
<Tooltip label={label}><IconFrame name={icon} variant="nav" size="sm" onClick={onClick} aria-label={label} /></Tooltip>
|
|
101
|
+
)
|
|
102
|
+
return (
|
|
103
|
+
<SettingsFooter>
|
|
104
|
+
{download && verb('download', 'Download', download)}
|
|
105
|
+
{verbs?.duplicate && verb('copy', 'Duplicate', verbs.duplicate)}
|
|
106
|
+
{verbs?.remove && verb('trash', 'Delete', async () => { if (await ask.remove(name, verbs)) onClose() })}
|
|
107
|
+
</SettingsFooter>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export default function AppItemMenuProvider({ children }) {
|
|
112
|
+
const menu = useContextMenu()
|
|
113
|
+
const ask = useAsk()
|
|
114
|
+
/* the file whose rail is open — a snapshot of its handlers; the rail keeps its own drafts */
|
|
115
|
+
const [info, setInfo] = useState(null)
|
|
116
|
+
const [editing, setEditing] = useState(false)
|
|
117
|
+
const close = () => setInfo(null)
|
|
118
|
+
const editable = !!(info?.verbs?.rename || info?.onTags || info?.onNote)
|
|
119
|
+
return (
|
|
120
|
+
/* each open is stamped, so the rail keeps its drafts across a rename (the key no longer follows the name) and the
|
|
121
|
+
* foot's Delete confirm names the file as renamed, not as opened */
|
|
122
|
+
<MenuCtx.Provider value={{ menu, openInfo: (item) => { setEditing(false); setInfo(item && { ...item, openId: Date.now() }) } }}>
|
|
123
|
+
{children}
|
|
124
|
+
<ContextMenu menu={menu}>
|
|
125
|
+
{(item) => item && (
|
|
126
|
+
<>
|
|
127
|
+
{item.verbs?.rename && <MenuDropdownItem iconLeft={glyph('edit')} onClick={() => ask.rename(item.name, item.verbs)}>Rename</MenuDropdownItem>}
|
|
128
|
+
{item.verbs?.duplicate && <MenuDropdownItem iconLeft={glyph('copy')} onClick={item.verbs.duplicate}>Duplicate</MenuDropdownItem>}
|
|
129
|
+
{item.verbs?.remove && <MenuDropdownItem iconLeft={glyph('trash')} onClick={() => ask.remove(item.name, item.verbs)}>Delete</MenuDropdownItem>}
|
|
130
|
+
{item.menuItems}
|
|
131
|
+
</>
|
|
132
|
+
)}
|
|
133
|
+
</ContextMenu>
|
|
134
|
+
<SettingsPanel
|
|
135
|
+
open={!!info} variant="rail" title="File" onClose={close} footer={info ? fileRailFoot(info, ask, close) : undefined}
|
|
136
|
+
/* the pencil — bare, as Create's rename and the catalog's filter and search are (IconFrame nav, 16 in the 32 box) */
|
|
137
|
+
headerActions={editable ? <IconFrame name="edit" variant="nav" size="md" iconSize={16} onClick={() => setEditing((v) => !v)} aria-label={editing ? 'Done editing' : 'Edit'} /> : undefined}
|
|
138
|
+
>
|
|
139
|
+
{/* `key` resets the drafts per file */}
|
|
140
|
+
{info && <FileRailBody key={info.openId} item={info} editing={editing} onRenamed={(name) => setInfo((i) => i && { ...i, name })} />}
|
|
141
|
+
</SettingsPanel>
|
|
142
|
+
</MenuCtx.Provider>
|
|
143
|
+
)
|
|
144
|
+
}
|