@kolkrabbi/kol-component 0.173.0 → 0.175.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.175.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,104 @@
1
+ import SectionText from './SectionText.jsx'
2
+ /**
3
+ * PageHeader — the page's masthead: an optional eyebrow, the title, and a
4
+ * sub-line.
5
+ *
6
+ * LIVES IN kol-component SINCE 2026-09-03 (page-header-one-masthead,
7
+ * kol-client-olina; user: *"these are serving the same purpose, why aren't they
8
+ * the same component different variants?"*). It shipped from `kol-shell`, which
9
+ * is the APP-shell tier — rails, drawers, the portal frame — so a site with no
10
+ * shell could not take it without installing the whole package for one header,
11
+ * and hand-built the masthead out of `SectionText` instead. kolkrabbi.io's
12
+ * `/prints` and `/work` did exactly that, `/prints` carrying a comment
13
+ * explaining it was reproducing `/work`'s block "in its wrapper verbatim" — a
14
+ * consumer restating a rule the component should own.
15
+ *
16
+ * The rest of the catalog stack — `ContentFilters`, `ContentCollection`,
17
+ * `ContentCard`, `SectionText` — was already here, so this reunites it: one
18
+ * import for the whole page, site or app. Nothing circular: `kol-shell` peers on
19
+ * `kol-component` at `>=0.127.0`, so every shell consumer already had it.
20
+ * This overrides ARCHITECTURE §3's list, which named it kol-shell's.
21
+ *
22
+ * TWO SCALES, because two things were being called a page header. An app page
23
+ * (monitor's Library, mirror's settings) wears a compact heading; a SITE page
24
+ * (kol-website's /work) opens on the display scale and the difference is not a
25
+ * preference, it is which register you are in. `size` picks:
26
+ *
27
+ * sm kol-sans-heading-03 32px — app chrome, a titled panel
28
+ * md kol-sans-display-03 36 / 42 / 48px — the default page masthead
29
+ * lg kol-sans-display-02 44 / 56 / 64px — a landing or section opener
30
+ *
31
+ * The title used to be `kol-heading-sm`, a retired t-shirt stop with NO rule
32
+ * anywhere in kol-theme, so every page title in every shell app fell through to
33
+ * the browser's default h1 (found 2026-08-15). It was mapped to heading-03,
34
+ * which was still too quiet for a page — hence the scale.
35
+ *
36
+ * `eyebrow` is the small label above the title (kol-website's "USE CASES").
37
+ * It self-hides when unset, so an app page passes nothing and gets nothing.
38
+ *
39
+ * @param {ReactNode} eyebrow small label above the title
40
+ * @param {ReactNode} title
41
+ * @param {ReactNode} subtitle mono line under the title
42
+ * @param {'app'|'site'} register which REGISTER the masthead is in (default `app`).
43
+ * The registers differ in the sub-line's voice and nothing else — the
44
+ * title roles, the sizes and the actions baseline are shared, which is
45
+ * what made this one component rather than two:
46
+ * app mono sub-line (`kol-mono-14`) — an app page's masthead. The
47
+ * default, so no shell page moves.
48
+ * site sans lede (`kol-sans-body-01`) — what kolkrabbi.io's `/prints`
49
+ * and `/work` build by hand today.
50
+ * @param {string} size sm | md | lg (default md)
51
+ * @param {'sans'|'mono'} voice the title's family (default sans). `mono` = the
52
+ * app tier's masthead (PageHeaderMonoTitle, kol-fxr 2026-08-27 —
53
+ * user ruling: kol-monitor's JetBrains Mono 32 / 500 is the look):
54
+ * kol-mono-heading-03 · kol-mono-display-03 · kol-mono-display-02
55
+ * (kol-theme ≥0.67.0). The subtitle stays kol-mono-14.
56
+ * @param {string} titleClass replaces the title role whole (the ContentText seam)
57
+ * @param {ReactNode} actions a control cluster on the SUBTITLE's first baseline — on the title's
58
+ * when there is no subtitle (PageHeaderTrailingSlot, kol-website 2026-08-28;
59
+ * kol-r2b2's header is the reference: wordmark left, controls right, on the
60
+ * line). Without it the consumer wrapped the header in a flex row and got the
61
+ * h1's baseline, or re-rendered the subtitle as a bare <p> off copied classes
62
+ * with an `!important` on the margin — a DS text role re-implemented outside.
63
+ * @param {string} subtitleMaxWidth the lede's measure (e.g. '800px' or '60ch'), a prop
64
+ * instead of a consumer selector reaching inside
65
+ * The bottom rhythm is `--kol-page-header-mb` (default 40px): inline, as before, but through a
66
+ * variable a consumer can re-point where an inline literal could only be `!important`-ed.
67
+ */
68
+ /* the title role per size and voice — the one thing PageHeader knows that the
69
+ * base does not, because the base's ladder is the SECTION scale */
70
+ const TITLE = {
71
+ sans: { sm: 'kol-sans-heading-03', md: 'kol-sans-display-03', lg: 'kol-sans-display-02' },
72
+ mono: { sm: 'kol-mono-heading-03', md: 'kol-mono-display-03', lg: 'kol-mono-display-02' },
73
+ }
74
+ /* the ONE thing the registers disagree about */
75
+ const LEDE = { app: 'kol-mono-14', site: 'kol-sans-body-01' }
76
+
77
+ export default function PageHeader({ eyebrow, title, subtitle, actions, subtitleMaxWidth, size = 'md', voice = 'sans', register = 'app', titleClass, className = '' }) {
78
+ const roles = TITLE[voice] ?? TITLE.sans
79
+ return (
80
+ /* the block owns its own rhythm — margins inline, never in a shared type
81
+ class, which leaks estate-wide (ShellHeaderFilterRefinements, 2026-08-15) */
82
+ <SectionText
83
+ eyebrow={eyebrow}
84
+ headline={title}
85
+ headlineAs="h1"
86
+ headlineClass={`text-fg-96 ${titleClass ?? roles[size] ?? roles.md}`}
87
+ body={subtitle}
88
+ bodyClass={`text-oq-64 ${LEDE[register] ?? LEDE.app} min-w-0`}
89
+ actions={actions}
90
+ actionsPlacement="inline"
91
+ actionsClass="flex items-center gap-4"
92
+ /* HELPER, not mono (user ruling 2026-08-15). An eyebrow is single-line
93
+ chrome — the whole definition of the `kol-helper-*` ramp — and it
94
+ carries its own tracking, so no inline letter-spacing. Off `oq-64`:
95
+ under half the ink read as disabled rather than quiet, and this is a
96
+ live label, not a footnote. */
97
+ eyebrowClass="kol-helper-12 text-oq-64"
98
+ gap="gap-3"
99
+ slotStyle={{ body: { maxWidth: subtitleMaxWidth } }}
100
+ className={className}
101
+ style={{ marginBottom: 'var(--kol-page-header-mb, 40px)' }}
102
+ />
103
+ )
104
+ }
@@ -71,24 +71,59 @@ export default function SectionText({
71
71
  labelClass,
72
72
  bodyClass = 'kol-section-text-body',
73
73
  actionsClass = 'flex flex-wrap gap-4',
74
+ /* ACTIONS ON THE BODY'S BASELINE (page-header-one-masthead, 2026-09-03).
75
+ * Default `below` is the section stack every organism renders. `inline` puts
76
+ * the cluster in ONE flex row with the body, which is the only way to land it
77
+ * on the body's first baseline rather than the headline's — flexbox exposes a
78
+ * flex item's first baseline, so they have to share a row.
79
+ *
80
+ * The cluster contributes NO HEIGHT there: a flex row takes its tallest
81
+ * child, so `sm` controls (26px) against a one-line `kol-mono-14` (18px) made
82
+ * the block 10px taller — measured across two apps, and the masthead is the
83
+ * one block every page shares, so a page with a control cluster sat lower
84
+ * than one without. `h-0 self-center` makes the children overflow a
85
+ * zero-height box symmetrically; the row's height is the TEXT's, at any rung.
86
+ * Horizontal layout is untouched, so a long body cannot run under the
87
+ * controls (PageHeaderTrailingSlot / PageHeaderActionsGrowsBlock, carried in
88
+ * from `PageHeader` when it became a composition of this base). */
89
+ actionsPlacement = 'below',
74
90
  slotClass = {},
75
91
  slotStyle = {},
76
92
  className = '',
93
+ /* the ROOT's own style — a composition that owns its rhythm needs it
94
+ (PageHeader's `--kol-page-header-mb`). `slotStyle` reaches the slots; this
95
+ was the one box it could not reach. */
96
+ style,
77
97
  }) {
78
98
  /* `label` / `labelClass` / slot key `label` = aliases of `eyebrow` (2026-08-27) */
79
99
  const eb = eyebrow ?? label
80
100
  const ebClass = eyebrowClass ?? labelClass ?? 'kol-helper-12 text-meta'
81
101
  const cls = (base, slot) => `${base} ${slotClass[slot] ?? (slot === 'eyebrow' ? slotClass.label : undefined) ?? ''}`.trim()
82
102
  const alignCls = align === 'center' ? 'items-center text-center' : 'items-start text-left'
103
+ const inlineActions = actionsPlacement === 'inline' && !!actions && !!body
104
+ const bodyNode = body && (typeof body === 'string'
105
+ ? <p className={cls(bodyClass, 'body')} style={slotStyle.body}>{body}</p>
106
+ : <div className={cls(bodyClass, 'body')} style={slotStyle.body}>{body}</div>)
107
+ const cluster = actions && (
108
+ <div className={cls(`${actionsClass} shrink-0 h-0 self-center`, 'actions')} style={slotStyle.actions}>{actions}</div>
109
+ )
83
110
  return (
84
- <div className={`kol-section-text flex flex-col ${gap} ${alignCls} ${className}`.replace(/\s+/g, ' ').trim()}>
111
+ <div className={`kol-section-text flex flex-col ${gap} ${alignCls} ${className}`.replace(/\s+/g, ' ').trim()} style={style}>
85
112
  {/* `kol-section-text-eyebrow` = uppercase by ROLE (kol-theme ≥0.55.0);
86
113
  * `labelClass` is the voice riding beside it */}
87
114
  {eb && <span className={cls(`kol-section-text-eyebrow ${ebClass}`, 'eyebrow')} style={slotStyle.eyebrow ?? slotStyle.label}>{eb}</span>}
88
115
  {headline && <Headline className={cls(`kol-section-text-headline ${headlineClass ?? (HEADLINE_ROLE[headlineSize] ?? HEADLINE_ROLE['heading-02'])}${headlineCase === 'upper' ? ' kol-section-text-caps' : ''}`, 'headline')} style={slotStyle.headline}>{headline}</Headline>}
89
- {body && (typeof body === 'string' ? <p className={cls(bodyClass, 'body')} style={slotStyle.body}>{body}</p> : <div className={cls(bodyClass, 'body')} style={slotStyle.body}>{body}</div>)}
116
+ {bodyNode && (inlineActions
117
+ ? (
118
+ <div className="flex items-baseline justify-between gap-6">
119
+ {bodyNode}
120
+ {cluster}
121
+ </div>
122
+ )
123
+ : bodyNode)}
90
124
  {children}
91
- {actions && <div className={cls(actionsClass, 'actions')} style={slotStyle.actions}>{actions}</div>}
125
+ {/* inline with no body → the cluster shares the HEADLINE's row instead */}
126
+ {actions && !inlineActions && <div className={cls(actionsClass, 'actions')} style={slotStyle.actions}>{actions}</div>}
92
127
  </div>
93
128
  )
94
129
  }