@kolkrabbi/kol-component 0.174.0 → 0.176.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 +1 -1
- package/src/atoms/Button.jsx +13 -24
- package/src/atoms/IconFrame.jsx +4 -3
- package/src/atoms/Input.jsx +5 -3
- package/src/atoms/ViewToggle.jsx +2 -2
- package/src/molecules/Dropdown.jsx +26 -7
- package/src/molecules/PageHeader.jsx +24 -55
- package/src/molecules/SearchInput.jsx +3 -3
- package/src/molecules/SectionText.jsx +38 -3
- package/src/utilities/tone.js +29 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.176.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/atoms/Button.jsx
CHANGED
|
@@ -12,13 +12,13 @@ import { glyphSize } from '../hooks/glyphLadders.js'
|
|
|
12
12
|
*
|
|
13
13
|
* @param {Object} props
|
|
14
14
|
* @param {ReactNode} props.children - Button content
|
|
15
|
-
* @param {'primary'|'secondary'|'accent'|'outline'|'ghost'|'nav'|'danger'|'grey'|'control'} props.variant - Visual variant. `danger` is the destructive treatment (--ui-error fill); `nav` is the chrome rung — transparent, oq-64 ink, one step brighter than `ghost`; `control` is an alias for `ghost` (legacy call-sites).
|
|
15
|
+
* @param {'primary'|'secondary'|'accent'|'outline'|'ghost'|'nav'|'danger'|'grey'|'control'} props.variant - Visual variant. UNSET (the default) inherits the tone of the nearest `kol-tone-*` wrapper, else renders primary; the five ground variants are aliases of `tone`. `danger` is the destructive treatment (--ui-error fill); `nav` is the chrome rung — transparent, oq-64 ink, one step brighter than `ghost`; `control` is an alias for `ghost` (legacy call-sites).
|
|
16
16
|
* @param {'xs'|'sm'|'md'|'lg'} props.size - Button size (default: 'md'); xs is the panel rung (ControlsXsRung, 2026-09-01) — kol-mono-8 in a 22px shell (20 icon-only), opt-in by prop
|
|
17
17
|
* @param {string} props.iconLeft - Icon name to display on the left
|
|
18
18
|
* @param {string} props.iconRight - Icon name to display on the right
|
|
19
19
|
* @param {string} props.iconLeftHover - Icon to show on hover (left position)
|
|
20
20
|
* @param {string} props.iconRightHover - Icon to show on hover (right position)
|
|
21
|
-
* @param {'
|
|
21
|
+
* @param {'primary'|'secondary'|'outline'|'ghost'|'grey'|'sunken'} props.tone - the ground (tone-is-the-ground-axis, 2026-09-03) — wins over `variant` on the same element; unset = inherit the wrapper's. `sunken` = the control set's dark well + fg-96 ink (ControlToneSunken); `inverse` aliased
|
|
22
22
|
* @param {string} props.iconOnly - Icon name for icon-only button
|
|
23
23
|
* @param {string} props.iconOnlyHover - Icon to show on hover (icon-only)
|
|
24
24
|
* @param {boolean} props.animateIcon - Disable default hover states to focus on icon animation
|
|
@@ -38,7 +38,7 @@ import { glyphSize } from '../hooks/glyphLadders.js'
|
|
|
38
38
|
*/
|
|
39
39
|
const Button = ({
|
|
40
40
|
children,
|
|
41
|
-
variant
|
|
41
|
+
variant,
|
|
42
42
|
size = 'md',
|
|
43
43
|
iconLeft,
|
|
44
44
|
iconRight,
|
|
@@ -73,27 +73,16 @@ const Button = ({
|
|
|
73
73
|
// variant="control" keep working post-migration).
|
|
74
74
|
const resolvedVariant = variant === 'control' ? 'ghost' : variant
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
: resolvedVariant === 'grey'
|
|
87
|
-
? 'kol-btn-grey'
|
|
88
|
-
/* `nav` — transparent box, oq-64 ink (2026-08-01). The class had lived in
|
|
89
|
-
* the theme since the shell landed with NO component able to emit it, so
|
|
90
|
-
* every consumer that wanted this exact weight hand-wrote the box instead:
|
|
91
|
-
* that orphan is the direct cause of the four-container header. It is the
|
|
92
|
-
* chrome rung — one step brighter than `ghost` at oq-48 — and it is what
|
|
93
|
-
* `text-fg-64` meant every time a call site typed it. */
|
|
94
|
-
: resolvedVariant === 'nav'
|
|
95
|
-
? 'kol-btn-nav'
|
|
96
|
-
: 'kol-btn-secondary'
|
|
76
|
+
/* THE GROUND IS A TONE (tone-is-the-ground-axis, 2026-09-03). No variant →
|
|
77
|
+
* NO class: the button paints from the `--kol-tone-*` properties it inherits
|
|
78
|
+
* from a toned wrapper, else the theme's primary fallback — that is how a
|
|
79
|
+
* set gets its tone "already set". An explicit variant stamps its class,
|
|
80
|
+
* which is an alias of the tone (primary · secondary · outline · ghost ·
|
|
81
|
+
* grey) or its own bundle (nav · danger · accent); `nav` is ghost's chrome
|
|
82
|
+
* rung, oq-80 ink + aria-current — it had lived in the theme with no
|
|
83
|
+
* component able to emit it, the direct cause of the four-container header. */
|
|
84
|
+
const KNOWN = ['primary', 'secondary', 'accent', 'outline', 'ghost', 'nav', 'danger', 'grey']
|
|
85
|
+
const variantClass = !resolvedVariant ? '' : KNOWN.includes(resolvedVariant) ? `kol-btn-${resolvedVariant}` : 'kol-btn-secondary'
|
|
97
86
|
|
|
98
87
|
// Add size class — pairs the padding rule with its mono type class.
|
|
99
88
|
const sizeClass = size === 'sm'
|
package/src/atoms/IconFrame.jsx
CHANGED
|
@@ -60,7 +60,7 @@ import { toneClass } from '../utilities/tone.js'
|
|
|
60
60
|
* Want the wash, the pressed fill or the disabled dim? That is `Button`.
|
|
61
61
|
*
|
|
62
62
|
* @param {string} name icon name (kol-icons)
|
|
63
|
-
* @param {string} variant primary|secondary|accent|outline|ghost|nav|grey|danger
|
|
63
|
+
* @param {string} variant primary|secondary|accent|outline|ghost|nav|grey|danger — unset inherits the nearest `kol-tone-*` wrapper's tone, else secondary
|
|
64
64
|
* @param {string} size xs|sm|md|lg — square + glyph together (xs = 20px square, 12 glyph; the panel rung, 2026-09-01)
|
|
65
65
|
* @param {string} radius sm (default, the system's 4px) | full (9999px).
|
|
66
66
|
* Two values, nothing between: a round frame is its
|
|
@@ -78,7 +78,7 @@ const GLYPH = SOLO
|
|
|
78
78
|
|
|
79
79
|
export default function IconFrame({
|
|
80
80
|
name,
|
|
81
|
-
variant
|
|
81
|
+
variant,
|
|
82
82
|
size = 'md',
|
|
83
83
|
radius = 'sm',
|
|
84
84
|
iconSize = null,
|
|
@@ -92,7 +92,8 @@ export default function IconFrame({
|
|
|
92
92
|
const radiusCls = radius === 'full' ? ' kol-icon-frame-radius-full' : ''
|
|
93
93
|
const resolvedIconSize = iconSize ?? GLYPH[size] ?? GLYPH.md
|
|
94
94
|
/* `tone="sunken"` (ControlToneSunken, 2026-08-28) — the control set's dark well + fg-96 ink, no states, as ever */
|
|
95
|
-
|
|
95
|
+
/* no variant → no class: the frame inherits a wrapper's tone, else secondary (2026-09-03) */
|
|
96
|
+
const cls = `kol-icon-frame${variant ? ` kol-icon-frame-${variant}` : ''} kol-icon-frame-${size}${radiusCls} ${toneClass(tone)} ${className}`.replace(/\s+/g, ' ').trim()
|
|
96
97
|
const glyph = <Icon name={name} size={resolvedIconSize} />
|
|
97
98
|
|
|
98
99
|
/* The element follows the affordance, and the CLASS is identical in all three
|
package/src/atoms/Input.jsx
CHANGED
|
@@ -6,7 +6,8 @@ import { glyphSize } from '../hooks/glyphLadders.js'
|
|
|
6
6
|
/**
|
|
7
7
|
* Input — single-input atom built on the .kol-control shell.
|
|
8
8
|
*
|
|
9
|
-
* variant
|
|
9
|
+
* variant unset (default) — the nearest `kol-tone-*` wrapper's tone, else filled
|
|
10
|
+
* variant="filled" — persistent solid bg (= button primary chrome)
|
|
10
11
|
* variant="outline" — bordered, transparent bg — THE secondary
|
|
11
12
|
* treatment (2026-07-08 chrome law: one
|
|
12
13
|
* secondary, always subordinate to filled)
|
|
@@ -61,7 +62,7 @@ export default function Input({
|
|
|
61
62
|
value,
|
|
62
63
|
onChange,
|
|
63
64
|
onCommit,
|
|
64
|
-
variant
|
|
65
|
+
variant,
|
|
65
66
|
tone = 'default',
|
|
66
67
|
size = 'md',
|
|
67
68
|
chars,
|
|
@@ -95,7 +96,8 @@ export default function Input({
|
|
|
95
96
|
|
|
96
97
|
const shellCls = [
|
|
97
98
|
'kol-control',
|
|
98
|
-
|
|
99
|
+
/* no variant → no modifier: the shell inherits a wrapper's tone, else filled (2026-09-03) */
|
|
100
|
+
resolvedVariant && `kol-control--${resolvedVariant}`,
|
|
99
101
|
`kol-control-${size}`,
|
|
100
102
|
SIZE_TYPE[size],
|
|
101
103
|
'cursor-text',
|
package/src/atoms/ViewToggle.jsx
CHANGED
|
@@ -78,7 +78,7 @@ const ViewToggle = ({
|
|
|
78
78
|
* consumer subtracted it with a `-ml-1` on the neighbour. `-mx-1` draws the padding inward from the
|
|
79
79
|
* declared box — the chips sit where the box says, the well bleeds 4px into the gap. */
|
|
80
80
|
const containerClasses = isIconVariant
|
|
81
|
-
? `kol-view-toggle inline-flex items-center gap-1 p-1 -mx-1
|
|
81
|
+
? `kol-view-toggle inline-flex items-center gap-1 p-1 -mx-1 rounded ${toneClass(tone)} ${className}`.replace(/\s+/g, ' ').trim()
|
|
82
82
|
: `flex gap-2 ${className}`
|
|
83
83
|
|
|
84
84
|
const buttonClasses = (isActive) => {
|
|
@@ -95,7 +95,7 @@ const ViewToggle = ({
|
|
|
95
95
|
* hover; that's deliberately gone.) */
|
|
96
96
|
return isActive
|
|
97
97
|
? `kol-control kol-control--filled kol-control-${size} kol-mono-${size === 'md' ? '14' : '12'}`
|
|
98
|
-
: `kol-control kol-control-${size} kol-mono-${size === 'md' ? '14' : '12'} text-meta hover:text-emphasis`
|
|
98
|
+
: `kol-control kol-control--plain kol-control-${size} kol-mono-${size === 'md' ? '14' : '12'} text-meta hover:text-emphasis`
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react'
|
|
2
|
-
import { toneClass } from '../utilities/tone.js'
|
|
1
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|
2
|
+
import { toneClass, TONE_VARS } from '../utilities/tone.js'
|
|
3
3
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
4
4
|
import { MenuDropdownItem } from './MenuItem.jsx'
|
|
5
5
|
import { PopoverPanel, usePopover } from '../utilities/Popover.jsx'
|
|
@@ -13,7 +13,9 @@ import { indicatorSize } from '../hooks/glyphLadders.js'
|
|
|
13
13
|
* active, focus ring all come from the button rules in kol-theme.
|
|
14
14
|
* `.kol-dd-*` classes only add trigger layout + the open/panel fusion.
|
|
15
15
|
*
|
|
16
|
-
* variant
|
|
16
|
+
* variant unset (default) — the tone of the nearest `kol-tone-*` wrapper,
|
|
17
|
+
* else primary (tone-is-the-ground-axis, 2026-09-03)
|
|
18
|
+
* variant="primary" — filled trigger; open panel continues the
|
|
17
19
|
* same fill (one piece: no border, no gap, hairline divider inside)
|
|
18
20
|
* variant="grey" — oq-12 filled trigger (opaque per the fill
|
|
19
21
|
* law); panel continues it
|
|
@@ -46,7 +48,7 @@ const Dropdown = ({
|
|
|
46
48
|
value,
|
|
47
49
|
onChange,
|
|
48
50
|
size,
|
|
49
|
-
variant
|
|
51
|
+
variant,
|
|
50
52
|
tone = 'default',
|
|
51
53
|
/* DropdownGhostWidthAndListHeight (kol-mirror 2026-08-28 — user, on the
|
|
52
54
|
* studio's 30-option Source picker in a ~300px shelf: "1 it's way too tall,
|
|
@@ -80,6 +82,22 @@ const Dropdown = ({
|
|
|
80
82
|
}) => {
|
|
81
83
|
const [isOpen, setIsOpen] = useState(defaultOpen)
|
|
82
84
|
|
|
85
|
+
/* THE PANEL IS PORTALLED (FloatingPortal → body), so a tone the trigger
|
|
86
|
+
* INHERITS from a toned wrapper never reaches it through the cascade — the
|
|
87
|
+
* exact failure the 2026-08-30 page-wash attempt hit. On open, copy the
|
|
88
|
+
* trigger's RESOLVED `--kol-tone-*` onto the panel as inline style: an
|
|
89
|
+
* explicit variant / tone class on the panel sets the same values, and the
|
|
90
|
+
* ambient case is the one only this can serve. */
|
|
91
|
+
const triggerRef = useRef(null)
|
|
92
|
+
const [ambient, setAmbient] = useState(null)
|
|
93
|
+
useLayoutEffect(() => {
|
|
94
|
+
if (!isOpen || !triggerRef.current) return
|
|
95
|
+
const cs = getComputedStyle(triggerRef.current)
|
|
96
|
+
const vars = {}
|
|
97
|
+
for (const v of TONE_VARS) { const val = cs.getPropertyValue(v).trim(); if (val) vars[v] = val }
|
|
98
|
+
setAmbient(vars)
|
|
99
|
+
}, [isOpen])
|
|
100
|
+
|
|
83
101
|
// sm everywhere unless explicitly overridden (see docblock size law).
|
|
84
102
|
const resolvedSize = size || 'sm'
|
|
85
103
|
|
|
@@ -141,7 +159,7 @@ const Dropdown = ({
|
|
|
141
159
|
'kol-btn',
|
|
142
160
|
/* grey is dropdown-only chrome (2026-07-15) — no kol-btn-* class so it
|
|
143
161
|
* never leaks into Button's variant set */
|
|
144
|
-
resolvedVariant === 'grey' ? 'kol-dd-trigger--grey' : `kol-btn-${resolvedVariant}`,
|
|
162
|
+
resolvedVariant === 'grey' ? 'kol-dd-trigger--grey' : resolvedVariant && `kol-btn-${resolvedVariant}`,
|
|
145
163
|
`kol-btn-${resolvedSize}`,
|
|
146
164
|
SIZE_TYPE[resolvedSize],
|
|
147
165
|
'kol-dd-trigger',
|
|
@@ -153,7 +171,7 @@ const Dropdown = ({
|
|
|
153
171
|
return (
|
|
154
172
|
<div className={`kol-dd-root relative inline-block align-middle ${className}`}>
|
|
155
173
|
<button
|
|
156
|
-
ref={popover.refs.setReference}
|
|
174
|
+
ref={(el) => { triggerRef.current = el; popover.refs.setReference(el) }}
|
|
157
175
|
{...popover.getReferenceProps()}
|
|
158
176
|
type="button"
|
|
159
177
|
className={triggerCls}
|
|
@@ -181,8 +199,9 @@ const Dropdown = ({
|
|
|
181
199
|
popover={popover}
|
|
182
200
|
panel={false}
|
|
183
201
|
focus={false}
|
|
184
|
-
className={`kol-dd-panel kol-dd-panel--${resolvedVariant} ${toneClass(tone)}`.trim()}
|
|
202
|
+
className={`kol-dd-panel ${resolvedVariant ? `kol-dd-panel--${resolvedVariant}` : ''} ${toneClass(tone)}`.replace(/\s+/g, ' ').trim()}
|
|
185
203
|
style={{
|
|
204
|
+
...ambient,
|
|
186
205
|
'--kol-dd-max-rows': maxRows ?? 10,
|
|
187
206
|
/* xs rows are 20px; the panel's max-height reads the row height */
|
|
188
207
|
...(resolvedSize === 'xs' && rowHeight == null ? { '--kol-dd-row-h': '20px' } : null),
|
|
@@ -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
|
-
<
|
|
101
|
-
{eyebrow
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
}
|
|
@@ -77,7 +77,7 @@ export default function SearchInput({
|
|
|
77
77
|
shortcutHint,
|
|
78
78
|
onFocus,
|
|
79
79
|
size = 'md',
|
|
80
|
-
variant
|
|
80
|
+
variant,
|
|
81
81
|
tone = 'default',
|
|
82
82
|
bare = false,
|
|
83
83
|
expanding = false,
|
|
@@ -157,7 +157,7 @@ export default function SearchInput({
|
|
|
157
157
|
control: 22 · 26 · 32 · 40 (01-foundations/09-sizes.md). This was a
|
|
158
158
|
hardcoded 36 — the LG square — so an expanding search sat beside a
|
|
159
159
|
`kol-btn-md` filter button at two different sizes. */
|
|
160
|
-
className={`kol-expand flex items-center rounded-full ${isOpen ?
|
|
160
|
+
className={`kol-expand flex items-center rounded-full ${isOpen ? `kol-expand--open ${toneClass(tone)}` : ''} ${className}`.replace(/\s+/g, ' ').trim()}
|
|
161
161
|
style={{ height: isOpen ? fieldH : square, width: isOpen ? expandedWidth : square }}
|
|
162
162
|
>
|
|
163
163
|
{/* THE GLYPH IS THE CLOSED STATE, and only that (user ruling
|
|
@@ -201,7 +201,7 @@ export default function SearchInput({
|
|
|
201
201
|
/* kol-control--bare: zero-chrome marker so the theme's coarse-pointer
|
|
202
202
|
* 16px floor covers this body plan too (OverlaySearchFieldZoomsIOS) */
|
|
203
203
|
? 'kol-control--bare flex w-full gap-2.5 px-4 py-3'
|
|
204
|
-
: `kol-control kol-control--${variant} kol-control-${size} gap-2${toneClass(tone) ?
|
|
204
|
+
: `kol-control${variant ? ` kol-control--${variant}` : ''} kol-control-${size} gap-2${toneClass(tone) ? ` ${toneClass(tone)}` : ''}`,
|
|
205
205
|
'items-center cursor-text',
|
|
206
206
|
SIZE_TYPE[size],
|
|
207
207
|
className,
|
|
@@ -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
|
-
{
|
|
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
|
-
{
|
|
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
|
}
|
package/src/utilities/tone.js
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* toneClass — the control set's
|
|
3
|
-
* kol-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* toneClass — the control set's TONE, six values (tone-is-the-ground-axis,
|
|
3
|
+
* kol-client-olina 2026-09-03; the six-tone list is the user's).
|
|
4
|
+
*
|
|
5
|
+
* primary · secondary · outline · ghost · grey · sunken
|
|
6
|
+
*
|
|
7
|
+
* A tone is a ground-and-ink bundle — `--kol-tone-*` custom properties in
|
|
8
|
+
* kol-theme (kol-components-molecules.css, TONE) that every control paints
|
|
9
|
+
* from. `default` is NOT a tone: it is the absence of one — the control
|
|
10
|
+
* inherits its wrapper's tone (one `kol-tone-*` class on any ancestor), else
|
|
11
|
+
* its family's fallback. That is the whole mechanism of "get a set with it
|
|
12
|
+
* already set": nothing is stamped, so the inheritance is not blocked.
|
|
13
|
+
*
|
|
14
|
+
* `inverse` is `sunken`'s alias (0.117.0's name — ControlToneSunken,
|
|
15
|
+
* kol-website 2026-08-28; user ruling: the control does not invert anything,
|
|
16
|
+
* it sits BELOW the plane it is on).
|
|
7
17
|
*/
|
|
8
|
-
export const
|
|
18
|
+
export const TONES = ['primary', 'secondary', 'outline', 'ghost', 'grey', 'sunken']
|
|
19
|
+
|
|
20
|
+
export const toneClass = (tone) =>
|
|
21
|
+
tone === 'inverse' ? 'kol-tone-sunken' : TONES.includes(tone) ? `kol-tone-${tone}` : ''
|
|
22
|
+
|
|
23
|
+
/* the properties a bundle sets — Dropdown copies them from its trigger onto
|
|
24
|
+
* the PORTALLED panel, which the cascade cannot reach */
|
|
25
|
+
export const TONE_VARS = [
|
|
26
|
+
'bg', 'image', 'fg', 'border',
|
|
27
|
+
'hover-bg', 'hover-image', 'hover-fg', 'hover-border',
|
|
28
|
+
'active-bg', 'active-image',
|
|
29
|
+
'pressed-bg', 'pressed-image', 'pressed-fg',
|
|
30
|
+
'panel-bg', 'panel-border-w', 'panel-border',
|
|
31
|
+
].map((k) => `--kol-tone-${k}`)
|