@kolkrabbi/kol-component 0.372.0 → 0.373.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-component",
3
- "version": "0.372.0",
3
+ "version": "0.373.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -33,8 +33,8 @@
33
33
  "pdfjs-dist": "^6.3.289",
34
34
  "react-syntax-highlighter": "^16.1.1",
35
35
  "@kolkrabbi/kol-search": "^0.3.0",
36
- "@kolkrabbi/kol-markdown": "^0.2.0",
37
- "@kolkrabbi/kol-growth": "^0.5.0"
36
+ "@kolkrabbi/kol-growth": "^0.5.0",
37
+ "@kolkrabbi/kol-markdown": "^0.2.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@kolkrabbi/kol-icons": ">=0.69.0",
package/src/index.js CHANGED
@@ -51,7 +51,7 @@ export { default as BackgroundVideo, default as HlsVideo } from './utilities/Bac
51
51
  export { default as Input } from './atoms/Input.jsx'
52
52
  export { default as Label } from './atoms/Label.jsx'
53
53
  export { default as LabeledControl } from './molecules/LabeledControl.jsx'
54
- export { default as FloatModule } from './molecules/FloatModule.jsx'
54
+ export { default as RailFloat, default as FloatModule } from './molecules/RailFloat.jsx'
55
55
  export { default as FloatModuleHeader } from './molecules/FloatModuleHeader.jsx'
56
56
  export { default as OverlayGlassPanel } from './utilities/OverlayGlassPanel.jsx'
57
57
  export { default as Pill } from './atoms/Pill.jsx'
@@ -286,7 +286,8 @@ export { default as SettingsSections } from './organisms/SettingsSections.jsx'
286
286
  /* the rail kit (RailKit, kol-monitor 2026-10-24): the parts a Rail's content is built from. Its sections and rows are
287
287
  * LabeledControlSection and SettingsRow. @deprecated 2026-11-08: the RailSection / RailRow aliases below are retired by
288
288
  * the user's ruling ("I always called it labeledControl and LabeledControlSection… I never approved the rename") */
289
- export { RailHeader, RailTabs, RailHint, RailActions, RailFoot, RailNav } from './organisms/RailKit.jsx'
289
+ export { default as RailHeader } from './molecules/RailHeader.jsx'
290
+ export { RailTabs, RailHint, RailActions, RailFoot, RailNav } from './organisms/RailKit.jsx'
290
291
  export { LabeledControlSection as RailSection, SettingsRow as RailRow } from './organisms/SettingsPanel.jsx'
291
292
  export { default as SectionNewsletter } from './organisms/SectionNewsletter.jsx'
292
293
  export { default as NewsletterBand } from './organisms/NewsletterBand.jsx'
@@ -1,34 +1,11 @@
1
- import { isValidElement } from 'react'
2
- import Button from '../atoms/Button.jsx'
3
-
4
- /* taxonomy-ok: molecule — the title, an actions slot and the fold Button (atom); FloatModule's header slot */
5
-
6
1
  /**
7
- * FloatModuleHeader — A float module's header: the title, an `actions` slot and the fold ⌃ / ⌄ (plan-2026-11-12-float-rails-figma
8
- * W4.1; the user: *"why is header not component?"*). FloatModule's `header` slot defaults to it, open and folded alike: the
9
- * same header, the module hides its body and footer around it. A row, the title filling it and truncating
10
- * (`kol-float-panel`, the emphasis ink), then `end`: the actions and the fold, 4 apart, 8 off the title.
11
- *
12
- * The fold is a float ghost sm Button whose glyph is the 12 chevron token (`--kol-float-chev-sm`, 14 on touch), the
13
- * Dropdown's and the layer rows' chevron, never the float button's 18 glyph (P15 *"USE 12px chevron"*): the button sets
14
- * its own `--kol-float-ic` to the chevron token, so the float button's glyph rule draws 12. Each part renders
15
- * only when given: no `onFold`, no fold; no `actions`, no slot.
16
- *
17
- * @param {ReactNode} [title] text takes the panel role; an element (NavRail float's switcher row) goes in as it is
18
- * @param {ReactNode} [actions] buttons before the fold (expand, collapse)
19
- * @param {boolean} [folded] the fold's state: ⌄ (Open) when folded, ⌃ (Fold) when open
20
- * @param {Function} [onFold] the fold's press; unset, no fold
21
- * @param {string} [className]
2
+ * @deprecated 2026-11-12 — `FloatModuleHeader` is `RailHeader variant="float"` under its old name (the family word leads).
3
+ * Drops when nobody imports it (04-retirements.md).
22
4
  */
23
- export default function FloatModuleHeader({ title, actions, folded = false, onFold, className = '' }) {
24
- const fold = onFold && (
25
- <Button variant="float" tone="ghost" size="sm" iconOnly={folded ? 'chevron-down' : 'chevron-up'} className="[--kol-float-ic:var(--kol-float-chev-sm)]"
26
- aria-label={folded ? 'Open' : 'Fold'} aria-expanded={!folded} onClick={onFold} />
27
- )
28
- return (
29
- <div data-float-module-header="" className={`flex w-full min-w-0 shrink-0 items-center justify-between gap-2 ${className}`.trim()}>
30
- {title != null && title !== false && (isValidElement(title) ? title : <span className="kol-float-panel text-emphasis min-w-0 flex-1 truncate">{title}</span>)}
31
- {(actions || fold) && <span className="ml-auto flex shrink-0 items-center gap-1">{actions}{fold}</span>}
32
- </div>
33
- )
5
+ import RailHeader from './RailHeader.jsx'
6
+
7
+ /* taxonomy-ok: molecule — the deprecated name of RailHeader variant="float" */
8
+
9
+ export default function FloatModuleHeader(props) {
10
+ return <RailHeader variant="float" {...props} />
34
11
  }
@@ -5,7 +5,7 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
5
5
 
6
6
  /* taxonomy-ok: molecule — Avatar (atom) or kol-icons's IconLoader, a title and trailing actions on Button's nav row; the window row nests Button (atom) + CloseButton (molecule) */
7
7
 
8
- /* class-for-class MoreRows' avatar row (menu-system W4.1, 2026-11-07): the nav Button's lg row, `kol-btn-float` on the float */
8
+ /* class-for-class MenuFloatRows' avatar row (menu-system W4.1, 2026-11-07): the nav Button's lg row, `kol-btn-float` on the float */
9
9
  const ROW = { float: 'w-full justify-start kol-btn-float', default: 'w-full justify-start h-11 gap-3' }
10
10
  /* the classes Button emits for `variant="nav" size="lg"` — the static header draws the same row without the press */
11
11
  const NAV_LG = 'kol-btn kol-btn-nav kol-btn-lg kol-mono-16'
@@ -18,7 +18,7 @@ const WINDOW = ['meta', 'nav', 'onMinimise', 'onClose']
18
18
  * User 2026-11-07: *"why not just modalheader?"*; 2026-11-08: *"are you both accounting for default and float?"* — the
19
19
  * window row that was QuickLookHeader folded in, class for class (QuickLookHeader is its deprecated alias).
20
20
  *
21
- * THE MENU ROW (MoreRows' account row, PanelsMenu's title) — an avatar or a glyph, the title, trailing `actions`. With
21
+ * THE MENU ROW (MenuFloatRows' account row, PanelsMenu's title) — an avatar or a glyph, the title, trailing `actions`. With
22
22
  * `onClick` the row is the pressable nav Button; without, the same row as a heading that takes no press. Drawn when
23
23
  * `avatar` or `onClick` is set, or when no window control is passed.
24
24
  *
@@ -1,15 +1,15 @@
1
1
  import { useState } from 'react'
2
- import FloatModuleHeader from './FloatModuleHeader.jsx'
2
+ import RailHeader from './RailHeader.jsx'
3
3
  import { floatSurfaceClass } from '../utilities/tone.js'
4
4
 
5
- /* taxonomy-ok: molecule — FloatModuleHeader (molecule) in the header slot over a body and a footer slot; the float module every float Rail is drawn on */
5
+ /* taxonomy-ok: molecule — RailHeader (molecule) in the header slot over a body and a footer slot; the float module every float Rail is drawn on */
6
6
 
7
7
  /**
8
- * FloatModule — the one float Rail shell (plan-2026-11-12-float-system W4.1; the user: *"why arent all rails in the same
8
+ * RailFloat (was `FloatModule`, renamed 2026-11-12; the old name stays a deprecated alias) — the one float Rail shell (plan-2026-11-12-float-system W4.1; the user: *"why arent all rails in the same
9
9
  * shell? also the floating nav?? because it should ALSO have a collapsed state"*). Three slots on the float surface at the
10
10
  * sheet radius (plan-2026-11-12-float-rails-figma W4.1, his approved tree):
11
11
  *
12
- * header `header`, default a `FloatModuleHeader` (the title, `actions`, the fold); renders when any of them is given
12
+ * header `header`, default a `RailHeader` (the title, `actions`, the fold); renders when any of them is given
13
13
  * body the children, scrolling under the header with its scrollbar hidden
14
14
  * footer `footer`, after the body, outside its scroll; renders only when given
15
15
  *
@@ -22,7 +22,7 @@ import { floatSurfaceClass } from '../utilities/tone.js'
22
22
  * `--kol-float-module-w` (`wide` `--kol-float-module-w-wide`), the radius `--kol-float-menu-r`, the rows
23
23
  * `--kol-float-module-gap` (`compact` spacing-2), the fold `--kol-float-fold-h`.
24
24
  *
25
- * @param {ReactNode} [header] the header slot; unset, a FloatModuleHeader of `title` · `head` · `actions` · the fold
25
+ * @param {ReactNode} [header] the header slot; unset, a RailHeader of `title` · `head` · `actions` · the fold
26
26
  * @param {ReactNode} [title] the header's title, and the folded pill's
27
27
  * @param {ReactNode} [head] replaces the title in the open header (NavRail's switcher row)
28
28
  * @param {ReactNode} [actions] buttons after the title (expand, collapse), before the fold; not on the folded pill
@@ -39,7 +39,7 @@ import { floatSurfaceClass } from '../utilities/tone.js'
39
39
  */
40
40
  const INSET = { md: 'p-4', sm: 'p-3', none: '' }
41
41
 
42
- export default function FloatModule({ header, title, head, actions, foldable = false, folded, defaultFolded = false, onFold, compact = false, wide = false, width, inset = 'md', surface = 'solid', footer, as: Tag = 'section', className = '', bodyClassName = '', style, 'aria-label': ariaLabel, children }) {
42
+ export default function RailFloat({ header, title, head, actions, foldable = false, folded, defaultFolded = false, onFold, compact = false, wide = false, width, inset = 'md', surface = 'solid', footer, as: Tag = 'section', className = '', bodyClassName = '', style, 'aria-label': ariaLabel, children }) {
43
43
  const [ownFolded, setOwnFolded] = useState(defaultFolded)
44
44
  const isFolded = foldable && (folded ?? ownFolded)
45
45
  const fold = () => { const next = !isFolded; if (folded === undefined) setOwnFolded(next); onFold?.(next) }
@@ -47,7 +47,7 @@ export default function FloatModule({ header, title, head, actions, foldable = f
47
47
  const label = ariaLabel ?? (typeof title === 'string' ? title : undefined)
48
48
  const gap = compact ? 'gap-2' : 'gap-[var(--kol-float-module-gap)]'
49
49
  const headerSlot = header ?? ((head || title || actions || foldable) && (
50
- <FloatModuleHeader title={isFolded ? title : head ?? title} actions={isFolded ? undefined : actions} folded={isFolded} onFold={foldable ? fold : undefined} />
50
+ <RailHeader variant="float" title={isFolded ? title : head ?? title} actions={isFolded ? undefined : actions} folded={isFolded} onFold={foldable ? fold : undefined} />
51
51
  ))
52
52
  const shape = isFolded
53
53
  ? 'flex-row items-center rounded-full pl-4 pr-1.5'
@@ -0,0 +1,52 @@
1
+ import { isValidElement } from 'react'
2
+ import Button from '../atoms/Button.jsx'
3
+
4
+ /* taxonomy-ok: molecule — the title slot, an actions slot and the fold Button (atom); the header of every Rail */
5
+
6
+ /**
7
+ * RailHeader — A Rail's header (family-prefix rename 2026-11-12: the float one was `FloatModuleHeader`, now
8
+ * `variant="float"`; the default one is the rail kit's title line). One component, two variants:
9
+ *
10
+ * `variant="default"` (the rail kit, RailKit 2026-10-24) — title (helper-14 uppercase), a subtitle, the header's actions
11
+ * before the × (which Rail draws). The node Rail's `header` slot takes it; SettingsPanel wears it.
12
+ *
13
+ * `variant="float"` (plan-2026-11-12-float-rails-figma W4.1; the user: *"why is header not component?"*) — RailFloat's
14
+ * header, open and folded alike: the title slot filling the row and truncating (`kol-float-panel`, the emphasis ink), then
15
+ * `end`: the actions and the fold, 4 apart, 8 off the title. The TITLE IS A SLOT: text takes the panel role, a node
16
+ * (NavRail float's switcher row) fills the title position as it is. The fold is a float ghost sm Button whose glyph is the
17
+ * 12 chevron token (`--kol-float-chev-sm`, 14 on touch), never the float button's 18 glyph (P15 *"USE 12px chevron"*).
18
+ * Each part renders only when given: no `onFold`, no fold; no `actions`, no slot.
19
+ *
20
+ * @param {'default'|'float'} [variant='default']
21
+ * @param {ReactNode} [title] the title slot — text, or a node in the title position
22
+ * @param {ReactNode} [subtitle] default: the line under the title
23
+ * @param {ReactNode} [actions] default: before the ×; float: before the fold (expand, collapse)
24
+ * @param {boolean} [folded] float: the fold's state — ⌄ (Open) when folded, ⌃ (Fold) when open
25
+ * @param {Function} [onFold] float: the fold's press; unset, no fold
26
+ * @param {string} [className]
27
+ */
28
+ export default function RailHeader({ variant = 'default', title, subtitle, actions, folded = false, onFold, className = '' }) {
29
+ if (variant !== 'float') {
30
+ return (
31
+ <div className={`flex min-w-0 items-center gap-2 ${className}`.trim()}>
32
+ <div className="flex min-w-0 flex-1 flex-col">
33
+ {title && <span className="kol-helper-14 uppercase text-emphasis">{title}</span>}
34
+ {subtitle && <span className="kol-mono-12 text-meta">{subtitle}</span>}
35
+ </div>
36
+ {actions}
37
+ </div>
38
+ )
39
+ }
40
+ const fold = onFold && (
41
+ <Button variant="float" tone="ghost" size="sm" iconOnly={folded ? 'chevron-down' : 'chevron-up'} className="[--kol-float-ic:var(--kol-float-chev-sm)]"
42
+ aria-label={folded ? 'Open' : 'Fold'} aria-expanded={!folded} onClick={onFold} />
43
+ )
44
+ return (
45
+ <div data-float-module-header="" className={`flex w-full min-w-0 shrink-0 items-center justify-between gap-2 ${className}`.trim()}>
46
+ {title != null && title !== false && (isValidElement(title)
47
+ ? <div data-rail-header-title="" className="flex min-w-0 flex-1">{title}</div>
48
+ : <span className="kol-float-panel text-emphasis min-w-0 flex-1 truncate">{title}</span>)}
49
+ {(actions || fold) && <span className="ml-auto flex shrink-0 items-center gap-1">{actions}{fold}</span>}
50
+ </div>
51
+ )
52
+ }
@@ -2,12 +2,12 @@ import { useState } from 'react'
2
2
  import { IconLoader } from '@kolkrabbi/kol-icons'
3
3
  import Kbd from '../atoms/Kbd.jsx'
4
4
  import TreeRow from '../molecules/TreeRow.jsx'
5
- import FloatModule from '../molecules/FloatModule.jsx'
5
+ import RailFloat from '../molecules/RailFloat.jsx'
6
6
  import { LabeledControlSection } from './SettingsPanel.jsx'
7
7
  import { Tooltip } from '../utilities/Popover.jsx'
8
8
  import { floatMotion } from '../utilities/motion.js'
9
9
 
10
- /* taxonomy-ok: organism — nests FloatModule + TreeRow (molecules) + LabeledControlSection (organism) + Kbd (atom) + Tooltip (utility) + kol-icons's Icon. */
10
+ /* taxonomy-ok: organism — nests RailFloat + TreeRow (molecules) + LabeledControlSection (organism) + Kbd (atom) + Tooltip (utility) + kol-icons's Icon. */
11
11
 
12
12
  /**
13
13
  * NavRailFloat — the float sidebar, `NavRail variant="float"` (float-everything W9 rows 122 · 127 · 128 · 131,
@@ -40,7 +40,7 @@ import { floatMotion } from '../utilities/motion.js'
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
42
  * @param {boolean} [foldable] the fold ⌃ beside the switcher row (plan-2026-11-12-float-system W4.1): the rail folds to
43
- * FloatModule's pill — `title` and ⌄ at the expanded width — apart from its 72 collapse
43
+ * RailFloat's pill — `title` and ⌄ at the expanded width — apart from its 72 collapse
44
44
  * and its hide. `folded` controlled, `defaultFolded` uncontrolled, `onFold(folded)`
45
45
  * @param {boolean|Object} [motion=true] expand ↔ collapse eases the width and fades the new rows in, and the slots and rows ease
46
46
  * their hover (`.kol-float-rail`, FloatActionStatesAndMotion 2026-11-04): `true` the
@@ -72,7 +72,7 @@ export default function NavRailFloat({ items = [], currentPath = '', onNavigate,
72
72
  </Tooltip>
73
73
  )
74
74
  return (
75
- <FloatModule as="nav" aria-label="Navigation" inset="none" width="var(--kol-shell-float-rail-width, 72px)" style={motionStyle} bodyClassName="items-center !gap-1"
75
+ <RailFloat as="nav" aria-label="Navigation" inset="none" width="var(--kol-shell-float-rail-width, 72px)" style={motionStyle} bodyClassName="items-center !gap-1"
76
76
  className={`kol-float-rail h-full !gap-1 items-center py-3.5 ${className}`.trim()}>
77
77
  {onCollapsedChange && slot('expand', 'Expand', 'panel-left', { well: true, onClick: () => onCollapsedChange(false) })}
78
78
  <div className="flex min-h-0 w-full flex-1 flex-col gap-6 overflow-y-auto py-3 [scrollbar-width:none]">
@@ -93,12 +93,12 @@ export default function NavRailFloat({ items = [], currentPath = '', onNavigate,
93
93
  </div>
94
94
  {onSearch && slot('search', 'Search pages', 'search', { well: true, onClick: onSearch })}
95
95
  {onHide && slot('hide', 'Hide', 'hamburger', { well: true, onClick: onHide })}
96
- </FloatModule>
96
+ </RailFloat>
97
97
  )
98
98
  }
99
99
 
100
100
  return (
101
- <FloatModule as="nav" aria-label="Navigation" inset="sm" width="var(--kol-shell-float-rail-open, 264px)" style={motionStyle}
101
+ <RailFloat as="nav" aria-label="Navigation" inset="sm" width="var(--kol-shell-float-rail-open, 264px)" style={motionStyle}
102
102
  title={title} foldable={foldable} folded={folded} defaultFolded={defaultFolded} onFold={onFold}
103
103
  bodyClassName="!gap-3" className={`kol-float-rail h-full !gap-3 ${className}`.trim()}
104
104
  footer={footer && <div className="flex shrink-0 flex-col gap-2">{footer}</div>}
@@ -139,6 +139,6 @@ export default function NavRailFloat({ items = [], currentPath = '', onNavigate,
139
139
  </LabeledControlSection>
140
140
  ))}
141
141
  </div>
142
- </FloatModule>
142
+ </RailFloat>
143
143
  )
144
144
  }
@@ -35,18 +35,8 @@ import { RAIL_ROW } from '../hooks/railRow.js'
35
35
  * inspector like fxr's, a list rail like monitor's patch table, and the bottom rail — in both tiers.
36
36
  */
37
37
 
38
- /** RailHeader — the rail's title line: title, subtitle, and the actions before the × (which Rail draws). */
39
- export function RailHeader({ title, subtitle, actions }) {
40
- return (
41
- <div className="flex min-w-0 items-center gap-2">
42
- <div className="flex min-w-0 flex-1 flex-col">
43
- {title && <span className="kol-helper-14 uppercase text-emphasis">{title}</span>}
44
- {subtitle && <span className="kol-mono-12 text-meta">{subtitle}</span>}
45
- </div>
46
- {actions}
47
- </div>
48
- )
49
- }
38
+ /* RailHeader is its own molecule (molecules/RailHeader.jsx, 2026-11-12 — the default and float headers, one component); the kit ships it */
39
+ export { default as RailHeader } from '../molecules/RailHeader.jsx'
50
40
 
51
41
  /** RailTabs — segmented tabs across the rail: `tabs` `[{ value, label }]`, controlled by `value` / `onChange`. */
52
42
  export function RailTabs({ tabs = [], value, onChange, ariaLabel = 'Tabs', className = '' }) {
@@ -8,12 +8,12 @@ import { LabeledControlSection } from './SettingsPanel.jsx'
8
8
  * ReadingContents — The book's contents, where the reader is in them, and how far through. `The Waves · 9 interludes ·
9
9
  * 01 First interlude … · Through the book 42%` (float-everything W11 row 149, 2026-11-04 — kol-float--style W2.9
10
10
  * `Contents panel`). It is BODY CONTENT (plan-2026-11-12-float-rails-figma W4.1): no sheet, no header, no margins of its
11
- * own. It goes in a `FloatModule`'s body, the module carrying the title (`Contents`), the fold and the status line in its
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
- * <FloatModule title="Contents" foldable footer={<span className="kol-float-label text-fg-64">Reading position saved</span>}>
14
+ * <RailFloat title="Contents" foldable 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
- * </FloatModule>
16
+ * </RailFloat>
17
17
  *
18
18
  * A column, 24 between its parts: `book` (the title in `kol-float-section` over the author in `kol-float-hint` fg-64,
19
19
  * 4 apart), the chapters as a float `LabeledControlSection` (the count in `kol-float-ruler` over one 36 `TocRow` per