@kolkrabbi/kol-component 0.173.0 → 0.174.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.173.0",
3
+ "version": "0.174.0",
4
4
  "description": "KOL design-system components — atoms through organisms, emitting canonical kol-* classes. Pairs with @kolkrabbi/kol-theme for styling.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -122,6 +122,7 @@ export { default as Carousel } from './molecules/Carousel.jsx'
122
122
  * three in-package copies (and kol-website's CarouselNavigation) happened. */
123
123
  export { default as EmblaNav } from './molecules/EmblaNav.jsx'
124
124
  export { default as ContentFilters } from './organisms/ContentFilters.jsx'
125
+ export { default as PageHeader } from './molecules/PageHeader.jsx'
125
126
  export { default as ErrorBoundary } from './utilities/ErrorBoundary.jsx'
126
127
  export { default as FeatureSplit } from './organisms/FeatureSplit.jsx'
127
128
  export { default as FeaturedCarousel } from './organisms/FeaturedCarousel.jsx'
@@ -0,0 +1,135 @@
1
+ /**
2
+ * PageHeader — the page's masthead: an optional eyebrow, the title, and a
3
+ * sub-line.
4
+ *
5
+ * LIVES IN kol-component SINCE 2026-09-03 (page-header-one-masthead,
6
+ * kol-client-olina; user: *"these are serving the same purpose, why aren't they
7
+ * the same component different variants?"*). It shipped from `kol-shell`, which
8
+ * is the APP-shell tier — rails, drawers, the portal frame — so a site with no
9
+ * shell could not take it without installing the whole package for one header,
10
+ * and hand-built the masthead out of `SectionText` instead. kolkrabbi.io's
11
+ * `/prints` and `/work` did exactly that, `/prints` carrying a comment
12
+ * explaining it was reproducing `/work`'s block "in its wrapper verbatim" — a
13
+ * consumer restating a rule the component should own.
14
+ *
15
+ * The rest of the catalog stack — `ContentFilters`, `ContentCollection`,
16
+ * `ContentCard`, `SectionText` — was already here, so this reunites it: one
17
+ * import for the whole page, site or app. Nothing circular: `kol-shell` peers on
18
+ * `kol-component` at `>=0.127.0`, so every shell consumer already had it.
19
+ * This overrides ARCHITECTURE §3's list, which named it kol-shell's.
20
+ *
21
+ * TWO SCALES, because two things were being called a page header. An app page
22
+ * (monitor's Library, mirror's settings) wears a compact heading; a SITE page
23
+ * (kol-website's /work) opens on the display scale and the difference is not a
24
+ * preference, it is which register you are in. `size` picks:
25
+ *
26
+ * sm kol-sans-heading-03 32px — app chrome, a titled panel
27
+ * md kol-sans-display-03 36 / 42 / 48px — the default page masthead
28
+ * lg kol-sans-display-02 44 / 56 / 64px — a landing or section opener
29
+ *
30
+ * The title used to be `kol-heading-sm`, a retired t-shirt stop with NO rule
31
+ * anywhere in kol-theme, so every page title in every shell app fell through to
32
+ * the browser's default h1 (found 2026-08-15). It was mapped to heading-03,
33
+ * which was still too quiet for a page — hence the scale.
34
+ *
35
+ * `eyebrow` is the small label above the title (kol-website's "USE CASES").
36
+ * It self-hides when unset, so an app page passes nothing and gets nothing.
37
+ *
38
+ * @param {ReactNode} eyebrow small label above the title
39
+ * @param {ReactNode} title
40
+ * @param {ReactNode} subtitle mono line under the title
41
+ * @param {'app'|'site'} register which REGISTER the masthead is in (default `app`).
42
+ * The registers differ in the sub-line's voice and nothing else — the
43
+ * title roles, the sizes and the actions baseline are shared, which is
44
+ * what made this one component rather than two:
45
+ * app mono sub-line (`kol-mono-14`) — an app page's masthead. The
46
+ * default, so no shell page moves.
47
+ * site sans lede (`kol-sans-body-01`) — what kolkrabbi.io's `/prints`
48
+ * and `/work` build by hand today.
49
+ * @param {string} size sm | md | lg (default md)
50
+ * @param {'sans'|'mono'} voice the title's family (default sans). `mono` = the
51
+ * app tier's masthead (PageHeaderMonoTitle, kol-fxr 2026-08-27 —
52
+ * user ruling: kol-monitor's JetBrains Mono 32 / 500 is the look):
53
+ * kol-mono-heading-03 · kol-mono-display-03 · kol-mono-display-02
54
+ * (kol-theme ≥0.67.0). The subtitle stays kol-mono-14.
55
+ * @param {string} titleClass replaces the title role whole (the ContentText seam)
56
+ * @param {ReactNode} actions a control cluster on the SUBTITLE's first baseline — on the title's
57
+ * when there is no subtitle (PageHeaderTrailingSlot, kol-website 2026-08-28;
58
+ * kol-r2b2's header is the reference: wordmark left, controls right, on the
59
+ * line). Without it the consumer wrapped the header in a flex row and got the
60
+ * h1's baseline, or re-rendered the subtitle as a bare <p> off copied classes
61
+ * with an `!important` on the margin — a DS text role re-implemented outside.
62
+ * @param {string} subtitleMaxWidth the lede's measure (e.g. '800px' or '60ch'), a prop
63
+ * instead of a consumer selector reaching inside
64
+ * The bottom rhythm is `--kol-page-header-mb` (default 40px): inline, as before, but through a
65
+ * variable a consumer can re-point where an inline literal could only be `!important`-ed.
66
+ */
67
+ const TITLE = {
68
+ sans: { sm: 'kol-sans-heading-03', md: 'kol-sans-display-03', lg: 'kol-sans-display-02' },
69
+ mono: { sm: 'kol-mono-heading-03', md: 'kol-mono-display-03', lg: 'kol-mono-display-02' },
70
+ }
71
+ /* the ONE thing the registers disagree about */
72
+ const LEDE = { app: 'kol-mono-14', site: 'kol-sans-body-01' }
73
+
74
+ export default function PageHeader({ eyebrow, title, subtitle, actions, subtitleMaxWidth, size = 'md', voice = 'sans', register = 'app', titleClass, className = '' }) {
75
+ const roles = TITLE[voice] ?? TITLE.sans
76
+ const h1 = <h1 className={`text-fg-96 ${titleClass ?? roles[size] ?? roles.md}`}>{title}</h1>
77
+ const lede = subtitle && <p className={`text-oq-64 ${LEDE[register] ?? LEDE.app} min-w-0`} style={{ marginTop: actions ? undefined : 12, maxWidth: subtitleMaxWidth }}>{subtitle}</p>
78
+ /* The cluster shares a baseline row with the lede (or the title): flexbox
79
+ exposes a flex item's FIRST baseline, so putting them in one row is the one
80
+ way to land on the subtitle's line rather than the h1's.
81
+
82
+ AND IT CONTRIBUTES NO HEIGHT (PageHeaderActionsGrowsBlock, kol-fxr
83
+ 2026-08-28). A flex row takes its tallest child, so a cluster of `sm`
84
+ controls (28px since kol-theme 0.90.0) against a one-line `kol-mono-14`
85
+ lede (18px) made the masthead 10px taller — measured, monitor's `/` at 65.2
86
+ against fxr's `/settings` at 75.2 with identical titles. The masthead is the
87
+ one block every page of an app shares, so a page with a control cluster sat
88
+ 10px lower than every page without one, with no way to opt out.
89
+
90
+ `h-0` + `self-center` is the fix and it is not a magic number: a zero-height
91
+ box centred on the row makes the children overflow it symmetrically, so the
92
+ row's height is the TEXT's and the cluster is free at any rung (the gap is
93
+ 10px at `sm`, 14 at `md` — a constant would have been wrong). Horizontal
94
+ layout is untouched: the box still takes its width, so `justify-between`
95
+ holds and a long lede cannot run under the controls. */
96
+ const cluster = actions && <div className="flex items-center gap-4 shrink-0 h-0 self-center">{actions}</div>
97
+ return (
98
+ /* the block owns its own rhythm — margins inline, never in a shared type
99
+ class, which leaks estate-wide (ShellHeaderFilterRefinements, 2026-08-15) */
100
+ <header className={`flex flex-col ${className}`.trim()} style={{ marginBottom: 'var(--kol-page-header-mb, 40px)' }}>
101
+ {eyebrow && (
102
+ /* HELPER, not mono (user ruling 2026-08-15). An eyebrow is single-line
103
+ chrome — that is the whole definition of the `kol-helper-*` ramp, and
104
+ it carries its own tracking, so no inline letter-spacing here.
105
+ Uppercase, and off `fg-48`: under half the ink read as disabled
106
+ rather than quiet, and this is a live label, not a footnote. */
107
+ <p
108
+ className="text-oq-64 kol-helper-12"
109
+ style={{ marginBottom: 12, textTransform: 'uppercase' }}
110
+ >
111
+ {eyebrow}
112
+ </p>
113
+ )}
114
+ {actions && subtitle ? (
115
+ <>
116
+ {h1}
117
+ <div className="flex items-baseline justify-between gap-6" style={{ marginTop: 12 }}>
118
+ {lede}
119
+ {cluster}
120
+ </div>
121
+ </>
122
+ ) : actions ? (
123
+ <div className="flex items-baseline justify-between gap-6">
124
+ {h1}
125
+ {cluster}
126
+ </div>
127
+ ) : (
128
+ <>
129
+ {h1}
130
+ {lede}
131
+ </>
132
+ )}
133
+ </header>
134
+ )
135
+ }