@kolkrabbi/kol-styleguide 0.4.0 → 0.4.1
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 +1 -1
- package/src/Swatch.jsx +34 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-styleguide",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "KOL style-guide / brand-guide component set — the visual specimens a brand manual is built from: color anatomy + combination lab, logo construction / clearspace / scaling, mood tiles, type blocks, and asset spec tables. Raided from the apps/brand styleguide. Sits above @kolkrabbi/kol-{theme,icons,component}.",
|
|
6
6
|
"license": "MIT",
|
package/src/Swatch.jsx
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import { ColorSwatch } from '@kolkrabbi/kol-component'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Swatch — the DOCUMENTED swatch:
|
|
5
|
-
* optional canonical-anchor dot.
|
|
4
|
+
* Swatch — the DOCUMENTED swatch: a specimen bar over its meta row (name, hex),
|
|
5
|
+
* with an optional canonical-anchor dot.
|
|
6
6
|
*
|
|
7
|
-
* `ColorSwatch` (kol-component) is the chip alone — a fixed-size pressable
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* `ColorSwatch` (kol-component) is the chip alone — a fixed-size pressable atom
|
|
8
|
+
* for paint bars and inspectors. A colour PAGE needs the specimen plus its label
|
|
9
|
+
* and value, which is the form both brand apps had built locally
|
|
10
10
|
* (`brand-book-mocks-two-consumers`, 2026-09-03: 23 lines, byte-identical in
|
|
11
11
|
* kol-client-olina and kol-website). This composes the atom rather than
|
|
12
12
|
* redrawing it, per the ticket.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
* `.kol-swatch-
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `kol-components-
|
|
21
|
-
*
|
|
22
|
-
*
|
|
14
|
+
* GEOMETRY IS CARRIED THROUGH. The forks wore `.kol-swatch` /
|
|
15
|
+
* `.kol-swatch-chip` / `.kol-swatch-meta`, and those rules are real — they ship
|
|
16
|
+
* in **`@kolkrabbi/kol-framework`** (`kol-framework.css`, the "Swatch / Ramp
|
|
17
|
+
* (color specimens)" block), not in kol-theme: a 6px-gap column, a **96px-tall**
|
|
18
|
+
* chip at radius 4, and a row-wrapped meta line on the baseline. They are
|
|
19
|
+
* stragglers — `.kol-mood-tile-*` left that same block for
|
|
20
|
+
* `kol-theme/kol-components-styleguide.css` on 2026-07-10 and these did not.
|
|
21
|
+
*
|
|
22
|
+
* So this component draws that geometry ITSELF rather than wearing the classes.
|
|
23
|
+
* kol-framework is not a peer of kol-styleguide and must not become one — a
|
|
24
|
+
* component whose look depends on another package's stylesheet being imported
|
|
25
|
+
* is the defect `styleguide-barrel-is-unimportable` was filed about. A
|
|
26
|
+
* consumer swapping its fork onto this gets the same render with no new
|
|
27
|
+
* install, and `height` is the seam if a page wants a different specimen depth.
|
|
23
28
|
*
|
|
24
29
|
* <Swatch hex="#131316" name="Ink" anchor />
|
|
25
30
|
*
|
|
@@ -27,16 +32,20 @@ import { ColorSwatch } from '@kolkrabbi/kol-component'
|
|
|
27
32
|
* copy; `name` renders exactly as authored.
|
|
28
33
|
*
|
|
29
34
|
* @param {string} hex - The colour, e.g. '#131316' (required — it is both the paint and the printed value)
|
|
30
|
-
* @param {ReactNode} name - Label
|
|
35
|
+
* @param {ReactNode} name - Label beside the value; omitted, only the hex renders
|
|
31
36
|
* @param {boolean} anchor - Mark this stop as the palette's canonical anchor — a difference-blended dot centred on the chip (default: false)
|
|
32
|
-
* @param {number|
|
|
37
|
+
* @param {number|string} height - Specimen depth, the forks' `.kol-swatch-chip` height (default: 96)
|
|
33
38
|
* @param {string} className - Extra classes on the wrapper
|
|
34
39
|
*/
|
|
35
|
-
export default function Swatch({ hex, name, anchor = false,
|
|
40
|
+
export default function Swatch({ hex, name, anchor = false, height = 96, className = '' }) {
|
|
36
41
|
return (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
/* gap 6 — .kol-swatch */
|
|
43
|
+
<div className={`flex flex-col ${className}`.trim()} style={{ gap: 6 }}>
|
|
44
|
+
{/* .kol-swatch-chip: full column width, 96 tall, radius 4. ColorSwatch's
|
|
45
|
+
'stretch' size fills this box, so the atom owns the paint and the
|
|
46
|
+
frame while the specimen depth stays the page's decision. */}
|
|
47
|
+
<div className="relative w-full" style={{ height }}>
|
|
48
|
+
<ColorSwatch hex={hex} size="stretch" radius="sm" />
|
|
40
49
|
{anchor && (
|
|
41
50
|
<span
|
|
42
51
|
aria-label="Canonical anchor"
|
|
@@ -51,7 +60,11 @@ export default function Swatch({ hex, name, anchor = false, size = 'fill', class
|
|
|
51
60
|
</span>
|
|
52
61
|
)}
|
|
53
62
|
</div>
|
|
54
|
-
|
|
63
|
+
{/* .kol-swatch-meta: row, space-between, baseline, wrapping */}
|
|
64
|
+
<div
|
|
65
|
+
className="kol-helper-10 flex flex-row flex-wrap items-baseline justify-between"
|
|
66
|
+
style={{ gap: '4px 12px' }}
|
|
67
|
+
>
|
|
55
68
|
{name && <span className="text-meta">{name}</span>}
|
|
56
69
|
<span className="text-strong font-semibold">{hex.toUpperCase()}</span>
|
|
57
70
|
</div>
|