@kolkrabbi/kol-component 0.348.0 → 0.349.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.348.0",
3
+ "version": "0.349.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,8 +30,8 @@
30
30
  "pdfjs-dist": "^6.3.289",
31
31
  "react-syntax-highlighter": "^16.1.1",
32
32
  "@kolkrabbi/kol-search": "^0.3.0",
33
- "@kolkrabbi/kol-growth": "^0.5.0",
34
- "@kolkrabbi/kol-markdown": "^0.2.0"
33
+ "@kolkrabbi/kol-markdown": "^0.2.0",
34
+ "@kolkrabbi/kol-growth": "^0.5.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@kolkrabbi/kol-icons": ">=0.61.1",
package/src/index.js CHANGED
@@ -84,6 +84,7 @@ 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
88
  /* float-everything W6 · W8 (0.335.0) */
88
89
  export { default as SummaryLine } from './molecules/SummaryLine.jsx'
89
90
  export { default as QuickLookHeader } from './molecules/QuickLookHeader.jsx'
@@ -0,0 +1,36 @@
1
+ import Button from '../atoms/Button.jsx'
2
+ import Avatar from '../atoms/Avatar.jsx'
3
+ import { Icon } from '@kolkrabbi/kol-icons'
4
+
5
+ /* taxonomy-ok: molecule — Avatar (atom) or kol-icons's Icon, a title and trailing actions on Button's nav row */
6
+
7
+ /* 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
+ const ROW = { float: 'w-full justify-start kol-btn-float', default: 'w-full justify-start h-11 gap-3' }
9
+ /* the classes Button emits for `variant="nav" size="lg"` — the static header draws the same row without the press */
10
+ const NAV_LG = 'kol-btn kol-btn-nav kol-btn-lg kol-mono-16'
11
+ const isSrc = (a) => /[/.:]/.test(a)
12
+
13
+ /**
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.
18
+ *
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)
25
+ * @param {string} [className]
26
+ */
27
+ export default function ModalHeader({ title, avatar, icon, actions, variant = 'default', onClick, className = '' }) {
28
+ const float = variant === 'float'
29
+ const cls = `${ROW[float ? 'float' : 'default']} ${className}`.trim()
30
+ const lead = avatar != null
31
+ ? (typeof avatar === 'string' ? <Avatar {...(isSrc(avatar) ? { src: avatar } : { initial: avatar })} alt="" size="xs" /> : avatar)
32
+ : icon && <Icon name={icon} size={float ? 'var(--kol-float-ic)' : 22} />
33
+ const body = <>{lead}{actions ? <span className="flex-1 text-left">{title}</span> : title}{actions && <span className="ml-auto flex shrink-0 items-center pointer-events-auto">{actions}</span>}</>
34
+ if (onClick) return <Button variant="nav" size="lg" className={cls} onClick={onClick}>{body}</Button>
35
+ return <div role="heading" aria-level={2} className={`${NAV_LG} ${cls} cursor-default pointer-events-none`}>{body}</div>
36
+ }
@@ -1,9 +1,10 @@
1
1
  import Button from '../atoms/Button.jsx'
2
+ import ModalHeader from './ModalHeader.jsx'
2
3
 
3
4
  /**
4
5
  * PanelsMenu — Which panels are shown, and the button that changes it. `Side panel · Hidden · Show` (float-everything
5
6
  * W4 row 57, 2026-11-04 — the exploration's workspace panels menu). A float sheet (`--kol-float-menu-r`, 16 in) with
6
- * a title and one row per panel on the list radius: the panel's name over its meta at the left, its state in the
7
+ * a ModalHeader (no avatar) and one row per panel on the list radius: the panel's name over its meta at the left, its state in the
7
8
  * middle, its action as a float button at the end — `primary` draws the inverted capsule (the one the user most
8
9
  * likely wants: Show), the rest the secondary tone. A press is `onAction(panel)`.
9
10
  *
@@ -16,7 +17,7 @@ import Button from '../atoms/Button.jsx'
16
17
  export default function PanelsMenu({ title = 'Workspace panels', panels = [], onAction, className = '' }) {
17
18
  return (
18
19
  <div className={`flex w-full max-w-md flex-col gap-3 rounded-[var(--kol-float-menu-r)] bg-surface-secondary p-4 ${className}`.trim()}>
19
- <span className="kol-float-panel text-fg-emphasis">{title}</span>
20
+ <ModalHeader variant="float" title={title} />
20
21
  <ul className="flex flex-col gap-2">
21
22
  {panels.map((p) => (
22
23
  <li key={p.id ?? p.name} className="flex items-center gap-4 rounded-[var(--kol-float-list-r)] bg-[var(--kol-float-well)] py-2 pl-4 pr-2">