@kolkrabbi/kol-component 0.334.0 → 0.336.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 +3 -3
- package/src/atoms/SectionLabel.jsx +29 -0
- package/src/index.js +25 -0
- package/src/molecules/ContentRow.jsx +30 -1
- package/src/molecules/DocsToc.jsx +16 -1
- package/src/molecules/EmptyState.jsx +15 -1
- package/src/molecules/FlyoutRow.jsx +10 -0
- package/src/molecules/IndexRow.jsx +37 -0
- package/src/molecules/LayerRow.jsx +53 -0
- package/src/molecules/Modal.jsx +58 -19
- package/src/molecules/NoticeBanner.jsx +28 -0
- package/src/molecules/QuantityInput.jsx +7 -3
- package/src/molecules/QuickLookFrame.jsx +31 -27
- package/src/molecules/QuickLookHeader.jsx +60 -0
- package/src/molecules/ReadingActions.jsx +31 -0
- package/src/molecules/ReadingChapterNav.jsx +38 -0
- package/src/molecules/ReadingHighlight.jsx +26 -0
- package/src/molecules/ReadingNotes.jsx +39 -0
- package/src/molecules/ReadingSettings.jsx +53 -0
- package/src/molecules/SectionText.jsx +15 -1
- package/src/molecules/SpecList.jsx +21 -1
- package/src/molecules/SummaryLine.jsx +18 -0
- package/src/molecules/TabsRow.jsx +54 -7
- package/src/molecules/TaskRow.jsx +43 -0
- package/src/molecules/TocRow.jsx +29 -0
- package/src/molecules/TreeRow.jsx +72 -0
- package/src/organisms/CalendarDay.jsx +60 -0
- package/src/organisms/CalendarMonth.jsx +75 -0
- package/src/organisms/CalendarTimeline.jsx +65 -0
- package/src/organisms/CalendarWeek.jsx +72 -0
- package/src/organisms/MediaLibrary.jsx +55 -0
- package/src/organisms/NavDrawer.jsx +67 -0
- package/src/organisms/NavRail.jsx +4 -1
- package/src/organisms/NavRailFloat.jsx +110 -0
- package/src/organisms/ReadingColumn.jsx +42 -0
- package/src/organisms/ReadingContents.jsx +54 -0
- package/src/organisms/ReadingOverview.jsx +60 -0
- package/src/organisms/ReadingPanel.jsx +36 -0
- package/src/organisms/Table.jsx +50 -1
- package/src/organisms/calendarDates.js +24 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useRef, useState } from 'react'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
3
|
+
import QuickLookHeader from './QuickLookHeader.jsx'
|
|
4
4
|
|
|
5
|
-
/* taxonomy-ok: molecule — nests
|
|
5
|
+
/* taxonomy-ok: molecule — nests QuickLookHeader (molecule) + kol-icons's Icon. */
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* QuickLookFrame — The preview window. the Finder Quick Look window (user 2026-09-23: *"put them in a container LIKE
|
|
@@ -30,8 +30,18 @@ import CloseButton from '../atoms/CloseButton.jsx'
|
|
|
30
30
|
* @param {Function} onResize ({ w, h }) => void while the corner is dragged
|
|
31
31
|
* @param {ReactNode} footer the transport row
|
|
32
32
|
* @param {ReactNode} children the body
|
|
33
|
+
*
|
|
34
|
+
* THE UTILITY WINDOW (`variant="float"`, float-everything W6 rows 86 · 88, 2026-11-04 — kol-float--style 46:2840): a
|
|
35
|
+
* non-modal float window — no scrim, the scene stays live under it. `kol-float-solid` on `--kol-float-window-r`, 20 in,
|
|
36
|
+
* 18 between its parts; the header is `QuickLookHeader variant="float"` (`icon` · title · `onMinimise` · `onClose`); the
|
|
37
|
+
* body is the caller's (chip tabs, float fields); `status` is the footer line (`Changes saved automatically`, the
|
|
38
|
+
* `kol-float-label` role on fg-64) with the resize corner as its glyph at the right — the same drag as the default grip.
|
|
39
|
+
* @param {'float'} [variant]
|
|
40
|
+
* @param {string} [icon] float: the window's glyph
|
|
41
|
+
* @param {Function} [onMinimise] float: the − control
|
|
42
|
+
* @param {ReactNode} [status] float: the footer line
|
|
33
43
|
*/
|
|
34
|
-
export default function QuickLookFrame({ title, meta, actions, onClose, nav, size: sizeProp, onResize, footer, className = '', children }) {
|
|
44
|
+
export default function QuickLookFrame({ variant, icon, onMinimise, status, title, meta, actions, onClose, nav, size: sizeProp, onResize, footer, className = '', children }) {
|
|
35
45
|
const [own, setOwn] = useState(null)
|
|
36
46
|
const size = sizeProp !== undefined ? sizeProp : own
|
|
37
47
|
const setSize = onResize ?? setOwn
|
|
@@ -55,35 +65,29 @@ export default function QuickLookFrame({ title, meta, actions, onClose, nav, siz
|
|
|
55
65
|
}
|
|
56
66
|
const onPointerUp = () => { drag.current = null }
|
|
57
67
|
|
|
68
|
+
const grip = { role: 'separator', 'aria-label': 'Resize', onPointerDown, onPointerMove, onPointerUp, onPointerCancel: onPointerUp }
|
|
69
|
+
if (variant === 'float') {
|
|
70
|
+
return (
|
|
71
|
+
<div ref={ref} style={size ? { width: size.w, height: size.h } : undefined}
|
|
72
|
+
className={`kol-float-solid flex w-full max-w-[562px] flex-col gap-[18px] rounded-[var(--kol-float-window-r)] p-5 text-fg-emphasis ${className}`.trim()}>
|
|
73
|
+
{header && <QuickLookHeader variant="float" icon={icon} title={title} actions={actions} onMinimise={onMinimise} onClose={onClose} />}
|
|
74
|
+
<div className="flex min-h-0 flex-1 flex-col gap-[18px]">{children}</div>
|
|
75
|
+
{footer}
|
|
76
|
+
<div className="flex items-center gap-3">
|
|
77
|
+
<span className="kol-float-label min-w-0 flex-1 truncate text-fg-64">{status}</span>
|
|
78
|
+
<span {...grip} className="inline-flex size-4 cursor-nwse-resize touch-none items-center justify-center text-oq-64 hover:text-oq-96"><Icon name="expand" size={13} /></span>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
58
83
|
const style = size ? { width: size.w, height: size.h, '--kol-ql-frame-h': `${size.h}px`, '--kol-ql-max-w': `${size.w - 2}px` } : undefined
|
|
59
84
|
return (
|
|
60
85
|
<div ref={ref} style={style}
|
|
61
86
|
className={`kol-quicklook${footer ? ' kol-quicklook--footer' : ''}${size ? ' kol-quicklook--sized' : ''} ${className}`.trim()}>
|
|
62
|
-
{header &&
|
|
63
|
-
<div className="kol-quicklook-header">
|
|
64
|
-
{nav?.total > 1 && (
|
|
65
|
-
/* the pager is its own group: the count sits off the chevrons, and the group sits clear of
|
|
66
|
-
* the file's name (user 2026-09-23) */
|
|
67
|
-
<span className="flex items-center gap-1 mr-3">
|
|
68
|
-
<Button variant="nav" size="sm" iconOnly="chevron-left" onClick={nav.onPrev} aria-label="Previous" />
|
|
69
|
-
<Button variant="nav" size="sm" iconOnly="chevron-right" onClick={nav.onNext} aria-label="Next" />
|
|
70
|
-
<span className="kol-mono-12 text-meta tabular-nums ml-3">{nav.index + 1} / {nav.total}</span>
|
|
71
|
-
</span>
|
|
72
|
-
)}
|
|
73
|
-
{title && <span className="kol-mono-12 text-strong truncate">{title}</span>}
|
|
74
|
-
{meta && <span className="kol-mono-12 text-meta truncate">{meta}</span>}
|
|
75
|
-
<span className="flex-1" />
|
|
76
|
-
{actions}
|
|
77
|
-
{/* THE ESTATE'S CLOSE IDIOM, and every header control wears it (user 2026-09-23): bare at
|
|
78
|
-
* rest, a wash on hover — a filled container read as a second surface on the header. LAST, at the
|
|
79
|
-
* far right (user 2026-10-18: *"X should be space between justify on the right"*) */}
|
|
80
|
-
{onClose && <CloseButton size="sm" onClick={onClose} />}
|
|
81
|
-
</div>
|
|
82
|
-
)}
|
|
87
|
+
{header && <QuickLookHeader title={title} meta={meta} actions={actions} nav={nav} onClose={onClose} />}
|
|
83
88
|
<div className="kol-quicklook-body">{children}</div>
|
|
84
89
|
{footer && <div className="kol-quicklook-footer">{footer}</div>}
|
|
85
|
-
<span className="kol-quicklook-grip"
|
|
86
|
-
onPointerDown={onPointerDown} onPointerMove={onPointerMove} onPointerUp={onPointerUp} onPointerCancel={onPointerUp} />
|
|
90
|
+
<span className="kol-quicklook-grip" {...grip} />
|
|
87
91
|
</div>
|
|
88
92
|
)
|
|
89
93
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
2
|
+
import Button from '../atoms/Button.jsx'
|
|
3
|
+
import CloseButton from '../atoms/CloseButton.jsx'
|
|
4
|
+
|
|
5
|
+
/* taxonomy-ok: molecule — nests Button (atom) + CloseButton (utility). */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* QuickLookHeader — A window's title row. Lifted out of QuickLookFrame (float-everything W6 row 82, 2026-11-04) so a
|
|
9
|
+
* Dialog, a confirm and the utility window wear the same header. Unset `variant` is QuickLookFrame's header as it was,
|
|
10
|
+
* class for class: ‹ › n / N · the file's name · its facts · the actions · the close, on `.kol-quicklook-header`.
|
|
11
|
+
*
|
|
12
|
+
* `variant="float"` is the exploration's window header (kol-float--style 46:2500): the window's glyph (16, oq-64) · its
|
|
13
|
+
* title in `kol-float-panel` (Inter 13/500) · − minimise · × close, 12 apart, the controls quiet on oq-64 and bright
|
|
14
|
+
* under the pointer. No rule under it — the no-borders law holds on float.
|
|
15
|
+
*
|
|
16
|
+
* @param {'float'} [variant]
|
|
17
|
+
* @param {string} [icon] float: the window's glyph (`user`, `alert-triangle`, …)
|
|
18
|
+
* @param {ReactNode} title
|
|
19
|
+
* @param {ReactNode} [meta] default look: the facts after the name
|
|
20
|
+
* @param {ReactNode} [actions] controls before the close
|
|
21
|
+
* @param {Object} [nav] default look: `{ index, total, onPrev, onNext }`
|
|
22
|
+
* @param {Function} [onMinimise] float: shows the − control
|
|
23
|
+
* @param {Function} [onClose] shows the × control
|
|
24
|
+
* @param {string} [className]
|
|
25
|
+
*/
|
|
26
|
+
export default function QuickLookHeader({ variant, icon, title, meta, actions, nav, onMinimise, onClose, className = '' }) {
|
|
27
|
+
if (variant === 'float') {
|
|
28
|
+
const ctl = 'inline-flex size-6 shrink-0 items-center justify-center rounded-full text-oq-64 hover:text-oq-96 hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] cursor-pointer'
|
|
29
|
+
return (
|
|
30
|
+
<div className={`flex min-h-6 w-full items-center gap-3 ${className}`.trim()}>
|
|
31
|
+
{icon && <Icon name={icon} size={16} className="shrink-0 text-oq-64" />}
|
|
32
|
+
<span className="kol-float-panel min-w-0 flex-1 truncate text-fg-emphasis">{title}</span>
|
|
33
|
+
{actions}
|
|
34
|
+
{onMinimise && <button type="button" aria-label="Minimise" onClick={onMinimise} className={ctl}><Icon name="minus" size={14} /></button>}
|
|
35
|
+
{onClose && <button type="button" aria-label="Close" onClick={onClose} className={ctl}><Icon name="x" size={16} /></button>}
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
return (
|
|
40
|
+
<div className={`kol-quicklook-header ${className}`.trim()}>
|
|
41
|
+
{nav?.total > 1 && (
|
|
42
|
+
/* the pager is its own group: the count sits off the chevrons, and the group sits clear of
|
|
43
|
+
* the file's name (user 2026-09-23) */
|
|
44
|
+
<span className="flex items-center gap-1 mr-3">
|
|
45
|
+
<Button variant="nav" size="sm" iconOnly="chevron-left" onClick={nav.onPrev} aria-label="Previous" />
|
|
46
|
+
<Button variant="nav" size="sm" iconOnly="chevron-right" onClick={nav.onNext} aria-label="Next" />
|
|
47
|
+
<span className="kol-mono-12 text-meta tabular-nums ml-3">{nav.index + 1} / {nav.total}</span>
|
|
48
|
+
</span>
|
|
49
|
+
)}
|
|
50
|
+
{title && <span className="kol-mono-12 text-strong truncate">{title}</span>}
|
|
51
|
+
{meta && <span className="kol-mono-12 text-meta truncate">{meta}</span>}
|
|
52
|
+
<span className="flex-1" />
|
|
53
|
+
{actions}
|
|
54
|
+
{/* THE ESTATE'S CLOSE IDIOM, and every header control wears it (user 2026-09-23): bare at
|
|
55
|
+
* rest, a wash on hover — a filled container read as a second surface on the header. LAST, at the
|
|
56
|
+
* far right (user 2026-10-18: *"X should be space between justify on the right"*) */}
|
|
57
|
+
{onClose && <CloseButton size="sm" onClick={onClose} />}
|
|
58
|
+
</div>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Button from '../atoms/Button.jsx'
|
|
2
|
+
|
|
3
|
+
/* taxonomy-ok: molecule — float Buttons in one capsule */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ReadingActions — What to do with the selected passage. `Highlight · Note · Copy · ···` (float-everything W11 row 147,
|
|
7
|
+
* 2026-11-04 — kol-float--style W2.9 `Selected passage actions`). A 40 capsule on `surface-secondary` holding sm float
|
|
8
|
+
* buttons in the quiet tone, each glyph (oq) and its word, the More ··· last as an icon-only round. Floats over the
|
|
9
|
+
* selection; the consumer places it.
|
|
10
|
+
*
|
|
11
|
+
* @param {Array} [actions] `[{ id, label, icon, onClick? }]` (default Highlight · Note · Copy)
|
|
12
|
+
* @param {Function} [onAction] `(id) => void`, after the action's own `onClick`
|
|
13
|
+
* @param {Function} [onMore] the ··· press; unset, no ···
|
|
14
|
+
* @param {string} [className]
|
|
15
|
+
*/
|
|
16
|
+
const DEFAULT_ACTIONS = [
|
|
17
|
+
{ id: 'highlight', label: 'Highlight', icon: 'highlighter' },
|
|
18
|
+
{ id: 'note', label: 'Note', icon: 'pencil' },
|
|
19
|
+
{ id: 'copy', label: 'Copy', icon: 'copy' },
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
export default function ReadingActions({ actions = DEFAULT_ACTIONS, onAction, onMore, className = '' }) {
|
|
23
|
+
return (
|
|
24
|
+
<div role="toolbar" aria-label="Passage" className={`inline-flex h-10 items-center gap-1 rounded-full bg-surface-secondary px-1.5 ${className}`.trim()}>
|
|
25
|
+
{actions.map((a) => (
|
|
26
|
+
<Button key={a.id} variant="float" tone="ghost" size="sm" iconLeft={a.icon} onClick={() => { a.onClick?.(); onAction?.(a.id) }}>{a.label}</Button>
|
|
27
|
+
))}
|
|
28
|
+
{onMore && <Button variant="float" tone="ghost" size="sm" iconOnly="more" aria-label="More" onClick={onMore} className="ml-auto" />}
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ReadingChapterNav — The chapters either side, as two capsules. `‹ Previous interlude · Second interlude` /
|
|
5
|
+
* `Next interlude · Fourth interlude ›` (float-everything W11 row 148, 2026-11-04 — kol-float--style W2.9 `Previous and
|
|
6
|
+
* next interlude`). Two 56 capsules on `surface-secondary`, 60 apart on a wide column (12 on a phone): the direction in
|
|
7
|
+
* `kol-float-ruler` (uppercase, fg-64) over the title in `kol-float-hint`, the chevron (oq-64) at the outer end. The
|
|
8
|
+
* hover is the float's fg-08 lift over the ground; a missing side leaves its cell empty.
|
|
9
|
+
*
|
|
10
|
+
* @param {{ label?: string, title: ReactNode, href?: string, onClick?: Function }} [prev] label default `Previous`
|
|
11
|
+
* @param {{ label?: string, title: ReactNode, href?: string, onClick?: Function }} [next] label default `Next`
|
|
12
|
+
* @param {string} [className]
|
|
13
|
+
*/
|
|
14
|
+
function Side({ dir, item }) {
|
|
15
|
+
if (!item) return <span />
|
|
16
|
+
const El = item.href ? 'a' : 'button'
|
|
17
|
+
const next = dir === 'next'
|
|
18
|
+
return (
|
|
19
|
+
<El {...(item.href ? { href: item.href } : { type: 'button' })} onClick={item.onClick}
|
|
20
|
+
className={`flex h-14 min-w-0 items-center gap-3 rounded-full bg-surface-secondary text-left no-underline cursor-pointer hover:shadow-[inset_0_0_0_999px_var(--kol-fg-08)] focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] ${next ? 'pl-5 pr-4' : 'pl-4 pr-5'}`}>
|
|
21
|
+
{!next && <Icon name="chevron-left" size="var(--kol-float-ic)" className="shrink-0 text-oq-64" />}
|
|
22
|
+
<span className="flex min-w-0 flex-1 flex-col">
|
|
23
|
+
<span className="kol-float-ruler truncate uppercase text-fg-64">{item.label ?? (next ? 'Next' : 'Previous')}</span>
|
|
24
|
+
<span className="kol-float-hint truncate text-fg-emphasis">{item.title}</span>
|
|
25
|
+
</span>
|
|
26
|
+
{next && <Icon name="chevron-right" size="var(--kol-float-ic)" className="shrink-0 text-oq-64" />}
|
|
27
|
+
</El>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default function ReadingChapterNav({ prev, next, className = '' }) {
|
|
32
|
+
return (
|
|
33
|
+
<nav aria-label="Chapters" className={`grid grid-cols-2 gap-3 sm:gap-[60px] ${className}`.trim()}>
|
|
34
|
+
<Side dir="prev" item={prev} />
|
|
35
|
+
<Side dir="next" item={next} />
|
|
36
|
+
</nav>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ReadingHighlight — A passage the reader marked, with its note marker. `… a willingness to remain. · Your highlight ·
|
|
3
|
+
* Note 1` (float-everything W11 row 146, 2026-11-04 — kol-float--style W2.9 `Existing highlight · Note marker`). A block
|
|
4
|
+
* on `surface-secondary` at radius 12, 20 in, 16 between: the passage in the reading face (`font`, default Literata) at
|
|
5
|
+
* the column's size and leading on the emphasis ink, the marker under it in `kol-float-label` (fg-64). With `onClick`
|
|
6
|
+
* the block is a button (open the note). `ReadingColumn` sets it inline among the paragraphs.
|
|
7
|
+
*
|
|
8
|
+
* @param {ReactNode} children the passage
|
|
9
|
+
* @param {ReactNode} [meta] the marker (default `Your highlight` · `Note <note>` when `note` is set)
|
|
10
|
+
* @param {number} [note] the note's number
|
|
11
|
+
* @param {string} [font] the reading face (default `'Literata', Georgia, serif`)
|
|
12
|
+
* @param {number} [size] px (default 22) · {number} [leading] (default 1.6)
|
|
13
|
+
* @param {Function} [onClick]
|
|
14
|
+
* @param {string} [className]
|
|
15
|
+
*/
|
|
16
|
+
export default function ReadingHighlight({ children, meta, note, font = "'Literata', Georgia, serif", size = 22, leading = 1.6, onClick, className = '' }) {
|
|
17
|
+
const El = onClick ? 'button' : 'div'
|
|
18
|
+
const marker = meta ?? (note != null ? `Your highlight · Note ${note}` : 'Your highlight')
|
|
19
|
+
return (
|
|
20
|
+
<El {...(onClick ? { type: 'button', onClick } : {})}
|
|
21
|
+
className={`flex w-full flex-col gap-4 rounded-xl bg-surface-secondary p-5 text-left ${onClick ? 'cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]' : ''} ${className}`.trim()}>
|
|
22
|
+
<span className="text-fg-emphasis" style={{ fontFamily: font, fontSize: size, lineHeight: leading }}>{children}</span>
|
|
23
|
+
<span className="kol-float-label text-fg-64">{marker}</span>
|
|
24
|
+
</El>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Button from '../atoms/Button.jsx'
|
|
2
|
+
import Textarea from '../atoms/Textarea.jsx'
|
|
3
|
+
|
|
4
|
+
/* taxonomy-ok: molecule — float Textarea and Buttons under mono labels */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ReadingNotes — The selected highlight and its note: the Notes side of `ReadingPanel` (float-everything W11 row 150,
|
|
8
|
+
* 2026-11-04 — kol-float--style W2.9 `Contextual reading panel · Notes`). Under a `kol-float-ruler` label (uppercase,
|
|
9
|
+
* fg-64): the passage on the float well at radius 14, 14 in, in the reading face at 16 / 1.5; its place in a 32 well
|
|
10
|
+
* capsule (`kol-float-label`, fg-64). Under the second label the note as a float Textarea, its save state in
|
|
11
|
+
* `kol-float-label`, then the way out — `View highlights` as the inverted float capsule (lg, full width) — the quiet
|
|
12
|
+
* remove, and the mono footer line.
|
|
13
|
+
*
|
|
14
|
+
* @param {ReactNode} quote the highlighted passage
|
|
15
|
+
* @param {ReactNode} [location] `Third interlude · Page 125`
|
|
16
|
+
* @param {string} [note] the note's text · {Function} [onNoteChange] `(text) => void`
|
|
17
|
+
* @param {ReactNode} [status] `All changes saved`
|
|
18
|
+
* @param {Function} [onView] · {string} [viewLabel] default `View highlights`
|
|
19
|
+
* @param {Function} [onRemove] · {string} [removeLabel] default `Remove highlight`
|
|
20
|
+
* @param {ReactNode} [footer] `Note 1 / Page 125`
|
|
21
|
+
* @param {string} [quoteLabel] default `Selected highlight` · {string} [noteLabel] default `Reading note`
|
|
22
|
+
* @param {string} [font] the reading face (default `'Literata', Georgia, serif`)
|
|
23
|
+
* @param {string} [className]
|
|
24
|
+
*/
|
|
25
|
+
export default function ReadingNotes({ quote, location, note = '', onNoteChange, status, onView, viewLabel = 'View highlights', onRemove, removeLabel = 'Remove highlight', footer, quoteLabel = 'Selected highlight', noteLabel = 'Reading note', font = "'Literata', Georgia, serif", className = '' }) {
|
|
26
|
+
return (
|
|
27
|
+
<div className={`flex flex-col ${className}`.trim()}>
|
|
28
|
+
<span className="kol-float-ruler uppercase text-fg-64">{quoteLabel}</span>
|
|
29
|
+
<blockquote className="mt-3 rounded-[14px] bg-[var(--kol-float-well)] p-3.5 text-[16px] leading-[1.5] text-fg-emphasis" style={{ fontFamily: font }}>{quote}</blockquote>
|
|
30
|
+
{location && <span className="kol-float-label mt-5 flex h-8 items-center rounded-full bg-[var(--kol-float-well)] px-4 text-fg-64">{location}</span>}
|
|
31
|
+
<span className="kol-float-ruler mt-8 uppercase text-fg-64">{noteLabel}</span>
|
|
32
|
+
<Textarea variant="float" rows={5} value={note} onChange={(e) => onNoteChange?.(e.target.value)} aria-label={noteLabel} className="mt-3" />
|
|
33
|
+
{status && <span className="kol-float-label mt-5 text-fg-64">{status}</span>}
|
|
34
|
+
{onView && <Button variant="float" tone="inverted" size="lg" iconRight="external-link" onClick={onView} className="mt-6 w-full justify-center">{viewLabel}</Button>}
|
|
35
|
+
{onRemove && <Button variant="float" tone="ghost" size="sm" onClick={onRemove} className="-ml-3 mt-4 self-start">{removeLabel}</Button>}
|
|
36
|
+
{footer && <span className="kol-float-ruler mt-5 uppercase text-fg-64">{footer}</span>}
|
|
37
|
+
</div>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Button from '../atoms/Button.jsx'
|
|
2
|
+
import Dropdown from './Dropdown.jsx'
|
|
3
|
+
import QuantityInput from './QuantityInput.jsx'
|
|
4
|
+
import TabsRow from './TabsRow.jsx'
|
|
5
|
+
|
|
6
|
+
/* taxonomy-ok: molecule — float Dropdowns, QuantityInput, TabsRow and Button under mono labels */
|
|
7
|
+
|
|
8
|
+
const TRACK = 'w-full rounded-full bg-[var(--kol-float-well)] p-1 [&>button]:flex-1 [&>button]:justify-center'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* ReadingSettings — How the text is set: the Reading side of `ReadingPanel` (float-everything W11 row 151, 2026-11-04 —
|
|
12
|
+
* kol-float--style W2.9 `Contextual reading panel · Reading`). Each setting under a `kol-float-ruler` label (uppercase,
|
|
13
|
+
* fg-64), 24 between: the theme pick (`themes` — a row of kol-styleguide `ThemeTile`s; kol-component cannot import
|
|
14
|
+
* it), the face as a float Dropdown, the size as the float QuantityInput (`22 px`), leading and width as float
|
|
15
|
+
* Dropdowns, the page flow as the float chip track (Scroll · Pages, fg-16 on the well), and `Reset defaults` as the
|
|
16
|
+
* secondary float capsule. Every control is a shipped float part, worn whole.
|
|
17
|
+
*
|
|
18
|
+
* @param {ReactNode} [themes] the theme row
|
|
19
|
+
* @param {string} [font] · {Array} [fonts] `[{ value, label }]` · {Function} [onFont]
|
|
20
|
+
* @param {number} [size] px · {Function} [onSize] · {number} [minSize] (12) · {number} [maxSize] (40)
|
|
21
|
+
* @param {string} [leading] · {Array} [leadings] · {Function} [onLeading]
|
|
22
|
+
* @param {string} [width] · {Array} [widths] · {Function} [onWidth]
|
|
23
|
+
* @param {string} [flow] · {Array} [flows] (default Scroll · Pages) · {Function} [onFlow]
|
|
24
|
+
* @param {Function} [onReset] · {string} [resetLabel] default `Reset defaults`
|
|
25
|
+
* @param {Object} [labels] the heads: `{ theme, font, size, leading, width, flow }`
|
|
26
|
+
* @param {string} [className]
|
|
27
|
+
*/
|
|
28
|
+
const LABELS = { theme: 'Theme', font: 'Font', size: 'Text size', leading: 'Line height', width: 'Reading width', flow: 'Page flow' }
|
|
29
|
+
const FLOWS = [{ value: 'scroll', label: 'Scroll' }, { value: 'pages', label: 'Pages' }]
|
|
30
|
+
|
|
31
|
+
function Field({ label, children }) {
|
|
32
|
+
return (
|
|
33
|
+
<div className="flex flex-col gap-2.5">
|
|
34
|
+
<span className="kol-float-ruler uppercase text-fg-64">{label}</span>
|
|
35
|
+
{children}
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default function ReadingSettings({ themes, font, fonts = [], onFont, size = 22, onSize, minSize = 12, maxSize = 40, leading, leadings = [], onLeading, width, widths = [], onWidth, flow = 'scroll', flows = FLOWS, onFlow, onReset, resetLabel = 'Reset defaults', labels: l = {}, className = '' }) {
|
|
41
|
+
const L = { ...LABELS, ...l }
|
|
42
|
+
return (
|
|
43
|
+
<div className={`flex flex-col gap-6 ${className}`.trim()}>
|
|
44
|
+
{themes && <Field label={L.theme}><div className="flex gap-2">{themes}</div></Field>}
|
|
45
|
+
{fonts.length > 0 && <Field label={L.font}><Dropdown variant="float" size="md" options={fonts} value={font} onChange={onFont} className="w-full" /></Field>}
|
|
46
|
+
<Field label={L.size}><QuantityInput variant="float" unit="px" ariaLabel="text size" value={size} onChange={onSize} min={minSize} max={maxSize} className="w-full" /></Field>
|
|
47
|
+
{leadings.length > 0 && <Field label={L.leading}><Dropdown variant="float" size="md" options={leadings} value={leading} onChange={onLeading} className="w-full" /></Field>}
|
|
48
|
+
{widths.length > 0 && <Field label={L.width}><Dropdown variant="float" size="md" options={widths} value={width} onChange={onWidth} className="w-full" /></Field>}
|
|
49
|
+
<Field label={L.flow}><TabsRow variant="float" size="xs" overflow="wrap" tabs={flows} value={flow} onChange={onFlow} ariaLabel={L.flow} className={TRACK} /></Field>
|
|
50
|
+
{onReset && <Button variant="float" tone="secondary" size="lg" onClick={onReset} className="mt-4 w-full justify-center">{resetLabel}</Button>}
|
|
51
|
+
</div>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
* to 724px — a document's own page (DocumentIndex). A level sets actions inline, and the bottom rhythm
|
|
49
49
|
* to `--kol-page-header-mb` (40px; content 16px). Unset = the section family as before.
|
|
50
50
|
* @param {ReactNode} media a mark above the eyebrow (a logo, an SVG) — with a `level` only
|
|
51
|
+
* @param {ReactNode} meta a fact at the far end of the HEADLINE's row (float-everything W9 row 140, 2026-11-04 —
|
|
52
|
+
* `Website traffic · kolkrabbi.io · Umami`): the source or scope, in mono on fg-64 (`kol-float-timecode`
|
|
53
|
+
* under `variant="float"`, else `kol-mono-12 text-meta`), baseline-aligned with the title. Unset, nothing
|
|
54
|
+
* `variant="float"` — the float page header (see SECTION_TEXT_LEVELS.float).
|
|
51
55
|
*/
|
|
52
56
|
export const HEADLINE_ROLE = {
|
|
53
57
|
pull: 'kol-section-text-pull',
|
|
@@ -74,6 +78,11 @@ export const SECTION_TEXT_LEVELS = {
|
|
|
74
78
|
/* document (DocumentIndexFigma, kol-atlas 2026-10-31) — the Research page header, the workspace sheet's: 36/1.2 bold
|
|
75
79
|
* display face at −0.005em, 12 under it; the lede 15/1.6 in the body face to a 724 edge */
|
|
76
80
|
document: { title: 'font-[family-name:var(--kol-font-family-sans)] text-[36px] font-bold leading-[1.2] tracking-[-0.005em]', lede: 'm-0 font-[family-name:var(--kol-font-family-sans-neutral)] text-[15px] leading-[1.6] text-fg-96', measure: '724px' },
|
|
81
|
+
/* float (float-everything W9 row 135, 2026-11-04 — kol-float--style 48:4542): the float page header — the eyebrow in
|
|
82
|
+
* mono (`kol-float-ruler`, fg-64, `STUDIO / WORKSPACE`), the title in `kol-float-sheet` (Inter 38/500), the subtitle
|
|
83
|
+
* in `kol-float-body` on fg-64; 8 between, 24 under. A section heading on the float is this with
|
|
84
|
+
* `headlineClass="kol-float-window"` and a `meta` (row 140). */
|
|
85
|
+
float: { title: 'kol-float-sheet', lede: 'kol-float-body text-fg-64', eyebrow: 'kol-float-ruler text-fg-64', gap: 'gap-2', mb: '24px' },
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
export default function SectionText({
|
|
@@ -124,6 +133,7 @@ export default function SectionText({
|
|
|
124
133
|
/* deprecated alias of `variant` (2026-10-31) */
|
|
125
134
|
level,
|
|
126
135
|
media,
|
|
136
|
+
meta,
|
|
127
137
|
}) {
|
|
128
138
|
/* a LEVEL fills the header defaults; an explicit prop always wins */
|
|
129
139
|
const variant = variantProp ?? level
|
|
@@ -153,7 +163,11 @@ export default function SectionText({
|
|
|
153
163
|
* *"more aligned like 'Studio'"* — it sat on the subtitle's line); centred on the title, not on its baseline */
|
|
154
164
|
const headRow = actionsPlacement === 'head' && !!actions && !!headline
|
|
155
165
|
const inlineHead = (actionsPlacement === 'inline' && !!actions && !body && !!headline) || headRow
|
|
156
|
-
const
|
|
166
|
+
const titleNode = 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>
|
|
167
|
+
/* `meta` rides the headline's row, at its far end */
|
|
168
|
+
const headlineNode = titleNode && meta
|
|
169
|
+
? <div className="flex self-stretch items-baseline justify-between gap-6">{titleNode}<span className={`${variant === 'float' ? 'kol-float-timecode text-fg-64' : 'kol-mono-12 text-meta'} shrink-0`}>{meta}</span></div>
|
|
170
|
+
: titleNode
|
|
157
171
|
const bodyNode = body && (typeof body === 'string'
|
|
158
172
|
? <p className={cls(bodyClass, 'body')} style={slotStyle.body}>{body}</p>
|
|
159
173
|
: <div className={cls(bodyClass, 'body')} style={slotStyle.body}>{body}</div>)
|
|
@@ -8,8 +8,28 @@ import Divider from '../atoms/Divider.jsx'
|
|
|
8
8
|
*
|
|
9
9
|
* @param {Array<{label: string, value: ReactNode}>} items rows, keyed by label
|
|
10
10
|
* @param {boolean} framed wrap the list in leading + trailing Divider
|
|
11
|
+
* @param {'float'} [variant] `float` (float-everything W8 row 126, 2026-11-04 — kol-float--style 48:3982): the info
|
|
12
|
+
* sheet — `title` in Inter 16 (`kol-float-body-lg`) over key · value rows on the sheet radius
|
|
13
|
+
* (`--kol-float-menu-r`, surface-secondary, 24 in), no dividers (the no-borders law): the key in
|
|
14
|
+
* `kol-float-hint` on fg-64 in a 126 column, the value beside it in Inter 13 on the emphasis ink, 12 between rows
|
|
15
|
+
* @param {ReactNode} [title] float: the sheet's heading (`Book information`)
|
|
11
16
|
*/
|
|
12
|
-
export default function SpecList({ items = [], framed = false }) {
|
|
17
|
+
export default function SpecList({ items = [], framed = false, variant, title, className = '' }) {
|
|
18
|
+
if (variant === 'float') {
|
|
19
|
+
return (
|
|
20
|
+
<section className={`flex w-full flex-col gap-5 rounded-[var(--kol-float-menu-r)] bg-surface-secondary p-6 ${className}`.trim()}>
|
|
21
|
+
{title && <h3 className="kol-float-body-lg m-0 text-fg-emphasis">{title}</h3>}
|
|
22
|
+
<dl className="m-0 flex flex-col gap-3">
|
|
23
|
+
{items.map((item) => (
|
|
24
|
+
<div key={item.label} className="grid grid-cols-[126px_1fr] items-baseline gap-4">
|
|
25
|
+
<dt className="kol-float-hint text-fg-64">{item.label}</dt>
|
|
26
|
+
<dd className="kol-float-hint m-0 text-fg-emphasis" style={{ fontSize: 13 }}>{item.value}</dd>
|
|
27
|
+
</div>
|
|
28
|
+
))}
|
|
29
|
+
</dl>
|
|
30
|
+
</section>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
13
33
|
return (
|
|
14
34
|
<>
|
|
15
35
|
{framed && <Divider />}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SummaryLine — A label and its value on one line. `Estimated size · 18.4 MB` (float-everything W6 row 91, 2026-11-04 —
|
|
3
|
+
* kol-float--style 46:3057): the label at the left in `kol-float-hint` on fg-64, the value at the right in
|
|
4
|
+
* `kol-float-timecode` (JetBrains Mono 12) in the emphasis ink, tabular. The line under a form that says what the
|
|
5
|
+
* action will produce; no rule above it — a gap does that.
|
|
6
|
+
*
|
|
7
|
+
* @param {ReactNode} label
|
|
8
|
+
* @param {ReactNode} value
|
|
9
|
+
* @param {string} [className]
|
|
10
|
+
*/
|
|
11
|
+
export default function SummaryLine({ label, value, className = '' }) {
|
|
12
|
+
return (
|
|
13
|
+
<div className={`flex w-full items-baseline justify-between gap-4 ${className}`.trim()}>
|
|
14
|
+
<span className="kol-float-hint min-w-0 truncate text-fg-64">{label}</span>
|
|
15
|
+
<span className="kol-float-timecode shrink-0 tabular-nums text-fg-emphasis">{value}</span>
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -79,6 +79,18 @@ import { floatSurfaceClass } from '../utilities/tone.js'
|
|
|
79
79
|
* (FloatFoldBothSidesGrey, kol-fxr 2026-11-03)
|
|
80
80
|
* @param {'ground'|'handle'} [foldTone='ground'] the edge tab's look: `ground` is the pill's own; `handle` is the grey edge
|
|
81
81
|
* handle (iOS's), `--kol-oq-24` with an `--kol-oq-96` chevron, whatever the pill's `surface`
|
|
82
|
+
* THE FLOAT ROW'S PARTS (float-everything W5 rows 67 · 78 and W9 row 137, 2026-11-04 — kol-float--style 46:1948, 46:2316,
|
|
83
|
+
* 48:4586), `variant="float"` only:
|
|
84
|
+
* @param {'xs'|'sm'|'md'|'lg'} [size] `xs` — the inspector's chip tabs: 26 capsules in `kol-float-label`, 10 in, the
|
|
85
|
+
* selected one fg-16 (row 67); sm · md · lg are the float button heights
|
|
86
|
+
* @param {'mono'} [type] `mono` — text tabs: mono labels (`kol-float-timecode`) at the sm height on the list radius, the
|
|
87
|
+
* selected one FILLED fg-16, the rest fg-48 (row 137 — the underline's rule replaced by the fill)
|
|
88
|
+
* A float tab takes `icon` (before the label, oq) and `count` (after it, mono, fg-64) — `Tasks 5` (row 78).
|
|
89
|
+
* @param {'solid'|'glass-dark'|'glass-light'} [surface] on `float`: the row sits in its own capsule — the float material,
|
|
90
|
+
* 6 in, so `size="lg"` tabs make the 56 pill (row 78). Unset, the row is bare as before
|
|
91
|
+
* @param {ReactNode} [trailing] inside the pill, after the tabs: the float capsule's (with `surface`) or the stacked
|
|
92
|
+
* phone pill's — AppFloatNav's transport puts its Timecode here. With `trailing` the phone pill anchors its LEFT
|
|
93
|
+
* edge where a centred pill without it would start, so every slot stays where it was; it grows to the right
|
|
82
94
|
* Tabs are `{ id, label }` or `{ value, label }` (either key), plus `icon` for stacked; a stacked tab's `selected`
|
|
83
95
|
* lights it whatever `value` is — action slots (the transport) light more than one.
|
|
84
96
|
*/
|
|
@@ -106,16 +118,28 @@ export const tabbarPillSlot = (at, { count, labels = false, split = false } = {}
|
|
|
106
118
|
/* the collapse's motion — one duration for the width and the glyph swap (300, user 2026-10-23: 180 read as abrupt) */
|
|
107
119
|
const COLLAPSE_MS = 300
|
|
108
120
|
|
|
109
|
-
export default function TabsRow({ tabs: raw = [], value, onChange, onClose, onMinimise, variant, look: lookLegacy, type
|
|
121
|
+
export default function TabsRow({ tabs: raw = [], value, onChange, onClose, onMinimise, variant, look: lookLegacy, type, trailing, filled = false, placement = 'inline', shape = 'bar', collapsed = false, onExpand, edge, border, shadow, dock, active, foldable, folded, onFoldChange, foldSide, foldTone, surface, split, labels, size, tracked = false, overflow = 'scroll', ariaLabel, className, style }) {
|
|
110
122
|
const tabs = raw.map((t) => ({ ...t, id: t.id ?? t.value }))
|
|
111
123
|
const look = variant ?? lookLegacy ?? 'underline'
|
|
112
124
|
const wrap = overflow === 'wrap'
|
|
113
125
|
/* `float` (W16, round 3): the chip row as capsules — float heights, pills 4 apart, the selected one oq-16 */
|
|
114
|
-
if (look === 'float')
|
|
126
|
+
if (look === 'float') {
|
|
127
|
+
const row = <ChipTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 'md'} float floatType={type} ariaLabel={ariaLabel} className={`${wrap ? 'flex-wrap ' : ''}${surface ? '' : className ?? ''}`} />
|
|
128
|
+
/* the capsule (row 78): the float material, 6 in, the tabs then the trailing slot */
|
|
129
|
+
if (surface) {
|
|
130
|
+
return (
|
|
131
|
+
<div className={`inline-flex max-w-full items-center gap-1 rounded-full p-1.5 ${floatSurfaceClass(surface)} ${className ?? ''}`.trim()}>
|
|
132
|
+
<Overflow mode={overflow} value={value}>{row}</Overflow>
|
|
133
|
+
{trailing && <div className="flex shrink-0 items-center gap-1">{trailing}</div>}
|
|
134
|
+
</div>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
return <Overflow mode={overflow} value={value}>{row}</Overflow>
|
|
138
|
+
}
|
|
115
139
|
if (look === 'chip') return <Overflow mode={overflow} value={value}><ChipTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 'sm'} filled={filled} ariaLabel={ariaLabel} className={`${wrap ? 'flex-wrap ' : ''}${className ?? ''}`} /></Overflow>
|
|
116
140
|
if (look === 'text') return <Overflow mode={overflow} value={value}><TextTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 14} tracked={tracked} className={`${wrap ? 'flex-wrap gap-y-2 ' : ''}${className ?? 'gap-6'}`} style={style} /></Overflow>
|
|
117
|
-
if (look === 'stacked') return <StackedTabs tabs={tabs} value={value} onChange={onChange} placement={placement} shape={shape} collapsed={collapsed} onExpand={onExpand} edge={edge} border={border} shadow={shadow} dock={dock} active={active} foldable={foldable} folded={folded} onFoldChange={onFoldChange} foldSide={foldSide} foldTone={foldTone} surface={surface} split={split} labels={labels} ariaLabel={ariaLabel} className={className ?? ''} />
|
|
118
|
-
return <Overflow mode={overflow} value={value}><UnderlineTabs tabs={tabs} value={value} onChange={onChange} onClose={onClose} onMinimise={onMinimise} wrap={wrap} type={type} /></Overflow>
|
|
141
|
+
if (look === 'stacked') return <StackedTabs trailing={trailing} tabs={tabs} value={value} onChange={onChange} placement={placement} shape={shape} collapsed={collapsed} onExpand={onExpand} edge={edge} border={border} shadow={shadow} dock={dock} active={active} foldable={foldable} folded={folded} onFoldChange={onFoldChange} foldSide={foldSide} foldTone={foldTone} surface={surface} split={split} labels={labels} ariaLabel={ariaLabel} className={className ?? ''} />
|
|
142
|
+
return <Overflow mode={overflow} value={value}><UnderlineTabs tabs={tabs} value={value} onChange={onChange} onClose={onClose} onMinimise={onMinimise} wrap={wrap} type={type ?? 'mono'} /></Overflow>
|
|
119
143
|
}
|
|
120
144
|
|
|
121
145
|
/* `overflow="scroll"`: the row in a sideways scroller that fades its clipped edges and keeps the active tab (`data-active`)
|
|
@@ -138,11 +162,31 @@ function Overflow({ mode, value, children }) {
|
|
|
138
162
|
}
|
|
139
163
|
|
|
140
164
|
/* chip — TabChips verbatim */
|
|
141
|
-
function ChipTabs({ tabs, value, onChange, size, filled, float = false, ariaLabel, className }) {
|
|
165
|
+
function ChipTabs({ tabs, value, onChange, size, filled, float = false, floatType, ariaLabel, className }) {
|
|
166
|
+
/* the float's two plain rows — the inspector's 26 chips (xs) and the mono text tabs — are drawn here, not by Button:
|
|
167
|
+
* neither is a Button rung (26 is not a float height; a mono label is not the float button's type) */
|
|
168
|
+
const plain = float && (size === 'xs' || floatType === 'mono')
|
|
142
169
|
return (
|
|
143
170
|
<div className={`flex items-center ${filled ? 'gap-2' : 'gap-1'}${float ? ' kol-tabs-float' : ''} ${className}`.trim()} role="tablist" aria-label={ariaLabel}>
|
|
144
171
|
{tabs.map((t) => {
|
|
145
172
|
const active = t.id === value
|
|
173
|
+
if (plain) {
|
|
174
|
+
const mono = floatType === 'mono'
|
|
175
|
+
return (
|
|
176
|
+
<button key={t.id} type="button" role="tab" aria-selected={active} data-active={active || undefined} onClick={() => onChange?.(t.id)}
|
|
177
|
+
className={`inline-flex shrink-0 items-center whitespace-nowrap cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] ${mono ? 'kol-float-timecode h-[var(--kol-float-h-sm)] rounded-[var(--kol-float-list-r)] px-3' : 'kol-float-label h-[26px] rounded-full px-2.5'} ${active ? 'bg-fg-16 text-fg-emphasis' : `${mono ? 'text-fg-48' : 'text-fg-64'} hover:bg-fg-08 hover:text-fg-emphasis`}`}>
|
|
178
|
+
{t.label}
|
|
179
|
+
</button>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
if (float && (t.icon || t.count != null)) {
|
|
183
|
+
return (
|
|
184
|
+
<Button key={t.id} variant="float" size={size} iconLeft={t.icon} pressed={active} role="tab" aria-selected={active} aria-pressed={undefined} data-active={active || undefined} onClick={() => onChange?.(t.id)}>
|
|
185
|
+
{t.label}
|
|
186
|
+
{t.count != null && <span className="kol-float-ruler ml-0.5 tabular-nums text-fg-64">{t.count}</span>}
|
|
187
|
+
</Button>
|
|
188
|
+
)
|
|
189
|
+
}
|
|
146
190
|
return (
|
|
147
191
|
/* a tab is selected, not pressed — the role's own attribute replaces Button's aria-pressed */
|
|
148
192
|
<Button key={t.id} variant={float ? 'float' : filled ? 'tab-filled' : 'tab'} size={size} pressed={active} role="tab" aria-selected={active} aria-pressed={undefined} data-active={active || undefined} onClick={() => onChange?.(t.id)}>
|
|
@@ -177,7 +221,7 @@ function TextTabs({ tabs, value, onChange, size, tracked, className, style }) {
|
|
|
177
221
|
/* the fold: a sideways swipe past this folds the pill, as frame E's prototype measures it */
|
|
178
222
|
const FOLD_SWIPE = 40
|
|
179
223
|
|
|
180
|
-
function StackedTabs({ tabs, value, onChange, placement, shape = 'bar', collapsed = false, onExpand, edge = 'bottom', border = true, shadow = false, dock = false, active: activeShape = 'fill', foldable = false, folded: foldedProp, onFoldChange, foldSide: foldSideProp = 'left', foldTone = 'ground', surface = 'solid', split: splitProp = false, labels = false, ariaLabel = 'Sections', className }) {
|
|
224
|
+
function StackedTabs({ trailing, tabs, value, onChange, placement, shape = 'bar', collapsed = false, onExpand, edge = 'bottom', border = true, shadow = false, dock = false, active: activeShape = 'fill', foldable = false, folded: foldedProp, onFoldChange, foldSide: foldSideProp = 'left', foldTone = 'ground', surface = 'solid', split: splitProp = false, labels = false, ariaLabel = 'Sections', className }) {
|
|
181
225
|
const [foldedOwn, setFoldedOwn] = useState(false)
|
|
182
226
|
const swipe = useRef({ x: null, swiped: false })
|
|
183
227
|
const [swipeSide, setSwipeSide] = useState('left')
|
|
@@ -335,6 +379,8 @@ function StackedTabs({ tabs, value, onChange, placement, shape = 'bar', collapse
|
|
|
335
379
|
gap: TABBAR_PILL_SPLIT_GAP,
|
|
336
380
|
...(dock
|
|
337
381
|
? { left: 'calc(var(--kol-shell-rail-width, 48px) + 64px)', bottom: 64 }
|
|
382
|
+
/* with a trailing slot the pill grows rightward from where a centred one would start — the slots never move */
|
|
383
|
+
: trailing ? { left: `calc(50% - ${W / 2}px)`, [top ? 'top' : 'bottom']: inset }
|
|
338
384
|
: { right: `calc(50% - ${W / 2}px)`, [top ? 'top' : 'bottom']: inset }),
|
|
339
385
|
...swipeProps.style,
|
|
340
386
|
}}
|
|
@@ -344,7 +390,7 @@ function StackedTabs({ tabs, value, onChange, placement, shape = 'bar', collapse
|
|
|
344
390
|
className={`relative flex items-center rounded-full overflow-hidden ${material}`.trim()}
|
|
345
391
|
style={{
|
|
346
392
|
height: TABBAR_PILL_H,
|
|
347
|
-
width: isCollapsed && !split ? TABBAR_PILL_H : barW,
|
|
393
|
+
width: isCollapsed && !split ? TABBAR_PILL_H : trailing ? 'auto' : barW,
|
|
348
394
|
padding: labels ? 3 : 4,
|
|
349
395
|
border: edgeLine,
|
|
350
396
|
...solidLook,
|
|
@@ -354,6 +400,7 @@ function StackedTabs({ tabs, value, onChange, placement, shape = 'bar', collapse
|
|
|
354
400
|
}}
|
|
355
401
|
>
|
|
356
402
|
{row}
|
|
403
|
+
{trailing && !isCollapsed && <div className="flex flex-none items-center pl-3 pr-4">{trailing}</div>}
|
|
357
404
|
{closeX}
|
|
358
405
|
</div>
|
|
359
406
|
{split && tip(isCollapsed ? { id: last.id, label: 'Close' } : last, (
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
2
|
+
import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
|
|
3
|
+
|
|
4
|
+
/* taxonomy-ok: molecule — nests ToggleCheckbox (atom) + kol-icons's Icon. */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TaskRow — A task: check · title · date chip. `Design the Tasks tab · 2026-07-01` (float-everything W8 row 118,
|
|
8
|
+
* 2026-11-04 — kol-float--style 48:3522). The float ToggleCheckbox, the title in `kol-float-body-lg` on the emphasis
|
|
9
|
+
* ink (fg-48 and struck once done), and the date as a chip at the right: a capsule on the well (`--kol-float-well`,
|
|
10
|
+
* the field's ground) at the float md height, the calendar glyph on oq-64, the date in `kol-float-timecode`. `onDate`
|
|
11
|
+
* makes the chip a button (open your date picker there); without it the chip is a label. Lists end in an
|
|
12
|
+
* `InlineAddRow variant="float"` — the panel's `+ New brief`.
|
|
13
|
+
*
|
|
14
|
+
* @param {ReactNode} title
|
|
15
|
+
* @param {string} [date]
|
|
16
|
+
* @param {boolean} [done] · {Function} [onDone]
|
|
17
|
+
* @param {Function} [onDate]
|
|
18
|
+
* @param {Function} [onClick] the title's press
|
|
19
|
+
* @param {string} [className]
|
|
20
|
+
*/
|
|
21
|
+
export default function TaskRow({ title, date, done = false, onDone, onDate, onClick, className = '' }) {
|
|
22
|
+
const Chip = onDate ? 'button' : 'span'
|
|
23
|
+
return (
|
|
24
|
+
<div className={`flex min-h-[var(--kol-float-h-md)] w-full items-center gap-3 ${className}`.trim()}>
|
|
25
|
+
<ToggleCheckbox variant="float" checked={done} onChange={onDone} aria-label="Done" className="shrink-0" />
|
|
26
|
+
<span
|
|
27
|
+
onClick={onClick}
|
|
28
|
+
className={`kol-float-body-lg min-w-0 flex-1 truncate ${onClick ? 'cursor-pointer' : ''} ${done ? 'text-fg-48 line-through' : 'text-fg-emphasis'}`.trim()}
|
|
29
|
+
>
|
|
30
|
+
{title}
|
|
31
|
+
</span>
|
|
32
|
+
{date && (
|
|
33
|
+
<Chip
|
|
34
|
+
{...(onDate ? { type: 'button', onClick: onDate } : {})}
|
|
35
|
+
className={`inline-flex h-[var(--kol-float-h-md)] shrink-0 items-center gap-2 rounded-full bg-[var(--kol-float-well)] px-4 ${onDate ? 'cursor-pointer hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]' : ''}`.trim()}
|
|
36
|
+
>
|
|
37
|
+
<Icon name="calendar" size={14} className="text-oq-64" />
|
|
38
|
+
<span className="kol-float-timecode tabular-nums text-fg-64">{date}</span>
|
|
39
|
+
</Chip>
|
|
40
|
+
)}
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
}
|