@molecule/app-listing-card-react 1.0.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/LICENSE ADDED
@@ -0,0 +1,115 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship.
43
+
44
+ "Contribution" shall mean any work of authorship, including the
45
+ original version of the Work and any modifications or additions
46
+ to that Work, that is intentionally submitted to the Licensor for
47
+ inclusion in the Work by the copyright owner or by an individual or
48
+ Legal Entity authorized to submit on behalf of the copyright owner.
49
+
50
+ "Contributor" shall mean Licensor and any individual or Legal Entity
51
+ on behalf of whom a Contribution has been received by the Licensor and
52
+ subsequently incorporated within the Work.
53
+
54
+ 2. Grant of Copyright License. Subject to the terms and conditions of
55
+ this License, each Contributor hereby grants to You a perpetual,
56
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
57
+ copyright license to reproduce, prepare Derivative Works of,
58
+ publicly display, publicly perform, sublicense, and distribute the
59
+ Work and such Derivative Works in Source or Object form.
60
+
61
+ 3. Grant of Patent License. Subject to the terms and conditions of
62
+ this License, each Contributor hereby grants to You a perpetual,
63
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
64
+ patent license to make, have made, use, offer to sell, sell, import,
65
+ and otherwise transfer the Work.
66
+
67
+ 4. Redistribution. You may reproduce and distribute copies of the
68
+ Work or Derivative Works thereof in any medium, with or without
69
+ modifications, and in Source or Object form, provided that You
70
+ meet the following conditions:
71
+
72
+ (a) You must give any other recipients of the Work or
73
+ Derivative Works a copy of this License; and
74
+
75
+ (b) You must cause any modified files to carry prominent notices
76
+ stating that You changed the files; and
77
+
78
+ (c) You must retain, in the Source form of any Derivative Works
79
+ that You distribute, all copyright, patent, trademark, and
80
+ attribution notices from the Source form of the Work,
81
+ excluding those notices that do not pertain to any part of
82
+ the Derivative Works; and
83
+
84
+ (d) If the Work includes a "NOTICE" text file as part of its
85
+ distribution, then any Derivative Works that You distribute must
86
+ include a readable copy of the attribution notices contained
87
+ within such NOTICE file.
88
+
89
+ 5. Submission of Contributions.
90
+
91
+ 6. Trademarks. This License does not grant permission to use the trade
92
+ names, trademarks, service marks, or product names of the Licensor.
93
+
94
+ 7. Disclaimer of Warranty. Unless required by applicable law or
95
+ agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
96
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
97
+
98
+ 8. Limitation of Liability. In no event and under no legal theory shall
99
+ any Contributor be liable to You for damages.
100
+
101
+ 9. Accepting Warranty or Additional Liability.
102
+
103
+ Copyright 2026 Molecule Dev, Inc.
104
+
105
+ Licensed under the Apache License, Version 2.0 (the "License");
106
+ you may not use this file except in compliance with the License.
107
+ You may obtain a copy of the License at
108
+
109
+ http://www.apache.org/licenses/LICENSE-2.0
110
+
111
+ Unless required by applicable law or agreed to in writing, software
112
+ distributed under the License is distributed on an "AS IS" BASIS,
113
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
+ See the License for the specific language governing permissions and
115
+ limitations under the License.
@@ -0,0 +1,43 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ /** Props for {@link ListingCard}. */
3
+ export interface ListingCardProps {
4
+ /** Slots — usually `<ListingCardMedia>` + `<ListingCardBody>` + `<ListingCardActions>`. */
5
+ children: ReactNode;
6
+ /**
7
+ * Called on any click on the card — including clicks inside
8
+ * `<ListingCardActions>`, which bubble into it unless the action handler
9
+ * calls `e.stopPropagation()`.
10
+ */
11
+ onClick?: () => void;
12
+ /** Extra classes on the outer Card. */
13
+ className?: string;
14
+ /** `data-mol-id` for AI-agent selectors. */
15
+ dataMolId?: string;
16
+ }
17
+ /**
18
+ * Product / property / listing card shell. Just a `<Card>` with vertical
19
+ * stacking of its children — typically `<ListingCardMedia>` +
20
+ * `<ListingCardBody>` + `<ListingCardActions>`.
21
+ *
22
+ * Use for product tiles, property cards, course cards, listings,
23
+ * and similar content-card layouts.
24
+ *
25
+ * @param props - Component props (see {@link ListingCardProps}).
26
+ * @example
27
+ * ```tsx
28
+ * <ListingCard>
29
+ * <ListingCardMedia src={product.image} aspect="4/3" />
30
+ * <ListingCardBody
31
+ * title={product.name}
32
+ * subtitle={product.category}
33
+ * price={`$${product.price}`}
34
+ * meta={<StatusPill kind="success">In stock</StatusPill>}
35
+ * />
36
+ * <ListingCardActions>
37
+ * <Button onClick={addToCart}>Add to cart</Button>
38
+ * </ListingCardActions>
39
+ * </ListingCard>
40
+ * ```
41
+ */
42
+ export declare function ListingCard({ children, onClick, className, dataMolId, }: ListingCardProps): JSX.Element;
43
+ //# sourceMappingURL=ListingCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListingCard.d.ts","sourceRoot":"","sources":["../src/ListingCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAK3C,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,2FAA2F;IAC3F,QAAQ,EAAE,SAAS,CAAA;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAO,EACP,SAAS,EACT,SAAS,GACV,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAWhC"}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ import { Card } from '@molecule/app-ui-react';
4
+ /**
5
+ * Product / property / listing card shell. Just a `<Card>` with vertical
6
+ * stacking of its children — typically `<ListingCardMedia>` +
7
+ * `<ListingCardBody>` + `<ListingCardActions>`.
8
+ *
9
+ * Use for product tiles, property cards, course cards, listings,
10
+ * and similar content-card layouts.
11
+ *
12
+ * @param props - Component props (see {@link ListingCardProps}).
13
+ * @example
14
+ * ```tsx
15
+ * <ListingCard>
16
+ * <ListingCardMedia src={product.image} aspect="4/3" />
17
+ * <ListingCardBody
18
+ * title={product.name}
19
+ * subtitle={product.category}
20
+ * price={`$${product.price}`}
21
+ * meta={<StatusPill kind="success">In stock</StatusPill>}
22
+ * />
23
+ * <ListingCardActions>
24
+ * <Button onClick={addToCart}>Add to cart</Button>
25
+ * </ListingCardActions>
26
+ * </ListingCard>
27
+ * ```
28
+ */
29
+ export function ListingCard({ children, onClick, className, dataMolId, }) {
30
+ const cm = getClassMap();
31
+ return (_jsx(Card, { "data-mol-id": dataMolId, onClick: onClick, className: cm.cn(onClick ? cm.cursorPointer : undefined, className), children: _jsx("div", { className: cm.stack(0), children: children }) }));
32
+ }
@@ -0,0 +1,16 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ /** Props for {@link ListingCardActions}. */
3
+ export interface ListingCardActionsProps {
4
+ /** Action content — buttons, favorite toggle, etc. */
5
+ children: ReactNode;
6
+ /** Layout — `'horizontal'` (default) fills width, `'stacked'` is vertical. */
7
+ layout?: 'horizontal' | 'stacked';
8
+ /** Extra classes. */
9
+ className?: string;
10
+ }
11
+ /**
12
+ * Bottom action row of a `<ListingCard>` (Add to cart, Save, etc.).
13
+ * @param props - Component props (see {@link ListingCardActionsProps}).
14
+ */
15
+ export declare function ListingCardActions({ children, layout, className, }: ListingCardActionsProps): JSX.Element;
16
+ //# sourceMappingURL=ListingCardActions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListingCardActions.d.ts","sourceRoot":"","sources":["../src/ListingCardActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAI3C,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACtC,sDAAsD;IACtD,QAAQ,EAAE,SAAS,CAAA;IACnB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACjC,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,MAAqB,EACrB,SAAS,GACV,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAavC"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ /**
4
+ * Bottom action row of a `<ListingCard>` (Add to cart, Save, etc.).
5
+ * @param props - Component props (see {@link ListingCardActionsProps}).
6
+ */
7
+ export function ListingCardActions({ children, layout = 'horizontal', className, }) {
8
+ const cm = getClassMap();
9
+ return (_jsx("div", { className: cm.cn(cm.flex({ direction: layout === 'stacked' ? 'col' : 'row', gap: 'sm', align: 'stretch' }), cm.sp('p', 3), className), children: children }));
10
+ }
@@ -0,0 +1,20 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ /** Props for {@link ListingCardBody}. */
3
+ export interface ListingCardBodyProps {
4
+ /** Primary title / name. */
5
+ title: ReactNode;
6
+ /** Secondary line (subtitle, location, category). */
7
+ subtitle?: ReactNode;
8
+ /** Price / metric line. */
9
+ price?: ReactNode;
10
+ /** Optional extras row (rating, availability, badges). */
11
+ meta?: ReactNode;
12
+ /** Extra classes. */
13
+ className?: string;
14
+ }
15
+ /**
16
+ * Body of a `<ListingCard>` — title / subtitle / price / meta rows stacked.
17
+ * @param props - Component props (see {@link ListingCardBodyProps}).
18
+ */
19
+ export declare function ListingCardBody({ title, subtitle, price, meta, className, }: ListingCardBodyProps): JSX.Element;
20
+ //# sourceMappingURL=ListingCardBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListingCardBody.d.ts","sourceRoot":"","sources":["../src/ListingCardBody.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAI3C,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,4BAA4B;IAC5B,KAAK,EAAE,SAAS,CAAA;IAChB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,SAAS,GACV,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,CAUpC"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ /**
4
+ * Body of a `<ListingCard>` — title / subtitle / price / meta rows stacked.
5
+ * @param props - Component props (see {@link ListingCardBodyProps}).
6
+ */
7
+ export function ListingCardBody({ title, subtitle, price, meta, className, }) {
8
+ const cm = getClassMap();
9
+ return (_jsxs("div", { className: cm.cn(cm.stack(1), cm.sp('p', 3), className), children: [_jsx("h3", { className: cm.cn(cm.textSize('base'), cm.fontWeight('semibold')), children: title }), subtitle && _jsx("p", { className: cm.textSize('sm'), children: subtitle }), price && _jsx("p", { className: cm.cn(cm.textSize('lg'), cm.fontWeight('bold')), children: price }), meta && _jsx("div", { className: cm.flex({ align: 'center', gap: 'sm', wrap: 'wrap' }), children: meta })] }));
10
+ }
@@ -0,0 +1,22 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ /** Props for {@link ListingCardMedia}. */
3
+ export interface ListingCardMediaProps {
4
+ /** Image URL or ReactNode. */
5
+ src?: string;
6
+ alt?: string;
7
+ /** Override with a ReactNode (video, carousel, svg). */
8
+ children?: ReactNode;
9
+ /** Aspect ratio (`'1/1' | '4/3' | '16/9' | '3/2'`), applied as an inline `aspect-ratio` style. Defaults to `'4/3'`. */
10
+ aspect?: '1/1' | '4/3' | '16/9' | '3/2';
11
+ /** Optional overlay node (badge, favorite heart). */
12
+ overlay?: ReactNode;
13
+ /** Extra classes. */
14
+ className?: string;
15
+ }
16
+ /**
17
+ * Media slot at the top of a `<ListingCard>`. Locks aspect ratio via
18
+ * inline style so apps get consistent card sizing without custom CSS.
19
+ * @param props - Component props (see {@link ListingCardMediaProps}).
20
+ */
21
+ export declare function ListingCardMedia({ src, alt, children, aspect, overlay, className, }: ListingCardMediaProps): JSX.Element;
22
+ //# sourceMappingURL=ListingCardMedia.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListingCardMedia.d.ts","sourceRoot":"","sources":["../src/ListingCardMedia.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAI3C,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC,8BAA8B;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,wDAAwD;IACxD,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,uHAAuH;IACvH,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAA;IACvC,qDAAqD;IACrD,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,GAAG,EACH,QAAQ,EACR,MAAc,EACd,OAAO,EACP,SAAS,GACV,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,CAkBrC"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ /**
4
+ * Media slot at the top of a `<ListingCard>`. Locks aspect ratio via
5
+ * inline style so apps get consistent card sizing without custom CSS.
6
+ * @param props - Component props (see {@link ListingCardMediaProps}).
7
+ */
8
+ export function ListingCardMedia({ src, alt, children, aspect = '4/3', overlay, className, }) {
9
+ const cm = getClassMap();
10
+ return (_jsxs("div", { className: cm.cn(cm.position('relative'), className), style: { aspectRatio: aspect.replace('/', ' / ') }, children: [children ??
11
+ (src && (_jsx("img", { src: src, alt: alt ?? '', style: { width: '100%', height: '100%', objectFit: 'cover' } }))), overlay && _jsx("div", { className: cm.cn(cm.position('absolute'), cm.inset0), children: overlay })] }));
12
+ }
@@ -0,0 +1,17 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ /** Props for {@link ListingGrid}. */
3
+ export interface ListingGridProps {
4
+ children: ReactNode;
5
+ /** Column count, fixed at every viewport width. Defaults to 3. */
6
+ columns?: 1 | 2 | 3 | 4 | 5 | 6;
7
+ gap?: 'xs' | 'sm' | 'md' | 'lg';
8
+ className?: string;
9
+ }
10
+ /**
11
+ * Grid for `<ListingCard>`s — a fixed `columns`-column grid at every
12
+ * viewport width. Alias for `CardGrid` tuned for listing layouts — same
13
+ * shape, different semantic name so importers can self-document.
14
+ * @param props - Component props (see {@link ListingGridProps}).
15
+ */
16
+ export declare function ListingGrid({ children, columns, gap, className, }: ListingGridProps): JSX.Element;
17
+ //# sourceMappingURL=ListingGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListingGrid.d.ts","sourceRoot":"","sources":["../src/ListingGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAI3C,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,SAAS,CAAA;IACnB,kEAAkE;IAClE,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC/B,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAW,EACX,GAAU,EACV,SAAS,GACV,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAGhC"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ /**
4
+ * Grid for `<ListingCard>`s — a fixed `columns`-column grid at every
5
+ * viewport width. Alias for `CardGrid` tuned for listing layouts — same
6
+ * shape, different semantic name so importers can self-document.
7
+ * @param props - Component props (see {@link ListingGridProps}).
8
+ */
9
+ export function ListingGrid({ children, columns = 3, gap = 'md', className, }) {
10
+ const cm = getClassMap();
11
+ return _jsx("div", { className: cm.cn(cm.grid({ cols: columns, gap }), className), children: children });
12
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * React product / property / listing card primitives.
3
+ *
4
+ * Exports:
5
+ * - `<ListingCard>` — outer Card shell. Props: `children`, `onClick?`,
6
+ * `className?`, `dataMolId?`.
7
+ * - `<ListingCardMedia>` — top image slot. Props: `src?`, `alt?`, `children?`
8
+ * (custom media node), `aspect?` (`'1/1' | '4/3' | '16/9' | '3/2'`, default
9
+ * `'4/3'`, applied as an inline aspect-ratio style), `overlay?` (badge /
10
+ * favorite button, absolutely positioned over the media), `className?`.
11
+ * - `<ListingCardBody>` — stacked text. Props: `title`, `subtitle?`, `price?`,
12
+ * `meta?`, `className?`.
13
+ * - `<ListingCardActions>` — action row. Props: `children`, `layout?`
14
+ * (`'horizontal'` default | `'stacked'`), `className?`.
15
+ * - `<ListingGrid>` — grid container. Props: `children`, `columns?` (1–6, default
16
+ * 3), `gap?`, `className?`.
17
+ *
18
+ * @remarks
19
+ * - `ListingCard.onClick` is attached to the WHOLE card — clicks on buttons inside
20
+ * `<ListingCardActions>` bubble into it. Call `e.stopPropagation()` in every
21
+ * action handler (as in the example) or the card navigation fires too.
22
+ * - `<ListingGrid columns={n}>` renders a responsive n-column grid (via `cm.grid`):
23
+ * 1 column on phones, stepping up to `n` at larger breakpoints, so listings
24
+ * don't overflow on mobile. Override `className` for a fixed grid.
25
+ * - `overlay` children are rendered inside an absolutely-positioned inset-0 layer;
26
+ * give interactive overlays their own pointer handling and stopPropagation.
27
+ * - Styling resolves through `getClassMap()`; the shell uses `<Card>` from
28
+ * `@molecule/app-ui-react` — wire a ClassMap bond first.
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * import { ListingCard, ListingCardMedia, ListingCardBody, ListingCardActions, ListingGrid } from '@molecule/app-listing-card-react'
33
+ *
34
+ * <ListingGrid columns={3}>
35
+ * <ListingCard onClick={() => navigate(`/listings/${item.id}`)}>
36
+ * <ListingCardMedia src={item.imageUrl} aspect="4/3" alt={item.name} />
37
+ * <ListingCardBody title={item.name} subtitle={item.location} price={`$${item.price}/night`} />
38
+ * <ListingCardActions>
39
+ * <button onClick={(e) => { e.stopPropagation(); saveListing(item.id) }}>Save</button>
40
+ * </ListingCardActions>
41
+ * </ListingCard>
42
+ * </ListingGrid>
43
+ * ```
44
+ *
45
+ * @module
46
+ */
47
+ export * from './ListingCard.js';
48
+ export * from './ListingCardActions.js';
49
+ export * from './ListingCardBody.js';
50
+ export * from './ListingCardMedia.js';
51
+ export * from './ListingGrid.js';
52
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ /**
2
+ * React product / property / listing card primitives.
3
+ *
4
+ * Exports:
5
+ * - `<ListingCard>` — outer Card shell. Props: `children`, `onClick?`,
6
+ * `className?`, `dataMolId?`.
7
+ * - `<ListingCardMedia>` — top image slot. Props: `src?`, `alt?`, `children?`
8
+ * (custom media node), `aspect?` (`'1/1' | '4/3' | '16/9' | '3/2'`, default
9
+ * `'4/3'`, applied as an inline aspect-ratio style), `overlay?` (badge /
10
+ * favorite button, absolutely positioned over the media), `className?`.
11
+ * - `<ListingCardBody>` — stacked text. Props: `title`, `subtitle?`, `price?`,
12
+ * `meta?`, `className?`.
13
+ * - `<ListingCardActions>` — action row. Props: `children`, `layout?`
14
+ * (`'horizontal'` default | `'stacked'`), `className?`.
15
+ * - `<ListingGrid>` — grid container. Props: `children`, `columns?` (1–6, default
16
+ * 3), `gap?`, `className?`.
17
+ *
18
+ * @remarks
19
+ * - `ListingCard.onClick` is attached to the WHOLE card — clicks on buttons inside
20
+ * `<ListingCardActions>` bubble into it. Call `e.stopPropagation()` in every
21
+ * action handler (as in the example) or the card navigation fires too.
22
+ * - `<ListingGrid columns={n}>` renders a responsive n-column grid (via `cm.grid`):
23
+ * 1 column on phones, stepping up to `n` at larger breakpoints, so listings
24
+ * don't overflow on mobile. Override `className` for a fixed grid.
25
+ * - `overlay` children are rendered inside an absolutely-positioned inset-0 layer;
26
+ * give interactive overlays their own pointer handling and stopPropagation.
27
+ * - Styling resolves through `getClassMap()`; the shell uses `<Card>` from
28
+ * `@molecule/app-ui-react` — wire a ClassMap bond first.
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * import { ListingCard, ListingCardMedia, ListingCardBody, ListingCardActions, ListingGrid } from '@molecule/app-listing-card-react'
33
+ *
34
+ * <ListingGrid columns={3}>
35
+ * <ListingCard onClick={() => navigate(`/listings/${item.id}`)}>
36
+ * <ListingCardMedia src={item.imageUrl} aspect="4/3" alt={item.name} />
37
+ * <ListingCardBody title={item.name} subtitle={item.location} price={`$${item.price}/night`} />
38
+ * <ListingCardActions>
39
+ * <button onClick={(e) => { e.stopPropagation(); saveListing(item.id) }}>Save</button>
40
+ * </ListingCardActions>
41
+ * </ListingCard>
42
+ * </ListingGrid>
43
+ * ```
44
+ *
45
+ * @module
46
+ */
47
+ export * from './ListingCard.js';
48
+ export * from './ListingCardActions.js';
49
+ export * from './ListingCardBody.js';
50
+ export * from './ListingCardMedia.js';
51
+ export * from './ListingGrid.js';
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@molecule/app-listing-card-react",
3
+ "version": "1.0.0",
4
+ "description": "React listing/product-card primitives with media, body, actions slots",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "test": "vitest run",
11
+ "test:watch": "vitest"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "keywords": [
23
+ "molecule",
24
+ "listing-card",
25
+ "react"
26
+ ],
27
+ "license": "Apache-2.0",
28
+ "peerDependencies": {
29
+ "@molecule/app-react": "^1.0.0",
30
+ "@molecule/app-ui": "^1.0.0",
31
+ "@molecule/app-ui-react": "^1.0.0",
32
+ "react": "^18.0.0 || ^19.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@molecule/app-react": "1.0.0",
36
+ "@molecule/app-ui": "1.0.0",
37
+ "@molecule/app-ui-react": "1.0.0",
38
+ "@types/node": "26.1.2",
39
+ "@types/react": "19.2.17",
40
+ "@types/react-dom": "19.2.3",
41
+ "react": "19.2.8",
42
+ "react-dom": "19.2.8",
43
+ "typescript": "6.0.3",
44
+ "vitest": "4.1.10"
45
+ }
46
+ }