@kolkrabbi/kol-component 0.348.0 → 0.350.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.350.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -12,6 +12,9 @@
12
12
  "./molecules/Rail": "./src/organisms/Rail.jsx",
13
13
  "./molecules/ShellDrawer": "./src/organisms/ShellDrawer.jsx",
14
14
  "./utilities/ButtonGroup": "./src/molecules/ButtonGroup.jsx",
15
+ "./atoms/CloseButton": "./src/molecules/CloseButton.jsx",
16
+ "./utilities/FullscreenOverlay": "./src/molecules/FullscreenOverlay.jsx",
17
+ "./utilities/LoaderOverlay": "./src/molecules/LoaderOverlay.jsx",
15
18
  "./atoms/*": "./src/atoms/*.jsx",
16
19
  "./molecules/*": "./src/molecules/*.jsx",
17
20
  "./organisms/*": "./src/organisms/*.jsx",
package/src/index.js CHANGED
@@ -22,7 +22,7 @@ export { default as AssetPlaceholder } from './utilities/AssetPlaceholder.jsx'
22
22
  export { default as Avatar } from './atoms/Avatar.jsx'
23
23
  export { default as Badge } from './atoms/Badge.jsx'
24
24
  export { default as Button } from './atoms/Button.jsx'
25
- export { default as CloseButton } from './atoms/CloseButton.jsx'
25
+ export { default as CloseButton } from './molecules/CloseButton.jsx'
26
26
  export { default as ActionButton } from './molecules/ActionButton.jsx'
27
27
  export { default as FileIcon } from './atoms/FileIcon.jsx'
28
28
  export { default as SizeOrDownload } from './atoms/SizeOrDownload.jsx'
@@ -41,7 +41,7 @@ export { default as ExitPreview } from './utilities/ExitPreview.jsx'
41
41
  export { default as Figure } from './atoms/Figure.jsx'
42
42
  /* which file origins a preview fetches with the sign-in cookie (Quick Look on private files, 2026-10-28) */
43
43
  export { registerCredentialedOrigin, credentialsFor } from './utilities/credentials.js'
44
- export { default as FullscreenOverlay } from './utilities/FullscreenOverlay.jsx'
44
+ export { default as FullscreenOverlay } from './molecules/FullscreenOverlay.jsx'
45
45
  /* the overlay layer stack — which open layer owns Escape; exported so a layer in another package
46
46
  * (kol-shell's walkthrough) joins the same stack instead of a second one (2026-10-09) */
47
47
  export { pushLayer, popLayer, isTopLayer } from './utilities/layerStack.js'
@@ -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'
@@ -157,6 +158,7 @@ export { default as ColorRamp } from './molecules/ColorRamp.jsx'
157
158
  export { default as TextFold } from './molecules/TextFold.jsx'
158
159
  export { default as PageControls } from './molecules/PageControls.jsx'
159
160
  export { default as ColorSwatch } from './molecules/ColorSwatch.jsx'
161
+ export { default as SwatchTile } from './molecules/SwatchTile.jsx'
160
162
  export { default as Dropdown } from './molecules/Dropdown.jsx'
161
163
  /* MultiSelect — several pick-one settings in one dropdown, a column each (2026-10-01, first cut) */
162
164
  export { default as MultiSelect } from './molecules/MultiSelect.jsx'
@@ -258,7 +260,7 @@ export { default as SectionSplit } from './organisms/SectionSplit.jsx'
258
260
  export { default as SectionCards } from './organisms/SectionCards.jsx'
259
261
  export { default as SectionCta, default as CtaGlobal } from './organisms/SectionCta.jsx'
260
262
  export { default as SectionFaq } from './organisms/SectionFaq.jsx'
261
- export { default as LoaderOverlay } from './utilities/LoaderOverlay.jsx'
263
+ export { default as LoaderOverlay } from './molecules/LoaderOverlay.jsx'
262
264
  /* dev chrome: name an element, agree on a cell, emit one sync line */
263
265
  export { default as QuadrantSync } from './utilities/QuadrantSync.jsx'
264
266
  export { default as MediaLibrary, MediaLibraryProvider, useMediaLibrary, MediaPicker } from './organisms/MediaLibrary.jsx'
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useState } from 'react'
2
- import ColorSwatch from './ColorSwatch.jsx'
3
- import { resolveCssVar, isLight } from '../hooks/cssVar.js'
2
+ import SwatchTile from './SwatchTile.jsx'
3
+ import { resolveCssVar } from '../hooks/cssVar.js'
4
4
 
5
5
  /**
6
6
  * ColorRamp — One row of color chips. one specimen row of color chips for a token-doc page. A label
@@ -16,7 +16,7 @@ import { resolveCssVar, isLight } from '../hooks/cssVar.js'
16
16
  * both the fill and the printed value. This is the old Ramp mode.
17
17
  *
18
18
  * Precedence: colors > vars > ramp/stops. The local Chip/Swatch dups the two
19
- * source files carried are gone — every chip is a DS ColorSwatch. The anchor
19
+ * source files carried are gone — every chip is a DS SwatchTile (size 'grid', 2026-11-07). The anchor
20
20
  * marker is a dot whose fill flips black/white through isLight so it reads on
21
21
  * any stop.
22
22
  *
@@ -98,20 +98,7 @@ export default function ColorRamp({
98
98
  const fill = c.literal ?? `var(${c.token})`
99
99
  const isAnchor = anchor != null && (anchor === c.stop || anchor === c.name || anchor === i)
100
100
  return (
101
- <div key={c.key} className="flex min-w-0 flex-col gap-1.5">
102
- <div className="relative">
103
- <ColorSwatch hex={fill} size="fill" radius="sm" title={`${c.name} ${value}`} />
104
- {isAnchor && value && (
105
- <span className="absolute inset-0 flex items-center justify-center" aria-hidden="true">
106
- <span className="w-2.5 h-2.5 rounded-full" style={{ background: isLight(value) ? '#000' : '#fff' }} />
107
- </span>
108
- )}
109
- </div>
110
- <div className="flex min-w-0 flex-col items-start gap-0.5 leading-tight">
111
- <span className="kol-helper-10 text-emphasis max-w-full truncate">{c.name}{isAnchor && ' ★'}</span>
112
- <span className="kol-helper-10 text-meta max-w-full truncate">{value}</span>
113
- </div>
114
- </div>
101
+ <SwatchTile key={c.key} hex={fill} name={c.name} value={value} size="grid" anchor={isAnchor} title={`${c.name} ${value}`} />
115
102
  )
116
103
  })}
117
104
  </div>
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useRef } from 'react'
2
- import { pushLayer, popLayer, isTopLayer } from './layerStack.js'
3
- import CloseButton from '../atoms/CloseButton.jsx'
2
+ import { pushLayer, popLayer, isTopLayer } from '../utilities/layerStack.js'
3
+ import CloseButton from './CloseButton.jsx'
4
4
 
5
5
  /**
6
6
  * FullscreenOverlay — The scrim and sheet every overlay wears. the scrim + centred sheet every overlay in the repo
@@ -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">
@@ -1,6 +1,6 @@
1
1
  import { Icon } from '@kolkrabbi/kol-icons'
2
2
  import Button from '../atoms/Button.jsx'
3
- import CloseButton from '../atoms/CloseButton.jsx'
3
+ import CloseButton from './CloseButton.jsx'
4
4
 
5
5
  /* taxonomy-ok: molecule — nests Button (atom) + CloseButton (utility). */
6
6
 
@@ -0,0 +1,105 @@
1
+ import ColorSwatch from './ColorSwatch.jsx'
2
+ import { isLight } from '../hooks/cssVar.js'
3
+
4
+ /**
5
+ * SwatchTile — A color swatch with its name and value under it. the ColorSwatch chip plus its caption, so a
6
+ * swatch grid stops being drawn by hand at every call site (2026-11-07). Each `size` is the form an existing
7
+ * caller drew, carried through class for class:
8
+ *
9
+ * 'tile' (default) — the documented specimen: a full-width bar `height` tall (96, the `.kol-swatch-chip`
10
+ * depth) over a baseline row, name meta-left and value strong-right (BlockSwatch, the
11
+ * Foundations token grids). `anchor` = a difference-blended dot centred on the bar.
12
+ * 'grid' — a square chip filling its grid column, name over value, both truncating (ColorRamp).
13
+ * `anchor` = a black/white dot through isLight, and a ★ after the name.
14
+ * number — a fixed chip of that many px, the caption left-aligned under it (the styleguide chips).
15
+ *
16
+ * <SwatchTile hex="#131316" name="Ink" anchor />
17
+ *
18
+ * @param {string} hex - The paint — any CSS color, `var(--token)` included
19
+ * @param {ReactNode} name - The label
20
+ * @param {ReactNode} meta - Optional third line, e.g. the token name
21
+ * @param {ReactNode} value - The printed value (default: `hex` uppercased); null hides it
22
+ * @param {'tile'|'grid'|number} size - The form (default 'tile')
23
+ * @param {number|string} height - 'tile' only: the bar's depth (default 96)
24
+ * @param {boolean} anchor - Mark the palette's canonical stop
25
+ * @param {boolean} selected - Passed to ColorSwatch
26
+ * @param {Function} onClick - Passed to ColorSwatch (makes the chip a button)
27
+ * @param {string} title - Passed to ColorSwatch (its tooltip)
28
+ * @param {string} chipClassName - Extra classes on the chip (e.g. a border on near-ground tokens)
29
+ * @param {string} className - Extra classes on the wrapper
30
+ */
31
+ export default function SwatchTile({
32
+ hex,
33
+ name,
34
+ meta,
35
+ value = hex?.toUpperCase(),
36
+ size = 'tile',
37
+ height = 96,
38
+ anchor = false,
39
+ selected,
40
+ onClick,
41
+ title,
42
+ chipClassName = '',
43
+ className = '',
44
+ }) {
45
+ const chip = { hex, selected, onClick, title, radius: 'sm', className: chipClassName }
46
+ const metaLine = meta && <span className="kol-helper-10 text-meta">{meta}</span>
47
+
48
+ if (size === 'grid') return (
49
+ <div className={`flex min-w-0 flex-col gap-1.5 ${className}`.trim()}>
50
+ <div className="relative">
51
+ <ColorSwatch {...chip} size="fill" />
52
+ {anchor && value && (
53
+ <span className="absolute inset-0 flex items-center justify-center" aria-hidden="true">
54
+ <span className="w-2.5 h-2.5 rounded-full" style={{ background: isLight(value) ? '#000' : '#fff' }} />
55
+ </span>
56
+ )}
57
+ </div>
58
+ <div className="flex min-w-0 flex-col items-start gap-0.5 leading-tight">
59
+ <span className="kol-helper-10 text-emphasis max-w-full truncate">{name}{anchor && ' ★'}</span>
60
+ <span className="kol-helper-10 text-meta max-w-full truncate">{value}</span>
61
+ {metaLine}
62
+ </div>
63
+ </div>
64
+ )
65
+
66
+ if (typeof size === 'number') return (
67
+ <div className={`flex flex-col items-start gap-1.5 ${className}`.trim()}>
68
+ <ColorSwatch {...chip} size={size} />
69
+ {name && <span className="kol-helper-10 text-meta">{name}</span>}
70
+ {value && <span className="kol-helper-10 text-strong font-semibold">{value}</span>}
71
+ {metaLine}
72
+ </div>
73
+ )
74
+
75
+ return (
76
+ /* gap 6 — .kol-swatch */
77
+ <div className={`flex flex-col ${className}`.trim()} style={{ gap: 6 }}>
78
+ {/* .kol-swatch-chip: full column width, `height` tall, radius 4 — ColorSwatch 'stretch' fills the box */}
79
+ <div className="relative w-full" style={{ height }}>
80
+ <ColorSwatch {...chip} size="stretch" />
81
+ {anchor && (
82
+ <span
83
+ aria-label="Canonical anchor"
84
+ className="absolute inset-0 flex items-center justify-center pointer-events-none"
85
+ >
86
+ {/* difference blend so the dot reads on any stop, light or dark */}
87
+ <span
88
+ className="block rounded-full"
89
+ style={{ width: 10, height: 10, background: 'white', mixBlendMode: 'difference' }}
90
+ />
91
+ </span>
92
+ )}
93
+ </div>
94
+ {/* .kol-swatch-meta: row, space-between, baseline, wrapping */}
95
+ <div
96
+ className="kol-helper-10 flex flex-row flex-wrap items-baseline justify-between"
97
+ style={{ gap: '4px 12px' }}
98
+ >
99
+ {name && <span className="text-meta">{name}</span>}
100
+ {value && <span className="text-strong font-semibold">{value}</span>}
101
+ </div>
102
+ {metaLine}
103
+ </div>
104
+ )
105
+ }
@@ -1,6 +1,6 @@
1
1
  import { useLayoutEffect, useRef, useState } from 'react'
2
2
  import useScrollFade from '../hooks/useScrollFade.js'
3
- import CloseButton from '../atoms/CloseButton.jsx'
3
+ import CloseButton from './CloseButton.jsx'
4
4
  import Button from '../atoms/Button.jsx'
5
5
  import { Icon } from '@kolkrabbi/kol-icons'
6
6
  import { RAIL_ROW } from '../hooks/railRow.js'
@@ -6,7 +6,7 @@ import Textarea from '../atoms/Textarea.jsx'
6
6
  import ViewToggle from '../atoms/ViewToggle.jsx'
7
7
  import QuickLookFrame from '../molecules/QuickLookFrame.jsx'
8
8
  import KindPreview from '../molecules/KindPreview.jsx'
9
- import FullscreenOverlay from '../utilities/FullscreenOverlay.jsx'
9
+ import FullscreenOverlay from '../molecules/FullscreenOverlay.jsx'
10
10
  import { splitFrontmatter, joinFrontmatter } from '@kolkrabbi/kol-markdown'
11
11
  import { readDraft, writeDraft, clearDraft } from '../utilities/localDrafts.js'
12
12
 
@@ -1,5 +1,5 @@
1
1
  import Button from '../atoms/Button.jsx'
2
- import FullscreenOverlay from '../utilities/FullscreenOverlay.jsx'
2
+ import FullscreenOverlay from '../molecules/FullscreenOverlay.jsx'
3
3
  import QuickLookFrame from '../molecules/QuickLookFrame.jsx'
4
4
  import KindPreview from '../molecules/KindPreview.jsx'
5
5
  import { kindOf, extOf, KIND_LABEL } from '../utilities/mediaKinds.js'
@@ -7,7 +7,7 @@ import Dropdown from '../molecules/Dropdown.jsx'
7
7
  import Input from '../atoms/Input.jsx'
8
8
  import ViewToggle from '../atoms/ViewToggle.jsx'
9
9
  import SearchInput from '../molecules/SearchInput.jsx'
10
- import FullscreenOverlay from '../utilities/FullscreenOverlay.jsx'
10
+ import FullscreenOverlay from '../molecules/FullscreenOverlay.jsx'
11
11
  import { Tooltip } from '../utilities/Popover.jsx'
12
12
  import MediaTile from '../molecules/MediaTile.jsx'
13
13
  import ContentRow from '../molecules/ContentRow.jsx'
@@ -9,7 +9,7 @@ import Divider from '../atoms/Divider.jsx'
9
9
  import Input from '../atoms/Input.jsx'
10
10
  import Tag from '../atoms/Tag.jsx'
11
11
  import IconFrame from '../atoms/IconFrame.jsx'
12
- import CloseButton from '../atoms/CloseButton.jsx'
12
+ import CloseButton from '../molecules/CloseButton.jsx'
13
13
  import ActionButton from '../molecules/ActionButton.jsx'
14
14
  import SizeOrDownload from '../atoms/SizeOrDownload.jsx'
15
15
  import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
@@ -35,7 +35,7 @@ import MediaPlayer from '../molecules/MediaPlayer.jsx'
35
35
  import Slider from '../molecules/Slider.jsx'
36
36
  import QuickLookFrame from '../molecules/QuickLookFrame.jsx'
37
37
  import { formatLength } from '../molecules/PlayTile.jsx'
38
- import FullscreenOverlay from '../utilities/FullscreenOverlay.jsx'
38
+ import FullscreenOverlay from '../molecules/FullscreenOverlay.jsx'
39
39
  import { useModal } from '../molecules/Modal.jsx'
40
40
  import ContentFilters from './ContentFilters.jsx'
41
41
  import DocumentEditor from './DocumentEditor.jsx'
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState } from 'react'
2
2
  import useEmblaCarousel from 'embla-carousel-react'
3
3
  import { Icon } from '@kolkrabbi/kol-icons'
4
- import FullscreenOverlay from '../utilities/FullscreenOverlay.jsx'
4
+ import FullscreenOverlay from '../molecules/FullscreenOverlay.jsx'
5
5
 
6
6
  /**
7
7
  * MediaViewer — THE fullscreen paged media viewer. One viewer for every
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react'
2
2
  import { pushLayer, popLayer, isTopLayer } from '../utilities/layerStack.js'
3
3
  import { createPortal } from 'react-dom'
4
4
  import { Icon } from '@kolkrabbi/kol-icons'
5
- import CloseButton from '../atoms/CloseButton.jsx'
5
+ import CloseButton from '../molecules/CloseButton.jsx'
6
6
  import Divider from '../atoms/Divider.jsx'
7
7
  import usePrefersReducedMotion from '../hooks/usePrefersReducedMotion.js'
8
8
  import useMediaQuery from '../hooks/useMediaQuery.js'
@@ -1,12 +1,12 @@
1
1
  import Button from '../atoms/Button.jsx'
2
2
  import Dropdown from '../molecules/Dropdown.jsx'
3
- import CloseButton from '../atoms/CloseButton.jsx'
3
+ import CloseButton from '../molecules/CloseButton.jsx'
4
4
  import Divider from '../atoms/Divider.jsx'
5
5
  import IconFrame from '../atoms/IconFrame.jsx'
6
6
  import LabeledControl from '../molecules/LabeledControl.jsx'
7
7
  import ToggleSwitch from '../atoms/ToggleSwitch.jsx'
8
8
  import Rail from './Rail.jsx'
9
- import FullscreenOverlay from '../utilities/FullscreenOverlay.jsx'
9
+ import FullscreenOverlay from '../molecules/FullscreenOverlay.jsx'
10
10
  import { Tooltip } from '../utilities/Popover.jsx'
11
11
  import { RailHeader } from './RailKit.jsx'
12
12
 
File without changes
File without changes