@kolkrabbi/kol-component 0.375.0 → 0.377.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/ToggleSwitch.jsx +10 -0
- package/src/index.js +9 -1
- package/src/molecules/ButtonGroup.jsx +5 -1
- package/src/molecules/ButtonSplit.jsx +63 -0
- package/src/molecules/Header.jsx +96 -0
- package/src/molecules/MenuFloat.jsx +164 -0
- package/src/molecules/Modal.jsx +18 -26
- package/src/molecules/ModalHeader.jsx +5 -14
- package/src/molecules/QuickLookFrame.jsx +4 -3
- package/src/molecules/RailFloat.jsx +30 -23
- package/src/molecules/RailHeader.jsx +10 -33
- package/src/molecules/SettingsControls.jsx +100 -155
- package/src/molecules/Slider.jsx +32 -8
- package/src/organisms/NavRailFloat.jsx +9 -14
- package/src/organisms/ReadingContents.jsx +1 -1
- package/src/organisms/ReadingPanel.jsx +8 -9
|
@@ -14,7 +14,7 @@ import { floatMotion } from '../utilities/motion.js'
|
|
|
14
14
|
* 2026-11-04 — kol-float--style 48:4015 expanded, 48:4277 rail). Its own path: none of the app rail's grab, drag or
|
|
15
15
|
* width token. Two states, the rail's words — EXPANDED (264) and COLLAPSED (72):
|
|
16
16
|
*
|
|
17
|
-
* expanded the switcher row (glyph · title ·
|
|
17
|
+
* expanded the switcher row — Header variant="nav" (glyph · title · ⌄ 12, or your `switcher`) · the search capsule (`Search pages ⌘K`) · the
|
|
18
18
|
* tree: a `{ heading }` entry opens a group, a float `LabeledControlSection` whose label is the heading
|
|
19
19
|
* (`kol-float-ruler`, fg-64, as authored) over the items under it; an item a
|
|
20
20
|
* `TreeRow size="lg"` (40 · 18 glyph · Inter 13 · count · chevron), its `sub` rows `TreeRow size="sm"`
|
|
@@ -39,9 +39,10 @@ import { floatMotion } from '../utilities/motion.js'
|
|
|
39
39
|
* @param {ReactNode} [footer]
|
|
40
40
|
* @param {Function} [onItemHover] collapsed only: `(item, element)` when the pointer enters a slot, `(null, null)` when it
|
|
41
41
|
* leaves — the seam a hover flyout hangs off (kol-shell's RailFlyout, FloatLayout 2026-11-04)
|
|
42
|
-
* @param {boolean} [
|
|
43
|
-
* RailFloat's pill — `title` and ⌄ at the expanded width — apart from its
|
|
44
|
-
* and its hide. `
|
|
42
|
+
* @param {boolean} [collapsibleV] the collapse-v chevron beside the switcher row (plan-2026-11-12-one-header W2.1): the rail
|
|
43
|
+
* collapses up to RailFloat's pill — `title` and ⌄ at the expanded width — apart from its
|
|
44
|
+
* 72 collapse and its hide. `collapsedV` controlled, `defaultCollapsedV` uncontrolled,
|
|
45
|
+
* `onCollapseV(collapsedV)`. Deprecated aliases: `foldable` · `folded` · `defaultFolded` · `onFold`
|
|
45
46
|
* @param {boolean|Object} [motion=true] expand ↔ collapse eases the width and fades the new rows in, and the slots and rows ease
|
|
46
47
|
* their hover (`.kol-float-rail`, FloatActionStatesAndMotion 2026-11-04): `true` the
|
|
47
48
|
* `--kol-float-*` tokens · `false` none · `{ duration, ease }` per app. Hide and show are
|
|
@@ -56,7 +57,7 @@ const groupsOf = (items) => {
|
|
|
56
57
|
return out[0].items.length ? out : out.slice(1)
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
export default function NavRailFloat({ items = [], currentPath = '', onNavigate, collapsed = false, onCollapsedChange, title, icon = 'grid', onSwitch, switcher, onSearch, onHide, defaultExpanded = [], footer, onItemHover, motion = true,
|
|
60
|
+
export default function NavRailFloat({ items = [], currentPath = '', onNavigate, collapsed = false, onCollapsedChange, title, icon = 'grid', onSwitch, switcher, onSearch, onHide, defaultExpanded = [], footer, onItemHover, motion = true, collapsibleV, collapsedV, defaultCollapsedV, onCollapseV, foldable, folded, defaultFolded, onFold, className = '' }) {
|
|
60
61
|
const motionStyle = floatMotion(motion).style
|
|
61
62
|
const [open, setOpen] = useState(() => new Set(defaultExpanded))
|
|
62
63
|
const toggle = (path) => setOpen((s) => { const n = new Set(s); n.has(path) ? n.delete(path) : n.add(path); return n })
|
|
@@ -99,16 +100,10 @@ export default function NavRailFloat({ items = [], currentPath = '', onNavigate,
|
|
|
99
100
|
|
|
100
101
|
return (
|
|
101
102
|
<RailFloat as="nav" aria-label="Navigation" inset="sm" width="var(--kol-shell-float-rail-open, 264px)" style={motionStyle}
|
|
102
|
-
|
|
103
|
+
headerVariant="nav" icon={icon} onSwitch={onSwitch} title={title} head={switcher}
|
|
104
|
+
collapsibleV={collapsibleV ?? foldable} collapsedV={collapsedV ?? folded} defaultCollapsedV={defaultCollapsedV ?? defaultFolded} onCollapseV={onCollapseV ?? onFold}
|
|
103
105
|
bodyClassName="!gap-3" className={`kol-float-rail h-full !gap-3 ${className}`.trim()}
|
|
104
|
-
footer={footer && <div className="flex shrink-0 flex-col gap-2">{footer}</div>}
|
|
105
|
-
head={switcher ?? (title && (
|
|
106
|
-
<button type="button" onClick={onSwitch} className="flex h-10 w-full items-center gap-2.5 rounded-[var(--kol-float-list-r)] px-2.5 text-left cursor-pointer hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
|
|
107
|
-
<IconLoader name={icon} size={18} className="shrink-0 text-oq-96" />
|
|
108
|
-
<span className="kol-float-body-lg min-w-0 flex-1 truncate text-fg-emphasis">{title}</span>
|
|
109
|
-
{onSwitch && <IconLoader name="chevron-down" size="var(--kol-float-chev-lg)" className="shrink-0 text-oq-64" />}
|
|
110
|
-
</button>
|
|
111
|
-
))}>
|
|
106
|
+
footer={footer && <div className="flex shrink-0 flex-col gap-2">{footer}</div>}>
|
|
112
107
|
{onSearch && (
|
|
113
108
|
<button type="button" onClick={onSearch} className="flex h-[var(--kol-float-h-md)] w-full items-center gap-2.5 rounded-full bg-[var(--kol-float-well)] px-3 text-left cursor-pointer hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
|
|
114
109
|
<IconLoader name="search" size={16} className="shrink-0 text-oq-64" />
|
|
@@ -11,7 +11,7 @@ import { LabeledControlSection } from './SettingsPanel.jsx'
|
|
|
11
11
|
* own. It goes in a `RailFloat`'s body, the module carrying the title (`Contents`), the fold and the status line in its
|
|
12
12
|
* footer:
|
|
13
13
|
*
|
|
14
|
-
* <RailFloat title="Contents"
|
|
14
|
+
* <RailFloat title="Contents" collapsibleV footer={<span className="kol-float-label text-fg-64">Reading position saved</span>}>
|
|
15
15
|
* <ReadingContents book="The Waves" author="Virginia Woolf" count="9 interludes" chapters={chapters} … />
|
|
16
16
|
* </RailFloat>
|
|
17
17
|
*
|
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Header from '../molecules/Header.jsx'
|
|
2
2
|
import TabsRow from '../molecules/TabsRow.jsx'
|
|
3
3
|
|
|
4
|
-
/* taxonomy-ok: organism — the reader's side sheet: header,
|
|
4
|
+
/* taxonomy-ok: organism — the reader's side sheet: header, collapse-v, chip track, body */
|
|
5
5
|
|
|
6
6
|
const TRACK = 'w-full rounded-full bg-[var(--kol-float-well)] p-1 [&>button]:flex-1 [&>button]:justify-center'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* ReadingPanel — The reader's side sheet: Notes and Reading behind one track (float-everything W11 rows 150 · 151,
|
|
10
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
|
|
11
|
+
* radius (`--kol-float-menu-r`), 20 in: `Header variant="property"` — the title in `kol-float-body-lg` with the collapse-v ⌃ (12) at the
|
|
12
12
|
* end, the float chip track under it (fg-16 on the well, the halves equal), then the body — `ReadingNotes` or
|
|
13
13
|
* `ReadingSettings` as `children`. No hairline edge.
|
|
14
14
|
*
|
|
15
15
|
* @param {string} [title] default `Reading panel`
|
|
16
16
|
* @param {Array} [tabs] `[{ value, label }]` (default Notes · Reading)
|
|
17
17
|
* @param {string} [tab] · {Function} [onTab] `(value) => void`
|
|
18
|
-
* @param {Function} [
|
|
18
|
+
* @param {Function} [onCollapseV] the ⌃ press (collapse-v); unset, none. `onFold` is its deprecated alias
|
|
19
19
|
* @param {ReactNode} children the open side's body
|
|
20
20
|
* @param {number} [width] default 320
|
|
21
21
|
* @param {string} [className]
|
|
22
22
|
*/
|
|
23
23
|
const TABS = [{ value: 'notes', label: 'Notes' }, { value: 'reading', label: 'Reading' }]
|
|
24
24
|
|
|
25
|
-
export default function ReadingPanel({ title = 'Reading panel', tabs = TABS, tab = 'notes', onTab, onFold, children, width = 320, className = '' }) {
|
|
25
|
+
export default function ReadingPanel({ title = 'Reading panel', tabs = TABS, tab = 'notes', onTab, onCollapseV, onFold, children, width = 320, className = '' }) {
|
|
26
26
|
return (
|
|
27
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</div>
|
|
28
|
+
{/* the one Header (property), its collapse-v chevron the 12 token (plan-2026-11-12-one-header W1.1 leftover); the title
|
|
29
|
+
* keeps its body-lg face as the title slot */}
|
|
30
|
+
<Header variant="property" title={<span className="kol-float-body-lg text-fg-emphasis truncate">{title}</span>} onCollapseV={onCollapseV ?? onFold} className="h-7 [&>span:last-child]:-mr-1.5" />
|
|
32
31
|
<TabsRow variant="float" size="xs" overflow="wrap" tabs={tabs} value={tab} onChange={onTab} ariaLabel={title} className={`mt-4 ${TRACK}`} />
|
|
33
32
|
<div className="mt-6">{children}</div>
|
|
34
33
|
</aside>
|