@kolkrabbi/kol-component 0.88.0 → 0.89.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.88.0",
3
+ "version": "0.89.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",
@@ -41,8 +41,13 @@ import usePrefersReducedMotion from '../hooks/usePrefersReducedMotion.js'
41
41
  *
42
42
  * @param {string} form 'grid' | 'list'
43
43
  * @param {string} min grid track minimum, card form (default 320px)
44
- * @param {number} cols OPT-IN column count, grid form: 1 below md, N from
45
- * md (2–6). Wins over `min`; the list form ignores it
44
+ * @param {number|object} cols OPT-IN column count, grid form. A number: 1 below
45
+ * md, N from md (1–6). A map per breakpoint
46
+ * (`{ md: 3, xl: 4 }` — sm · md · lg · xl · 2xl): 1
47
+ * below the first rung, each rung's count from there
48
+ * (ContentCollectionColsResponsive, 2026-08-27 —
49
+ * user: "can we make it 4 in the biggest breakpoint?").
50
+ * Wins over `min`; the list form ignores it
46
51
  * @param {string} listMin OPT-IN: makes the list multi-column too, for a dense
47
52
  * file-browser cut. Unset = one full-width column
48
53
  * @param {number} gap px between items. UNSET reads the token for the
@@ -53,13 +58,19 @@ import usePrefersReducedMotion from '../hooks/usePrefersReducedMotion.js'
53
58
  * nine call sites. Pass a number only to differ
54
59
  * @param {boolean} stagger enter animation on/off (reduced motion wins)
55
60
  */
56
- const COLS = {
57
- 1: 'grid-cols-1',
58
- 2: 'grid-cols-1 md:grid-cols-2',
59
- 3: 'grid-cols-1 md:grid-cols-3',
60
- 4: 'grid-cols-1 md:grid-cols-4',
61
- 5: 'grid-cols-1 md:grid-cols-5',
62
- 6: 'grid-cols-1 md:grid-cols-6',
61
+ /* literal per rung × count — a class built at runtime is never emitted */
62
+ const COLS_AT = {
63
+ sm: { 1: 'sm:grid-cols-1', 2: 'sm:grid-cols-2', 3: 'sm:grid-cols-3', 4: 'sm:grid-cols-4', 5: 'sm:grid-cols-5', 6: 'sm:grid-cols-6' },
64
+ md: { 1: 'md:grid-cols-1', 2: 'md:grid-cols-2', 3: 'md:grid-cols-3', 4: 'md:grid-cols-4', 5: 'md:grid-cols-5', 6: 'md:grid-cols-6' },
65
+ lg: { 1: 'lg:grid-cols-1', 2: 'lg:grid-cols-2', 3: 'lg:grid-cols-3', 4: 'lg:grid-cols-4', 5: 'lg:grid-cols-5', 6: 'lg:grid-cols-6' },
66
+ xl: { 1: 'xl:grid-cols-1', 2: 'xl:grid-cols-2', 3: 'xl:grid-cols-3', 4: 'xl:grid-cols-4', 5: 'xl:grid-cols-5', 6: 'xl:grid-cols-6' },
67
+ '2xl': { 1: '2xl:grid-cols-1', 2: '2xl:grid-cols-2', 3: '2xl:grid-cols-3', 4: '2xl:grid-cols-4', 5: '2xl:grid-cols-5', 6: '2xl:grid-cols-6' },
68
+ }
69
+ const colsClasses = (cols) => {
70
+ const map = typeof cols === 'number' ? { md: cols } : cols
71
+ if (!map || typeof map !== 'object') return ''
72
+ const rungs = Object.keys(COLS_AT).map((bp) => COLS_AT[bp][map[bp]]).filter(Boolean)
73
+ return rungs.length ? ['grid-cols-1', ...rungs].join(' ') : ''
63
74
  }
64
75
 
65
76
  export default function ContentCollection({
@@ -81,7 +92,7 @@ export default function ContentCollection({
81
92
  ? `${gap}px`
82
93
  : `var(--kol-gap-wall-${form === 'list' ? 'list' : 'grid'})`
83
94
 
84
- const colsCls = form !== 'list' && COLS[cols] ? COLS[cols] : ''
95
+ const colsCls = form !== 'list' ? colsClasses(cols) : ''
85
96
  return (
86
97
  <ul
87
98
  key={form}