@kolkrabbi/kol-component 0.349.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.349.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",
@@ -30,8 +33,8 @@
30
33
  "pdfjs-dist": "^6.3.289",
31
34
  "react-syntax-highlighter": "^16.1.1",
32
35
  "@kolkrabbi/kol-search": "^0.3.0",
33
- "@kolkrabbi/kol-markdown": "^0.2.0",
34
- "@kolkrabbi/kol-growth": "^0.5.0"
36
+ "@kolkrabbi/kol-growth": "^0.5.0",
37
+ "@kolkrabbi/kol-markdown": "^0.2.0"
35
38
  },
36
39
  "peerDependencies": {
37
40
  "@kolkrabbi/kol-icons": ">=0.61.1",
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'
@@ -158,6 +158,7 @@ export { default as ColorRamp } from './molecules/ColorRamp.jsx'
158
158
  export { default as TextFold } from './molecules/TextFold.jsx'
159
159
  export { default as PageControls } from './molecules/PageControls.jsx'
160
160
  export { default as ColorSwatch } from './molecules/ColorSwatch.jsx'
161
+ export { default as SwatchTile } from './molecules/SwatchTile.jsx'
161
162
  export { default as Dropdown } from './molecules/Dropdown.jsx'
162
163
  /* MultiSelect — several pick-one settings in one dropdown, a column each (2026-10-01, first cut) */
163
164
  export { default as MultiSelect } from './molecules/MultiSelect.jsx'
@@ -259,7 +260,7 @@ export { default as SectionSplit } from './organisms/SectionSplit.jsx'
259
260
  export { default as SectionCards } from './organisms/SectionCards.jsx'
260
261
  export { default as SectionCta, default as CtaGlobal } from './organisms/SectionCta.jsx'
261
262
  export { default as SectionFaq } from './organisms/SectionFaq.jsx'
262
- export { default as LoaderOverlay } from './utilities/LoaderOverlay.jsx'
263
+ export { default as LoaderOverlay } from './molecules/LoaderOverlay.jsx'
263
264
  /* dev chrome: name an element, agree on a cell, emit one sync line */
264
265
  export { default as QuadrantSync } from './utilities/QuadrantSync.jsx'
265
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
@@ -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