@kolkrabbi/kol-component 0.289.0 → 0.290.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.290.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,3 +1,4 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from 'react'
|
|
1
2
|
import ContentMedia from './ContentMedia.jsx'
|
|
2
3
|
import ContentText from './ContentText.jsx'
|
|
3
4
|
import { toneClass } from '../utilities/tone.js'
|
|
@@ -240,6 +241,20 @@ export default function ContentCard({
|
|
|
240
241
|
* left, instead of bottom-right (the 2026-08-15 ruling). Block from the
|
|
241
242
|
* first value, inline from the second (or the same one). */
|
|
242
243
|
const [padBlock, padInline = padBlock] = String(padding ?? '0').trim().split(/\s+/)
|
|
244
|
+
/* the copy stops BEFORE the actions (FileCardTitleClearsActions, kol-fxr 2026-10-22): they are
|
|
245
|
+
* absolute, so the text column spanned the plate and a long title's ellipsis landed under the cog.
|
|
246
|
+
* Their measured width (+ one pad) is reserved on the text side, so `truncate` ends left of them. */
|
|
247
|
+
const actionsRef = useRef(null)
|
|
248
|
+
const [actionsW, setActionsW] = useState(0)
|
|
249
|
+
useLayoutEffect(() => {
|
|
250
|
+
const el = actionsRef.current
|
|
251
|
+
if (!el) { setActionsW(0); return undefined }
|
|
252
|
+
const measure = () => setActionsW(el.offsetWidth)
|
|
253
|
+
measure()
|
|
254
|
+
const ro = new ResizeObserver(measure)
|
|
255
|
+
ro.observe(el)
|
|
256
|
+
return () => ro.disconnect()
|
|
257
|
+
}, [actions != null])
|
|
243
258
|
/* image-only cards (print) pass no text slots — the empty plate must not render */
|
|
244
259
|
const hasText = ['title', 'body', 'kicker', 'detail', 'date', 'size', 'meta', 'tags'].some((k) => textSlots[k] != null)
|
|
245
260
|
/* `actions` sit IN THE TEXT PLATE, bottom-right (user ruling 2026-08-15:
|
|
@@ -280,6 +295,7 @@ export default function ContentCard({
|
|
|
280
295
|
className="kol-card-plate relative"
|
|
281
296
|
style={{
|
|
282
297
|
'--kol-plate-pad': padding,
|
|
298
|
+
'--kol-plate-actions-w': actionsW ? `calc(${actionsW}px + ${padInline})` : undefined,
|
|
283
299
|
'--kol-plate-pad-md': box.padMd,
|
|
284
300
|
padding,
|
|
285
301
|
/* a fill-card with no cover keeps its frame and its plate keeps the FOOT — dropping the media
|
|
@@ -293,13 +309,14 @@ export default function ContentCard({
|
|
|
293
309
|
zIndex: box.layout === 'canvas' ? 1 : undefined,
|
|
294
310
|
}}
|
|
295
311
|
>
|
|
296
|
-
{hasText && <ContentText variant={variant} form={isHero ? 'hero' : 'card'} tagVariant={tagVariant ?? (/surface-/.test(ground ?? '') ? 'tertiary' : 'primary')} {...textSlots} />}
|
|
312
|
+
{hasText && <ContentText variant={variant} form={isHero ? 'hero' : 'card'} className={actionsW ? 'min-w-0 pr-[var(--kol-plate-actions-w)]' : ''} tagVariant={tagVariant ?? (/surface-/.test(ground ?? '') ? 'tertiary' : 'primary')} {...textSlots} />}
|
|
297
313
|
{/* ABSOLUTE, not a flex sibling: the plate's height moves with the title
|
|
298
314
|
* and the meta, so a laid-out stack would stretch or drift with it. The
|
|
299
315
|
* inset reads the SAME pad token the plate uses, so the icons sit the
|
|
300
316
|
* same distance from the top and right edges as the copy does. */}
|
|
301
317
|
{actions && (
|
|
302
318
|
<div
|
|
319
|
+
ref={actionsRef}
|
|
303
320
|
className="absolute flex"
|
|
304
321
|
style={{ top: padBlock, bottom: padBlock, right: padInline }}
|
|
305
322
|
>
|
|
@@ -305,7 +305,7 @@ export default function ContentRow({
|
|
|
305
305
|
<div className="flex flex-1 min-w-0 items-stretch" style={{ padding: box.plate, gap: box.plateGap ?? box.plate }}>
|
|
306
306
|
{/* the meta line's leading is its type size, so its baseline lands on the bottom pad, level with the last
|
|
307
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} />
|
|
308
|
+
<ContentText variant={variant} form="row" className="min-w-0 flex-1 justify-between [&_.kol-mono-12]:leading-none" tagVariant={tagVariant ?? (/surface-/.test(ground ?? '') ? 'tertiary' : 'primary')} {...text} />
|
|
309
309
|
{actions && <div className="shrink-0">{actions}</div>}
|
|
310
310
|
</div>
|
|
311
311
|
) : (
|