@kolkrabbi/kol-component 0.335.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 +1 -1
- package/src/index.js +14 -0
- package/src/molecules/QuantityInput.jsx +7 -3
- 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/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/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/calendarDates.js +24 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -94,6 +94,20 @@ export { default as IndexRow } from './molecules/IndexRow.jsx'
|
|
|
94
94
|
export { default as TaskRow } from './molecules/TaskRow.jsx'
|
|
95
95
|
export { default as TocRow } from './molecules/TocRow.jsx'
|
|
96
96
|
export { default as NavDrawer } from './organisms/NavDrawer.jsx'
|
|
97
|
+
/* float-everything W11 — calendar + reader (0.336.0) */
|
|
98
|
+
export { default as CalendarTimeline } from './organisms/CalendarTimeline.jsx'
|
|
99
|
+
export { default as CalendarMonth } from './organisms/CalendarMonth.jsx'
|
|
100
|
+
export { default as CalendarWeek } from './organisms/CalendarWeek.jsx'
|
|
101
|
+
export { default as CalendarDay } from './organisms/CalendarDay.jsx'
|
|
102
|
+
export { default as ReadingColumn } from './organisms/ReadingColumn.jsx'
|
|
103
|
+
export { default as ReadingHighlight } from './molecules/ReadingHighlight.jsx'
|
|
104
|
+
export { default as ReadingActions } from './molecules/ReadingActions.jsx'
|
|
105
|
+
export { default as ReadingChapterNav } from './molecules/ReadingChapterNav.jsx'
|
|
106
|
+
export { default as ReadingContents } from './organisms/ReadingContents.jsx'
|
|
107
|
+
export { default as ReadingPanel } from './organisms/ReadingPanel.jsx'
|
|
108
|
+
export { default as ReadingNotes } from './molecules/ReadingNotes.jsx'
|
|
109
|
+
export { default as ReadingSettings } from './molecules/ReadingSettings.jsx'
|
|
110
|
+
export { default as ReadingOverview } from './organisms/ReadingOverview.jsx'
|
|
97
111
|
export { default as WorkspaceSwitcher } from './molecules/WorkspaceSwitcher.jsx'
|
|
98
112
|
export { default as AccountMenu } from './molecules/AccountMenu.jsx'
|
|
99
113
|
export { default as OptionRow } from './molecules/OptionRow.jsx'
|
|
@@ -21,6 +21,8 @@ import { useEffect, useState } from 'react'
|
|
|
21
21
|
* @param {string} size 'sm' | 'md' | 'lg' — pins the responsive size
|
|
22
22
|
* @param {'float'} variant the float stepper (float-everything W2 row 24, 2026-11-04): a 36 capsule on the float
|
|
23
23
|
* well, − value + in Inter 500 (the glyphs oq, 40% at a bound), the float heights by `size`
|
|
24
|
+
* @param {string} unit FLOAT: a word after the value (`22 px` — the reader's text size, W11 row 151, 2026-11-04)
|
|
25
|
+
* @param {string} ariaLabel FLOAT: what the value is; the − + read `Decrease <it>` / `Increase <it>` (default quantity)
|
|
24
26
|
* @param {string} className extra classes on the root
|
|
25
27
|
*/
|
|
26
28
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
@@ -40,6 +42,8 @@ const QuantityInput = ({
|
|
|
40
42
|
controls = 'chevron',
|
|
41
43
|
size,
|
|
42
44
|
variant,
|
|
45
|
+
unit,
|
|
46
|
+
ariaLabel = 'quantity',
|
|
43
47
|
className = '',
|
|
44
48
|
}) => {
|
|
45
49
|
const [resolvedSize, setResolvedSize] = useState('md')
|
|
@@ -79,9 +83,9 @@ const QuantityInput = ({
|
|
|
79
83
|
const btn = 'inline-flex h-full w-8 shrink-0 items-center justify-center rounded-full text-oq-64 hover:text-oq-96 disabled:opacity-40 disabled:hover:text-oq-64 cursor-pointer disabled:cursor-not-allowed outline-none focus-visible:[box-shadow:var(--kol-float-focus)] transition-colors'
|
|
80
84
|
return (
|
|
81
85
|
<div className={`inline-flex items-center rounded-full bg-[var(--kol-float-well)] px-1 kol-float-panel text-fg-emphasis ${FLOAT_H[size] ?? FLOAT_H.md} ${className}`.trim()}>
|
|
82
|
-
<button type="button" onClick={decrement} disabled={value <= min} className={btn} aria-label=
|
|
83
|
-
<span className="min-w-6 text-center tabular-nums">{value}</span>
|
|
84
|
-
<button type="button" onClick={increment} disabled={value >= max} className={btn} aria-label=
|
|
86
|
+
<button type="button" onClick={decrement} disabled={value <= min} className={btn} aria-label={`Decrease ${ariaLabel}`}><Icon name="minus" size={14} /></button>
|
|
87
|
+
<span className="min-w-6 flex-1 text-center tabular-nums">{value}{unit ? ` ${unit}` : ''}</span>
|
|
88
|
+
<button type="button" onClick={increment} disabled={value >= max} className={btn} aria-label={`Increase ${ariaLabel}`}><Icon name="plus" size={14} /></button>
|
|
85
89
|
</div>
|
|
86
90
|
)
|
|
87
91
|
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { toHours } from './calendarDates.js'
|
|
2
|
+
|
|
3
|
+
/* taxonomy-ok: organism — a whole calendar region: the all-day lane over the hours */
|
|
4
|
+
|
|
5
|
+
const HOUR = 25
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* CalendarDay — One day: what lasts all of it, then the hours. `All day · 07:00 … 19:00` (float-everything W11 row
|
|
9
|
+
* 161, 2026-11-04 — kol-float--style W2.11 `Day calendar`). On the page ground at the sheet radius: a 62 all-day lane
|
|
10
|
+
* (`All day` in `kol-float-label`, fg-64, 18 in; each all-day item a 32 bar on fg-16, radius 8, its label in
|
|
11
|
+
* `kol-float-hint`), then one 25 row per hour with the time in `kol-float-ruler` in a 110 gutter. A timed event is an
|
|
12
|
+
* fg-16 block across the lane from its start to its end; `now` draws a 1px line of the ink across the lane with
|
|
13
|
+
* `nowLabel` over its end. No gridlines (no-borders law) — the gutter's times are the scale.
|
|
14
|
+
*
|
|
15
|
+
* @param {Array} [allDay] `[{ label }]`
|
|
16
|
+
* @param {Array} [events] `[{ start: 'HH:MM', end: 'HH:MM', label }]`
|
|
17
|
+
* @param {number} [from] first hour shown (default 7)
|
|
18
|
+
* @param {number} [to] last hour shown (default 19)
|
|
19
|
+
* @param {string} [now] `HH:MM` — the current-time line; unset, none
|
|
20
|
+
* @param {string} [nowLabel] default `Today`
|
|
21
|
+
* @param {string} [allDayLabel] default `All day`
|
|
22
|
+
* @param {string} [className]
|
|
23
|
+
*/
|
|
24
|
+
export default function CalendarDay({ allDay = [], events = [], from = 7, to = 19, now, nowLabel = 'Today', allDayLabel = 'All day', className = '' }) {
|
|
25
|
+
const hours = Array.from({ length: to - from + 1 }, (_, i) => from + i)
|
|
26
|
+
const y = (t) => (toHours(t) - from) * HOUR + 4
|
|
27
|
+
const nowY = now != null ? y(now) : null
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className={`overflow-hidden rounded-[var(--kol-float-menu-r)] bg-surface-primary pb-1 ${className}`.trim()}>
|
|
31
|
+
<div className="flex min-h-[62px] items-center gap-4 pl-[18px] pr-[18px]">
|
|
32
|
+
<span className="kol-float-label w-[76px] shrink-0 text-fg-64">{allDayLabel}</span>
|
|
33
|
+
<div className="flex min-w-0 flex-1 flex-col gap-1 py-[15px]">
|
|
34
|
+
{allDay.map((a, i) => (
|
|
35
|
+
<span key={i} className="kol-float-hint flex h-8 items-center truncate rounded-[var(--kol-float-list-r)] bg-fg-16 px-4 text-fg-emphasis">{a.label}</span>
|
|
36
|
+
))}
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div className="relative" style={{ height: hours.length * HOUR + 4 }}>
|
|
40
|
+
{hours.map((h, i) => (
|
|
41
|
+
<span key={h} className="kol-float-ruler absolute left-[18px] tabular-nums text-fg-64" style={{ top: i * HOUR + 5 }}>
|
|
42
|
+
{String(h).padStart(2, '0')}:00
|
|
43
|
+
</span>
|
|
44
|
+
))}
|
|
45
|
+
{events.map((e, i) => (
|
|
46
|
+
<span key={i} className="kol-float-label absolute left-[110px] right-[18px] flex items-start overflow-hidden rounded-[var(--kol-float-list-r)] bg-fg-16 px-3 py-1 text-fg-emphasis"
|
|
47
|
+
style={{ top: y(e.start), height: Math.max(HOUR - 2, y(e.end) - y(e.start) - 2) }}>
|
|
48
|
+
<span className="truncate">{e.label}</span>
|
|
49
|
+
</span>
|
|
50
|
+
))}
|
|
51
|
+
{nowY != null && (
|
|
52
|
+
<>
|
|
53
|
+
<span className="kol-float-label absolute right-[30px] text-fg-emphasis" style={{ top: nowY - 18 }}>{nowLabel}</span>
|
|
54
|
+
<span className="absolute left-[110px] right-[18px] h-px bg-[var(--kol-surface-on-primary)]" style={{ top: nowY }} />
|
|
55
|
+
</>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { toDate, addDays, sameDay, weekStart, daysBetween, WEEKDAYS } from './calendarDates.js'
|
|
2
|
+
|
|
3
|
+
/* taxonomy-ok: organism — a whole calendar region: weekday head, six week rows, event bars */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* CalendarMonth — A month as a grid of weeks, with what runs across them. `MON … SUN` over six rows (float-everything
|
|
7
|
+
* W11 row 159, 2026-11-04 — kol-float--style W2.11 `Month calendar`). On the page ground (`bg-surface-primary`) at the
|
|
8
|
+
* sheet radius: a 40 head of weekdays in `kol-float-ruler` (fg-64), then one 60 row per week — the date in mono 11
|
|
9
|
+
* at 16 in (fg-64; outside the month fg-40), today on a 25 disc of the ink, Saturday and Sunday on fg-02. An event is a
|
|
10
|
+
* 16 bar on fg-16 (radius 4, 8 in from its cells) with its label in Inter 10, split at each week's edge and labelled
|
|
11
|
+
* again where it resumes. No gridlines (the no-borders law): the columns read by alignment and the weekend tint.
|
|
12
|
+
*
|
|
13
|
+
* @param {string|Date} month any day of the month to show (`2026-11` or `2026-11-03`)
|
|
14
|
+
* @param {string|Date} [today] lit on the disc
|
|
15
|
+
* @param {Array} [events] `[{ start, end?, label }]` — dates as `YYYY-MM-DD`; `end` inclusive, default `start`
|
|
16
|
+
* @param {string[]} [weekdays] the head's words (default Mon … Sun)
|
|
17
|
+
* @param {Function} [onSelect] `(date: Date) => void` — a day pressed
|
|
18
|
+
* @param {string} [className]
|
|
19
|
+
*/
|
|
20
|
+
export default function CalendarMonth({ month, today, events = [], weekdays = WEEKDAYS, onSelect, className = '' }) {
|
|
21
|
+
const m = toDate(String(month).length === 7 ? `${month}-01` : month)
|
|
22
|
+
const first = new Date(m.getFullYear(), m.getMonth(), 1)
|
|
23
|
+
const last = new Date(m.getFullYear(), m.getMonth() + 1, 0)
|
|
24
|
+
const t = today ? toDate(today) : null
|
|
25
|
+
const weeks = []
|
|
26
|
+
for (let ws = weekStart(first); ws <= last; ws = addDays(ws, 7)) weeks.push(ws)
|
|
27
|
+
const evs = events.map((e) => ({ ...e, s: toDate(e.start), e: toDate(e.end ?? e.start) }))
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className={`overflow-hidden rounded-[var(--kol-float-menu-r)] bg-surface-primary ${className}`.trim()}>
|
|
31
|
+
<div className="grid h-10 grid-cols-7 items-center">
|
|
32
|
+
{weekdays.map((d) => <span key={d} className="kol-float-ruler px-4 uppercase text-fg-64">{d}</span>)}
|
|
33
|
+
</div>
|
|
34
|
+
{weeks.map((ws) => {
|
|
35
|
+
const we = addDays(ws, 6)
|
|
36
|
+
const bars = evs.filter((e) => e.s <= we && e.e >= ws).map((e) => {
|
|
37
|
+
const a = Math.max(0, daysBetween(ws, e.s))
|
|
38
|
+
const b = Math.min(6, daysBetween(ws, e.e))
|
|
39
|
+
return { label: e.label, a, b }
|
|
40
|
+
})
|
|
41
|
+
/* lanes: a bar takes the first lane whose last bar ended before it starts */
|
|
42
|
+
const ends = []
|
|
43
|
+
for (const bar of bars) {
|
|
44
|
+
bar.lane = ends.findIndex((end) => end < bar.a)
|
|
45
|
+
if (bar.lane < 0) bar.lane = ends.length
|
|
46
|
+
ends[bar.lane] = bar.b
|
|
47
|
+
}
|
|
48
|
+
return (
|
|
49
|
+
<div key={ws.toISOString()} className="relative grid grid-cols-7" style={{ minHeight: Math.max(60, 38 + ends.length * 20 + 2) }}>
|
|
50
|
+
{Array.from({ length: 7 }, (_, i) => {
|
|
51
|
+
const day = addDays(ws, i)
|
|
52
|
+
const isToday = sameDay(day, t)
|
|
53
|
+
const out = day.getMonth() !== m.getMonth()
|
|
54
|
+
const Cell = onSelect ? 'button' : 'div'
|
|
55
|
+
return (
|
|
56
|
+
<Cell key={i} {...(onSelect ? { type: 'button', onClick: () => onSelect(day) } : {})}
|
|
57
|
+
className={`flex items-start px-4 pt-[9px] text-left ${i >= 5 ? 'bg-fg-02' : ''} ${onSelect ? 'cursor-pointer hover:bg-fg-04 focus-visible:outline-none focus-visible:shadow-[inset_var(--kol-float-focus)]' : ''}`.trim()}>
|
|
58
|
+
<span className={`kol-float-ruler inline-flex h-[25px] min-w-[25px] items-center justify-center rounded-full text-[11px] tabular-nums ${isToday ? '-ml-[7px] bg-[var(--kol-surface-on-primary)] text-[var(--kol-surface-primary)]' : out ? 'text-fg-40 justify-start' : 'text-fg-64 justify-start'}`}>
|
|
59
|
+
{day.getDate()}
|
|
60
|
+
</span>
|
|
61
|
+
</Cell>
|
|
62
|
+
)
|
|
63
|
+
})}
|
|
64
|
+
{bars.map((b, i) => (
|
|
65
|
+
<span key={i} className="kol-float-label pointer-events-none absolute flex h-4 items-center truncate rounded-[4px] bg-fg-16 px-2 text-[10px] leading-none text-fg-emphasis"
|
|
66
|
+
style={{ top: 38 + b.lane * 20, left: `calc(${(b.a / 7) * 100}% + 8px)`, width: `calc(${((b.b - b.a + 1) / 7) * 100}% - 16px)` }}>
|
|
67
|
+
{b.label}
|
|
68
|
+
</span>
|
|
69
|
+
))}
|
|
70
|
+
</div>
|
|
71
|
+
)
|
|
72
|
+
})}
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { toDate } from './calendarDates.js'
|
|
2
|
+
|
|
3
|
+
/* taxonomy-ok: organism — a whole calendar region: month head, phase rows, today line */
|
|
4
|
+
|
|
5
|
+
const MONTHS_SHORT = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* CalendarTimeline — A year of phases on one scale. `PHASE · Jan … Dec`, one row per phase (float-everything W11 row
|
|
9
|
+
* 158, 2026-11-04 — kol-float--style W2.11 `Timeline calendar`). On the page ground at the sheet radius: a 44 head
|
|
10
|
+
* (`label` in `kol-float-ruler` over a 172 gutter, the months in `kol-float-label`, fg-64, 11 into each column), then
|
|
11
|
+
* one 26 row per phase — its name in the gutter (`kol-float-label`, fg-64) and its bar on fg-16 (18 tall, radius 6,
|
|
12
|
+
* 4 in from its ends) placed by its dates. An `emphasis` row is the span itself: its name in `kol-float-hint` on the
|
|
13
|
+
* emphasis ink, a 7 bar on fg-64. `today` draws a 1px line of the ink down the rows. Month columns are equal; a date
|
|
14
|
+
* lands by its day within its month. No gridlines (no-borders law).
|
|
15
|
+
*
|
|
16
|
+
* @param {number} [year] the year shown (default `today`'s, else this year)
|
|
17
|
+
* @param {Array} rows `[{ label, start, end, emphasis? }]` — dates as `YYYY-MM-DD`, `end` inclusive
|
|
18
|
+
* @param {string|Date} [today]
|
|
19
|
+
* @param {string} [label] the gutter's head (default `Phase`)
|
|
20
|
+
* @param {string[]} [months] the head's words (default Jan … Dec)
|
|
21
|
+
* @param {string} [className]
|
|
22
|
+
*/
|
|
23
|
+
export default function CalendarTimeline({ year, rows = [], today, label = 'Phase', months = MONTHS_SHORT, className = '' }) {
|
|
24
|
+
const t = today ? toDate(today) : null
|
|
25
|
+
const yr = year ?? (t ?? new Date()).getFullYear()
|
|
26
|
+
/* a date as a share of the year: month index + the day within it, over 12 equal columns */
|
|
27
|
+
const at = (d, end = false) => {
|
|
28
|
+
if (d.getFullYear() < yr) return 0
|
|
29
|
+
if (d.getFullYear() > yr) return 1
|
|
30
|
+
const dim = new Date(yr, d.getMonth() + 1, 0).getDate()
|
|
31
|
+
return (d.getMonth() + (d.getDate() - (end ? 0 : 1)) / dim) / 12
|
|
32
|
+
}
|
|
33
|
+
const pct = (f) => `${f * 100}%`
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div className={`overflow-hidden rounded-[var(--kol-float-menu-r)] bg-surface-primary pb-3 ${className}`.trim()}>
|
|
37
|
+
<div className="flex h-11 items-center">
|
|
38
|
+
<span className="kol-float-ruler w-[172px] shrink-0 pl-5 uppercase text-fg-64">{label}</span>
|
|
39
|
+
<div className="grid flex-1 grid-cols-12">
|
|
40
|
+
{months.map((m) => <span key={m} className="kol-float-label pl-[11px] text-fg-64">{m}</span>)}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
<div className="relative flex flex-col">
|
|
44
|
+
{rows.map((r, i) => {
|
|
45
|
+
const a = at(toDate(r.start))
|
|
46
|
+
const b = at(toDate(r.end ?? r.start), true)
|
|
47
|
+
return (
|
|
48
|
+
<div key={i} className="flex h-[26px] items-center">
|
|
49
|
+
<span className={`w-[172px] shrink-0 truncate pl-5 ${r.emphasis ? 'kol-float-hint text-fg-emphasis' : 'kol-float-label text-fg-64'}`}>{r.label}</span>
|
|
50
|
+
<div className="relative h-full flex-1">
|
|
51
|
+
<span className={`absolute top-1/2 -translate-y-1/2 ${r.emphasis ? 'h-[7px] rounded-[4px] bg-fg-64' : 'h-[18px] rounded-[6px] bg-fg-16'}`}
|
|
52
|
+
style={{ left: `calc(${pct(a)} + 4px)`, width: `calc(${pct(b - a)} - 8px)` }} />
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
})}
|
|
57
|
+
{t && t.getFullYear() === yr && (
|
|
58
|
+
<span className="pointer-events-none absolute inset-y-0 left-[172px] right-0">
|
|
59
|
+
<span className="absolute inset-y-0 w-px bg-[var(--kol-surface-on-primary)]" style={{ left: pct(at(t)) }} />
|
|
60
|
+
</span>
|
|
61
|
+
)}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { toDate, addDays, sameDay, weekStart, WEEKDAYS } from './calendarDates.js'
|
|
2
|
+
|
|
3
|
+
/* taxonomy-ok: organism — a whole calendar region: seven day columns and the running list */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* CalendarWeek — A week as seven columns, and what runs through it. `MON 2 … SUN 8` (float-everything W11 row 160,
|
|
7
|
+
* 2026-11-04 — kol-float--style W2.11 `Week calendar`). On the page ground at the sheet radius: each column 20 in, the
|
|
8
|
+
* weekday in `kol-float-ruler` (fg-64), the date in Inter 17 under it (today on a 32 disc of the ink), the day's events
|
|
9
|
+
* as fg-16 chips on the list radius; Saturday and Sunday on fg-02. With no events, `empty` sits along the columns'
|
|
10
|
+
* foot. Under them, `running` — the phases that span the week — under its mono label: each a 92 card on
|
|
11
|
+
* `surface-secondary` (radius 16) with a 7 × 38 marker in fg-64, the name in `kol-float-body-lg`, its meta in mono, the
|
|
12
|
+
* range at the end. No gridlines (no-borders law).
|
|
13
|
+
*
|
|
14
|
+
* @param {string|Date} week any day of the week to show
|
|
15
|
+
* @param {string|Date} [today]
|
|
16
|
+
* @param {Array} [events] `[{ date, label, time? }]`
|
|
17
|
+
* @param {ReactNode} [empty] the line when no event shows
|
|
18
|
+
* @param {Array} [running] `[{ label, meta?, range? }]`
|
|
19
|
+
* @param {string} [runningLabel] default `Running this week`
|
|
20
|
+
* @param {string[]} [weekdays]
|
|
21
|
+
* @param {Function} [onSelect] `(date: Date) => void`
|
|
22
|
+
* @param {string} [className]
|
|
23
|
+
*/
|
|
24
|
+
export default function CalendarWeek({ week, today, events = [], empty, running = [], runningLabel = 'Running this week', weekdays = WEEKDAYS, onSelect, className = '' }) {
|
|
25
|
+
const ws = weekStart(toDate(week))
|
|
26
|
+
const t = today ? toDate(today) : null
|
|
27
|
+
const days = Array.from({ length: 7 }, (_, i) => addDays(ws, i))
|
|
28
|
+
const evs = events.map((e) => ({ ...e, d: toDate(e.date) }))
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className={`overflow-hidden rounded-[var(--kol-float-menu-r)] bg-surface-primary ${className}`.trim()}>
|
|
32
|
+
<div className="relative grid h-[213px] grid-cols-7">
|
|
33
|
+
{days.map((day, i) => {
|
|
34
|
+
const isToday = sameDay(day, t)
|
|
35
|
+
const list = evs.filter((e) => sameDay(e.d, day))
|
|
36
|
+
const Cell = onSelect ? 'button' : 'div'
|
|
37
|
+
return (
|
|
38
|
+
<Cell key={i} {...(onSelect ? { type: 'button', onClick: () => onSelect(day) } : {})}
|
|
39
|
+
className={`flex min-w-0 flex-col items-start gap-1.5 px-5 pt-5 text-left ${i >= 5 ? 'bg-fg-02' : ''} ${onSelect ? 'cursor-pointer focus-visible:outline-none focus-visible:shadow-[inset_var(--kol-float-focus)]' : ''}`.trim()}>
|
|
40
|
+
<span className="kol-float-ruler uppercase text-fg-64">{weekdays[i]}</span>
|
|
41
|
+
<span className={`inline-flex h-8 min-w-8 items-center justify-center rounded-full font-[family-name:var(--kol-font-family-float)] text-[17px] tabular-nums ${isToday ? '-ml-[9px] bg-[var(--kol-surface-on-primary)] text-[var(--kol-surface-primary)]' : 'justify-start text-fg-emphasis'}`}>
|
|
42
|
+
{day.getDate()}
|
|
43
|
+
</span>
|
|
44
|
+
{list.map((e, k) => (
|
|
45
|
+
<span key={k} className="kol-float-label flex w-full min-w-0 flex-col rounded-[var(--kol-float-list-r)] bg-fg-16 px-2 py-1 text-fg-emphasis">
|
|
46
|
+
{e.time && <span className="kol-float-ruler text-fg-64">{e.time}</span>}
|
|
47
|
+
<span className="truncate">{e.label}</span>
|
|
48
|
+
</span>
|
|
49
|
+
))}
|
|
50
|
+
</Cell>
|
|
51
|
+
)
|
|
52
|
+
})}
|
|
53
|
+
{empty && evs.length === 0 && <span className="kol-float-hint pointer-events-none absolute bottom-5 left-6 text-fg-64">{empty}</span>}
|
|
54
|
+
</div>
|
|
55
|
+
{running.length > 0 && (
|
|
56
|
+
<div className="flex flex-col gap-4 px-6 pb-6 pt-8">
|
|
57
|
+
<span className="kol-float-ruler uppercase text-fg-64">{runningLabel}</span>
|
|
58
|
+
{running.map((r, i) => (
|
|
59
|
+
<div key={i} className="flex h-[92px] items-center gap-4 rounded-2xl bg-surface-secondary px-5">
|
|
60
|
+
<span className="h-[38px] w-[7px] shrink-0 rounded-[4px] bg-fg-64" />
|
|
61
|
+
<span className="flex min-w-0 flex-1 flex-col gap-1">
|
|
62
|
+
<span className="kol-float-body-lg truncate text-fg-emphasis">{r.label}</span>
|
|
63
|
+
{r.meta && <span className="kol-float-ruler text-fg-64">{r.meta}</span>}
|
|
64
|
+
</span>
|
|
65
|
+
{r.range && <span className="kol-float-timecode shrink-0 text-fg-64">{r.range}</span>}
|
|
66
|
+
</div>
|
|
67
|
+
))}
|
|
68
|
+
</div>
|
|
69
|
+
)}
|
|
70
|
+
</div>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import ReadingChapterNav from '../molecules/ReadingChapterNav.jsx'
|
|
2
|
+
|
|
3
|
+
/* taxonomy-ok: organism — the reader's whole text region: position line, head, prose, chapter nav */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ReadingColumn — The text itself, set for reading (float-everything W11 row 145, 2026-11-04 — kol-float--style W2.9
|
|
7
|
+
* `Reading column`). A column `width` wide (default 760): the position line in `kol-float-ruler` (where in the book ·
|
|
8
|
+
* `125 / 297`), the eyebrow, the title in the reading face at 48 / 1.25, the standfirst in Inter 12 / 1.6 (fg-64),
|
|
9
|
+
* then `children` — the prose, 24 between blocks: paragraphs in the reading face at `size` / `leading` on fg-88, `h2`
|
|
10
|
+
* at 28 / 1.45 on the emphasis ink, a `blockquote` on the fg-04 lift at radius 12, 20 in (the quote at 26 / 1.45, its
|
|
11
|
+
* `cite` in `kol-float-label`), `ol`/`small` as notes in Inter 12 (fg-64); `ReadingHighlight` sits among them. Last the
|
|
12
|
+
* `ReadingChapterNav` from `prev` / `next`. The reading face is the reader's (`font`, default Literata — the consumer
|
|
13
|
+
* loads it; Georgia stands in); the chrome around it stays Inter and JetBrains Mono.
|
|
14
|
+
*
|
|
15
|
+
* @param {ReactNode} [position] the position line's start (`The Waves / Interlude 03`)
|
|
16
|
+
* @param {ReactNode} [page] its end (`125 / 297`)
|
|
17
|
+
* @param {ReactNode} [eyebrow] · {ReactNode} [title] · {ReactNode} [standfirst]
|
|
18
|
+
* @param {ReactNode} children the prose
|
|
19
|
+
* @param {Object} [prev] · {Object} [next] — `ReadingChapterNav`'s sides
|
|
20
|
+
* @param {string} [font] default `'Literata', Georgia, serif`
|
|
21
|
+
* @param {number} [size] px (default 22) · {number} [leading] (default 1.6) · {number} [width] px (default 760)
|
|
22
|
+
* @param {string} [className]
|
|
23
|
+
*/
|
|
24
|
+
export default function ReadingColumn({ position, page, eyebrow, title, standfirst, children, prev, next, font = "'Literata', Georgia, serif", size = 22, leading = 1.6, width = 760, className = '' }) {
|
|
25
|
+
return (
|
|
26
|
+
<article className={`mx-auto flex w-full flex-col gap-6 ${className}`.trim()} style={{ maxWidth: width, '--reading-font': font, '--reading-size': `${size}px`, '--reading-leading': leading }}>
|
|
27
|
+
{(position || page) && (
|
|
28
|
+
<div className="flex items-baseline justify-between gap-4">
|
|
29
|
+
<span className="kol-float-ruler truncate uppercase text-fg-64">{position}</span>
|
|
30
|
+
{page && <span className="kol-float-ruler shrink-0 text-[11px] tabular-nums text-fg-64">{page}</span>}
|
|
31
|
+
</div>
|
|
32
|
+
)}
|
|
33
|
+
{eyebrow && <span className="kol-float-ruler mt-4 uppercase text-fg-64">{eyebrow}</span>}
|
|
34
|
+
{title && <h1 className="m-0 -mt-2 text-[48px] font-normal leading-[1.25] text-fg-emphasis [font-family:var(--reading-font)]">{title}</h1>}
|
|
35
|
+
{standfirst && <p className="m-0 font-[family-name:var(--kol-font-family-float)] text-[12px] leading-[1.6] text-fg-64">{standfirst}</p>}
|
|
36
|
+
<div className="flex flex-col gap-6 [&_p]:m-0 [&_p]:text-[length:var(--reading-size)] [&_p]:leading-[var(--reading-leading)] [&_p]:[color:var(--kol-fg-88)] [&_p]:[font-family:var(--reading-font)] [&_h2]:m-0 [&_h2]:mt-2 [&_h2]:text-[28px] [&_h2]:font-normal [&_h2]:leading-[1.45] [&_h2]:[color:var(--kol-fg-emphasis)] [&_h2]:[font-family:var(--reading-font)] [&_blockquote]:m-0 [&_blockquote]:flex [&_blockquote]:flex-col [&_blockquote]:gap-4 [&_blockquote]:rounded-xl [&_blockquote]:[background:var(--kol-fg-04)] [&_blockquote]:p-5 [&_blockquote_p]:text-[26px] [&_blockquote_p]:leading-[1.45] [&_blockquote_p]:[color:var(--kol-fg-emphasis)] [&_cite]:font-[family-name:var(--kol-font-family-float)] [&_cite]:text-[11px] [&_cite]:leading-4 [&_cite]:not-italic [&_cite]:[color:var(--kol-fg-64)] [&_small]:font-[family-name:var(--kol-font-family-float)] [&_small]:text-[12px] [&_small]:leading-[1.6] [&_small]:[color:var(--kol-fg-64)]">
|
|
37
|
+
{children}
|
|
38
|
+
</div>
|
|
39
|
+
{(prev || next) && <ReadingChapterNav prev={prev} next={next} className="mt-2" />}
|
|
40
|
+
</article>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Button from '../atoms/Button.jsx'
|
|
2
|
+
import ProgressBar from '../atoms/ProgressBar.jsx'
|
|
3
|
+
import TocRow from '../molecules/TocRow.jsx'
|
|
4
|
+
|
|
5
|
+
/* taxonomy-ok: organism — the reader's contents sheet: book head, TocRow list, progress */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ReadingContents — The book's contents, where the reader is in them, and how far through. `Contents · The Waves ·
|
|
9
|
+
* 01 First interlude … · Through the book 42%` (float-everything W11 row 149, 2026-11-04 — kol-float--style W2.9
|
|
10
|
+
* `Contents panel`). A 304 sheet on `surface-secondary` at the sheet radius, 20 in: `Contents` in `kol-float-body-lg`
|
|
11
|
+
* with the fold ⌃, the book in `kol-float-section` over its author (`kol-float-hint`, fg-64), the count in
|
|
12
|
+
* `kol-float-ruler`, then one `TocRow` per chapter (numbered, `current` lifted fg-16), then the progress line —
|
|
13
|
+
* `Through the book` and the share in mono over the float ProgressBar (4px) — and the save state.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} [title] default `Contents`
|
|
16
|
+
* @param {ReactNode} [book] · {ReactNode} [author] · {ReactNode} [count] `9 interludes`
|
|
17
|
+
* @param {Array} chapters `[{ id, label, href? }]`
|
|
18
|
+
* @param {string} [current] the id the reader is in
|
|
19
|
+
* @param {Function} [onSelect] `(id) => void`
|
|
20
|
+
* @param {number} [progress] 0–100; unset, no progress line
|
|
21
|
+
* @param {string} [progressLabel] default `Through the book`
|
|
22
|
+
* @param {ReactNode} [status] `Reading position saved`
|
|
23
|
+
* @param {Function} [onFold]
|
|
24
|
+
* @param {number} [width] default 304
|
|
25
|
+
* @param {string} [className]
|
|
26
|
+
*/
|
|
27
|
+
export default function ReadingContents({ title = 'Contents', book, author, count, chapters = [], current, onSelect, progress, progressLabel = 'Through the book', status, onFold, width = 304, className = '' }) {
|
|
28
|
+
return (
|
|
29
|
+
<aside className={`flex flex-col rounded-[var(--kol-float-menu-r)] bg-surface-secondary p-5 ${className}`.trim()} style={{ width }} aria-label={title}>
|
|
30
|
+
<div className="flex h-7 items-center justify-between">
|
|
31
|
+
<span className="kol-float-body-lg text-fg-emphasis">{title}</span>
|
|
32
|
+
{onFold && <Button variant="float" tone="ghost" size="sm" iconOnly="chevron-up" aria-label="Fold" onClick={onFold} className="-mr-1.5" />}
|
|
33
|
+
</div>
|
|
34
|
+
{book && <span className="kol-float-section mt-8 text-fg-emphasis">{book}</span>}
|
|
35
|
+
{author && <span className="kol-float-hint mt-1 text-fg-64">{author}</span>}
|
|
36
|
+
{count && <span className="kol-float-ruler mt-6 uppercase text-fg-64">{count}</span>}
|
|
37
|
+
<nav className="-mx-2 mt-3 flex flex-col gap-1" aria-label={title}>
|
|
38
|
+
{chapters.map((c, i) => (
|
|
39
|
+
<TocRow key={c.id} number={i + 1} label={c.label} href={c.href} current={c.id === current} onClick={onSelect ? () => onSelect(c.id) : undefined} className="h-9" />
|
|
40
|
+
))}
|
|
41
|
+
</nav>
|
|
42
|
+
{progress != null && (
|
|
43
|
+
<div className="mt-6 flex flex-col gap-3">
|
|
44
|
+
<div className="flex items-center justify-between">
|
|
45
|
+
<span className="kol-float-hint text-fg-64">{progressLabel}</span>
|
|
46
|
+
<span className="kol-float-timecode tabular-nums text-fg-emphasis">{Math.round(progress)}%</span>
|
|
47
|
+
</div>
|
|
48
|
+
<ProgressBar variant="float" value={progress} ariaLabel={progressLabel} />
|
|
49
|
+
</div>
|
|
50
|
+
)}
|
|
51
|
+
{status && <span className="kol-float-label mt-5 text-fg-64">{status}</span>}
|
|
52
|
+
</aside>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import Button from '../atoms/Button.jsx'
|
|
2
|
+
import Tag from '../atoms/Tag.jsx'
|
|
3
|
+
import ProgressBar from '../atoms/ProgressBar.jsx'
|
|
4
|
+
import { floatSurfaceClass } from '../utilities/tone.js'
|
|
5
|
+
|
|
6
|
+
/* taxonomy-ok: organism — the book's page: cover, metadata, the saved place, the two ways in */
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ReadingOverview — A book before you open it: cover, what it is, and where you left it (float-everything W11 row 152,
|
|
10
|
+
* 2026-11-04 — kol-float--style W2.9 `Book overview`). The way back as a quiet float capsule over two columns: the
|
|
11
|
+
* `cover` (300 × 420, the consumer's image) and, 52 off it, the title in the reading face at 52 / 1.45, the author in
|
|
12
|
+
* `kol-float-window` (fg-64), the metadata as float Tags (md, 12 apart), the description in `kol-float-body-lg` (fg-64),
|
|
13
|
+
* the saved place as a card on `surface-secondary` at the sheet radius (24 in: `kol-float-ruler` label, the chapter in
|
|
14
|
+
* `kol-float-window`, the page line and share over the float ProgressBar), then `Resume reading →` as the inverted lg
|
|
15
|
+
* capsule beside the secondary one on the float's solid ground (it sits on the page, not a sheet). Stacks under the cover on a phone.
|
|
16
|
+
*
|
|
17
|
+
* @param {Function} [onBack] · {string} [backLabel] default `Back to my library`
|
|
18
|
+
* @param {ReactNode} [cover]
|
|
19
|
+
* @param {ReactNode} title · {ReactNode} [author]
|
|
20
|
+
* @param {string[]} [meta] `['Fiction', 'EPUB', 'Reading']`
|
|
21
|
+
* @param {ReactNode} [description]
|
|
22
|
+
* @param {Object} [place] `{ label?, title, line, progress }` — label default `Your place`, `line` `Page 125 of 297`, progress 0–100
|
|
23
|
+
* @param {Function} [onResume] · {string} [resumeLabel] default `Resume reading`
|
|
24
|
+
* @param {Function} [onCollect] · {string} [collectLabel] default `Add to collection`
|
|
25
|
+
* @param {string} [font] the title's face (default `'Literata', Georgia, serif`)
|
|
26
|
+
* @param {string} [className]
|
|
27
|
+
*/
|
|
28
|
+
export default function ReadingOverview({ onBack, backLabel = 'Back to my library', cover, title, author, meta = [], description, place, onResume, resumeLabel = 'Resume reading', onCollect, collectLabel = 'Add to collection', font = "'Literata', Georgia, serif", className = '' }) {
|
|
29
|
+
return (
|
|
30
|
+
<section className={`flex flex-col gap-8 ${className}`.trim()}>
|
|
31
|
+
{onBack && <Button variant="float" tone="ghost" size="sm" iconLeft="arrow-left" onClick={onBack} className="-ml-3 self-start">{backLabel}</Button>}
|
|
32
|
+
<div className="flex flex-col gap-8 md:flex-row md:gap-[52px]">
|
|
33
|
+
{cover && <div className="aspect-[300/420] w-full max-w-[300px] shrink-0 self-start overflow-hidden rounded-sm">{cover}</div>}
|
|
34
|
+
<div className="flex min-w-0 flex-1 flex-col">
|
|
35
|
+
<h1 className="m-0 text-[52px] font-normal leading-[1.45] text-fg-emphasis" style={{ fontFamily: font }}>{title}</h1>
|
|
36
|
+
{author && <span className="kol-float-window mt-3 font-normal text-fg-64">{author}</span>}
|
|
37
|
+
{meta.length > 0 && <div className="mt-5 flex flex-wrap gap-3">{meta.map((m) => <Tag key={m} variant="float" size="md" hash={false}>{m}</Tag>)}</div>}
|
|
38
|
+
{description && <p className="kol-float-body-lg m-0 mt-6 text-fg-64">{description}</p>}
|
|
39
|
+
{place && (
|
|
40
|
+
<div className="mt-10 flex flex-col rounded-[var(--kol-float-menu-r)] bg-surface-secondary px-6 py-4">
|
|
41
|
+
<span className="kol-float-ruler uppercase text-fg-64">{place.label ?? 'Your place'}</span>
|
|
42
|
+
<span className="kol-float-window mt-2 font-normal text-fg-emphasis">{place.title}</span>
|
|
43
|
+
<div className="mt-2 flex items-center justify-between">
|
|
44
|
+
<span className="kol-float-hint text-fg-64">{place.line}</span>
|
|
45
|
+
{place.progress != null && <span className="kol-float-timecode tabular-nums text-fg-emphasis">{Math.round(place.progress)}%</span>}
|
|
46
|
+
</div>
|
|
47
|
+
{place.progress != null && <ProgressBar variant="float" value={place.progress} ariaLabel={place.label ?? 'Your place'} className="mt-2" />}
|
|
48
|
+
</div>
|
|
49
|
+
)}
|
|
50
|
+
{(onResume || onCollect) && (
|
|
51
|
+
<div className="mt-5 flex flex-wrap gap-4">
|
|
52
|
+
{onResume && <Button variant="float" tone="inverted" size="lg" iconRight="arrow-right" onClick={onResume}>{resumeLabel}</Button>}
|
|
53
|
+
{onCollect && <Button variant="float" tone="secondary" size="lg" onClick={onCollect} className={floatSurfaceClass('solid')}>{collectLabel}</Button>}
|
|
54
|
+
</div>
|
|
55
|
+
)}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</section>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Button from '../atoms/Button.jsx'
|
|
2
|
+
import TabsRow from '../molecules/TabsRow.jsx'
|
|
3
|
+
|
|
4
|
+
/* taxonomy-ok: organism — the reader's side sheet: header, fold, chip track, body */
|
|
5
|
+
|
|
6
|
+
const TRACK = 'w-full rounded-full bg-[var(--kol-float-well)] p-1 [&>button]:flex-1 [&>button]:justify-center'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ReadingPanel — The reader's side sheet: Notes and Reading behind one track (float-everything W11 rows 150 · 151,
|
|
10
|
+
* 2026-11-04 — kol-float--style W2.9 `Contextual reading panel`). A 320 sheet on `surface-secondary` at the sheet
|
|
11
|
+
* radius (`--kol-float-menu-r`), 20 in: the title in `kol-float-body-lg` with the fold ⌃ (a quiet float round) at the
|
|
12
|
+
* end, the float chip track under it (fg-16 on the well, the halves equal), then the body — `ReadingNotes` or
|
|
13
|
+
* `ReadingSettings` as `children`. No hairline edge.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} [title] default `Reading panel`
|
|
16
|
+
* @param {Array} [tabs] `[{ value, label }]` (default Notes · Reading)
|
|
17
|
+
* @param {string} [tab] · {Function} [onTab] `(value) => void`
|
|
18
|
+
* @param {Function} [onFold] the ⌃ press; unset, none
|
|
19
|
+
* @param {ReactNode} children the open side's body
|
|
20
|
+
* @param {number} [width] default 320
|
|
21
|
+
* @param {string} [className]
|
|
22
|
+
*/
|
|
23
|
+
const TABS = [{ value: 'notes', label: 'Notes' }, { value: 'reading', label: 'Reading' }]
|
|
24
|
+
|
|
25
|
+
export default function ReadingPanel({ title = 'Reading panel', tabs = TABS, tab = 'notes', onTab, onFold, children, width = 320, className = '' }) {
|
|
26
|
+
return (
|
|
27
|
+
<aside className={`flex flex-col rounded-[var(--kol-float-menu-r)] bg-surface-secondary p-5 ${className}`.trim()} style={{ width }} aria-label={title}>
|
|
28
|
+
<div className="flex h-7 items-center justify-between">
|
|
29
|
+
<span className="kol-float-body-lg text-fg-emphasis">{title}</span>
|
|
30
|
+
{onFold && <Button variant="float" tone="ghost" size="sm" iconOnly="chevron-up" aria-label="Fold" onClick={onFold} className="-mr-1.5" />}
|
|
31
|
+
</div>
|
|
32
|
+
<TabsRow variant="float" size="xs" overflow="wrap" tabs={tabs} value={tab} onChange={onTab} ariaLabel={title} className={`mt-4 ${TRACK}`} />
|
|
33
|
+
<div className="mt-6">{children}</div>
|
|
34
|
+
</aside>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* calendarDates — the four Calendar views' date arithmetic (float-everything W11, 2026-11-04). Dates are local
|
|
2
|
+
* `YYYY-MM-DD` strings or Date objects; weeks start on Monday. Not exported from the package. */
|
|
3
|
+
|
|
4
|
+
export const toDate = (d) => {
|
|
5
|
+
if (d instanceof Date) return new Date(d.getFullYear(), d.getMonth(), d.getDate())
|
|
6
|
+
const [y, m, day] = String(d).split('-').map(Number)
|
|
7
|
+
return new Date(y, (m || 1) - 1, day || 1)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const addDays = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n)
|
|
11
|
+
|
|
12
|
+
export const sameDay = (a, b) => a && b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate()
|
|
13
|
+
|
|
14
|
+
/** Monday of the week holding `d` */
|
|
15
|
+
export const weekStart = (d) => addDays(d, -((d.getDay() + 6) % 7))
|
|
16
|
+
|
|
17
|
+
/** whole days from a to b */
|
|
18
|
+
export const daysBetween = (a, b) => Math.round((b - a) / 86400000)
|
|
19
|
+
|
|
20
|
+
export const WEEKDAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
|
21
|
+
export const MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
|
22
|
+
|
|
23
|
+
/** `HH:MM` → hours as a number */
|
|
24
|
+
export const toHours = (t) => { const [h, m = 0] = String(t).split(':').map(Number); return h + m / 60 }
|