@kolkrabbi/kol-component 0.287.0 → 0.288.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,5 +1,6 @@
|
|
|
1
1
|
import ContentMedia from './ContentMedia.jsx'
|
|
2
2
|
import ContentText from './ContentText.jsx'
|
|
3
|
+
import { toneClass } from '../utilities/tone.js'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* ContentCard — the card form of the content-card system. Variants differ in
|
|
@@ -179,6 +180,10 @@ export default function ContentCard({
|
|
|
179
180
|
* move together. For the card's INK, pass `text` — it falls through to
|
|
180
181
|
* ContentText with the rest of the slots. */
|
|
181
182
|
bg,
|
|
183
|
+
/* `tone` — the ground from the control set's tone ladder (ContentCardRowTone, kol-fxr 2026-10-22):
|
|
184
|
+
* the rest fill AND its hover step from one `kol-tone-*` bundle, so they move together. `bg`
|
|
185
|
+
* still wins the rest fill when both are passed. Unset → the variant's own ground. */
|
|
186
|
+
tone,
|
|
182
187
|
control,
|
|
183
188
|
controlStart,
|
|
184
189
|
reveal,
|
|
@@ -203,6 +208,7 @@ export default function ContentCard({
|
|
|
203
208
|
* escape hatch that would let any variant borrow another's box. */
|
|
204
209
|
const variant = aliased.startsWith('showcase') && layout ? LAYOUT_KEY[layout] ?? aliased : aliased
|
|
205
210
|
const box = BOX[variant] ?? BOX.file
|
|
211
|
+
const ground = bg ?? (tone ? 'var(--kol-tone-bg)' : box.bg)
|
|
206
212
|
const doFlip = flip ?? box.flip
|
|
207
213
|
/* HERO (2026-08-27 — the featured card riding a page's fold; ListingCard
|
|
208
214
|
* size="hero" had no ContentCard equivalent, which is why Stack still
|
|
@@ -250,7 +256,7 @@ export default function ContentCard({
|
|
|
250
256
|
* true: a rounded still floating inside a square grey card, plate corners
|
|
251
257
|
* square (kol-client-hrafn, screenshot-confirmed on 0.183.0, fixed 0.183.1).
|
|
252
258
|
* One prop is not done until every derivation reads it. */
|
|
253
|
-
const framed = box.border != null ||
|
|
259
|
+
const framed = box.border != null || ground != null
|
|
254
260
|
|
|
255
261
|
/* NO COVER IS NOT A MISSING COVER (content-card-needs-no-cover,
|
|
256
262
|
* kol-client-olina 2026-09-04). `ContentMedia` turns absent children into an
|
|
@@ -287,7 +293,7 @@ export default function ContentCard({
|
|
|
287
293
|
zIndex: box.layout === 'canvas' ? 1 : undefined,
|
|
288
294
|
}}
|
|
289
295
|
>
|
|
290
|
-
{hasText && <ContentText variant={variant} form={isHero ? 'hero' : 'card'} tagVariant={tagVariant ?? (/surface-/.test(
|
|
296
|
+
{hasText && <ContentText variant={variant} form={isHero ? 'hero' : 'card'} tagVariant={tagVariant ?? (/surface-/.test(ground ?? '') ? 'tertiary' : 'primary')} {...textSlots} />}
|
|
291
297
|
{/* ABSOLUTE, not a flex sibling: the plate's height moves with the title
|
|
292
298
|
* and the meta, so a laid-out stack would stretch or drift with it. The
|
|
293
299
|
* inset reads the SAME pad token the plate uses, so the icons sit the
|
|
@@ -436,16 +442,16 @@ export default function ContentCard({
|
|
|
436
442
|
if (onClick) onClick(event)
|
|
437
443
|
}
|
|
438
444
|
const interactive = href || onClick
|
|
439
|
-
const hoverBg = HOVER[variant]
|
|
445
|
+
const hoverBg = tone ? 'var(--kol-tone-hover-bg)' : HOVER[variant]
|
|
440
446
|
|
|
441
447
|
const common = {
|
|
442
448
|
'data-tags': isHero && Array.isArray(text.tags) && text.tags.length ? text.tags.join(' ') : undefined,
|
|
443
|
-
className: `kol-card group flex ${box.layout === 'canvas' && reveal != null ? 'has-reveal' : ''} ${expanded ? 'flex-col md:flex-row-reverse' : 'flex-col'} ${box.layout === 'drawer' ? 'relative overflow-hidden rounded-[var(--kol-radius-sm)]' : ''} ${framed ? 'overflow-hidden rounded-[var(--kol-radius-sm)]' : ''} ${box.border ? 'border' : ''} ${box.layout === 'canvas' ? 'relative' : ''} ${interactive ? 'cursor-pointer select-none' : ''} ${hoverBg && interactive ? 'kol-content-hover' : ''} ${interactive && box.frameHover ? 'kol-content-hover-frame' : ''} ${className}`.trim(),
|
|
449
|
+
className: `kol-card group flex ${toneClass(tone)} ${box.layout === 'canvas' && reveal != null ? 'has-reveal' : ''} ${expanded ? 'flex-col md:flex-row-reverse' : 'flex-col'} ${box.layout === 'drawer' ? 'relative overflow-hidden rounded-[var(--kol-radius-sm)]' : ''} ${framed ? 'overflow-hidden rounded-[var(--kol-radius-sm)]' : ''} ${box.border ? 'border' : ''} ${box.layout === 'canvas' ? 'relative' : ''} ${interactive ? 'cursor-pointer select-none' : ''} ${hoverBg && interactive ? 'kol-content-hover' : ''} ${interactive && box.frameHover ? 'kol-content-hover-frame' : ''} ${className}`.trim(),
|
|
444
450
|
style: {
|
|
445
451
|
/* same reason as ContentRow: rest colors are PROPERTIES, because an
|
|
446
452
|
* inline background/borderColor outranks the hover class and the step
|
|
447
453
|
* would never render. */
|
|
448
|
-
'--kol-card-bg':
|
|
454
|
+
'--kol-card-bg': ground ?? undefined,
|
|
449
455
|
'--kol-card-border': box.border ? (selected ? 'var(--kol-fg-64)' : box.border) : undefined,
|
|
450
456
|
'--kol-content-hover-bg': hoverBg ?? undefined,
|
|
451
457
|
'--kol-content-hover-border': box.frameHover ?? undefined,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ContentMedia from './ContentMedia.jsx'
|
|
2
2
|
import ContentText from './ContentText.jsx'
|
|
3
|
+
import { toneClass } from '../utilities/tone.js'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* ContentRow — The row form of a content card. the row form of the content-card system: leading thumb (where
|
|
@@ -183,12 +184,18 @@ export default function ContentRow({
|
|
|
183
184
|
* a selected row is the list's state, not the consumer's ground. For the
|
|
184
185
|
* row's INK, pass `text` — it falls through to ContentText. */
|
|
185
186
|
bg,
|
|
187
|
+
/* `tone` — the ground from the control set's tone ladder (ContentCardRowTone, kol-fxr 2026-10-22):
|
|
188
|
+
* the rest fill AND its hover step from one `kol-tone-*` bundle, so they move together. `bg`
|
|
189
|
+
* still wins the rest fill when both are passed. Unset → the variant's own ground. */
|
|
190
|
+
tone,
|
|
186
191
|
className = '',
|
|
187
192
|
...text
|
|
188
193
|
}) {
|
|
189
194
|
const aliased = ALIAS[variantProp] ?? variantProp
|
|
190
195
|
const variant = aliased.startsWith('showcase') && layout ? LAYOUT_KEY[layout] ?? aliased : aliased
|
|
191
196
|
const box = BOX[variant] ?? BOX.file
|
|
197
|
+
const ground = bg ?? (tone ? 'var(--kol-tone-bg)' : box.bg)
|
|
198
|
+
const hover = tone ? 'var(--kol-tone-hover-bg)' : box.hover
|
|
192
199
|
/* `media={false}` — NO COVER, not a missing one (content-card-needs-no-cover,
|
|
193
200
|
* kol-client-olina 2026-09-04). The row could already hide its thumb with
|
|
194
201
|
* `thumb={0}`, but that is a SIZE answering a question about MEANING, and a
|
|
@@ -240,12 +247,12 @@ export default function ContentRow({
|
|
|
240
247
|
* consumer setting it got no error and no change. Undefined publishes
|
|
241
248
|
* nothing and the CSS fallback keeps every current row square. */
|
|
242
249
|
'--kol-row-thumb-ratio': ratio ?? box.ratio,
|
|
243
|
-
'--kol-content-hover-bg':
|
|
250
|
+
'--kol-content-hover-bg': hover,
|
|
244
251
|
'--kol-content-hover-border': box.frameHover,
|
|
245
252
|
/* rest values are PROPERTIES, not inline declarations — an inline
|
|
246
253
|
* `background`/`borderColor` outranks every class, so the hover rules in
|
|
247
254
|
* kol-theme could never win and no row hover fired at all. */
|
|
248
|
-
'--kol-row-bg': selected ? 'var(--kol-fg-04)' :
|
|
255
|
+
'--kol-row-bg': selected ? 'var(--kol-fg-04)' : ground,
|
|
249
256
|
'--kol-row-border': box.frame || undefined,
|
|
250
257
|
}
|
|
251
258
|
|
|
@@ -260,7 +267,7 @@ export default function ContentRow({
|
|
|
260
267
|
* (a rendered alphabet, a waveform, a sparkline) is never the family's. */
|
|
261
268
|
const inner = box.column ? (
|
|
262
269
|
<>
|
|
263
|
-
<ContentText variant={variant} form="row" className="w-full" tagVariant={tagVariant ?? (/surface-/.test(
|
|
270
|
+
<ContentText variant={variant} form="row" className="w-full" tagVariant={tagVariant ?? (/surface-/.test(ground ?? '') ? 'tertiary' : 'primary')} {...text} />
|
|
264
271
|
{footer}
|
|
265
272
|
</>
|
|
266
273
|
) : (
|
|
@@ -298,11 +305,11 @@ export default function ContentRow({
|
|
|
298
305
|
<div className="flex flex-1 min-w-0 items-stretch" style={{ padding: box.plate, gap: box.plateGap ?? box.plate }}>
|
|
299
306
|
{/* the meta line's leading is its type size, so its baseline lands on the bottom pad, level with the last
|
|
300
307
|
* control — at its 16px line the digits sat ~4px above it (user 2026-10-22) */}
|
|
301
|
-
<ContentText variant={variant} form="row" className="flex-1 justify-between [&_.kol-mono-12]:leading-none" tagVariant={tagVariant ?? (/surface-/.test(
|
|
308
|
+
<ContentText variant={variant} form="row" className="flex-1 justify-between [&_.kol-mono-12]:leading-none" tagVariant={tagVariant ?? (/surface-/.test(ground ?? '') ? 'tertiary' : 'primary')} {...text} />
|
|
302
309
|
{actions && <div className="shrink-0">{actions}</div>}
|
|
303
310
|
</div>
|
|
304
311
|
) : (
|
|
305
|
-
<ContentText variant={variant} form="row" className={`flex-1 ${box.height != null ? 'py-[2px]' : ''}`.trim()} tagVariant={tagVariant ?? (/surface-/.test(
|
|
312
|
+
<ContentText variant={variant} form="row" className={`flex-1 ${box.height != null ? 'py-[2px]' : ''}`.trim()} tagVariant={tagVariant ?? (/surface-/.test(ground ?? '') ? 'tertiary' : 'primary')} {...text} />
|
|
306
313
|
)}
|
|
307
314
|
{/* `specs` rides the trailing edge on EVERY variant — year · material ·
|
|
308
315
|
* edition is a content difference, not a geometry one, and minting a
|
|
@@ -326,7 +333,7 @@ export default function ContentRow({
|
|
|
326
333
|
)
|
|
327
334
|
|
|
328
335
|
const common = {
|
|
329
|
-
className: `kol-row group flex ${box.column ? 'flex-col' : ''} ${box.align} ${box.height != null ? 'kol-row--fixed' : ''} ${box.heightSm != null ? 'kol-row--fixed-sm' : ''} ${box.divider ? 'kol-row--divided' : ''} ${box.frame ? 'rounded-[var(--kol-radius-sm)] border' : ''} ${box.clip ? 'overflow-hidden rounded-[var(--kol-radius-sm)]' : ''} ${interactive ? 'cursor-pointer select-none' : ''} ${interactive &&
|
|
336
|
+
className: `kol-row group flex ${toneClass(tone)} ${box.column ? 'flex-col' : ''} ${box.align} ${box.height != null ? 'kol-row--fixed' : ''} ${box.heightSm != null ? 'kol-row--fixed-sm' : ''} ${box.divider ? 'kol-row--divided' : ''} ${box.frame ? 'rounded-[var(--kol-radius-sm)] border' : ''} ${box.clip ? 'overflow-hidden rounded-[var(--kol-radius-sm)]' : ''} ${interactive ? 'cursor-pointer select-none' : ''} ${interactive && hover ? 'kol-content-hover' : ''} ${interactive && box.frameHover ? 'kol-content-hover-frame' : ''} ${className}`.trim(),
|
|
330
337
|
style: vars,
|
|
331
338
|
}
|
|
332
339
|
|
|
@@ -127,7 +127,7 @@ export function MenuItem({
|
|
|
127
127
|
/* xs wears the TRIGGER's face (kol-mono-8), not the helper: the trigger's ghost
|
|
128
128
|
* stack reserves the widest label in its own face, and a row set in a different
|
|
129
129
|
* one measured 3px wider and clipped the selected row beside its check. */
|
|
130
|
-
const ROW_BY_SIZE = { xs: 'kol-mono-8 px-2 h-5', sm: 'kol-helper-12 px-
|
|
130
|
+
const ROW_BY_SIZE = { xs: 'kol-mono-8 px-2 h-5', sm: 'kol-helper-12 px-2 h-8', md: 'kol-helper-12 px-2 h-8', lg: 'kol-helper-12 px-2 h-8' }
|
|
131
131
|
/* `rowClass` — the row's type, side padding and height, whole, in place of the size's own
|
|
132
132
|
* (Dropdown passes it, 2026-10-02: its rows wear the trigger's face and sit on the trigger's
|
|
133
133
|
* text edge; a menu's rows keep `ROW_BY_SIZE`). */
|