@kolkrabbi/kol-component 0.174.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.174.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",
@@ -1,3 +1,4 @@
1
+ import SectionText from './SectionText.jsx'
1
2
  /**
2
3
  * PageHeader — the page's masthead: an optional eyebrow, the title, and a
3
4
  * sub-line.
@@ -64,6 +65,8 @@
64
65
  * The bottom rhythm is `--kol-page-header-mb` (default 40px): inline, as before, but through a
65
66
  * variable a consumer can re-point where an inline literal could only be `!important`-ed.
66
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 */
67
70
  const TITLE = {
68
71
  sans: { sm: 'kol-sans-heading-03', md: 'kol-sans-display-03', lg: 'kol-sans-display-02' },
69
72
  mono: { sm: 'kol-mono-heading-03', md: 'kol-mono-display-03', lg: 'kol-mono-display-02' },
@@ -73,63 +76,29 @@ const LEDE = { app: 'kol-mono-14', site: 'kol-sans-body-01' }
73
76
 
74
77
  export default function PageHeader({ eyebrow, title, subtitle, actions, subtitleMaxWidth, size = 'md', voice = 'sans', register = 'app', titleClass, className = '' }) {
75
78
  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
79
  return (
98
80
  /* the block owns its own rhythm — margins inline, never in a shared type
99
81
  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>
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
+ />
134
103
  )
135
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
  }