@molecule/app-card-grid-react 1.0.0 → 1.0.1
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/README.md +169 -0
- package/package.json +14 -8
package/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-08-04T01:50:14.018Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# @molecule/app-card-grid-react
|
|
10
|
+
|
|
11
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
+
|
|
15
|
+
React card-grid and bento-grid layouts.
|
|
16
|
+
|
|
17
|
+
Exports:
|
|
18
|
+
|
|
19
|
+
- `<CardGrid>` — responsive grid with configurable column count.
|
|
20
|
+
- `<BentoGrid>` — col/row-span or named-areas layout for mixed-size cards.
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { CardGrid, BentoGrid } from '@molecule/app-card-grid-react'
|
|
26
|
+
|
|
27
|
+
<CardGrid columns={3} gap="md">
|
|
28
|
+
<ProductCard product={products[0]} />
|
|
29
|
+
<ProductCard product={products[1]} />
|
|
30
|
+
<ProductCard product={products[2]} />
|
|
31
|
+
</CardGrid>
|
|
32
|
+
|
|
33
|
+
<BentoGrid
|
|
34
|
+
items={[
|
|
35
|
+
{ id: 'hero', content: <HeroCard />, colSpan: 8, rowSpan: 2 },
|
|
36
|
+
{ id: 'stats', content: <StatsCard />, colSpan: 4 },
|
|
37
|
+
]}
|
|
38
|
+
/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Type
|
|
42
|
+
|
|
43
|
+
`feature`
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install @molecule/app-card-grid-react @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
|
|
49
|
+
npm install -D @types/react
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## API
|
|
53
|
+
|
|
54
|
+
### Interfaces
|
|
55
|
+
|
|
56
|
+
#### `BentoGridProps`
|
|
57
|
+
|
|
58
|
+
Props for {@link BentoGrid}.
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
interface BentoGridProps {
|
|
62
|
+
/** Items to render. */
|
|
63
|
+
items: BentoItem[]
|
|
64
|
+
/**
|
|
65
|
+
* Optional `grid-template-areas` string (e.g. `'a a b' 'c d d'`). When
|
|
66
|
+
* provided, each `BentoItem.area` must match a token in the template.
|
|
67
|
+
*/
|
|
68
|
+
areas?: string
|
|
69
|
+
/** Default column count when `areas` is absent. Defaults to 12. */
|
|
70
|
+
columns?: number
|
|
71
|
+
/** Gap between items. */
|
|
72
|
+
gap?: 'xs' | 'sm' | 'md' | 'lg'
|
|
73
|
+
/** Extra classes. */
|
|
74
|
+
className?: string
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### `BentoItem`
|
|
79
|
+
|
|
80
|
+
Data descriptor for a single cell in a BentoGrid layout.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
interface BentoItem {
|
|
84
|
+
/** Unique item identifier (React key). */
|
|
85
|
+
id: string
|
|
86
|
+
/** Card content. */
|
|
87
|
+
content: ReactNode
|
|
88
|
+
/** CSS grid-column-span (1-12). Defaults to 4. */
|
|
89
|
+
colSpan?: number
|
|
90
|
+
/** CSS grid-row-span (1-6). Defaults to 1. */
|
|
91
|
+
rowSpan?: number
|
|
92
|
+
/** Named grid-area when using `areas` layout. */
|
|
93
|
+
area?: string
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
#### `CardGridProps`
|
|
98
|
+
|
|
99
|
+
Props for {@link CardGrid}.
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
interface CardGridProps {
|
|
103
|
+
/** Cards. */
|
|
104
|
+
children: ReactNode
|
|
105
|
+
/** Column count at the md+ breakpoint. 1–6. Defaults to 3. */
|
|
106
|
+
columns?: 1 | 2 | 3 | 4 | 5 | 6
|
|
107
|
+
/** Gap between cards. */
|
|
108
|
+
gap?: 'xs' | 'sm' | 'md' | 'lg'
|
|
109
|
+
/** Extra classes. */
|
|
110
|
+
className?: string
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Functions
|
|
115
|
+
|
|
116
|
+
#### `BentoGrid(props)`
|
|
117
|
+
|
|
118
|
+
Bento-style grid — items span multiple cells for a magazine / dashboard
|
|
119
|
+
layout. Works in two modes: (a) col/row-span driven, (b) named-areas
|
|
120
|
+
driven via the `areas` prop.
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
function BentoGrid({
|
|
124
|
+
items,
|
|
125
|
+
areas,
|
|
126
|
+
columns = 12,
|
|
127
|
+
gap = 'md',
|
|
128
|
+
className,
|
|
129
|
+
}: BentoGridProps): ReactElement<unknown, string | JSXElementConstructor<any>>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
- `props` — Component props (see {@link BentoGridProps}).
|
|
133
|
+
|
|
134
|
+
#### `CardGrid(props)`
|
|
135
|
+
|
|
136
|
+
Generic responsive card grid. Collapses to one column on narrow viewports
|
|
137
|
+
and grows to `columns` on md+. Typical uses: product grids, post grids,
|
|
138
|
+
dashboard widget rows.
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
function CardGrid({ children, columns = 3, gap = 'md', className }: CardGridProps): JSX.Element
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
- `props` — Component props (see {@link CardGridProps}).
|
|
145
|
+
|
|
146
|
+
## Injection Notes
|
|
147
|
+
|
|
148
|
+
### Requirements
|
|
149
|
+
|
|
150
|
+
Peer dependencies:
|
|
151
|
+
|
|
152
|
+
- `@molecule/app-react` ^1.0.1
|
|
153
|
+
- `@molecule/app-ui` ^1.0.1
|
|
154
|
+
- `@molecule/app-ui-react` ^1.0.1
|
|
155
|
+
- `react` ^18.0.0 || ^19.0.0
|
|
156
|
+
|
|
157
|
+
### Runtime Dependencies
|
|
158
|
+
|
|
159
|
+
- `@molecule/app-react`
|
|
160
|
+
- `@molecule/app-ui`
|
|
161
|
+
- `@molecule/app-ui-react`
|
|
162
|
+
- `react`
|
|
163
|
+
|
|
164
|
+
`<CardGrid>` collapses to one column on narrow viewports and grows to
|
|
165
|
+
`columns` (1–6) at the md+ breakpoint via the ClassMap grid. In
|
|
166
|
+
`<BentoGrid>`, span mode uses a `columns`-wide grid (default 12) with
|
|
167
|
+
per-item `colSpan`/`rowSpan`; passing `areas` switches to named
|
|
168
|
+
`grid-template-areas` — then every item must set a matching `area`
|
|
169
|
+
token or it falls out of the template.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-card-grid-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Responsive React card grid and bento-grid layouts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
|
-
"dist"
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
21
22
|
],
|
|
22
23
|
"keywords": [
|
|
23
24
|
"molecule",
|
|
@@ -25,16 +26,21 @@
|
|
|
25
26
|
"react"
|
|
26
27
|
],
|
|
27
28
|
"license": "Apache-2.0",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
32
|
+
"directory": "packages/app/features/card-grid-react"
|
|
33
|
+
},
|
|
28
34
|
"peerDependencies": {
|
|
29
|
-
"@molecule/app-react": "^1.0.
|
|
30
|
-
"@molecule/app-ui": "^1.0.
|
|
31
|
-
"@molecule/app-ui-react": "^1.0.
|
|
35
|
+
"@molecule/app-react": "^1.0.1",
|
|
36
|
+
"@molecule/app-ui": "^1.0.1",
|
|
37
|
+
"@molecule/app-ui-react": "^1.0.1",
|
|
32
38
|
"react": "^18.0.0 || ^19.0.0"
|
|
33
39
|
},
|
|
34
40
|
"devDependencies": {
|
|
35
|
-
"@molecule/app-react": "1.0.
|
|
36
|
-
"@molecule/app-ui": "1.0.
|
|
37
|
-
"@molecule/app-ui-react": "1.0.
|
|
41
|
+
"@molecule/app-react": "1.0.1",
|
|
42
|
+
"@molecule/app-ui": "1.0.1",
|
|
43
|
+
"@molecule/app-ui-react": "1.0.1",
|
|
38
44
|
"@types/node": "26.1.2",
|
|
39
45
|
"@types/react": "19.2.17",
|
|
40
46
|
"@types/react-dom": "19.2.3",
|