@danielcruzcode/ui-core 0.1.6 → 0.1.8
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/dist/JumboProvider/JumboProvider.d.ts +6 -0
- package/dist/JumboProvider/JumboProvider.d.ts.map +1 -0
- package/dist/JumboProvider/JumboProvider.js +37 -0
- package/dist/JumboProvider/JumboProvider.js.map +1 -0
- package/dist/JumboProvider/index.d.ts +3 -0
- package/dist/JumboProvider/index.d.ts.map +1 -0
- package/dist/JumboProvider/index.js +2 -0
- package/dist/JumboProvider/index.js.map +1 -0
- package/dist/commerce/ProductCard/ProductCard.d.ts +4 -5
- package/dist/commerce/ProductCard/ProductCard.d.ts.map +1 -1
- package/dist/commerce/ProductCard/ProductCard.js +42 -0
- package/dist/commerce/ProductCard/ProductCard.js.map +1 -0
- package/dist/commerce/ProductCard/ProductCard.styles.d.ts +106 -0
- package/dist/commerce/ProductCard/ProductCard.styles.d.ts.map +1 -0
- package/dist/commerce/ProductCard/ProductCard.styles.js +212 -0
- package/dist/commerce/ProductCard/ProductCard.styles.js.map +1 -0
- package/dist/commerce/ProductCard/index.js +2 -0
- package/dist/commerce/ProductCard/index.js.map +1 -0
- package/dist/commerce/ProductShelf/ProductShelf.d.ts +6 -3
- package/dist/commerce/ProductShelf/ProductShelf.d.ts.map +1 -1
- package/dist/commerce/ProductShelf/ProductShelf.js +20 -0
- package/dist/commerce/ProductShelf/ProductShelf.js.map +1 -0
- package/dist/commerce/ProductShelf/index.js +2 -0
- package/dist/commerce/ProductShelf/index.js.map +1 -0
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.d.ts.map +1 -1
- package/dist/components/Card/Card.js +33 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Carousel/Carousel.d.ts +7 -3
- package/dist/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.js +24 -9
- package/dist/components/Carousel/Carousel.js.map +1 -1
- package/dist/components/Carousel/index.js +2 -0
- package/dist/components/Carousel/index.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs10.js +1 -1
- package/dist/index.cjs11.js +1 -1
- package/dist/index.cjs12.js +1 -5
- package/dist/index.cjs13.js +1 -6
- package/dist/index.cjs14.js +1 -1
- package/dist/index.cjs15.js +1 -1
- package/dist/index.cjs16.js +1 -1
- package/dist/index.cjs17.js +26 -1
- package/dist/index.cjs18.js +1 -1
- package/dist/index.cjs19.js +1 -0
- package/dist/index.cjs2.js +1 -19
- package/dist/index.cjs20.js +1 -0
- package/dist/index.cjs21.js +1 -0
- package/dist/index.cjs22.js +1 -0
- package/dist/index.cjs23.js +1 -0
- package/dist/index.cjs24.js +1 -0
- package/dist/index.cjs25.js +1 -0
- package/dist/index.cjs26.js +1 -0
- package/dist/index.cjs27.js +1 -0
- package/dist/index.cjs28.js +1 -0
- package/dist/index.cjs29.js +1 -0
- package/dist/index.cjs3.js +1 -12
- package/dist/index.cjs4.js +1 -17
- package/dist/index.cjs5.js +1 -17
- package/dist/index.cjs6.js +1 -8
- package/dist/index.cjs7.js +1 -12
- package/dist/index.cjs8.js +1 -8
- package/dist/index.cjs9.js +1 -18
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +18 -16
- package/dist/index.esm10.js +101 -61
- package/dist/index.esm11.js +57 -24
- package/dist/index.esm12.js +11 -11
- package/dist/index.esm13.js +27 -12
- package/dist/index.esm14.js +26 -45
- package/dist/index.esm15.js +75 -22
- package/dist/index.esm16.js +45 -33
- package/dist/index.esm17.js +167 -1202
- package/dist/index.esm18.js +22 -50
- package/dist/index.esm19.js +12 -0
- package/dist/index.esm2.js +47 -37
- package/dist/index.esm20.js +130 -0
- package/dist/index.esm21.js +7 -0
- package/dist/index.esm22.js +34 -0
- package/dist/index.esm23.js +10 -0
- package/dist/index.esm24.js +22 -0
- package/dist/index.esm25.js +53 -0
- package/dist/index.esm26.js +9 -0
- package/dist/index.esm27.js +52 -0
- package/dist/index.esm28.js +35 -0
- package/dist/index.esm29.js +1204 -0
- package/dist/index.esm3.js +31 -26
- package/dist/index.esm4.js +27 -27
- package/dist/index.esm5.js +84 -34
- package/dist/index.esm6.js +72 -23
- package/dist/index.esm7.js +62 -27
- package/dist/index.esm8.js +68 -34
- package/dist/index.esm9.js +114 -84
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/layout/Container/Container.js +14 -0
- package/dist/layout/Container/Container.js.map +1 -0
- package/dist/layout/Stack/Stack.js +13 -0
- package/dist/layout/Stack/Stack.js.map +1 -0
- package/dist/primitives/Badge/Badge.d.ts +3 -2
- package/dist/primitives/Badge/Badge.d.ts.map +1 -1
- package/dist/primitives/Badge/Badge.js +31 -0
- package/dist/primitives/Badge/Badge.js.map +1 -0
- package/dist/primitives/Badge/index.js +2 -0
- package/dist/primitives/Badge/index.js.map +1 -0
- package/dist/primitives/Button/Button.js +37 -0
- package/dist/primitives/Button/Button.js.map +1 -0
- package/dist/primitives/Checkbox/Checkbox.js +28 -0
- package/dist/primitives/Checkbox/Checkbox.js.map +1 -0
- package/dist/primitives/Input/Input.js +36 -0
- package/dist/primitives/Input/Input.js.map +1 -0
- package/dist/primitives/Select/Select.js +24 -0
- package/dist/primitives/Select/Select.js.map +1 -0
- package/dist/primitives/Tag/Tag.js +29 -0
- package/dist/primitives/Tag/Tag.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JumboProvider.d.ts","sourceRoot":"","sources":["../../src/JumboProvider/JumboProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAuC7D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tokens } from '@danielcruzcode/design-tokens';
|
|
3
|
+
import { Global, css } from '@emotion/react';
|
|
4
|
+
export function JumboProvider({ children }) {
|
|
5
|
+
return (_jsxs(_Fragment, { children: [_jsx(Global, { styles: css `
|
|
6
|
+
*, *::before, *::after {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: 0;
|
|
10
|
+
}
|
|
11
|
+
body {
|
|
12
|
+
font-family: ${tokens.font.body};
|
|
13
|
+
color: ${tokens.color.text};
|
|
14
|
+
background: ${tokens.color.surface};
|
|
15
|
+
-webkit-font-smoothing: antialiased;
|
|
16
|
+
-moz-osx-font-smoothing: grayscale;
|
|
17
|
+
}
|
|
18
|
+
img, video {
|
|
19
|
+
display: block;
|
|
20
|
+
max-width: 100%;
|
|
21
|
+
}
|
|
22
|
+
button {
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
border: none;
|
|
25
|
+
background: none;
|
|
26
|
+
font: inherit;
|
|
27
|
+
}
|
|
28
|
+
a {
|
|
29
|
+
color: inherit;
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
}
|
|
32
|
+
ul, ol {
|
|
33
|
+
list-style: none;
|
|
34
|
+
}
|
|
35
|
+
` }), children] }));
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=JumboProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JumboProvider.js","sourceRoot":"","sources":["../../src/JumboProvider/JumboProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAO7C,MAAM,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAsB;IAC5D,OAAO,CACL,8BACE,KAAC,MAAM,IACL,MAAM,EAAE,GAAG,CAAA;;;;;;;2BAOQ,MAAM,CAAC,IAAI,CAAC,IAAI;qBACtB,MAAM,CAAC,KAAK,CAAC,IAAI;0BACZ,MAAM,CAAC,KAAK,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;SAqBrC,GACD,EACD,QAAQ,IACR,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/JumboProvider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/JumboProvider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { type FlagVariant } from './ProductCard.styles';
|
|
2
|
+
export type { FlagVariant };
|
|
1
3
|
export interface ProductImage {
|
|
2
4
|
src: string;
|
|
3
5
|
alt: string;
|
|
4
6
|
}
|
|
5
7
|
export interface ProductCardProps {
|
|
8
|
+
promotionalFlag?: FlagVariant;
|
|
6
9
|
id: string;
|
|
7
10
|
title: string;
|
|
8
11
|
subtitle?: string;
|
|
@@ -10,9 +13,7 @@ export interface ProductCardProps {
|
|
|
10
13
|
price: number;
|
|
11
14
|
originalPrice?: number;
|
|
12
15
|
discountPercent?: number;
|
|
13
|
-
badge?: string;
|
|
14
16
|
rating?: number;
|
|
15
|
-
reviewCount?: number;
|
|
16
17
|
installments?: {
|
|
17
18
|
count: number;
|
|
18
19
|
value: number;
|
|
@@ -20,11 +21,9 @@ export interface ProductCardProps {
|
|
|
20
21
|
unavailable?: boolean;
|
|
21
22
|
loading?: boolean;
|
|
22
23
|
onAddToCart?: (id: string) => void;
|
|
23
|
-
onWishlist?: (id: string) => void;
|
|
24
|
-
onQuickView?: (id: string) => void;
|
|
25
24
|
onClick?: (id: string) => void;
|
|
26
25
|
formatPrice?: (value: number) => string;
|
|
27
26
|
className?: string;
|
|
28
27
|
}
|
|
29
|
-
export declare function ProductCard({ id, title, subtitle, images, price, originalPrice, discountPercent,
|
|
28
|
+
export declare function ProductCard({ id, title, subtitle, images, price, originalPrice, discountPercent, rating, installments: installmentsData, unavailable, loading, onAddToCart, onClick, formatPrice, className, promotionalFlag, }: ProductCardProps): import("react/jsx-runtime").JSX.Element;
|
|
30
29
|
//# sourceMappingURL=ProductCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCard.d.ts","sourceRoot":"","sources":["../../../src/commerce/ProductCard/ProductCard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProductCard.d.ts","sourceRoot":"","sources":["../../../src/commerce/ProductCard/ProductCard.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,WAAW,EAcjB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA8DD,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,KAAK,EACL,QAAQ,EACR,MAAM,EACN,KAAK,EACL,aAAa,EACb,eAAe,EACf,MAAM,EACN,YAAY,EAAE,gBAAgB,EAC9B,WAAmB,EACnB,OAAe,EACf,WAAW,EACX,OAAO,EACP,WAAW,EACX,SAAS,EACT,eAAe,GAChB,EAAE,gBAAgB,2CA+ElB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Card } from '../../components/Card';
|
|
3
|
+
import { Badge } from '../../primitives/Badge';
|
|
4
|
+
import { Button } from '../../primitives/Button';
|
|
5
|
+
import { Body, Flag, Footer, ImageWrapper, Img, Installments, OriginalPrice, Price, ProductTitle, Root, SkeletonBtn, SkeletonImage, SkeletonLine, StarsWrapper, Subtitle, } from './ProductCard.styles';
|
|
6
|
+
const flagLabels = {
|
|
7
|
+
'jumbo-pesos': 'Jumbo Pesos',
|
|
8
|
+
'black-days': 'Black Days',
|
|
9
|
+
'hot-sale': 'Hot Sale',
|
|
10
|
+
'without-stock': 'Agotado',
|
|
11
|
+
};
|
|
12
|
+
function Stars({ rating }) {
|
|
13
|
+
return (_jsx(StarsWrapper, { "aria-hidden": "true", children: Array.from({ length: 5 }).map((_, i) => (_jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: i < Math.round(rating) ? '#F9AB00' : 'none', stroke: "#F9AB00", strokeWidth: "1", "aria-hidden": "true", children: _jsx("path", { d: "M6 1l1.39 2.82L10.5 4.27l-2.25 2.19.53 3.09L6 8l-2.78 1.55.53-3.09L1.5 4.27l3.11-.45L6 1z" }) }, i))) }));
|
|
14
|
+
}
|
|
15
|
+
function ProductCardSkeleton() {
|
|
16
|
+
return (_jsxs("article", { "aria-label": "Cargando producto", style: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexDirection: 'column',
|
|
19
|
+
justifyContent: 'space-between',
|
|
20
|
+
height: '528px',
|
|
21
|
+
boxSizing: 'border-box',
|
|
22
|
+
paddingBottom: '8px',
|
|
23
|
+
}, "aria-busy": "true", children: [_jsxs("div", { children: [_jsx(SkeletonLine, { style: { width: '80%', height: '1rem', margin: '8px auto 8px' } }), _jsx(SkeletonImage, {}), _jsxs("div", { style: { padding: '8px', display: 'flex', flexDirection: 'column', gap: '8px' }, children: [_jsx(SkeletonLine, { style: { width: '70%' } }), _jsx(SkeletonLine, { style: { width: '100%' } }), _jsx(SkeletonLine, { style: { width: '70%' } }), _jsx(SkeletonLine, { style: { width: '50%' } })] })] }), _jsxs("div", { children: [_jsx(SkeletonBtn, {}), _jsx(SkeletonLine, { style: { width: '70%', marginTop: '8px' } })] })] }));
|
|
24
|
+
}
|
|
25
|
+
export function ProductCard({ id, title, subtitle, images, price, originalPrice, discountPercent, rating, installments: installmentsData, unavailable = false, loading = false, onAddToCart, onClick, formatPrice, className, promotionalFlag, }) {
|
|
26
|
+
if (loading)
|
|
27
|
+
return _jsx(ProductCardSkeleton, {});
|
|
28
|
+
const displayPrice = formatPrice ? formatPrice(price) : String(price);
|
|
29
|
+
const displayOriginal = originalPrice
|
|
30
|
+
? formatPrice
|
|
31
|
+
? formatPrice(originalPrice)
|
|
32
|
+
: String(originalPrice)
|
|
33
|
+
: undefined;
|
|
34
|
+
const firstImage = images[0];
|
|
35
|
+
const media = (_jsxs(_Fragment, { children: [_jsx(Flag, { variant: promotionalFlag, children: promotionalFlag ? flagLabels[promotionalFlag] : '\u00A0' }), _jsx(ImageWrapper, { unavailable: unavailable, children: firstImage && (_jsx(Img, { src: firstImage.src, alt: firstImage.alt, width: 100, height: 100, loading: "lazy" })) })] }));
|
|
36
|
+
const bodyContent = (_jsxs(Body, { children: [_jsx(Subtitle, { style: { visibility: subtitle ? 'visible' : 'hidden' }, children: subtitle ?? '\u00A0' }), _jsx(ProductTitle, { children: title }), _jsx(Badge, { visible: Boolean(discountPercent), variant: "warning", size: "sm", children: discountPercent ? `-${discountPercent}%` : '\u00A0' }), _jsx(Price, { children: displayPrice }), _jsx(OriginalPrice, { style: { visibility: displayOriginal ? 'visible' : 'hidden' }, children: displayOriginal ?? '\u00A0' }), _jsx(Installments, { style: { visibility: installmentsData ? 'visible' : 'hidden' }, children: installmentsData
|
|
37
|
+
? `${installmentsData.count}x ${formatPrice ? formatPrice(installmentsData.value) : installmentsData.value}`
|
|
38
|
+
: '\u00A0' })] }));
|
|
39
|
+
const footerContent = (_jsxs(Footer, { children: [onAddToCart && (_jsx(Button, { variant: "primary", size: "sm", fullWidth: true, disabled: unavailable, onClick: () => onAddToCart(id), children: "Agregar" })), _jsx(StarsWrapper, { style: { visibility: rating !== undefined ? 'visible' : 'hidden' }, "aria-label": rating !== undefined ? `${rating} de 5 estrellas` : undefined, role: 'img', children: _jsx(Stars, { rating: rating ?? 0 }) })] }));
|
|
40
|
+
return (_jsx(Root, { className: className, children: _jsx(Card, { media: media, body: bodyContent, footer: footerContent, hoverable: Boolean(onClick), onClick: onClick ? () => onClick(id) : undefined }) }));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=ProductCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductCard.js","sourceRoot":"","sources":["../../../src/commerce/ProductCard/ProductCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC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
5
|
+
toString: () => string;
|
|
6
|
+
} & string;
|
|
7
|
+
export declare const Root: import("@emotion/styled").StyledComponent<{
|
|
8
|
+
theme?: import("@emotion/react").Theme;
|
|
9
|
+
as?: React.ElementType;
|
|
10
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
11
|
+
export declare const ImageWrapper: import("@emotion/styled").StyledComponent<{
|
|
12
|
+
theme?: import("@emotion/react").Theme;
|
|
13
|
+
as?: React.ElementType;
|
|
14
|
+
} & {
|
|
15
|
+
unavailable?: boolean;
|
|
16
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
17
|
+
export declare const Img: import("@emotion/styled").StyledComponent<{
|
|
18
|
+
theme?: import("@emotion/react").Theme;
|
|
19
|
+
as?: React.ElementType;
|
|
20
|
+
}, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
21
|
+
export type FlagVariant = 'jumbo-pesos' | 'black-days' | 'hot-sale' | 'without-stock';
|
|
22
|
+
export declare const Flag: import("@emotion/styled").StyledComponent<{
|
|
23
|
+
theme?: import("@emotion/react").Theme;
|
|
24
|
+
as?: React.ElementType;
|
|
25
|
+
} & {
|
|
26
|
+
variant?: FlagVariant;
|
|
27
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
28
|
+
export declare const BadgeOverlay: import("@emotion/styled").StyledComponent<{
|
|
29
|
+
theme?: import("@emotion/react").Theme;
|
|
30
|
+
as?: React.ElementType;
|
|
31
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
32
|
+
export declare const WishlistBtn: import("@emotion/styled").StyledComponent<{
|
|
33
|
+
theme?: import("@emotion/react").Theme;
|
|
34
|
+
as?: React.ElementType;
|
|
35
|
+
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
36
|
+
export declare const UnavailableOverlay: import("@emotion/styled").StyledComponent<{
|
|
37
|
+
theme?: import("@emotion/react").Theme;
|
|
38
|
+
as?: React.ElementType;
|
|
39
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
40
|
+
export declare const UnavailableText: import("@emotion/styled").StyledComponent<{
|
|
41
|
+
theme?: import("@emotion/react").Theme;
|
|
42
|
+
as?: React.ElementType;
|
|
43
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
44
|
+
export declare const Body: import("@emotion/styled").StyledComponent<{
|
|
45
|
+
theme?: import("@emotion/react").Theme;
|
|
46
|
+
as?: React.ElementType;
|
|
47
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
48
|
+
export declare const ProductTitle: import("@emotion/styled").StyledComponent<{
|
|
49
|
+
theme?: import("@emotion/react").Theme;
|
|
50
|
+
as?: React.ElementType;
|
|
51
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
52
|
+
export declare const Subtitle: import("@emotion/styled").StyledComponent<{
|
|
53
|
+
theme?: import("@emotion/react").Theme;
|
|
54
|
+
as?: React.ElementType;
|
|
55
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
56
|
+
export declare const StarsWrapper: import("@emotion/styled").StyledComponent<{
|
|
57
|
+
theme?: import("@emotion/react").Theme;
|
|
58
|
+
as?: React.ElementType;
|
|
59
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
60
|
+
export declare const ReviewCount: import("@emotion/styled").StyledComponent<{
|
|
61
|
+
theme?: import("@emotion/react").Theme;
|
|
62
|
+
as?: React.ElementType;
|
|
63
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
64
|
+
export declare const PriceWrapper: import("@emotion/styled").StyledComponent<{
|
|
65
|
+
theme?: import("@emotion/react").Theme;
|
|
66
|
+
as?: React.ElementType;
|
|
67
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
68
|
+
export declare const Price: import("@emotion/styled").StyledComponent<{
|
|
69
|
+
theme?: import("@emotion/react").Theme;
|
|
70
|
+
as?: React.ElementType;
|
|
71
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
72
|
+
export declare const OriginalPrice: import("@emotion/styled").StyledComponent<{
|
|
73
|
+
theme?: import("@emotion/react").Theme;
|
|
74
|
+
as?: React.ElementType;
|
|
75
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
76
|
+
export declare const Installments: import("@emotion/styled").StyledComponent<{
|
|
77
|
+
theme?: import("@emotion/react").Theme;
|
|
78
|
+
as?: React.ElementType;
|
|
79
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
80
|
+
export declare const Footer: import("@emotion/styled").StyledComponent<{
|
|
81
|
+
theme?: import("@emotion/react").Theme;
|
|
82
|
+
as?: React.ElementType;
|
|
83
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
84
|
+
export declare const SkeletonBase: import("@emotion/styled").StyledComponent<{
|
|
85
|
+
theme?: import("@emotion/react").Theme;
|
|
86
|
+
as?: React.ElementType;
|
|
87
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
88
|
+
export declare const SkeletonImage: import("@emotion/styled").StyledComponent<{
|
|
89
|
+
theme?: import("@emotion/react").Theme;
|
|
90
|
+
as?: React.ElementType;
|
|
91
|
+
} & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
92
|
+
theme?: import("@emotion/react").Theme;
|
|
93
|
+
}, {}, {}>;
|
|
94
|
+
export declare const SkeletonLine: import("@emotion/styled").StyledComponent<{
|
|
95
|
+
theme?: import("@emotion/react").Theme;
|
|
96
|
+
as?: React.ElementType;
|
|
97
|
+
} & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
98
|
+
theme?: import("@emotion/react").Theme;
|
|
99
|
+
}, {}, {}>;
|
|
100
|
+
export declare const SkeletonBtn: import("@emotion/styled").StyledComponent<{
|
|
101
|
+
theme?: import("@emotion/react").Theme;
|
|
102
|
+
as?: React.ElementType;
|
|
103
|
+
} & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
104
|
+
theme?: import("@emotion/react").Theme;
|
|
105
|
+
}, {}, {}>;
|
|
106
|
+
//# sourceMappingURL=ProductCard.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductCard.styles.d.ts","sourceRoot":"","sources":["../../../src/commerce/ProductCard/ProductCard.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO;;;;;UAGnB,CAAC;AAEF,eAAO,MAAM,IAAI;;;yGAIhB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;kBAA8B,OAAO;yGAQ7D,CAAC;AAEF,eAAO,MAAM,GAAG;;;gHAUf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,YAAY,GAAG,UAAU,GAAG,eAAe,CAAC;AA0BtF,eAAO,MAAM,IAAI;;;;cAA0B,WAAW;yGAcrD,CAAC;AAEF,eAAO,MAAM,YAAY;;;yGAOxB,CAAC;AAEF,eAAO,MAAM,WAAW;;;qHAuBvB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;yGAO9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;2GAK3B,CAAC;AAEF,eAAO,MAAM,IAAI;;;yGAMhB,CAAC;AAEF,eAAO,MAAM,YAAY;;;qHAYxB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;qHAKpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;yGAKxB,CAAC;AAEF,eAAO,MAAM,WAAW;;;2GAIvB,CAAC;AAEF,eAAO,MAAM,YAAY;;;yGAMxB,CAAC;AAEF,eAAO,MAAM,KAAK;;;2GAOjB,CAAC;AAEF,eAAO,MAAM,aAAa;;;2GAQzB,CAAC;AAEF,eAAO,MAAM,YAAY;;;2GAIxB,CAAC;AAEF,eAAO,MAAM,MAAM;;;yGAIlB,CAAC;AAEF,eAAO,MAAM,YAAY;;;yGAUxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;UAIzB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;UAGxB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;UAGvB,CAAC"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { tokens } from '@danielcruzcode/design-tokens';
|
|
2
|
+
import { keyframes } from '@emotion/react';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
export const shimmer = keyframes `
|
|
5
|
+
0% { background-position: -200% 0 }
|
|
6
|
+
100% { background-position: 200% 0 }
|
|
7
|
+
`;
|
|
8
|
+
export const Root = styled.div `
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
height: 100%;
|
|
12
|
+
`;
|
|
13
|
+
export const ImageWrapper = styled.div `
|
|
14
|
+
position: relative;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
width: 100%;
|
|
19
|
+
margin-top: ${tokens.space.sm};
|
|
20
|
+
${({ unavailable }) => unavailable && 'opacity: 0.5;'}
|
|
21
|
+
`;
|
|
22
|
+
export const Img = styled.img `
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
max-width: 156px;
|
|
26
|
+
max-height: 144px;
|
|
27
|
+
object-fit: cover;
|
|
28
|
+
transition: transform ${tokens.transition.normal};
|
|
29
|
+
${ImageWrapper}:hover & {
|
|
30
|
+
transform: scale(1.04);
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
const flagVariantStyles = {
|
|
34
|
+
'jumbo-pesos': `
|
|
35
|
+
background-color: ${tokens.color.brand};
|
|
36
|
+
color: #ffffff;
|
|
37
|
+
`,
|
|
38
|
+
'black-days': `
|
|
39
|
+
background-color: #111111;
|
|
40
|
+
color: #ffffff;
|
|
41
|
+
`,
|
|
42
|
+
'hot-sale': `
|
|
43
|
+
background-color: #e53935;
|
|
44
|
+
color: #ffffff;
|
|
45
|
+
`,
|
|
46
|
+
'without-stock': `
|
|
47
|
+
background-color: #EBECF0;
|
|
48
|
+
color: #0B0C0E;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
font-size: 14px;
|
|
51
|
+
line-height: 16px;
|
|
52
|
+
letter-spacing: -0.4px;
|
|
53
|
+
text-align: center;
|
|
54
|
+
`,
|
|
55
|
+
};
|
|
56
|
+
export const Flag = styled.div `
|
|
57
|
+
width: 156px;
|
|
58
|
+
max-width: 156px;
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
padding: 2px 8px;
|
|
63
|
+
border-radius: ${tokens.radius.sm};
|
|
64
|
+
font-family: ${tokens.font.body};
|
|
65
|
+
font-size: 11px;
|
|
66
|
+
margin: ${tokens.space.sm} auto 0;
|
|
67
|
+
font-weight: 600;
|
|
68
|
+
letter-spacing: 0.04em;
|
|
69
|
+
${({ variant }) => variant && flagVariantStyles[variant]}
|
|
70
|
+
`;
|
|
71
|
+
export const BadgeOverlay = styled.div `
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: ${tokens.space.sm};
|
|
74
|
+
left: ${tokens.space.sm};
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
gap: 4px;
|
|
78
|
+
`;
|
|
79
|
+
export const WishlistBtn = styled.button `
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: ${tokens.space.sm};
|
|
82
|
+
right: ${tokens.space.sm};
|
|
83
|
+
width: 32px;
|
|
84
|
+
height: 32px;
|
|
85
|
+
border-radius: ${tokens.radius.full};
|
|
86
|
+
border: 1px solid ${tokens.color.border};
|
|
87
|
+
background-color: ${tokens.color.background};
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
color: ${tokens.color.textMuted};
|
|
93
|
+
transition: color ${tokens.transition.fast}, border-color ${tokens.transition.fast};
|
|
94
|
+
&:hover {
|
|
95
|
+
color: ${tokens.color.danger};
|
|
96
|
+
border-color: ${tokens.color.danger};
|
|
97
|
+
}
|
|
98
|
+
&:focus-visible {
|
|
99
|
+
outline: 2px solid ${tokens.color.borderFocus};
|
|
100
|
+
outline-offset: 2px;
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
export const UnavailableOverlay = styled.div `
|
|
104
|
+
position: absolute;
|
|
105
|
+
inset: 0;
|
|
106
|
+
background-color: rgba(255, 255, 255, 0.7);
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
`;
|
|
111
|
+
export const UnavailableText = styled.span `
|
|
112
|
+
font-family: ${tokens.font.body};
|
|
113
|
+
font-size: 13px;
|
|
114
|
+
font-weight: 600;
|
|
115
|
+
color: ${tokens.color.textMuted};
|
|
116
|
+
`;
|
|
117
|
+
export const Body = styled.div `
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-direction: column;
|
|
120
|
+
gap: 4px;
|
|
121
|
+
padding: ${tokens.space.sm};
|
|
122
|
+
flex: 1;
|
|
123
|
+
`;
|
|
124
|
+
export const ProductTitle = styled.p `
|
|
125
|
+
font-family: ${tokens.font.body};
|
|
126
|
+
font-size: 14px;
|
|
127
|
+
font-weight: 500;
|
|
128
|
+
color: ${tokens.color.text};
|
|
129
|
+
display: -webkit-box;
|
|
130
|
+
-webkit-line-clamp: 2;
|
|
131
|
+
-webkit-box-orient: vertical;
|
|
132
|
+
overflow: hidden;
|
|
133
|
+
line-height: 1.4;
|
|
134
|
+
margin: 0;
|
|
135
|
+
height: 2.5rem;
|
|
136
|
+
`;
|
|
137
|
+
export const Subtitle = styled.p `
|
|
138
|
+
font-family: ${tokens.font.body};
|
|
139
|
+
font-size: 12px;
|
|
140
|
+
color: ${tokens.color.textMuted};
|
|
141
|
+
margin: 0;
|
|
142
|
+
`;
|
|
143
|
+
export const StarsWrapper = styled.div `
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
gap: 4px;
|
|
147
|
+
height: 1rem;
|
|
148
|
+
`;
|
|
149
|
+
export const ReviewCount = styled.span `
|
|
150
|
+
font-family: ${tokens.font.body};
|
|
151
|
+
font-size: 12px;
|
|
152
|
+
color: ${tokens.color.textMuted};
|
|
153
|
+
`;
|
|
154
|
+
export const PriceWrapper = styled.div `
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: baseline;
|
|
157
|
+
gap: ${tokens.space.sm};
|
|
158
|
+
flex-wrap: wrap;
|
|
159
|
+
margin-top: auto;
|
|
160
|
+
`;
|
|
161
|
+
export const Price = styled.span `
|
|
162
|
+
font-family: ${tokens.font.body};
|
|
163
|
+
color: ${tokens.color.brand};
|
|
164
|
+
font-weight: 600;
|
|
165
|
+
font-size: 16px;
|
|
166
|
+
line-height: 20px;
|
|
167
|
+
letter-spacing: 0px;
|
|
168
|
+
`;
|
|
169
|
+
export const OriginalPrice = styled.span `
|
|
170
|
+
font-family: ${tokens.font.body};
|
|
171
|
+
color: ${tokens.color.textMuted};
|
|
172
|
+
text-decoration: line-through;
|
|
173
|
+
font-weight: 600;
|
|
174
|
+
font-size: 12px;
|
|
175
|
+
line-height: 14px;
|
|
176
|
+
letter-spacing: 0px;
|
|
177
|
+
`;
|
|
178
|
+
export const Installments = styled.span `
|
|
179
|
+
font-family: ${tokens.font.body};
|
|
180
|
+
font-size: 12px;
|
|
181
|
+
color: ${tokens.color.textMuted};
|
|
182
|
+
`;
|
|
183
|
+
export const Footer = styled.div `
|
|
184
|
+
display: flex;
|
|
185
|
+
flex-direction: column;
|
|
186
|
+
gap: ${tokens.space.sm};
|
|
187
|
+
`;
|
|
188
|
+
export const SkeletonBase = styled.div `
|
|
189
|
+
border-radius: ${tokens.radius.md};
|
|
190
|
+
background: linear-gradient(
|
|
191
|
+
90deg,
|
|
192
|
+
${tokens.color.surface} 25%,
|
|
193
|
+
${tokens.color.surfaceHover} 50%,
|
|
194
|
+
${tokens.color.surface} 75%
|
|
195
|
+
);
|
|
196
|
+
background-size: 200% 100%;
|
|
197
|
+
animation: ${shimmer} 1.5s ease-in-out infinite;
|
|
198
|
+
`;
|
|
199
|
+
export const SkeletonImage = styled(SkeletonBase) `
|
|
200
|
+
width: 156px;
|
|
201
|
+
height: 144px;
|
|
202
|
+
margin: 8px auto;
|
|
203
|
+
`;
|
|
204
|
+
export const SkeletonLine = styled(SkeletonBase) `
|
|
205
|
+
height: 14px;
|
|
206
|
+
border-radius: ${tokens.radius.sm};
|
|
207
|
+
`;
|
|
208
|
+
export const SkeletonBtn = styled(SkeletonBase) `
|
|
209
|
+
height: 40px;
|
|
210
|
+
border-radius: ${tokens.radius.md};
|
|
211
|
+
`;
|
|
212
|
+
//# sourceMappingURL=ProductCard.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductCard.styles.js","sourceRoot":"","sources":["../../../src/commerce/ProductCard/ProductCard.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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EF,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;;mBAE5B,MAAM,CAAC,MAAM,CAAC,EAAE;CAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commerce/ProductCard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { ProductCardProps } from '../ProductCard';
|
|
1
|
+
import { type ProductCardProps } from '../ProductCard';
|
|
2
2
|
type SlidesPerView = number | {
|
|
3
3
|
mobile: number;
|
|
4
4
|
tablet: number;
|
|
5
|
+
wide?: number;
|
|
5
6
|
desktop: number;
|
|
7
|
+
} | {
|
|
8
|
+
min: number;
|
|
9
|
+
max?: number;
|
|
6
10
|
};
|
|
7
11
|
export interface ProductShelfProps {
|
|
8
12
|
products: ProductCardProps[];
|
|
@@ -11,12 +15,11 @@ export interface ProductShelfProps {
|
|
|
11
15
|
autoplayMs?: number;
|
|
12
16
|
slidesPerView?: SlidesPerView;
|
|
13
17
|
onAddToCart?: (id: string) => void;
|
|
14
|
-
onWishlist?: (id: string) => void;
|
|
15
18
|
onProductClick?: (id: string) => void;
|
|
16
19
|
formatPrice?: (value: number) => string;
|
|
17
20
|
loading?: boolean;
|
|
18
21
|
skeletonCount?: number;
|
|
19
22
|
}
|
|
20
|
-
export declare function ProductShelf({ products, title, autoplay, autoplayMs, slidesPerView, onAddToCart,
|
|
23
|
+
export declare function ProductShelf({ products, title, autoplay, autoplayMs, slidesPerView, onAddToCart, onProductClick, formatPrice, loading, skeletonCount, }: ProductShelfProps): import("react/jsx-runtime").JSX.Element;
|
|
21
24
|
export {};
|
|
22
25
|
//# sourceMappingURL=ProductShelf.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductShelf.d.ts","sourceRoot":"","sources":["../../../src/commerce/ProductShelf/ProductShelf.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"ProductShelf.d.ts","sourceRoot":"","sources":["../../../src/commerce/ProductShelf/ProductShelf.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEpE,KAAK,aAAa,GACd,MAAM,GACN;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAKD,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,KAAK,EACL,QAAgB,EAChB,UAAiB,EACjB,aAAoD,EACpD,WAAW,EACX,cAAc,EACd,WAAW,EACX,OAAe,EACf,aAAiB,GAClB,EAAE,iBAAiB,2CAkCnB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tokens } from '@danielcruzcode/design-tokens';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import { Carousel } from '../../components/Carousel';
|
|
5
|
+
import { ProductCard } from '../ProductCard';
|
|
6
|
+
const Root = styled.section `display:flex;flex-direction:column;gap:${tokens.space.md};`;
|
|
7
|
+
const Heading = styled.h2 `font-family:${tokens.font.display};font-size:24px;color:${tokens.color.text};margin:0;letter-spacing:0.02em;`;
|
|
8
|
+
export function ProductShelf({ products, title, autoplay = false, autoplayMs = 4000, slidesPerView = { mobile: 1, tablet: 2, desktop: 4 }, onAddToCart, onProductClick, formatPrice, loading = false, skeletonCount = 4, }) {
|
|
9
|
+
const items = loading
|
|
10
|
+
? Array.from({ length: skeletonCount }).map((_, i) => ({
|
|
11
|
+
id: `skeleton-${i}`,
|
|
12
|
+
title: '',
|
|
13
|
+
images: [],
|
|
14
|
+
price: 0,
|
|
15
|
+
loading: true,
|
|
16
|
+
}))
|
|
17
|
+
: products;
|
|
18
|
+
return (_jsxs(Root, { "aria-label": title ?? 'Productos', children: [title && _jsx(Heading, { children: title }), _jsx(Carousel, { autoplay: autoplay, autoplayMs: autoplayMs, slidesPerView: slidesPerView, gap: "md", showArrows: true, showDots: true, loop: true, children: items.map((product) => (_jsx(ProductCard, { ...product, onAddToCart: onAddToCart, onClick: onProductClick, formatPrice: formatPrice }, product.id))) })] }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ProductShelf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductShelf.js","sourceRoot":"","sources":["../../../src/commerce/ProductShelf/ProductShelf.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,WAAW,EAAyB,MAAM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AEN,OAAO,EACX,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,WAAW,IAJnB,OAAO,CAAC,EAAE,CAKf,CACH,CAAC,GACO,IACN,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commerce/ProductShelf/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -9,5 +9,5 @@ export interface CardProps {
|
|
|
9
9
|
className?: string;
|
|
10
10
|
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
11
11
|
}
|
|
12
|
-
export declare function Card({ media, header, body, footer, onClick, hoverable, className, padding }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function Card({ media, header, body, footer, onClick, hoverable, className, padding, }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CACvC;AAyBD,wBAAgB,IAAI,CAAC,EACnB,KAAK,EACL,MAAM,EACN,IAAI,EACJ,MAAM,EACN,OAAO,EACP,SAAiB,EACjB,SAAS,EACT,OAAgB,GACjB,EAAE,SAAS,2CA2BX"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tokens } from '@danielcruzcode/design-tokens';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
const paddingMap = { none: '0', sm: tokens.space.sm, md: tokens.space.md, lg: tokens.space.lg };
|
|
5
|
+
const StyledArticle = styled.article `
|
|
6
|
+
display:flex;
|
|
7
|
+
flex-direction:column;
|
|
8
|
+
background-color:${tokens.color.background};
|
|
9
|
+
border-radius:${tokens.radius.md};
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
position:relative;
|
|
12
|
+
transition:box-shadow ${tokens.transition.normal},transform ${tokens.transition.normal};
|
|
13
|
+
max-width:15rem;
|
|
14
|
+
height:528px;
|
|
15
|
+
padding:${({ padding }) => paddingMap[padding]};
|
|
16
|
+
${({ hoverable }) => hoverable && `cursor:pointer;&:hover{box-shadow:${tokens.shadow.sm};transform:translateY(-2px);}`}
|
|
17
|
+
`;
|
|
18
|
+
const CardMedia = styled.div `width:100%;overflow:hidden;`;
|
|
19
|
+
const CardHeader = styled.div `padding:${tokens.space.sm} ${tokens.space.md};`;
|
|
20
|
+
const CardBody = styled.div `padding:0 ${tokens.space.sm};flex:1;`;
|
|
21
|
+
const CardFooter = styled.div `padding:${tokens.space.sm};margin-top:auto;`;
|
|
22
|
+
export function Card({ media, header, body, footer, onClick, hoverable = false, className, padding = 'none', }) {
|
|
23
|
+
const isInteractive = Boolean(onClick);
|
|
24
|
+
return (_jsxs(StyledArticle, { hoverable: hoverable || isInteractive, padding: padding, className: className, onClick: onClick, role: isInteractive ? 'button' : undefined, tabIndex: isInteractive ? 0 : undefined, onKeyDown: isInteractive
|
|
25
|
+
? (e) => {
|
|
26
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
onClick?.();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
: undefined, children: [media && _jsx(CardMedia, { children: media }), header && _jsx(CardHeader, { children: header }), body && _jsx(CardBody, { children: body }), footer && _jsx(CardFooter, { children: footer })] }));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=Card.js.map
|