@kolkrabbi/kol-component 0.131.0 → 0.132.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/index.js +0 -2
- package/src/molecules/MediaCard.jsx +0 -103
- package/src/molecules/MediaRow.jsx +0 -55
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.132.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/index.js
CHANGED
|
@@ -82,8 +82,6 @@ export { default as Dropdown } from './molecules/Dropdown.jsx'
|
|
|
82
82
|
export { default as FieldRow, StatusChip } from './molecules/FieldRow.jsx'
|
|
83
83
|
export { default as FramedMediaBand } from './organisms/FramedMediaBand.jsx'
|
|
84
84
|
export { default as Image } from './atoms/Image.jsx'
|
|
85
|
-
export { default as MediaCard } from './molecules/MediaCard.jsx'
|
|
86
|
-
export { default as MediaRow } from './molecules/MediaRow.jsx'
|
|
87
85
|
|
|
88
86
|
/* content-card system (2026-08-15) — the ruled card/row family:
|
|
89
87
|
* docs/documentation/03-components/06-content-card-system.md */
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { Icon } from '@kolkrabbi/kol-icons'
|
|
2
|
-
|
|
3
|
-
/* taxonomy-ok: nests kol-icons's Icon (a package import the relative-import
|
|
4
|
-
* check can't see) plus the same-file SelectIndicator. */
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated 2026-08-26 — absorbed by `ContentCard variant="default"` in @kolkrabbi/kol-component
|
|
8
|
-
* (the Content Set, 2026-08-15). Step 1 of the retirement wave: this export
|
|
9
|
-
* stays and renders unchanged until the next major, then it is removed.
|
|
10
|
-
* Consumers: swap on your next bump. Map + row-by-row diff:
|
|
11
|
-
* docs/documentation/03-components/06-content-card-system.md.
|
|
12
|
-
*
|
|
13
|
-
* SelectIndicator — passive square check indicator for multi-select rows and
|
|
14
|
-
* cards. `on` = checked. Deliberately NOT ToggleCheckbox: that is a labeled
|
|
15
|
-
* form control with a real <input>, which double-fires inside a click-target
|
|
16
|
-
* card and misleads assistive tech — here the CARD is the toggle, this is
|
|
17
|
-
* only its visual state. Inline CSS vars because `bg-fg-default` isn't a
|
|
18
|
-
* generated Tailwind utility; the checked fill reads from
|
|
19
|
-
* `--kol-surface-on-primary` (solid fg, theme-correct).
|
|
20
|
-
*
|
|
21
|
-
* Shared by MediaCard and MediaRow; not exported from the package barrel.
|
|
22
|
-
*/
|
|
23
|
-
export function SelectIndicator({ on = false }) {
|
|
24
|
-
return (
|
|
25
|
-
<span
|
|
26
|
-
className="w-4 h-4 shrink-0 rounded-sm border flex items-center justify-center transition-colors"
|
|
27
|
-
style={
|
|
28
|
-
on
|
|
29
|
-
? { background: 'var(--kol-surface-on-primary)', borderColor: 'var(--kol-surface-on-primary)' }
|
|
30
|
-
: { background: 'var(--kol-fg-ab-16, rgba(0,0,0,0.15))', borderColor: 'var(--kol-fg-ab-48, rgba(0,0,0,0.4))' }
|
|
31
|
-
}
|
|
32
|
-
aria-hidden="true"
|
|
33
|
-
>
|
|
34
|
-
{on && <Icon name="check" size={11} style={{ color: 'var(--kol-surface-primary)' }} />}
|
|
35
|
-
</span>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* MediaCard — grid tile for one media object: square thumbnail with a
|
|
41
|
-
* top-right download overlay (or a top-left select checkbox in select mode),
|
|
42
|
-
* then name / meta / actions stacked below. The grid-view counterpart to
|
|
43
|
-
* MediaRow (same slot contract).
|
|
44
|
-
*
|
|
45
|
-
* Presentational — the parent supplies rendered slots; no media loading,
|
|
46
|
-
* fetch, or rename logic lives here. Grid track sizing belongs to the parent
|
|
47
|
-
* list; the card just fills its cell.
|
|
48
|
-
*
|
|
49
|
-
* @param {ReactNode} thumb square thumbnail (image/video/placeholder)
|
|
50
|
-
* @param {ReactNode} name name cell (plain text or an inline editor)
|
|
51
|
-
* @param {string} meta one-line secondary text (e.g. "1.2 MB · 2026-06-19")
|
|
52
|
-
* @param {ReactNode} actions row of action buttons (hidden in select mode)
|
|
53
|
-
* @param {string} downloadHref href for the overlay download button (omit to hide)
|
|
54
|
-
* @param {boolean} selectMode selection mode on → checkbox replaces download, whole card toggles
|
|
55
|
-
* @param {boolean} selected this card is selected (stronger border + checked box)
|
|
56
|
-
* @param {Function} onSelect (event) => void — card click in select mode; gets shiftKey for range
|
|
57
|
-
*/
|
|
58
|
-
export default function MediaCard({
|
|
59
|
-
thumb,
|
|
60
|
-
name,
|
|
61
|
-
meta,
|
|
62
|
-
actions,
|
|
63
|
-
downloadHref,
|
|
64
|
-
selectMode = false,
|
|
65
|
-
selected = false,
|
|
66
|
-
onSelect,
|
|
67
|
-
}) {
|
|
68
|
-
return (
|
|
69
|
-
<li
|
|
70
|
-
onClick={selectMode ? onSelect : undefined}
|
|
71
|
-
className={`flex flex-col rounded overflow-hidden border bg-fg-02 ${selectMode ? 'cursor-pointer select-none' : ''}`}
|
|
72
|
-
style={{ borderColor: selected ? 'var(--kol-fg-64)' : 'var(--kol-fg-12)' }}
|
|
73
|
-
>
|
|
74
|
-
<div className="aspect-square relative">
|
|
75
|
-
{thumb}
|
|
76
|
-
{selectMode ? (
|
|
77
|
-
<span
|
|
78
|
-
className="kol-frame-control kol-frame-control--top-left rounded p-1"
|
|
79
|
-
style={{ background: 'var(--kol-fg-ab-12, rgba(0,0,0,0.4))', backdropFilter: 'blur(4px)' }}
|
|
80
|
-
>
|
|
81
|
-
<SelectIndicator on={selected} />
|
|
82
|
-
</span>
|
|
83
|
-
) : downloadHref ? (
|
|
84
|
-
<a
|
|
85
|
-
href={downloadHref}
|
|
86
|
-
aria-label="Download"
|
|
87
|
-
title="Download"
|
|
88
|
-
className="kol-frame-control inline-flex items-center justify-center w-8 h-8 rounded text-emphasis hover:bg-fg-ab-24 transition-colors"
|
|
89
|
-
style={{ background: 'var(--kol-fg-ab-12, rgba(0,0,0,0.4))', backdropFilter: 'blur(4px)' }}
|
|
90
|
-
onClick={(e) => e.stopPropagation()}
|
|
91
|
-
>
|
|
92
|
-
<Icon name="download" size={16} />
|
|
93
|
-
</a>
|
|
94
|
-
) : null}
|
|
95
|
-
</div>
|
|
96
|
-
<div className="p-3 flex flex-col gap-2">
|
|
97
|
-
{name}
|
|
98
|
-
<p className="kol-mono-12 text-fg-48">{meta}</p>
|
|
99
|
-
{!selectMode && actions}
|
|
100
|
-
</div>
|
|
101
|
-
</li>
|
|
102
|
-
)
|
|
103
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { SelectIndicator } from './MediaCard.jsx'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated 2026-08-26 — absorbed by `ContentRow variant="default"` in @kolkrabbi/kol-component
|
|
5
|
-
* (the Content Set, 2026-08-15). Step 1 of the retirement wave: this export
|
|
6
|
-
* stays and renders unchanged until the next major, then it is removed.
|
|
7
|
-
* Consumers: swap on your next bump. Map + row-by-row diff:
|
|
8
|
-
* docs/documentation/03-components/06-content-card-system.md.
|
|
9
|
-
*
|
|
10
|
-
* MediaRow — list row for one media object: optional select checkbox, small
|
|
11
|
-
* thumbnail, name (flex), fixed-width date + size columns, then actions.
|
|
12
|
-
* The list-view counterpart to MediaCard (same slot contract).
|
|
13
|
-
*
|
|
14
|
-
* Presentational — the parent supplies rendered slots; interaction outside
|
|
15
|
-
* select mode lives in the thumb / name / actions slots. Column widths are
|
|
16
|
-
* consumer-tunable via `dateWidth` / `sizeWidth`.
|
|
17
|
-
*
|
|
18
|
-
* @param {ReactNode} thumb small thumbnail (48px square)
|
|
19
|
-
* @param {ReactNode} name name cell (plain text or an inline editor)
|
|
20
|
-
* @param {string} date right-aligned date column
|
|
21
|
-
* @param {string} size right-aligned size column
|
|
22
|
-
* @param {ReactNode} actions row of action buttons (hidden in select mode)
|
|
23
|
-
* @param {string} dateWidth Tailwind width class for the date column
|
|
24
|
-
* @param {string} sizeWidth Tailwind width class for the size column
|
|
25
|
-
* @param {boolean} selectMode selection mode on → checkbox shown, whole row toggles, actions hidden
|
|
26
|
-
* @param {boolean} selected this row is selected (highlight + checked box)
|
|
27
|
-
* @param {Function} onSelect (event) => void — row click in select mode; gets shiftKey for range
|
|
28
|
-
*/
|
|
29
|
-
export default function MediaRow({
|
|
30
|
-
thumb,
|
|
31
|
-
name,
|
|
32
|
-
date,
|
|
33
|
-
size,
|
|
34
|
-
actions,
|
|
35
|
-
dateWidth = 'w-24',
|
|
36
|
-
sizeWidth = 'w-20',
|
|
37
|
-
selectMode = false,
|
|
38
|
-
selected = false,
|
|
39
|
-
onSelect,
|
|
40
|
-
}) {
|
|
41
|
-
return (
|
|
42
|
-
<li
|
|
43
|
-
onClick={selectMode ? onSelect : undefined}
|
|
44
|
-
className={`flex items-center gap-3 py-2 border-b ${selectMode ? 'cursor-pointer select-none' : ''} ${selected ? 'bg-fg-08' : ''}`}
|
|
45
|
-
style={{ borderColor: 'var(--kol-fg-08)' }}
|
|
46
|
-
>
|
|
47
|
-
{selectMode && <SelectIndicator on={selected} />}
|
|
48
|
-
<div className="w-12 h-12 shrink-0 rounded overflow-hidden">{thumb}</div>
|
|
49
|
-
<div className="flex-1 min-w-0">{name}</div>
|
|
50
|
-
<p className={`kol-mono-12 text-fg-32 shrink-0 text-right ${dateWidth}`}>{date}</p>
|
|
51
|
-
<p className={`kol-mono-12 text-fg-48 shrink-0 text-right ${sizeWidth}`}>{size}</p>
|
|
52
|
-
{!selectMode && <div className="shrink-0">{actions}</div>}
|
|
53
|
-
</li>
|
|
54
|
-
)
|
|
55
|
-
}
|