@kolkrabbi/kol-component 0.286.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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.288.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",
|
|
@@ -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
|
|
@@ -93,7 +94,9 @@ const BOX = {
|
|
|
93
94
|
* control vanishing. article is the exception the shipped card already set: it
|
|
94
95
|
* has no surface of its own to step, so it dims its title instead. */
|
|
95
96
|
const HOVER = {
|
|
96
|
-
file:
|
|
97
|
+
/* file: no fill change on hover (user 2026-10-22: "remove the card background color change on hover") —
|
|
98
|
+
* the cover's zoom and the corner controls are its hover. Was oq-04. */
|
|
99
|
+
file: null,
|
|
97
100
|
slide: 'var(--kol-surface-primary)', /* the plate holds its color on hover; the drawer control is the affordance */
|
|
98
101
|
catalog: 'var(--kol-surface-tertiary)',
|
|
99
102
|
/* article and work take NO surface hover, and that is a decision not a gap:
|
|
@@ -177,6 +180,10 @@ export default function ContentCard({
|
|
|
177
180
|
* move together. For the card's INK, pass `text` — it falls through to
|
|
178
181
|
* ContentText with the rest of the slots. */
|
|
179
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,
|
|
180
187
|
control,
|
|
181
188
|
controlStart,
|
|
182
189
|
reveal,
|
|
@@ -201,6 +208,7 @@ export default function ContentCard({
|
|
|
201
208
|
* escape hatch that would let any variant borrow another's box. */
|
|
202
209
|
const variant = aliased.startsWith('showcase') && layout ? LAYOUT_KEY[layout] ?? aliased : aliased
|
|
203
210
|
const box = BOX[variant] ?? BOX.file
|
|
211
|
+
const ground = bg ?? (tone ? 'var(--kol-tone-bg)' : box.bg)
|
|
204
212
|
const doFlip = flip ?? box.flip
|
|
205
213
|
/* HERO (2026-08-27 — the featured card riding a page's fold; ListingCard
|
|
206
214
|
* size="hero" had no ContentCard equivalent, which is why Stack still
|
|
@@ -248,7 +256,7 @@ export default function ContentCard({
|
|
|
248
256
|
* true: a rounded still floating inside a square grey card, plate corners
|
|
249
257
|
* square (kol-client-hrafn, screenshot-confirmed on 0.183.0, fixed 0.183.1).
|
|
250
258
|
* One prop is not done until every derivation reads it. */
|
|
251
|
-
const framed = box.border != null ||
|
|
259
|
+
const framed = box.border != null || ground != null
|
|
252
260
|
|
|
253
261
|
/* NO COVER IS NOT A MISSING COVER (content-card-needs-no-cover,
|
|
254
262
|
* kol-client-olina 2026-09-04). `ContentMedia` turns absent children into an
|
|
@@ -285,7 +293,7 @@ export default function ContentCard({
|
|
|
285
293
|
zIndex: box.layout === 'canvas' ? 1 : undefined,
|
|
286
294
|
}}
|
|
287
295
|
>
|
|
288
|
-
{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} />}
|
|
289
297
|
{/* ABSOLUTE, not a flex sibling: the plate's height moves with the title
|
|
290
298
|
* and the meta, so a laid-out stack would stretch or drift with it. The
|
|
291
299
|
* inset reads the SAME pad token the plate uses, so the icons sit the
|
|
@@ -434,16 +442,16 @@ export default function ContentCard({
|
|
|
434
442
|
if (onClick) onClick(event)
|
|
435
443
|
}
|
|
436
444
|
const interactive = href || onClick
|
|
437
|
-
const hoverBg = HOVER[variant]
|
|
445
|
+
const hoverBg = tone ? 'var(--kol-tone-hover-bg)' : HOVER[variant]
|
|
438
446
|
|
|
439
447
|
const common = {
|
|
440
448
|
'data-tags': isHero && Array.isArray(text.tags) && text.tags.length ? text.tags.join(' ') : undefined,
|
|
441
|
-
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(),
|
|
442
450
|
style: {
|
|
443
451
|
/* same reason as ContentRow: rest colors are PROPERTIES, because an
|
|
444
452
|
* inline background/borderColor outranks the hover class and the step
|
|
445
453
|
* would never render. */
|
|
446
|
-
'--kol-card-bg':
|
|
454
|
+
'--kol-card-bg': ground ?? undefined,
|
|
447
455
|
'--kol-card-border': box.border ? (selected ? 'var(--kol-fg-64)' : box.border) : undefined,
|
|
448
456
|
'--kol-content-hover-bg': hoverBg ?? undefined,
|
|
449
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
|
|
@@ -47,7 +48,11 @@ const BOX = {
|
|
|
47
48
|
* grey background, remove it"). The default row is a bare ruled line — a
|
|
48
49
|
* full-width grey band under it is heavier than the line itself. Scoped to
|
|
49
50
|
* `default`: catalog and print still carry the same `oq-04`, unruled. */
|
|
50
|
-
|
|
51
|
+
/* THE FILE CARD'S ANATOMY, SIDEWAYS (user 2026-10-22: *"its 2 items IMAGE + TEXT in one container that has rounded
|
|
52
|
+
* corners and bg color. the padding is done on the text"*). The row is the container — fg-02, rounded, clipped, no
|
|
53
|
+
* padding, no gap; the thumb is a 72 square flush in it; `plate` is the text section's padding (12 all round), and the text, specs
|
|
54
|
+
* and actions live inside that one padded box. */
|
|
55
|
+
file: { thumb: 72, ratio: '1 / 1', pad: '0px', gap: '0px', align: 'items-stretch', bg: 'var(--kol-fg-02)', clip: true, plate: S3 },
|
|
51
56
|
/* SLIDE (slide-variant-and-shelf-preset, 2026-09-03): file's row with the thumb FILLING the
|
|
52
57
|
* rung's height and taking its width from 16:9 — 48 tall, 85 wide, the whole frame — not
|
|
53
58
|
* the 48 square, which cropped a deck to a sliver (read off olina's /slide-deck). `minH` 64
|
|
@@ -179,12 +184,18 @@ export default function ContentRow({
|
|
|
179
184
|
* a selected row is the list's state, not the consumer's ground. For the
|
|
180
185
|
* row's INK, pass `text` — it falls through to ContentText. */
|
|
181
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,
|
|
182
191
|
className = '',
|
|
183
192
|
...text
|
|
184
193
|
}) {
|
|
185
194
|
const aliased = ALIAS[variantProp] ?? variantProp
|
|
186
195
|
const variant = aliased.startsWith('showcase') && layout ? LAYOUT_KEY[layout] ?? aliased : aliased
|
|
187
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
|
|
188
199
|
/* `media={false}` — NO COVER, not a missing one (content-card-needs-no-cover,
|
|
189
200
|
* kol-client-olina 2026-09-04). The row could already hide its thumb with
|
|
190
201
|
* `thumb={0}`, but that is a SIZE answering a question about MEANING, and a
|
|
@@ -236,12 +247,12 @@ export default function ContentRow({
|
|
|
236
247
|
* consumer setting it got no error and no change. Undefined publishes
|
|
237
248
|
* nothing and the CSS fallback keeps every current row square. */
|
|
238
249
|
'--kol-row-thumb-ratio': ratio ?? box.ratio,
|
|
239
|
-
'--kol-content-hover-bg':
|
|
250
|
+
'--kol-content-hover-bg': hover,
|
|
240
251
|
'--kol-content-hover-border': box.frameHover,
|
|
241
252
|
/* rest values are PROPERTIES, not inline declarations — an inline
|
|
242
253
|
* `background`/`borderColor` outranks every class, so the hover rules in
|
|
243
254
|
* kol-theme could never win and no row hover fired at all. */
|
|
244
|
-
'--kol-row-bg': selected ? 'var(--kol-fg-04)' :
|
|
255
|
+
'--kol-row-bg': selected ? 'var(--kol-fg-04)' : ground,
|
|
245
256
|
'--kol-row-border': box.frame || undefined,
|
|
246
257
|
}
|
|
247
258
|
|
|
@@ -256,7 +267,7 @@ export default function ContentRow({
|
|
|
256
267
|
* (a rendered alphabet, a waveform, a sparkline) is never the family's. */
|
|
257
268
|
const inner = box.column ? (
|
|
258
269
|
<>
|
|
259
|
-
<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} />
|
|
260
271
|
{footer}
|
|
261
272
|
</>
|
|
262
273
|
) : (
|
|
@@ -269,9 +280,11 @@ export default function ContentRow({
|
|
|
269
280
|
* media object-covers into it; row height = max(thumb, text). This
|
|
270
281
|
* retires the 2026-08-15 fill-the-height ruling and the `thumbSquare`
|
|
271
282
|
* exception it needed. Rows never zoom their thumb — cards keep theirs. */
|
|
272
|
-
<div className={`kol-row-thumb shrink-0 self-start ${thumbPx === 'fill' ? 'is-fill' : ''} ${thumbPx === 'fill' && ratioAxis === 'height' ? 'pays-height' : ''}`.replace(/\s+/g, ' ').trim()}>
|
|
283
|
+
<div className={`kol-row-thumb shrink-0 ${box.plate ? 'self-stretch' : 'self-start'} ${thumbPx === 'fill' ? 'is-fill' : ''} ${thumbPx === 'fill' && ratioAxis === 'height' ? 'pays-height' : ''}`.replace(/\s+/g, ' ').trim()}>
|
|
273
284
|
<ContentMedia
|
|
274
285
|
ratio={null}
|
|
286
|
+
/* a row that clips its own corners does not round the thumb again — the card's rule (2026-08-15) */
|
|
287
|
+
radius={!box.clip}
|
|
275
288
|
border={box.thumbBorder ?? false}
|
|
276
289
|
bg={box.thumbBg}
|
|
277
290
|
className={box.thumbRadius ? 'rounded-[var(--kol-radius-xs)]' : ''}
|
|
@@ -284,7 +297,20 @@ export default function ContentRow({
|
|
|
284
297
|
* ruled it on screen): the two lines stack to 34 inside a 40 content box,
|
|
285
298
|
* and pushing them fully apart puts the ascenders hard against the thumb's
|
|
286
299
|
* top and bottom edges. It is the ROW's ruling, so the row passes it. */}
|
|
287
|
-
|
|
300
|
+
{box.plate ? (
|
|
301
|
+
/* the TEXT SECTION — one padded box holding the copy, the specs and the actions (the card's plate) */
|
|
302
|
+
/* items-STRETCH: the actions column spans the padded height, so a column of controls spreads from the
|
|
303
|
+
* top pad to the bottom pad as it does on the card's plate, and the copy spans it too — title on the top
|
|
304
|
+
* pad, date · size on the bottom one, level with the last control (user 2026-10-22) */
|
|
305
|
+
<div className="flex flex-1 min-w-0 items-stretch" style={{ padding: box.plate, gap: box.plateGap ?? box.plate }}>
|
|
306
|
+
{/* the meta line's leading is its type size, so its baseline lands on the bottom pad, level with the last
|
|
307
|
+
* control — at its 16px line the digits sat ~4px above it (user 2026-10-22) */}
|
|
308
|
+
<ContentText variant={variant} form="row" className="flex-1 justify-between [&_.kol-mono-12]:leading-none" tagVariant={tagVariant ?? (/surface-/.test(ground ?? '') ? 'tertiary' : 'primary')} {...text} />
|
|
309
|
+
{actions && <div className="shrink-0">{actions}</div>}
|
|
310
|
+
</div>
|
|
311
|
+
) : (
|
|
312
|
+
<ContentText variant={variant} form="row" className={`flex-1 ${box.height != null ? 'py-[2px]' : ''}`.trim()} tagVariant={tagVariant ?? (/surface-/.test(ground ?? '') ? 'tertiary' : 'primary')} {...text} />
|
|
313
|
+
)}
|
|
288
314
|
{/* `specs` rides the trailing edge on EVERY variant — year · material ·
|
|
289
315
|
* edition is a content difference, not a geometry one, and minting a
|
|
290
316
|
* seventh page-named box for it is the exact mistake §1 of the ticket is
|
|
@@ -302,12 +328,12 @@ export default function ContentRow({
|
|
|
302
328
|
</dl>
|
|
303
329
|
)}
|
|
304
330
|
{/* trailing edge, never in the text flow — MediaRow's placement */}
|
|
305
|
-
{actions && <div className="shrink-0">{actions}</div>}
|
|
331
|
+
{actions && !box.plate && <div className="shrink-0">{actions}</div>}
|
|
306
332
|
</>
|
|
307
333
|
)
|
|
308
334
|
|
|
309
335
|
const common = {
|
|
310
|
-
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' : ''} ${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(),
|
|
311
337
|
style: vars,
|
|
312
338
|
}
|
|
313
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`). */
|