@kolkrabbi/kol-component 0.284.0 → 0.285.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 +3 -3
- package/src/index.js +1 -1
- package/src/molecules/PageHeader.jsx +17 -93
- package/src/molecules/SectionText.jsx +53 -7
- package/src/utilities/Popover.jsx +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.285.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"embla-carousel-react": "^8.6.0",
|
|
27
27
|
"pdfjs-dist": "^6.3.289",
|
|
28
28
|
"react-syntax-highlighter": "^16.1.1",
|
|
29
|
-
"@kolkrabbi/kol-
|
|
30
|
-
"@kolkrabbi/kol-
|
|
29
|
+
"@kolkrabbi/kol-search": "^0.3.0",
|
|
30
|
+
"@kolkrabbi/kol-markdown": "^0.1.3"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@kolkrabbi/kol-icons": ">=0.22.0",
|
package/src/index.js
CHANGED
|
@@ -61,7 +61,7 @@ export { default as QuantityInput } from './molecules/QuantityInput.jsx'
|
|
|
61
61
|
export { default as Knob, default as RotaryDial } from './molecules/Knob.jsx'
|
|
62
62
|
export { default as SearchInput } from './molecules/SearchInput.jsx'
|
|
63
63
|
export { default as InspectorSection, default as Section } from './molecules/InspectorSection.jsx'
|
|
64
|
-
export { default as SectionText } from './molecules/SectionText.jsx'
|
|
64
|
+
export { default as SectionText, SECTION_TEXT_LEVELS } from './molecules/SectionText.jsx'
|
|
65
65
|
export { default as SectionLabel } from './atoms/SectionLabel.jsx'
|
|
66
66
|
export { default as SegmentedToggle } from './atoms/SegmentedToggle.jsx'
|
|
67
67
|
export { default as Stepper } from './molecules/Stepper.jsx'
|
|
@@ -1,105 +1,29 @@
|
|
|
1
|
-
import SectionText from './SectionText.jsx'
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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
|
-
* ONE SCALE since 2026-10-18 (Round 11): the app/site split, `size` sm–xl and the mono voice are
|
|
23
|
-
* retired — `level` page | section is the only choice (see the block under this one).
|
|
24
|
-
*
|
|
25
|
-
* `eyebrow` is the small label above the title (kol-website's "USE CASES").
|
|
26
|
-
* It self-hides when unset, so an app page passes nothing and gets nothing.
|
|
27
|
-
*
|
|
28
|
-
* @param {ReactNode} eyebrow small label above the title
|
|
29
|
-
* @param {ReactNode} title
|
|
30
|
-
* @param {ReactNode} subtitle the lede under the title (`description` is its other name)
|
|
31
|
-
* @param {'page'|'app'|'section'} level ONE HEADER (Round 11, approved 2026-10-18): page = h1
|
|
32
|
-
* display-01 over `.kol-header-lede` (22/28 Light) — the hero; app = h1 display-01 at
|
|
33
|
-
* 46/60 (`text-[46px] md:text-[60px]`) over `.kol-header-lede-app` (19/26 Light) — the app tier's pages; section = h2
|
|
34
|
-
* display-03 over `.kol-header-lede-section` (16/24 Light +0.5px). Default `page`.
|
|
35
|
-
* Classes per level: `PAGE_HEADER_ROLES`.
|
|
36
|
-
* @param {ReactNode} media a mark above the eyebrow (a logo, an SVG) — shown only when passed
|
|
37
|
-
* @param {ReactNode} description the subtitle's other name — the header's description
|
|
38
|
-
* @param {string} titleClass replaces the title role whole (the ContentText seam)
|
|
39
|
-
* @param {ReactNode} actions a control cluster on the SUBTITLE's first baseline — on the title's
|
|
40
|
-
* when there is no subtitle (PageHeaderTrailingSlot, kol-website 2026-08-28;
|
|
41
|
-
* kol-r2b2's header is the reference: wordmark left, controls right, on the
|
|
42
|
-
* line). Without it the consumer wrapped the header in a flex row and got the
|
|
43
|
-
* h1's baseline, or re-rendered the subtitle as a bare <p> off copied classes
|
|
44
|
-
* with an `!important` on the margin — a DS text role re-implemented outside.
|
|
45
|
-
* @param {string} subtitleMaxWidth the lede's measure (e.g. '800px' or '60ch'), a prop
|
|
46
|
-
* instead of a consumer selector reaching inside
|
|
47
|
-
* size · voice · register · masthead — retired 2026-10-18, accepted and ignored.
|
|
48
|
-
* The bottom rhythm is `--kol-page-header-mb` (default 40px): inline, as before, but through a
|
|
49
|
-
* variable a consumer can re-point where an inline literal could only be `!important`-ed.
|
|
2
|
+
* @deprecated 2026-10-22 → `SectionText` with `level` (user: *"rename PageHeader to something that describes
|
|
3
|
+
* section text elements and ship together"*). PageHeader was SectionText under four header levels; the levels
|
|
4
|
+
* now live on SectionText, so one component carries every section text block — a page's masthead, a page
|
|
5
|
+
* section, a section of content. Same props as before, mapped: `title` → `headline`, `subtitle` /
|
|
6
|
+
* `description` → `body`, `titleClass` → `headlineClass`, `subtitleMaxWidth` → the body's measure. `size` ·
|
|
7
|
+
* `voice` · `register` · `masthead` stay accepted and ignored. On the retirement ledger; the original is in
|
|
8
|
+
* `_tmp/2026-10-22-dev-section-header/`.
|
|
50
9
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
* `size` · `voice` · `register` · `masthead` are accepted and ignored, so every caller (and every
|
|
56
|
-
* Shell's masthead) renders the one header with no edit. `titleClass` stays the seam. */
|
|
57
|
-
/* THREE LEVELS since 0.277.0 (PageHeaderAppLevel, kol-monitor — user: *"that display is fine for Section
|
|
58
|
-
* Hero like in brand but not for EVERYTHING ELSE that uses the mono"*). `app` sits BETWEEN page and section,
|
|
59
|
-
* in their family (0.278.0 — user: *"did I ask for mono?!?! … MAKE THE TEXT SMALLER … SO THAT IT IS BETWEEN
|
|
60
|
-
* SECTION AND PAGE"*; 0.277.0 had made it mono): page's display-01 at 46 · 60 (from 768) in Tailwind,
|
|
61
|
-
* no new style (0.279.0), over a 19/26 light lede. The app tier's Home ·
|
|
62
|
-
* Library · Settings · Dev pages, which kol-shell defaults to it. Exported so a page drawing its own title
|
|
63
|
-
* (monitor's Create inputs) matches the level. */
|
|
64
|
-
export const PAGE_HEADER_ROLES = {
|
|
65
|
-
page: { title: 'kol-sans-display-01', lede: 'kol-header-lede' },
|
|
66
|
-
app: { title: 'kol-sans-display-01 text-[46px] md:text-[60px]', lede: 'kol-header-lede-app' },
|
|
67
|
-
section: { title: 'kol-sans-display-03', lede: 'kol-header-lede-section' },
|
|
68
|
-
}
|
|
10
|
+
import SectionText, { SECTION_TEXT_LEVELS } from './SectionText.jsx'
|
|
11
|
+
|
|
12
|
+
/** @deprecated → `SECTION_TEXT_LEVELS` */
|
|
13
|
+
export const PAGE_HEADER_ROLES = SECTION_TEXT_LEVELS
|
|
69
14
|
|
|
70
|
-
export default function PageHeader({
|
|
71
|
-
|
|
72
|
-
const roles = PAGE_HEADER_ROLES[level] ?? PAGE_HEADER_ROLES.page
|
|
73
|
-
const header = (
|
|
74
|
-
/* the block owns its own rhythm — margins inline, never in a shared type
|
|
75
|
-
class, which leaks estate-wide (ShellHeaderFilterRefinements, 2026-08-15) */
|
|
15
|
+
export default function PageHeader({ title, subtitle, description, subtitleMaxWidth, titleClass, level = 'page', eyebrow, actions, media, className = '' }) {
|
|
16
|
+
return (
|
|
76
17
|
<SectionText
|
|
18
|
+
level={level}
|
|
77
19
|
eyebrow={eyebrow}
|
|
78
20
|
headline={title}
|
|
79
|
-
|
|
80
|
-
headlineClass={`text-fg-96 ${titleClass ?? roles.title}`}
|
|
21
|
+
headlineClass={titleClass}
|
|
81
22
|
body={subtitle ?? description}
|
|
82
|
-
bodyClass={`${roles.lede} min-w-0`}
|
|
83
23
|
actions={actions}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
/* HELPER, not mono (user ruling 2026-08-15). An eyebrow is single-line
|
|
87
|
-
chrome — the whole definition of the `kol-helper-*` ramp — and it
|
|
88
|
-
carries its own tracking, so no inline letter-spacing. Off `oq-64`:
|
|
89
|
-
under half the ink read as disabled rather than quiet, and this is a
|
|
90
|
-
live label, not a footnote. */
|
|
91
|
-
eyebrowClass="kol-helper-12 text-oq-64"
|
|
92
|
-
gap="gap-3"
|
|
93
|
-
slotStyle={{ body: { maxWidth: subtitleMaxWidth } }}
|
|
24
|
+
media={media}
|
|
25
|
+
slotStyle={subtitleMaxWidth ? { body: { maxWidth: subtitleMaxWidth } } : undefined}
|
|
94
26
|
className={className}
|
|
95
|
-
style={media ? undefined : { marginBottom: 'var(--kol-page-header-mb, 40px)' }}
|
|
96
27
|
/>
|
|
97
28
|
)
|
|
98
|
-
if (!media) return header
|
|
99
|
-
return (
|
|
100
|
-
<div className="flex flex-col gap-4" style={{ marginBottom: 'var(--kol-page-header-mb, 40px)' }}>
|
|
101
|
-
<span className="inline-flex text-emphasis">{media}</span>
|
|
102
|
-
{header}
|
|
103
|
-
</div>
|
|
104
|
-
)
|
|
105
29
|
}
|
|
@@ -36,6 +36,15 @@
|
|
|
36
36
|
* stamps `reveal` on each part; nothing animates in the DS)
|
|
37
37
|
* @param {object} slotStyle inline style per slot — `{ headline: { '--reveal-delay': '0.1s' } }`
|
|
38
38
|
* @param {string} className extra classes on the block
|
|
39
|
+
* @param {'page'|'app'|'section'|'content'} [level] THE HEADER LEVELS (2026-10-22, user: *"rename PageHeader to
|
|
40
|
+
* something that describes section text elements"* — PageHeader is now an alias of this). A
|
|
41
|
+
* level fills the role defaults; any explicit prop still wins. page = h1 display-01 over
|
|
42
|
+
* `.kol-header-lede` — the hero; app = h1 display-01 at 46/60 over `.kol-header-lede-app`;
|
|
43
|
+
* section = h2 display-03 over `.kol-header-lede-section`; content = h3 heading-04 under a
|
|
44
|
+
* `kol-eyebrow`, over body-01 fg-64 at 64ch — a section of a page's CONTENT (a dev tab's
|
|
45
|
+
* sections, DevSectionHeader, kol-fxr). A level sets actions inline, and the bottom rhythm
|
|
46
|
+
* to `--kol-page-header-mb` (40px; content 16px). Unset = the section family as before.
|
|
47
|
+
* @param {ReactNode} media a mark above the eyebrow (a logo, an SVG) — with a `level` only
|
|
39
48
|
*/
|
|
40
49
|
export const HEADLINE_ROLE = {
|
|
41
50
|
pull: 'kol-section-text-pull',
|
|
@@ -50,18 +59,29 @@ export const HEADLINE_ROLE = {
|
|
|
50
59
|
'heading-05': 'kol-sans-heading-05',
|
|
51
60
|
}
|
|
52
61
|
|
|
62
|
+
/* ONE HEADER, FOUR LEVELS (Round 11 + PageHeaderAppLevel, carried from PageHeader whole). `title` is the
|
|
63
|
+
* headline's type, `lede` the body's; the rest default the block for that level. */
|
|
64
|
+
export const SECTION_TEXT_LEVELS = {
|
|
65
|
+
page: { title: 'kol-sans-display-01', lede: 'kol-header-lede' },
|
|
66
|
+
app: { title: 'kol-sans-display-01 text-[46px] md:text-[60px]', lede: 'kol-header-lede-app' },
|
|
67
|
+
section: { title: 'kol-sans-display-03', lede: 'kol-header-lede-section', as: 'h2' },
|
|
68
|
+
/* content (DevSectionHeader, kol-fxr 2026-10-22 — the user's approved look: *"maybe title and description is
|
|
69
|
+
* one step bigger?"*; never `kol-helper-*` for a paragraph) */
|
|
70
|
+
content: { title: 'kol-sans-heading-04', lede: 'kol-sans-body-01 text-fg-64', eyebrow: 'kol-eyebrow text-fg-48', as: 'h3', gap: 'gap-2', mb: '16px', measure: '64ch' },
|
|
71
|
+
}
|
|
72
|
+
|
|
53
73
|
export default function SectionText({
|
|
54
74
|
eyebrow,
|
|
55
75
|
label,
|
|
56
76
|
headline,
|
|
57
77
|
headlineSize = 'heading-02',
|
|
58
|
-
headlineAs
|
|
78
|
+
headlineAs,
|
|
59
79
|
headlineCase = 'auto',
|
|
60
80
|
headlineClass,
|
|
61
81
|
body,
|
|
62
82
|
actions,
|
|
63
83
|
align = 'start',
|
|
64
|
-
gap
|
|
84
|
+
gap,
|
|
65
85
|
children,
|
|
66
86
|
/* ONE eyebrow voice across the set (SectionTextLabelVoice, user 2026-08-26:
|
|
67
87
|
* "closer to the hero eyebrow") — the hero's helper-12 / meta, small and
|
|
@@ -69,8 +89,8 @@ export default function SectionText({
|
|
|
69
89
|
* the eyebrow ROLE (ruled the same day), on `.kol-section-text-eyebrow`. */
|
|
70
90
|
eyebrowClass,
|
|
71
91
|
labelClass,
|
|
72
|
-
bodyClass
|
|
73
|
-
actionsClass
|
|
92
|
+
bodyClass,
|
|
93
|
+
actionsClass,
|
|
74
94
|
/* ACTIONS ON THE BODY'S BASELINE (page-header-one-masthead, 2026-09-03).
|
|
75
95
|
* Default `below` is the section stack every organism renders. `inline` puts
|
|
76
96
|
* the cluster in ONE flex row with the body, which is the only way to land it
|
|
@@ -86,7 +106,7 @@ export default function SectionText({
|
|
|
86
106
|
* Horizontal layout is untouched, so a long body cannot run under the
|
|
87
107
|
* controls (PageHeaderTrailingSlot / PageHeaderActionsGrowsBlock, carried in
|
|
88
108
|
* from `PageHeader` when it became a composition of this base). */
|
|
89
|
-
actionsPlacement
|
|
109
|
+
actionsPlacement,
|
|
90
110
|
slotClass = {},
|
|
91
111
|
slotStyle = {},
|
|
92
112
|
className = '',
|
|
@@ -94,10 +114,29 @@ export default function SectionText({
|
|
|
94
114
|
(PageHeader's `--kol-page-header-mb`). `slotStyle` reaches the slots; this
|
|
95
115
|
was the one box it could not reach. */
|
|
96
116
|
style,
|
|
117
|
+
level,
|
|
118
|
+
media,
|
|
97
119
|
}) {
|
|
120
|
+
/* a LEVEL fills the header defaults; an explicit prop always wins */
|
|
121
|
+
const L = level ? SECTION_TEXT_LEVELS[level] ?? SECTION_TEXT_LEVELS.page : null
|
|
122
|
+
const Headline = headlineAs ?? L?.as ?? (L ? 'h1' : 'h2')
|
|
123
|
+
if (L) {
|
|
124
|
+
headlineClass = `text-fg-96 ${headlineClass ?? L.title}`
|
|
125
|
+
bodyClass ??= `${L.lede} min-w-0`
|
|
126
|
+
actionsClass ??= 'flex items-center gap-4'
|
|
127
|
+
actionsPlacement ??= 'inline'
|
|
128
|
+
slotStyle = L.measure && !slotStyle.body?.maxWidth ? { ...slotStyle, body: { ...slotStyle.body, maxWidth: L.measure } } : slotStyle
|
|
129
|
+
if (!media) style = { marginBottom: `var(--kol-page-header-mb, ${L.mb ?? '40px'})`, ...style }
|
|
130
|
+
}
|
|
131
|
+
gap ??= L?.gap ?? (L ? 'gap-3' : 'gap-4')
|
|
132
|
+
bodyClass ??= 'kol-section-text-body'
|
|
133
|
+
actionsClass ??= 'flex flex-wrap gap-4'
|
|
134
|
+
actionsPlacement ??= 'below'
|
|
98
135
|
/* `label` / `labelClass` / slot key `label` = aliases of `eyebrow` (2026-08-27) */
|
|
99
136
|
const eb = eyebrow ?? label
|
|
100
|
-
|
|
137
|
+
/* a level's eyebrow is HELPER, not mono (PageHeader's ruling 2026-08-15), off `oq-64`; content's is the
|
|
138
|
+
* `kol-eyebrow` role */
|
|
139
|
+
const ebClass = eyebrowClass ?? labelClass ?? (L ? L.eyebrow ?? 'kol-helper-12 text-oq-64' : 'kol-helper-12 text-meta')
|
|
101
140
|
const cls = (base, slot) => `${base} ${slotClass[slot] ?? (slot === 'eyebrow' ? slotClass.label : undefined) ?? ''}`.trim()
|
|
102
141
|
const alignCls = align === 'center' ? 'items-center text-center' : 'items-start text-left'
|
|
103
142
|
const inlineActions = actionsPlacement === 'inline' && !!actions && !!body
|
|
@@ -109,7 +148,7 @@ export default function SectionText({
|
|
|
109
148
|
const cluster = actions && (
|
|
110
149
|
<div className={cls(`${actionsClass} shrink-0 md:h-0 md:self-center`, 'actions')} style={slotStyle.actions}>{actions}</div>
|
|
111
150
|
)
|
|
112
|
-
|
|
151
|
+
const block = (
|
|
113
152
|
<div className={`kol-section-text flex flex-col ${gap} ${alignCls} ${className}`.replace(/\s+/g, ' ').trim()} style={style}>
|
|
114
153
|
{/* `kol-section-text-eyebrow` = uppercase by ROLE (kol-theme ≥0.55.0);
|
|
115
154
|
* `labelClass` is the voice riding beside it */}
|
|
@@ -146,4 +185,11 @@ export default function SectionText({
|
|
|
146
185
|
{actions && !inlineActions && !inlineHead && <div className={cls(actionsClass, 'actions')} style={slotStyle.actions}>{actions}</div>}
|
|
147
186
|
</div>
|
|
148
187
|
)
|
|
188
|
+
if (!(L && media)) return block
|
|
189
|
+
return (
|
|
190
|
+
<div className="flex flex-col gap-4" style={{ marginBottom: `var(--kol-page-header-mb, ${L.mb ?? '40px'})` }}>
|
|
191
|
+
<span className="inline-flex text-emphasis">{media}</span>
|
|
192
|
+
{block}
|
|
193
|
+
</div>
|
|
194
|
+
)
|
|
149
195
|
}
|
|
@@ -259,6 +259,9 @@ function TooltipOn({
|
|
|
259
259
|
* className — extra classes on the panel
|
|
260
260
|
* style — extra inline styles merged with floatingStyles
|
|
261
261
|
*/
|
|
262
|
+
/* how many floats this one is opened from inside — context crosses portals, the DOM order does not */
|
|
263
|
+
const FloatDepth = createContext(0)
|
|
264
|
+
|
|
262
265
|
export function PopoverPanel({
|
|
263
266
|
popover,
|
|
264
267
|
children,
|
|
@@ -276,6 +279,7 @@ export function PopoverPanel({
|
|
|
276
279
|
className = '',
|
|
277
280
|
style: extraStyle,
|
|
278
281
|
}) {
|
|
282
|
+
const depth = useContext(FloatDepth)
|
|
279
283
|
if (!popover.open) return null
|
|
280
284
|
|
|
281
285
|
const { refs, floatingStyles, context, getFloatingProps } = popover
|
|
@@ -295,12 +299,12 @@ export function PopoverPanel({
|
|
|
295
299
|
const node = (
|
|
296
300
|
<div
|
|
297
301
|
ref={refs.setFloating}
|
|
298
|
-
style={
|
|
302
|
+
style={{ ...floatingStyles, ...(depth ? { '--kol-float-depth': depth } : null), ...extraStyle }}
|
|
299
303
|
className={cls}
|
|
300
304
|
data-editor-keep-selection
|
|
301
305
|
{...getFloatingProps()}
|
|
302
306
|
>
|
|
303
|
-
{children}
|
|
307
|
+
<FloatDepth.Provider value={depth + 1}>{children}</FloatDepth.Provider>
|
|
304
308
|
</div>
|
|
305
309
|
)
|
|
306
310
|
|