@kolkrabbi/kol-component 0.47.1 → 0.49.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.49.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",
|
|
@@ -13,15 +13,33 @@ import usePrefersReducedMotion from '../hooks/usePrefersReducedMotion.js'
|
|
|
13
13
|
* ponytail: form switch re-mounts with a stagger, no FLIP — add FLIP
|
|
14
14
|
* (measure → invert → play) when a consumer needs card↔row to tween.
|
|
15
15
|
*
|
|
16
|
+
* BOTH FORMS ARE GRIDS (user call 2026-08-15: *"layout always wraps the items
|
|
17
|
+
* in a grid, at least 99% of the time"*). `list` is not a single column — it is
|
|
18
|
+
* the same wall with WIDER tracks, so a compact row gets the room its fields
|
|
19
|
+
* need. The shipped consumers already did this (`repeat(4, 1fr)` for list,
|
|
20
|
+
* `repeat(6, 1fr)` for grid); what they got wrong was FORCING the count.
|
|
21
|
+
*
|
|
22
|
+
* The count derives from the wall's OWN width, never the viewport, and never a
|
|
23
|
+
* fixed track count — 05-layout-systems.md, the card-wall law: *"the shell
|
|
24
|
+
* rails eat width that viewport breakpoints can't see, so a forced count
|
|
25
|
+
* compresses every card"* (user call 2026-08-09). Hence `auto-fill` +
|
|
26
|
+
* `minmax()`, with the law's 20rem minimum as the default.
|
|
27
|
+
*
|
|
16
28
|
* @param {string} form 'grid' | 'list'
|
|
17
|
-
* @param {string} min grid track minimum (
|
|
18
|
-
* @param {
|
|
29
|
+
* @param {string} min grid track minimum, card form (default 20rem — the law)
|
|
30
|
+
* @param {string} listMin grid track minimum, list form (default 30rem)
|
|
31
|
+
* @param {number} gap px between items — defaults PER FORM (grid 24,
|
|
32
|
+
* list 8), the values every shipped consumer
|
|
33
|
+
* re-typed as a ternary at its own call site. A
|
|
34
|
+
* single default meant the ternary survived the
|
|
35
|
+
* migration, which is half the duplication
|
|
19
36
|
* @param {boolean} stagger enter animation on/off (reduced motion wins)
|
|
20
37
|
*/
|
|
21
38
|
export default function ContentCollection({
|
|
22
39
|
form = 'grid',
|
|
23
|
-
min = '
|
|
24
|
-
|
|
40
|
+
min = '20rem',
|
|
41
|
+
listMin = '30rem',
|
|
42
|
+
gap,
|
|
25
43
|
stagger = true,
|
|
26
44
|
children,
|
|
27
45
|
className = '',
|
|
@@ -29,16 +47,19 @@ export default function ContentCollection({
|
|
|
29
47
|
const reduced = usePrefersReducedMotion()
|
|
30
48
|
const animate = stagger && !reduced
|
|
31
49
|
const items = Array.isArray(children) ? children.flat() : [children]
|
|
50
|
+
/* ruled 2026-08-15 — the shipped 24/8 become the defaults, so `gap` is only
|
|
51
|
+
* passed when a consumer genuinely differs from the house. */
|
|
52
|
+
const px = gap ?? (form === 'list' ? 8 : 24)
|
|
32
53
|
|
|
33
54
|
return (
|
|
34
55
|
<ul
|
|
35
56
|
key={form}
|
|
36
57
|
className={`m-0 list-none p-0 ${className}`.trim()}
|
|
37
|
-
style={
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
58
|
+
style={{
|
|
59
|
+
display: 'grid',
|
|
60
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${form === 'list' ? listMin : min}, 1fr))`,
|
|
61
|
+
gap: `${px}px`,
|
|
62
|
+
}}
|
|
42
63
|
>
|
|
43
64
|
{items.map((child, i) =>
|
|
44
65
|
child == null ? null : (
|