@molecule/app-listing-card-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.
Files changed (2) hide show
  1. package/README.md +274 -0
  2. package/package.json +14 -8
package/README.md ADDED
@@ -0,0 +1,274 @@
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:51:15.543Z
7
+ -->
8
+
9
+ # @molecule/app-listing-card-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 product / property / listing card primitives.
16
+
17
+ Exports:
18
+
19
+ - `<ListingCard>` — outer Card shell. Props: `children`, `onClick?`,
20
+ `className?`, `dataMolId?`.
21
+ - `<ListingCardMedia>` — top image slot. Props: `src?`, `alt?`, `children?`
22
+ (custom media node), `aspect?` (`'1/1' | '4/3' | '16/9' | '3/2'`, default
23
+ `'4/3'`, applied as an inline aspect-ratio style), `overlay?` (badge /
24
+ favorite button, absolutely positioned over the media), `className?`.
25
+ - `<ListingCardBody>` — stacked text. Props: `title`, `subtitle?`, `price?`,
26
+ `meta?`, `className?`.
27
+ - `<ListingCardActions>` — action row. Props: `children`, `layout?`
28
+ (`'horizontal'` default | `'stacked'`), `className?`.
29
+ - `<ListingGrid>` — grid container. Props: `children`, `columns?` (1–6, default
30
+ 3), `gap?`, `className?`.
31
+
32
+ ## Quick Start
33
+
34
+ ```tsx
35
+ import {
36
+ ListingCard,
37
+ ListingCardMedia,
38
+ ListingCardBody,
39
+ ListingCardActions,
40
+ ListingGrid,
41
+ } from '@molecule/app-listing-card-react'
42
+
43
+ ;<ListingGrid columns={3}>
44
+ <ListingCard onClick={() => navigate(`/listings/${item.id}`)}>
45
+ <ListingCardMedia src={item.imageUrl} aspect="4/3" alt={item.name} />
46
+ <ListingCardBody title={item.name} subtitle={item.location} price={`$${item.price}/night`} />
47
+ <ListingCardActions>
48
+ <button
49
+ onClick={(e) => {
50
+ e.stopPropagation()
51
+ saveListing(item.id)
52
+ }}
53
+ >
54
+ Save
55
+ </button>
56
+ </ListingCardActions>
57
+ </ListingCard>
58
+ </ListingGrid>
59
+ ```
60
+
61
+ ## Type
62
+
63
+ `feature`
64
+
65
+ ## Installation
66
+
67
+ ```bash
68
+ npm install @molecule/app-listing-card-react @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
69
+ npm install -D @types/react
70
+ ```
71
+
72
+ ## API
73
+
74
+ ### Interfaces
75
+
76
+ #### `ListingCardActionsProps`
77
+
78
+ Props for {@link ListingCardActions}.
79
+
80
+ ```typescript
81
+ interface ListingCardActionsProps {
82
+ /** Action content — buttons, favorite toggle, etc. */
83
+ children: ReactNode
84
+ /** Layout — `'horizontal'` (default) fills width, `'stacked'` is vertical. */
85
+ layout?: 'horizontal' | 'stacked'
86
+ /** Extra classes. */
87
+ className?: string
88
+ }
89
+ ```
90
+
91
+ #### `ListingCardBodyProps`
92
+
93
+ Props for {@link ListingCardBody}.
94
+
95
+ ```typescript
96
+ interface ListingCardBodyProps {
97
+ /** Primary title / name. */
98
+ title: ReactNode
99
+ /** Secondary line (subtitle, location, category). */
100
+ subtitle?: ReactNode
101
+ /** Price / metric line. */
102
+ price?: ReactNode
103
+ /** Optional extras row (rating, availability, badges). */
104
+ meta?: ReactNode
105
+ /** Extra classes. */
106
+ className?: string
107
+ }
108
+ ```
109
+
110
+ #### `ListingCardMediaProps`
111
+
112
+ Props for {@link ListingCardMedia}.
113
+
114
+ ```typescript
115
+ interface ListingCardMediaProps {
116
+ /** Image URL or ReactNode. */
117
+ src?: string
118
+ alt?: string
119
+ /** Override with a ReactNode (video, carousel, svg). */
120
+ children?: ReactNode
121
+ /** Aspect ratio (`'1/1' | '4/3' | '16/9' | '3/2'`), applied as an inline `aspect-ratio` style. Defaults to `'4/3'`. */
122
+ aspect?: '1/1' | '4/3' | '16/9' | '3/2'
123
+ /** Optional overlay node (badge, favorite heart). */
124
+ overlay?: ReactNode
125
+ /** Extra classes. */
126
+ className?: string
127
+ }
128
+ ```
129
+
130
+ #### `ListingCardProps`
131
+
132
+ Props for {@link ListingCard}.
133
+
134
+ ```typescript
135
+ interface ListingCardProps {
136
+ /** Slots — usually `<ListingCardMedia>` + `<ListingCardBody>` + `<ListingCardActions>`. */
137
+ children: ReactNode
138
+ /**
139
+ * Called on any click on the card — including clicks inside
140
+ * `<ListingCardActions>`, which bubble into it unless the action handler
141
+ * calls `e.stopPropagation()`.
142
+ */
143
+ onClick?: () => void
144
+ /** Extra classes on the outer Card. */
145
+ className?: string
146
+ /** `data-mol-id` for AI-agent selectors. */
147
+ dataMolId?: string
148
+ }
149
+ ```
150
+
151
+ #### `ListingGridProps`
152
+
153
+ Props for {@link ListingGrid}.
154
+
155
+ ```typescript
156
+ interface ListingGridProps {
157
+ children: ReactNode
158
+ /** Column count, fixed at every viewport width. Defaults to 3. */
159
+ columns?: 1 | 2 | 3 | 4 | 5 | 6
160
+ gap?: 'xs' | 'sm' | 'md' | 'lg'
161
+ className?: string
162
+ }
163
+ ```
164
+
165
+ ### Functions
166
+
167
+ #### `ListingCard(props)`
168
+
169
+ Product / property / listing card shell. Just a `<Card>` with vertical
170
+ stacking of its children — typically `<ListingCardMedia>` +
171
+ `<ListingCardBody>` + `<ListingCardActions>`.
172
+
173
+ Use for product tiles, property cards, course cards, listings,
174
+ and similar content-card layouts.
175
+
176
+ ```typescript
177
+ function ListingCard({ children, onClick, className, dataMolId }: ListingCardProps): JSX.Element
178
+ ```
179
+
180
+ - `props` — Component props (see {@link ListingCardProps}).
181
+
182
+ #### `ListingCardActions(props)`
183
+
184
+ Bottom action row of a `<ListingCard>` (Add to cart, Save, etc.).
185
+
186
+ ```typescript
187
+ function ListingCardActions({
188
+ children,
189
+ layout = 'horizontal',
190
+ className,
191
+ }: ListingCardActionsProps): JSX.Element
192
+ ```
193
+
194
+ - `props` — Component props (see {@link ListingCardActionsProps}).
195
+
196
+ #### `ListingCardBody(props)`
197
+
198
+ Body of a `<ListingCard>` — title / subtitle / price / meta rows stacked.
199
+
200
+ ```typescript
201
+ function ListingCardBody({
202
+ title,
203
+ subtitle,
204
+ price,
205
+ meta,
206
+ className,
207
+ }: ListingCardBodyProps): JSX.Element
208
+ ```
209
+
210
+ - `props` — Component props (see {@link ListingCardBodyProps}).
211
+
212
+ #### `ListingCardMedia(props)`
213
+
214
+ Media slot at the top of a `<ListingCard>`. Locks aspect ratio via
215
+ inline style so apps get consistent card sizing without custom CSS.
216
+
217
+ ```typescript
218
+ function ListingCardMedia({
219
+ src,
220
+ alt,
221
+ children,
222
+ aspect = '4/3',
223
+ overlay,
224
+ className,
225
+ }: ListingCardMediaProps): JSX.Element
226
+ ```
227
+
228
+ - `props` — Component props (see {@link ListingCardMediaProps}).
229
+
230
+ #### `ListingGrid(props)`
231
+
232
+ Grid for `<ListingCard>`s — a fixed `columns`-column grid at every
233
+ viewport width. Alias for `CardGrid` tuned for listing layouts — same
234
+ shape, different semantic name so importers can self-document.
235
+
236
+ ```typescript
237
+ function ListingGrid({
238
+ children,
239
+ columns = 3,
240
+ gap = 'md',
241
+ className,
242
+ }: ListingGridProps): JSX.Element
243
+ ```
244
+
245
+ - `props` — Component props (see {@link ListingGridProps}).
246
+
247
+ ## Injection Notes
248
+
249
+ ### Requirements
250
+
251
+ Peer dependencies:
252
+
253
+ - `@molecule/app-react` ^1.0.1
254
+ - `@molecule/app-ui` ^1.0.1
255
+ - `@molecule/app-ui-react` ^1.0.1
256
+ - `react` ^18.0.0 || ^19.0.0
257
+
258
+ ### Runtime Dependencies
259
+
260
+ - `@molecule/app-react`
261
+ - `@molecule/app-ui`
262
+ - `@molecule/app-ui-react`
263
+ - `react`
264
+
265
+ - `ListingCard.onClick` is attached to the WHOLE card — clicks on buttons inside
266
+ `<ListingCardActions>` bubble into it. Call `e.stopPropagation()` in every
267
+ action handler (as in the example) or the card navigation fires too.
268
+ - `<ListingGrid columns={n}>` renders a responsive n-column grid (via `cm.grid`):
269
+ 1 column on phones, stepping up to `n` at larger breakpoints, so listings
270
+ don't overflow on mobile. Override `className` for a fixed grid.
271
+ - `overlay` children are rendered inside an absolutely-positioned inset-0 layer;
272
+ give interactive overlays their own pointer handling and stopPropagation.
273
+ - Styling resolves through `getClassMap()`; the shell uses `<Card>` from
274
+ `@molecule/app-ui-react` — wire a ClassMap bond first.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-listing-card-react",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "React listing/product-card primitives with media, body, actions slots",
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/listing-card-react"
33
+ },
28
34
  "peerDependencies": {
29
- "@molecule/app-react": "^1.0.0",
30
- "@molecule/app-ui": "^1.0.0",
31
- "@molecule/app-ui-react": "^1.0.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.0",
36
- "@molecule/app-ui": "1.0.0",
37
- "@molecule/app-ui-react": "1.0.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",