@kolkrabbi/kol-component 0.356.0 → 0.358.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.356.0",
3
+ "version": "0.358.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,9 +32,9 @@
32
32
  "embla-carousel-react": "^8.6.0",
33
33
  "pdfjs-dist": "^6.3.289",
34
34
  "react-syntax-highlighter": "^16.1.1",
35
- "@kolkrabbi/kol-growth": "^0.5.0",
36
35
  "@kolkrabbi/kol-markdown": "^0.2.0",
37
- "@kolkrabbi/kol-search": "^0.3.0"
36
+ "@kolkrabbi/kol-search": "^0.3.0",
37
+ "@kolkrabbi/kol-growth": "^0.5.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@kolkrabbi/kol-icons": ">=0.68.0",
package/src/index.js CHANGED
@@ -84,10 +84,10 @@ export { default as InlineAddRow } from './molecules/InlineAddRow.jsx'
84
84
  export { default as LinkAddRow } from './molecules/LinkAddRow.jsx'
85
85
  export { default as ColorField } from './molecules/ColorField.jsx'
86
86
  export { default as PanelsMenu } from './molecules/PanelsMenu.jsx'
87
- export { default as ModalHeader } from './molecules/ModalHeader.jsx'
87
+ /* ModalHeader is the one modal header (2026-11-08); `QuickLookHeader` is its deprecated alias on the retirement ledger */
88
+ export { default as ModalHeader, default as QuickLookHeader } from './molecules/ModalHeader.jsx'
88
89
  /* float-everything W6 · W8 (0.335.0) */
89
90
  export { default as SummaryLine } from './molecules/SummaryLine.jsx'
90
- export { default as QuickLookHeader } from './molecules/QuickLookHeader.jsx'
91
91
  export { default as NoticeBanner } from './molecules/NoticeBanner.jsx'
92
92
  export { default as TreeRow, TREE_ROW } from './molecules/TreeRow.jsx'
93
93
  export { default as FlyoutRow } from './molecules/FlyoutRow.jsx'
@@ -3,7 +3,7 @@ import { createPortal } from 'react-dom'
3
3
  import Button from '../atoms/Button.jsx'
4
4
  import Input from '../atoms/Input.jsx'
5
5
  import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
6
- import QuickLookHeader from './QuickLookHeader.jsx'
6
+ import ModalHeader from './ModalHeader.jsx'
7
7
  import ModalShell from './ModalShell.jsx'
8
8
 
9
9
  /**
@@ -62,7 +62,7 @@ import ModalShell from './ModalShell.jsx'
62
62
  *
63
63
  * THE FLOAT (`variant: 'float'` on any call or on the provider, float-everything W6 rows 84 · 85 · 89 · 90, 2026-11-04 —
64
64
  * kol-float--style 46:2795): the window on `kol-float-solid` at `--kol-float-window-r`, 24 in, 18 between its parts.
65
- * A `header` (with its `icon`) draws `QuickLookHeader variant="float"` over the title; the title is the heading
65
+ * A `header` (with its `icon`) draws `ModalHeader variant="float"` over the title; the title is the heading
66
66
  * (`kol-float-section`… at 20: Inter 500), `body` a line under it in the hint ink; fields are float Inputs, toggles float
67
67
  * ToggleCheckboxes; the actions sit apart — the quiet cancel at the left (`tone="ghost"`), the next step at the right
68
68
  * (`inverted`, or `danger` when `tone: 'danger'` — the destructive confirm). Still a blocking task, so the scrim
@@ -223,7 +223,7 @@ function ModalView({ state, closeWith, variant, contained }) {
223
223
  maxWidth: contained ? '90%' : '90vw',
224
224
  ...(float ? { width: 562 } : {}),
225
225
  }}
226
- header={float && state.header && <QuickLookHeader variant="float" icon={state.icon} title={state.header} onClose={cancel} />}
226
+ header={float && state.header && <ModalHeader variant="float" icon={state.icon} title={state.header} onClose={cancel} />}
227
227
  footer={float ? (
228
228
  /* the float's actions sit apart: recovery quiet at the left, the next step at the right */
229
229
  <div className="flex items-center justify-between gap-3">
@@ -332,7 +332,7 @@ export function useModal() {
332
332
  * <Dialog open={open} onClose={() => setOpen(false)} title="Filter by page" width={560}>…</Dialog>
333
333
  *
334
334
  * `variant="float"` (float-everything W6 rows 83 · 84 · 89, 2026-11-04 — kol-float--style 46:2655): the float window —
335
- * `kol-float-solid` on `--kol-float-window-r`, 24 in, 18 between its parts, the title drawn as `QuickLookHeader
335
+ * `kol-float-solid` on `--kol-float-window-r`, 24 in, 18 between its parts, the title drawn as `ModalHeader
336
336
  * variant="float"` (`icon` · title · − when `onMinimise` · ×) over the children. `blocking` (default true) keeps the
337
337
  * scrim: a blocking task dims the scene, a utility window does not (row 89) — `blocking={false}` drops the scrim and the
338
338
  * press-outside close and leaves the scene live (QuickLookFrame float is the utility window proper).
@@ -442,7 +442,7 @@ export function Dialog({ open, onClose, title, width = 560, variant = 'lift', ic
442
442
  * `.kol-overlay-panel` is the lift every KOL overlay wears (oq-04, no border — the scrim is the edge). */
443
443
  className={float ? `pointer-events-auto gap-[18px] p-6 ${container ? 'max-h-[85%]' : 'max-h-[85vh]'} overflow-auto` : `${container ? 'max-h-[85%]' : 'max-h-[85vh]'}${blocking ? '' : ' pointer-events-auto'}`}
444
444
  style={{ width: `min(${width}px, calc(${container ? '100%' : '100vw'} - 32px))` }}
445
- header={float && title && <QuickLookHeader variant="float" icon={icon} title={title} onMinimise={onMinimise} onClose={onClose} />}
445
+ header={float && title && <ModalHeader variant="float" icon={icon} title={title} onMinimise={onMinimise} onClose={onClose} />}
446
446
  >
447
447
  {children}
448
448
  </ModalShell>
@@ -1,31 +1,83 @@
1
1
  import Button from '../atoms/Button.jsx'
2
2
  import Avatar from '../atoms/Avatar.jsx'
3
+ import CloseButton from './CloseButton.jsx'
3
4
  import { IconLoader } from '@kolkrabbi/kol-icons'
4
5
 
5
- /* taxonomy-ok: molecule — Avatar (atom) or kol-icons's Icon, a title and trailing actions on Button's nav row */
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) */
6
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
9
  const ROW = { float: 'w-full justify-start kol-btn-float', default: 'w-full justify-start h-11 gap-3' }
9
10
  /* the classes Button emits for `variant="nav" size="lg"` — the static header draws the same row without the press */
10
11
  const NAV_LG = 'kol-btn kol-btn-nav kol-btn-lg kol-mono-16'
11
12
  const isSrc = (a) => /[/.:]/.test(a)
13
+ /* a window's controls — passing any of them (even undefined, as QuickLookFrame does) draws the window row */
14
+ const WINDOW = ['meta', 'nav', 'onMinimise', 'onClose']
12
15
 
13
16
  /**
14
- * ModalHeader — The top row of a floating surface: an avatar or a glyph, the title, and trailing actions (a close).
15
- * One header for every float sheet and modal (menu-system W4, user 2026-11-07: *"why not just modalheader?"*) —
16
- * MoreRows' account row and PanelsMenu's title draw it. With `onClick` the row is the pressable nav Button it was in
17
- * MoreRows; without, the same row as a heading that takes no press.
17
+ * ModalHeader — The top row of every float sheet and modal: one header, two looks (`default` · `float`), two rows.
18
+ * User 2026-11-07: *"why not just modalheader?"*; 2026-11-08: *"are you both accounting for default and float?"* — the
19
+ * window row that was QuickLookHeader folded in, class for class (QuickLookHeader is its deprecated alias).
18
20
  *
19
- * @param {string} title
20
- * @param {string|ReactNode} [avatar] a picture url, initials, or a node drawn as is
21
- * @param {string} [icon] a kol-icons name, in the avatar's place when there is none
22
- * @param {ReactNode} [actions] trailing node — a close button
23
- * @param {'float'|'default'} [variant='default'] `float` the float row (`kol-btn-float`), else the 44px nav row
24
- * @param {Function} [onClick] makes the row a press (the account row)
21
+ * THE MENU ROW (MoreRows' account row, PanelsMenu's title) — an avatar or a glyph, the title, trailing `actions`. With
22
+ * `onClick` the row is the pressable nav Button; without, the same row as a heading that takes no press. Drawn when
23
+ * `avatar` or `onClick` is set, or when no window control is passed.
24
+ *
25
+ * THE WINDOW ROW (Dialog float, the useModal float prompts, QuickLookFrame) — drawn when `meta`, `nav`, `onMinimise` or
26
+ * `onClose` is passed. Default: ‹ › n / N · the file's name · its facts · the actions · the close, on
27
+ * `.kol-quicklook-header`. Float (kol-float--style 46:2500): the window's glyph (16, oq-64) · its title in
28
+ * `kol-float-panel` (Inter 13/500) · − minimise · × close, 12 apart, the controls quiet on oq-64 and bright under the
29
+ * pointer. No rule under it — the no-borders law holds on float.
30
+ *
31
+ * @param {ReactNode} title
32
+ * @param {'float'|'default'} [variant='default']
33
+ * @param {string|ReactNode} [avatar] menu row: a picture url, initials, or a node drawn as is
34
+ * @param {string} [icon] a kol-icons name — the menu row's lead when there is no avatar; the float window's glyph
35
+ * @param {ReactNode} [actions] trailing controls (before the close on the window row)
36
+ * @param {Function} [onClick] menu row: makes the row a press (the account row)
37
+ * @param {ReactNode} [meta] window, default look: the facts after the name
38
+ * @param {Object} [nav] window, default look: `{ index, total, onPrev, onNext }`
39
+ * @param {Function} [onMinimise] window, float: shows the − control
40
+ * @param {Function} [onClose] window: shows the × control
25
41
  * @param {string} [className]
26
42
  */
27
- export default function ModalHeader({ title, avatar, icon, actions, variant = 'default', onClick, className = '' }) {
43
+ export default function ModalHeader(props) {
44
+ const { title, avatar, icon, actions, variant = 'default', onClick, meta, nav, onMinimise, onClose, className = '' } = props
28
45
  const float = variant === 'float'
46
+ if (avatar == null && !onClick && WINDOW.some((k) => k in props)) {
47
+ if (float) {
48
+ 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'
49
+ return (
50
+ <div className={`flex min-h-6 w-full items-center gap-3 ${className}`.trim()}>
51
+ {icon && <IconLoader name={icon} size={16} className="shrink-0 text-oq-64" />}
52
+ <span className="kol-float-panel min-w-0 flex-1 truncate text-fg-emphasis">{title}</span>
53
+ {actions}
54
+ {onMinimise && <button type="button" aria-label="Minimise" onClick={onMinimise} className={ctl}><IconLoader name="minus" size={14} /></button>}
55
+ {onClose && <button type="button" aria-label="Close" onClick={onClose} className={ctl}><IconLoader name="x" size={16} /></button>}
56
+ </div>
57
+ )
58
+ }
59
+ return (
60
+ <div className={`kol-quicklook-header ${className}`.trim()}>
61
+ {nav?.total > 1 && (
62
+ /* the pager is its own group: the count sits off the chevrons, and the group sits clear of
63
+ * the file's name (user 2026-09-23) */
64
+ <span className="flex items-center gap-1 mr-3">
65
+ <Button variant="nav" size="sm" iconOnly="chevron-left" onClick={nav.onPrev} aria-label="Previous" />
66
+ <Button variant="nav" size="sm" iconOnly="chevron-right" onClick={nav.onNext} aria-label="Next" />
67
+ <span className="kol-mono-12 text-meta tabular-nums ml-3">{nav.index + 1} / {nav.total}</span>
68
+ </span>
69
+ )}
70
+ {title && <span className="kol-mono-12 text-strong truncate">{title}</span>}
71
+ {meta && <span className="kol-mono-12 text-meta truncate">{meta}</span>}
72
+ <span className="flex-1" />
73
+ {actions}
74
+ {/* THE ESTATE'S CLOSE IDIOM, and every header control wears it (user 2026-09-23): bare at
75
+ * rest, a wash on hover — a filled container read as a second surface on the header. LAST, at the
76
+ * far right (user 2026-10-18: *"X should be space between justify on the right"*) */}
77
+ {onClose && <CloseButton size="sm" onClick={onClose} />}
78
+ </div>
79
+ )
80
+ }
29
81
  const cls = `${ROW[float ? 'float' : 'default']} ${className}`.trim()
30
82
  const lead = avatar != null
31
83
  ? (typeof avatar === 'string' ? <Avatar {...(isSrc(avatar) ? { src: avatar } : { initial: avatar })} alt="" size="xs" /> : avatar)
@@ -9,7 +9,7 @@ import { forwardRef } from 'react'
9
9
  * layer it sits in. Padding and the gap between the parts are the caller's too (`className`): a prompt and a media
10
10
  * window do not share them.
11
11
  *
12
- * <ModalShell header={<QuickLookHeader … />} footer={<div>…actions</div>} className="gap-4 p-5" style={{ width: 560 }}>
12
+ * <ModalShell header={<ModalHeader … />} footer={<div>…actions</div>} className="gap-4 p-5" style={{ width: 560 }}>
13
13
  * …body
14
14
  * </ModalShell>
15
15
  *
@@ -1,9 +1,9 @@
1
1
  import { useRef, useState } from 'react'
2
2
  import { IconLoader } from '@kolkrabbi/kol-icons'
3
- import QuickLookHeader from './QuickLookHeader.jsx'
3
+ import ModalHeader from './ModalHeader.jsx'
4
4
  import ModalShell from './ModalShell.jsx'
5
5
 
6
- /* taxonomy-ok: molecule — QuickLookHeader (molecule) on ModalShell (molecule) + kol-icons's IconLoader. */
6
+ /* taxonomy-ok: molecule — ModalHeader (molecule) on ModalShell (molecule) + kol-icons's IconLoader. */
7
7
 
8
8
  /**
9
9
  * QuickLookFrame — The preview window. the Finder Quick Look window (user 2026-09-23: *"put them in a container LIKE
@@ -34,7 +34,7 @@ import ModalShell from './ModalShell.jsx'
34
34
  *
35
35
  * THE UTILITY WINDOW (`variant="float"`, float-everything W6 rows 86 · 88, 2026-11-04 — kol-float--style 46:2840): a
36
36
  * non-modal float window — no scrim, the scene stays live under it. `kol-float-solid` on `--kol-float-window-r`, 20 in,
37
- * 18 between its parts; the header is `QuickLookHeader variant="float"` (`icon` · title · `onMinimise` · `onClose`); the
37
+ * 18 between its parts; the header is `ModalHeader variant="float"` (`icon` · title · `onMinimise` · `onClose`); the
38
38
  * body is the caller's (chip tabs, float fields); `status` is the footer line (`Changes saved automatically`, the
39
39
  * `kol-float-label` role on fg-64) with the resize corner as its glyph at the right — the same drag as the default grip.
40
40
  * @param {'float'} [variant]
@@ -71,7 +71,7 @@ export default function QuickLookFrame({ variant, icon, onMinimise, status, titl
71
71
  return (
72
72
  <ModalShell ref={ref} variant="float" style={size ? { width: size.w, height: size.h } : undefined}
73
73
  className={`w-full max-w-[562px] gap-[18px] p-5 ${className}`.trim()}
74
- header={header && <QuickLookHeader variant="float" icon={icon} title={title} actions={actions} onMinimise={onMinimise} onClose={onClose} />}
74
+ header={header && <ModalHeader variant="float" icon={icon} title={title} actions={actions} onMinimise={onMinimise} onClose={onClose} />}
75
75
  footer={(
76
76
  <>
77
77
  {footer}
@@ -91,7 +91,7 @@ export default function QuickLookFrame({ variant, icon, onMinimise, status, titl
91
91
  return (
92
92
  <ModalShell ref={ref} style={style}
93
93
  className={`kol-quicklook${footer ? ' kol-quicklook--footer' : ''}${size ? ' kol-quicklook--sized' : ''} ${className}`.trim()}
94
- header={header && <QuickLookHeader title={title} meta={meta} actions={actions} nav={nav} onClose={onClose} />}
94
+ header={header && <ModalHeader title={title} meta={meta} actions={actions} nav={nav} onClose={onClose} />}
95
95
  footer={<>{footer && <div className="kol-quicklook-footer">{footer}</div>}<span className="kol-quicklook-grip" {...grip} /></>}>
96
96
  <div className="kol-quicklook-body">{children}</div>
97
97
  </ModalShell>
@@ -75,7 +75,7 @@ import NavRailFloat from './NavRailFloat.jsx'
75
75
  * THE PRESETS (user 2026-10-24: *"the rail, do you make a preset for this? like catalog has preset?"*) — three rails, one
76
76
  * name each, in `RAIL_PRESETS` below: `app` is the studio rail (this file's AppRail: the 48px rail that grabs open,
77
77
  * sections ENTER and EXPAND, the pill on the phone, Media · Sign in · Settings at the foot); `site` is the brand rail
78
- * (NavRailSite — brand.kolkrabbi.io); `workshop` is the workshop rail (kol-workshop's ShellSidebar, registered through
78
+ * (NavRailSite — brand.kolkrabbi.io); `workshop` is the workshop rail (kol-workshop's ShellRail, registered through
79
79
  * `registerRailPreset` since kol-component cannot import kol-workshop). AppShell passes the preset and reads its phone
80
80
  * shape; an app passes nothing else about the rail.
81
81
  *
@@ -1,60 +0,0 @@
1
- import { IconLoader } from '@kolkrabbi/kol-icons'
2
- import Button from '../atoms/Button.jsx'
3
- import CloseButton from './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 && <IconLoader 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}><IconLoader name="minus" size={14} /></button>}
35
- {onClose && <button type="button" aria-label="Close" onClick={onClose} className={ctl}><IconLoader 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
- }