@envive-ai/react-toolkit 0.2.2 → 0.2.4
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/Accordion/index.cjs +4 -0
- package/dist/Accordion/index.d.cts +13 -0
- package/dist/Accordion/index.d.ts +13 -0
- package/dist/Accordion/index.js +4 -0
- package/dist/Accordion-DxtXK__u.js +77 -0
- package/dist/Accordion-RpyCFs2a.cjs +88 -0
- package/dist/AnimatedChevron/index.cjs +3 -0
- package/dist/AnimatedChevron/index.d.cts +14 -0
- package/dist/AnimatedChevron/index.d.ts +14 -0
- package/dist/AnimatedChevron/index.js +3 -0
- package/dist/AnimatedChevron-Bik7GMSe.js +29 -0
- package/dist/AnimatedChevron-Q96FneFy.cjs +37 -0
- package/dist/AppliedFiltersScrollbar/index.cjs +46 -0
- package/dist/AppliedFiltersScrollbar/index.d.cts +22 -0
- package/dist/AppliedFiltersScrollbar/index.d.ts +22 -0
- package/dist/AppliedFiltersScrollbar/index.js +42 -0
- package/dist/ButtonBase/index.cjs +6 -0
- package/dist/ButtonBase/index.d.cts +42 -0
- package/dist/ButtonBase/index.d.ts +42 -0
- package/dist/ButtonBase/index.js +5 -0
- package/dist/ButtonBase-6wjsZ1tU.js +60 -0
- package/dist/ButtonBase-AU23oGQr.cjs +75 -0
- package/dist/ButtonBase-C_uKnl48.js +1 -0
- package/dist/ButtonBase-DbWQ25n-.cjs +0 -0
- package/dist/DynamicFiltersScrollbar/index.cjs +34 -0
- package/dist/DynamicFiltersScrollbar/index.d.cts +28 -0
- package/dist/DynamicFiltersScrollbar/index.d.ts +28 -0
- package/dist/DynamicFiltersScrollbar/index.js +30 -0
- package/dist/DynamicFiltersScrollbar-50i_InZz.cjs +81 -0
- package/dist/DynamicFiltersScrollbar-AhyHehrB.js +66 -0
- package/dist/FilterScrollbar/index.cjs +5 -0
- package/dist/FilterScrollbar/index.d.cts +47 -0
- package/dist/FilterScrollbar/index.d.ts +47 -0
- package/dist/FilterScrollbar/index.js +4 -0
- package/dist/ImageWithFallback/index.cjs +3 -0
- package/dist/ImageWithFallback/index.d.cts +26 -0
- package/dist/ImageWithFallback/index.d.ts +26 -0
- package/dist/ImageWithFallback/index.js +3 -0
- package/dist/ImageWithFallback-1LqhQK1q.cjs +51 -0
- package/dist/ImageWithFallback-Ckwsmd8P.js +42 -0
- package/dist/ModalSheet/index.cjs +4 -0
- package/dist/ModalSheet/index.d.cts +38 -0
- package/dist/ModalSheet/index.d.ts +38 -0
- package/dist/ModalSheet/index.js +4 -0
- package/dist/ModalSheet-BSj_g9JF.js +302 -0
- package/dist/ModalSheet-CcthFeMD.cjs +313 -0
- package/dist/ProductCard/index.cjs +15 -0
- package/dist/ProductCard/index.d.cts +2 -0
- package/dist/ProductCard/index.d.ts +2 -0
- package/dist/ProductCard/index.js +6 -0
- package/dist/ProductCard-BIlnM2nV.js +254 -0
- package/dist/ProductCard-CByKIsUN.cjs +318 -0
- package/dist/ProductGrid/index.cjs +8 -0
- package/dist/ProductGrid/index.d.cts +33 -0
- package/dist/ProductGrid/index.d.ts +33 -0
- package/dist/ProductGrid/index.js +7 -0
- package/dist/ProductGrid-BeFeluHo.cjs +74 -0
- package/dist/ProductGrid-Cgkb4vNf.js +60 -0
- package/dist/RadioButton/index.cjs +4 -0
- package/dist/RadioButton/index.d.cts +32 -0
- package/dist/RadioButton/index.d.ts +32 -0
- package/dist/RadioButton/index.js +4 -0
- package/dist/RadioButton-C_soBi7w.js +75 -0
- package/dist/RadioButton-DG0PgZbz.cjs +84 -0
- package/dist/RadioButtonGroup/index.cjs +6 -0
- package/dist/RadioButtonGroup/index.d.cts +36 -0
- package/dist/RadioButtonGroup/index.d.ts +36 -0
- package/dist/RadioButtonGroup/index.js +5 -0
- package/dist/RadioButtonGroup-3t2kqSFA.cjs +52 -0
- package/dist/RadioButtonGroup-DMbVgPQH.js +38 -0
- package/dist/SearchAutocomplete/index.cjs +3 -0
- package/dist/SearchAutocomplete/index.d.cts +13 -0
- package/dist/SearchAutocomplete/index.d.ts +13 -0
- package/dist/SearchAutocomplete/index.js +3 -0
- package/dist/SearchAutocomplete-TX8UTczp.cjs +62 -0
- package/dist/SearchAutocomplete-obO19yzL.js +51 -0
- package/dist/SearchFilter/index.cjs +17 -0
- package/dist/SearchFilter/index.d.cts +91 -0
- package/dist/SearchFilter/index.d.ts +91 -0
- package/dist/SearchFilter/index.js +12 -0
- package/dist/SearchFilter-BQW4o3Xf.js +268 -0
- package/dist/SearchFilter-t9or-lnj.cjs +307 -0
- package/dist/SearchInput/index.cjs +8 -0
- package/dist/SearchInput/index.d.cts +34 -0
- package/dist/SearchInput/index.d.ts +34 -0
- package/dist/SearchInput/index.js +7 -0
- package/dist/SearchInput-BaiWd0_O.js +108 -0
- package/dist/SearchInput-CO1poiit.cjs +124 -0
- package/dist/SearchInputForm/index.cjs +40 -0
- package/dist/SearchInputForm/index.d.cts +34 -0
- package/dist/SearchInputForm/index.d.ts +34 -0
- package/dist/SearchInputForm/index.js +38 -0
- package/dist/SearchResultsContent/index.cjs +44 -0
- package/dist/SearchResultsContent/index.d.cts +48 -0
- package/dist/SearchResultsContent/index.d.ts +48 -0
- package/dist/SearchResultsContent/index.js +41 -0
- package/dist/SearchResultsFilterSidebar/index.cjs +59 -0
- package/dist/SearchResultsFilterSidebar/index.d.cts +2 -0
- package/dist/SearchResultsFilterSidebar/index.d.ts +2 -0
- package/dist/SearchResultsFilterSidebar/index.js +55 -0
- package/dist/SearchResultsStates/index.cjs +14 -0
- package/dist/SearchResultsStates/index.d.cts +69 -0
- package/dist/SearchResultsStates/index.d.ts +69 -0
- package/dist/SearchResultsStates/index.js +12 -0
- package/dist/SearchResultsStates-Bv5NyxPn.cjs +132 -0
- package/dist/SearchResultsStates-DUG-117h.js +110 -0
- package/dist/SettingsVariant-BsBbdjV5.cjs +63 -0
- package/dist/SettingsVariant-CUSFlJEu.js +55 -0
- package/dist/SparkleAnimation/index.cjs +4 -0
- package/dist/SparkleAnimation/index.d.cts +23 -0
- package/dist/SparkleAnimation/index.d.ts +23 -0
- package/dist/SparkleAnimation/index.js +3 -0
- package/dist/SparkleAnimation-Bm3fk2FJ.cjs +101 -0
- package/dist/SparkleAnimation-D1QjYho_.js +84 -0
- package/dist/Spinner/index.cjs +3 -0
- package/dist/Spinner/index.d.cts +11 -0
- package/dist/Spinner/index.d.ts +11 -0
- package/dist/Spinner/index.js +3 -0
- package/dist/Spinner-BqTt55uu.js +38 -0
- package/dist/Spinner-DjK8ts9E.cjs +46 -0
- package/dist/SuggestionButton/index.cjs +187 -0
- package/dist/SuggestionButton/index.d.cts +35 -0
- package/dist/SuggestionButton/index.d.ts +35 -0
- package/dist/SuggestionButton/index.js +179 -0
- package/dist/TextInput/index.cjs +4 -0
- package/dist/TextInput/index.d.cts +13 -0
- package/dist/TextInput/index.d.ts +13 -0
- package/dist/TextInput/index.js +4 -0
- package/dist/TextInput-B_4Bu2vf.js +31 -0
- package/dist/TextInput-iAKCKHwT.cjs +40 -0
- package/dist/ToggleButton/index.cjs +4 -0
- package/dist/ToggleButton/index.d.cts +30 -0
- package/dist/ToggleButton/index.d.ts +30 -0
- package/dist/ToggleButton/index.js +4 -0
- package/dist/ToggleButton-Br6MgjiG.js +60 -0
- package/dist/ToggleButton-CJ74eu-N.cjs +68 -0
- package/dist/Typography/index.cjs +6 -0
- package/dist/Typography/index.d.cts +3 -0
- package/dist/Typography/index.d.ts +3 -0
- package/dist/Typography/index.js +3 -0
- package/dist/Typography-CFNWgbM5.cjs +176 -0
- package/dist/Typography-D3vDkBMS.js +150 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/colorsConfig-D-MZuBvt.cjs +38 -0
- package/dist/colorsConfig-DEfiLHH0.js +26 -0
- package/dist/index-B5p2z61Y.d.ts +325 -0
- package/dist/index-BH-QK27q.d.ts +31 -0
- package/dist/index-BMHF0IWd.d.cts +31 -0
- package/dist/index-BcvJf9Sr.d.ts +46 -0
- package/dist/index-DDp-fLgm.d.cts +325 -0
- package/dist/index-Dfe_lkL2.d.cts +46 -0
- package/dist/searchFilterSidebarVariants-BD4SYugF.js +34 -0
- package/dist/searchFilterSidebarVariants-DXabOauB.cjs +39 -0
- package/dist/types-BhGjnuWx.d.cts +4 -0
- package/dist/types-CGRog8XL.d.ts +4 -0
- package/dist/typographyVariantClasses-COmQXqcN.d.ts +119 -0
- package/dist/typographyVariantClasses-DTSltxPN.d.cts +119 -0
- package/package.json +3 -3
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { Typography } from "./Typography-D3vDkBMS.js";
|
|
2
|
+
import { ImageWithFallback } from "./ImageWithFallback-Ckwsmd8P.js";
|
|
3
|
+
import { Spinner } from "./Spinner-BqTt55uu.js";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { MdStar } from "react-icons/md";
|
|
7
|
+
import { useImageResolver } from "@envive-ai/react-hooks/hooks/ImageResolver";
|
|
8
|
+
|
|
9
|
+
//#region src/logging/logger.ts
|
|
10
|
+
var Logger = class {
|
|
11
|
+
static logInfo(message, ...args) {
|
|
12
|
+
console.info(`INFO: ${message}`, ...args);
|
|
13
|
+
}
|
|
14
|
+
static logDebug(message, ...args) {
|
|
15
|
+
console.debug(`DEBUG: ${message}`, ...args);
|
|
16
|
+
}
|
|
17
|
+
static logError(message, error, ...args) {
|
|
18
|
+
console.error(`ERROR: ${message} error=${error}`, args);
|
|
19
|
+
}
|
|
20
|
+
static logWarn(message, error, ...args) {
|
|
21
|
+
console.warn(`WARN: ${message} error=${error}`, args);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var logger_default = Logger;
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/util/formatPrice.ts
|
|
28
|
+
const formatPrice = (price, currency = "$") => {
|
|
29
|
+
if (price == null) return "";
|
|
30
|
+
const options = {};
|
|
31
|
+
if (!Number.isInteger(price)) {
|
|
32
|
+
options.minimumFractionDigits = 2;
|
|
33
|
+
options.maximumFractionDigits = 2;
|
|
34
|
+
}
|
|
35
|
+
return `${currency}${price.toLocaleString("en-US", options)}`;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/components/ProductCard/productCardVariants.ts
|
|
40
|
+
/**
|
|
41
|
+
* Shared variant mapping configurations for ProductCard components
|
|
42
|
+
*/
|
|
43
|
+
const variantClassMap = new Map([
|
|
44
|
+
["filled", ["spiffy-tw-bg-[--spiffy-colors-background-secondary]", "spiffy-tw-shadow-md"]],
|
|
45
|
+
["bordered", [
|
|
46
|
+
"spiffy-tw-bg-[--spiffy-colors-background-secondary]",
|
|
47
|
+
"spiffy-tw-border",
|
|
48
|
+
"spiffy-tw-border-[--spiffy-colors-border-light]"
|
|
49
|
+
]],
|
|
50
|
+
["minimal", ["spiffy-tw-bg-transparent"]],
|
|
51
|
+
["transparentBordered", [
|
|
52
|
+
"spiffy-tw-bg-transparent",
|
|
53
|
+
"spiffy-tw-border",
|
|
54
|
+
"spiffy-tw-border-[--spiffy-colors-border-light]"
|
|
55
|
+
]]
|
|
56
|
+
]);
|
|
57
|
+
const variantHoverClassMap = new Map([["backgroundDark", ["hover:spiffy-tw-bg-[--spiffy-colors-background-secondary-dark]"]], ["none", []]]);
|
|
58
|
+
const variantTitleColorMap = new Map([
|
|
59
|
+
["filled", "spiffy-tw-text-[--spiffy-colors-text-link]"],
|
|
60
|
+
["bordered", "spiffy-tw-text-[--spiffy-colors-text-primary]"],
|
|
61
|
+
["minimal", "spiffy-tw-text-[--spiffy-colors-text-primary]"],
|
|
62
|
+
["transparentBordered", "spiffy-tw-text-[--spiffy-colors-text-primary]"]
|
|
63
|
+
]);
|
|
64
|
+
const productCardLayoutVariantClasses = {
|
|
65
|
+
normal: {
|
|
66
|
+
productTitle: ["spiffy-product-card-title"],
|
|
67
|
+
container: ["spiffy-tw-w-[208px]"],
|
|
68
|
+
verticalContainer: ["spiffy-tw-rounded-[8px]", "spiffy-tw-h-[268px]"]
|
|
69
|
+
},
|
|
70
|
+
tall: {
|
|
71
|
+
productTitle: ["spiffy-product-card-title-tall", "spiffy-tw-pt-[8px]"],
|
|
72
|
+
container: ["spiffy-tw-w-[160px] lg:spiffy-tw-w-[300px]"],
|
|
73
|
+
verticalContainer: ["lg:spiffy-tw-h-[496px]"]
|
|
74
|
+
},
|
|
75
|
+
square: {
|
|
76
|
+
productTitle: ["spiffy-product-card-title-tall", "spiffy-tw-pt-[8px]"],
|
|
77
|
+
container: ["spiffy-tw-w-[160px] lg:spiffy-tw-w-[280px]"],
|
|
78
|
+
verticalContainer: ["lg:spiffy-tw-h-[400px]"]
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/components/ProductCard/ProductCard.tsx
|
|
84
|
+
const formatReviews = (stars) => String(Number(stars).toLocaleString("en-US", {
|
|
85
|
+
minimumFractionDigits: 1,
|
|
86
|
+
maximumFractionDigits: 1
|
|
87
|
+
}));
|
|
88
|
+
const RatingSummary = ({ stars, reviewCount, className }) => {
|
|
89
|
+
const group = classNames("spiffy-product-card-rating", "spiffy-product-card-text-color", "spiffy-tw-flex", "spiffy-tw-flex-row", "spiffy-tw-items-center", "spiffy-tw-gap-1", "spiffy-tw-text-[--spiffy-colors-text-primary]", "spiffy-tw-tracking-[0.8px]");
|
|
90
|
+
const starClassnames = classNames("spiffy-product-card-rating-star-color", "spiffy-tw-fill-[--spiffy-colors-accent-primary]", "spiffy-tw-w-[14px]", "spiffy-tw-h-[14px]");
|
|
91
|
+
return /* @__PURE__ */ jsx("div", {
|
|
92
|
+
className,
|
|
93
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
94
|
+
className: group,
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ jsx(MdStar, { className: starClassnames }),
|
|
97
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
98
|
+
variant: "body3",
|
|
99
|
+
children: formatReviews(stars)
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ jsxs(Typography, {
|
|
102
|
+
variant: "body3",
|
|
103
|
+
children: [
|
|
104
|
+
"(",
|
|
105
|
+
reviewCount,
|
|
106
|
+
")"
|
|
107
|
+
]
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const PriceSection = ({ originalPrice, salePrice, pricePrefix }) => {
|
|
114
|
+
if (!originalPrice) return null;
|
|
115
|
+
const priceClassName = classNames("spiffy-product-card-price", "spiffy-product-card-text-color", "spiffy-tw-font-regular", "spiffy-tw-flex", "spiffy-tw-flex-wrap", "spiffy-tw-gap-1", "spiffy-tw-text-sm", "spiffy-tw-font-[400]", "spiffy-tw-leading-[100%]", "spiffy-tw-tracking-[0.8px]", "spiffy-tw-text-[--spiffy-colors-text-primary]");
|
|
116
|
+
const showSalePrice = salePrice && originalPrice !== salePrice;
|
|
117
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
118
|
+
className: priceClassName,
|
|
119
|
+
children: [
|
|
120
|
+
pricePrefix && /* @__PURE__ */ jsx(Typography, { children: pricePrefix }),
|
|
121
|
+
showSalePrice && /* @__PURE__ */ jsx(Typography, { children: salePrice }),
|
|
122
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
123
|
+
className: showSalePrice ? "spiffy-tw-line-through" : "",
|
|
124
|
+
children: originalPrice
|
|
125
|
+
})
|
|
126
|
+
]
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
const ProductCard = ({ productCardConfig, merchantShortName, imageUrl, title, url, originalPrice, averageRating, numberReviews, salePrice, variant, hoverVariant, dataTestId, layoutVariant = "normal", zoomOnHover = false, aspectRatio = "none", growWithContainer = false, handleClick }) => {
|
|
130
|
+
const { resolve } = useImageResolver();
|
|
131
|
+
const finalVariant = variant ?? productCardConfig?.variant ?? "filled";
|
|
132
|
+
const finalHoverVariant = hoverVariant ?? productCardConfig?.hoverVariant ?? "backgroundDark";
|
|
133
|
+
const finalLayoutVariant = layoutVariant ?? productCardConfig?.layoutVariant ?? "normal";
|
|
134
|
+
const pricePrefix = productCardConfig?.pricePrefix;
|
|
135
|
+
if (productCardConfig == null) {
|
|
136
|
+
logger_default.logError("[ProductCard] productCardConfig is null", void 0, { merchant: merchantShortName });
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
const layoutClasses = productCardLayoutVariantClasses[finalLayoutVariant];
|
|
140
|
+
const containerClassnames = classNames("spiffy-tw-cursor-pointer", "spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-inherit", "spiffy-tw-overflow-hidden", {
|
|
141
|
+
"spiffy-tw-h-full": growWithContainer,
|
|
142
|
+
"spiffy-tw-w-full": growWithContainer,
|
|
143
|
+
"spiffy-tw-max-w-full": growWithContainer
|
|
144
|
+
}, !growWithContainer && layoutClasses.container, variantClassMap.get(finalVariant) ?? [], variantHoverClassMap.get(finalHoverVariant) ?? []);
|
|
145
|
+
const verticalContainerVariantClasses = productCardLayoutVariantClasses[layoutVariant].verticalContainer;
|
|
146
|
+
const verticalContainerClassnames = classNames("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-overflow-hidden", "spiffy-tw-gap-inherit", {
|
|
147
|
+
"spiffy-tw-h-full": growWithContainer,
|
|
148
|
+
"spiffy-tw-w-full": growWithContainer,
|
|
149
|
+
"spiffy-tw-flex-1": growWithContainer
|
|
150
|
+
}, ...!growWithContainer && layoutVariant ? verticalContainerVariantClasses : []);
|
|
151
|
+
const linkClassnames = classNames({
|
|
152
|
+
"spiffy-tw-w-full": true,
|
|
153
|
+
"spiffy-tw-h-full": true,
|
|
154
|
+
"spiffy-tw-overflow-hidden": true,
|
|
155
|
+
"spiffy-tw-select-none": true
|
|
156
|
+
});
|
|
157
|
+
const imageClipContainerClassnames = classNames("spiffy-tw-w-full", "spiffy-tw-overflow-hidden", {
|
|
158
|
+
"spiffy-tw-flex-shrink-0": growWithContainer,
|
|
159
|
+
"spiffy-tw-tw-h-full": !growWithContainer
|
|
160
|
+
}, aspectRatio === "3:4" ? "spiffy-tw-aspect-[3/4]" : "", aspectRatio === "square" ? "spiffy-tw-aspect-square" : "");
|
|
161
|
+
const imageContainerClassnames = classNames(linkClassnames, zoomOnHover ? [
|
|
162
|
+
"spiffy-tw-transition-transform",
|
|
163
|
+
"spiffy-tw-duration-200",
|
|
164
|
+
"spiffy-tw-origin-top",
|
|
165
|
+
"hover:spiffy-tw-scale-105"
|
|
166
|
+
] : []);
|
|
167
|
+
const contentClassnames = classNames("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-p-2", "spiffy-tw-pr-2", "spiffy-tw-items-start", "spiffy-tw-justify-end", { "spiffy-tw-flex-grow-0": layoutVariant === "tall" || layoutVariant === "square" });
|
|
168
|
+
const productTitleClassnames = classNames("spiffy-tw-line-clamp-2", "spiffy-tw-overflow-clip", "spiffy-tw-tracking-[0.8px]", "spiffy-tw-whitespace-normal", "spiffy-tw-normal-case", variantTitleColorMap.get(finalVariant) ?? "spiffy-tw-text-[--spiffy-colors-text-primary]", ...layoutClasses.productTitle);
|
|
169
|
+
const priceAndRatingContainerClassnames = classNames("spiffy-tw-flex", "spiffy-tw-flex-row", "spiffy-tw-justify-between", "spiffy-tw-items-center", "spiffy-tw-w-full", "spiffy-tw-pt-2", "spiffy-tw-gap-2");
|
|
170
|
+
const imageClassnames = classNames("spiffy-tw-bg-transparent", "spiffy-tw-w-full", "spiffy-tw-h-full", "spiffy-tw-object-cover", "spiffy-tw-object-top", "spiffy-tw-select-none", "spiffy-tw-pointer-events-none");
|
|
171
|
+
return /* @__PURE__ */ jsx("div", {
|
|
172
|
+
className: containerClassnames,
|
|
173
|
+
"data-testid": dataTestId,
|
|
174
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
175
|
+
href: url,
|
|
176
|
+
onClick: () => handleClick(url),
|
|
177
|
+
target: "_self",
|
|
178
|
+
draggable: false,
|
|
179
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
180
|
+
className: verticalContainerClassnames,
|
|
181
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
182
|
+
className: imageClipContainerClassnames,
|
|
183
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
184
|
+
className: imageContainerClassnames,
|
|
185
|
+
children: imageUrl && /* @__PURE__ */ jsx(ImageWithFallback, {
|
|
186
|
+
src: resolve(imageUrl, layoutVariant === "tall" ? 300 : 178),
|
|
187
|
+
alt: title,
|
|
188
|
+
fallback: /* @__PURE__ */ jsx(Spinner, { className: "spiffy-tw-w-6 spiffy-tw-h-6" }),
|
|
189
|
+
imageClassnames
|
|
190
|
+
})
|
|
191
|
+
})
|
|
192
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
193
|
+
className: contentClassnames,
|
|
194
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
195
|
+
variant: "h4",
|
|
196
|
+
className: productTitleClassnames,
|
|
197
|
+
children: title
|
|
198
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
199
|
+
className: priceAndRatingContainerClassnames,
|
|
200
|
+
children: [(originalPrice || salePrice) && /* @__PURE__ */ jsx(PriceSection, {
|
|
201
|
+
originalPrice: formatPrice(originalPrice),
|
|
202
|
+
salePrice: formatPrice(salePrice),
|
|
203
|
+
pricePrefix
|
|
204
|
+
}), averageRating && numberReviews && /* @__PURE__ */ jsx(RatingSummary, {
|
|
205
|
+
stars: averageRating,
|
|
206
|
+
reviewCount: numberReviews
|
|
207
|
+
})]
|
|
208
|
+
})]
|
|
209
|
+
})]
|
|
210
|
+
})
|
|
211
|
+
})
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/components/ProductCard/types.ts
|
|
217
|
+
let ProductCardSkeletonOverrides = /* @__PURE__ */ function(ProductCardSkeletonOverrides$1) {
|
|
218
|
+
ProductCardSkeletonOverrides$1["PRODUCT_CARD_SKELETON_CONTAINER"] = "spiffy-product-card-skeleton-container";
|
|
219
|
+
ProductCardSkeletonOverrides$1["PRODUCT_CARD_SKELETON"] = "spiffy-product-card-skeleton";
|
|
220
|
+
return ProductCardSkeletonOverrides$1;
|
|
221
|
+
}({});
|
|
222
|
+
let AnimatedProductCardOverrides = /* @__PURE__ */ function(AnimatedProductCardOverrides$1) {
|
|
223
|
+
AnimatedProductCardOverrides$1["PRODUCT_CARD_ANIMATED_CONTAINER"] = "spiffy-product-card-animated-container";
|
|
224
|
+
AnimatedProductCardOverrides$1["PRODUCT_CARD_ANIMATED_IMAGE_CONTAINER"] = "spiffy-product-card-animated";
|
|
225
|
+
return AnimatedProductCardOverrides$1;
|
|
226
|
+
}({});
|
|
227
|
+
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/components/ProductCard/ProductCardSkeleton.tsx
|
|
230
|
+
const ProductCardSkeleton = ({ layoutVariant, aspectRatio, growWithContainer = false }) => {
|
|
231
|
+
const layoutClasses = productCardLayoutVariantClasses[layoutVariant || "normal"];
|
|
232
|
+
const containerClasses = classNames(ProductCardSkeletonOverrides.PRODUCT_CARD_SKELETON_CONTAINER, "spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-inherit", "spiffy-tw-bg-transparent", !growWithContainer ? layoutClasses.container : "");
|
|
233
|
+
const verticalContainerClasses = classNames("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-overflow-hidden", "spiffy-tw-gap-inherit", !growWithContainer ? layoutClasses.verticalContainer : "");
|
|
234
|
+
const imageClipContainerClasses = classNames("spiffy-tw-w-full", aspectRatio === "3:4" ? "spiffy-tw-aspect-[3/4]" : "", aspectRatio === "square" ? "spiffy-tw-aspect-square" : "", "spiffy-tw-overflow-hidden");
|
|
235
|
+
const imageSkeletonClasses = classNames("spiffy-tw-bg-[#F4F4F6]", "spiffy-tw-animate-pulse", "spiffy-tw-opacity-70", "spiffy-tw-w-full", "spiffy-tw-h-full");
|
|
236
|
+
const contentContainerClasses = classNames("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-2", "spiffy-tw-w-full", "spiffy-tw-p-2");
|
|
237
|
+
const textSkeletonClasses = classNames(ProductCardSkeletonOverrides.PRODUCT_CARD_SKELETON, "spiffy-tw-h-[15px]", "spiffy-tw-block", "spiffy-tw-rounded-sm", "spiffy-tw-animate-pulse", "spiffy-tw-opacity-70", "spiffy-tw-bg-[#F4F4F6]");
|
|
238
|
+
return /* @__PURE__ */ jsx("div", {
|
|
239
|
+
className: containerClasses,
|
|
240
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
241
|
+
className: verticalContainerClasses,
|
|
242
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
243
|
+
className: imageClipContainerClasses,
|
|
244
|
+
children: /* @__PURE__ */ jsx("div", { className: imageSkeletonClasses })
|
|
245
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
246
|
+
className: contentContainerClasses,
|
|
247
|
+
children: [/* @__PURE__ */ jsx("div", { className: classNames(textSkeletonClasses, "spiffy-tw-w-full") }), /* @__PURE__ */ jsx("div", { className: classNames(textSkeletonClasses, "spiffy-tw-w-[60%]") })]
|
|
248
|
+
})]
|
|
249
|
+
})
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
//#endregion
|
|
254
|
+
export { AnimatedProductCardOverrides, PriceSection, ProductCard, ProductCardSkeleton, ProductCardSkeletonOverrides, RatingSummary, productCardLayoutVariantClasses, variantClassMap, variantHoverClassMap, variantTitleColorMap };
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const require_Typography = require('./Typography-CFNWgbM5.cjs');
|
|
3
|
+
const require_ImageWithFallback = require('./ImageWithFallback-1LqhQK1q.cjs');
|
|
4
|
+
const require_Spinner = require('./Spinner-DjK8ts9E.cjs');
|
|
5
|
+
let classnames = require("classnames");
|
|
6
|
+
classnames = require_chunk.__toESM(classnames);
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
react_jsx_runtime = require_chunk.__toESM(react_jsx_runtime);
|
|
9
|
+
let react_icons_md = require("react-icons/md");
|
|
10
|
+
react_icons_md = require_chunk.__toESM(react_icons_md);
|
|
11
|
+
let __envive_ai_react_hooks_hooks_ImageResolver = require("@envive-ai/react-hooks/hooks/ImageResolver");
|
|
12
|
+
__envive_ai_react_hooks_hooks_ImageResolver = require_chunk.__toESM(__envive_ai_react_hooks_hooks_ImageResolver);
|
|
13
|
+
|
|
14
|
+
//#region src/logging/logger.ts
|
|
15
|
+
var Logger = class {
|
|
16
|
+
static logInfo(message, ...args) {
|
|
17
|
+
console.info(`INFO: ${message}`, ...args);
|
|
18
|
+
}
|
|
19
|
+
static logDebug(message, ...args) {
|
|
20
|
+
console.debug(`DEBUG: ${message}`, ...args);
|
|
21
|
+
}
|
|
22
|
+
static logError(message, error, ...args) {
|
|
23
|
+
console.error(`ERROR: ${message} error=${error}`, args);
|
|
24
|
+
}
|
|
25
|
+
static logWarn(message, error, ...args) {
|
|
26
|
+
console.warn(`WARN: ${message} error=${error}`, args);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var logger_default = Logger;
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/util/formatPrice.ts
|
|
33
|
+
const formatPrice = (price, currency = "$") => {
|
|
34
|
+
if (price == null) return "";
|
|
35
|
+
const options = {};
|
|
36
|
+
if (!Number.isInteger(price)) {
|
|
37
|
+
options.minimumFractionDigits = 2;
|
|
38
|
+
options.maximumFractionDigits = 2;
|
|
39
|
+
}
|
|
40
|
+
return `${currency}${price.toLocaleString("en-US", options)}`;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/components/ProductCard/productCardVariants.ts
|
|
45
|
+
/**
|
|
46
|
+
* Shared variant mapping configurations for ProductCard components
|
|
47
|
+
*/
|
|
48
|
+
const variantClassMap = new Map([
|
|
49
|
+
["filled", ["spiffy-tw-bg-[--spiffy-colors-background-secondary]", "spiffy-tw-shadow-md"]],
|
|
50
|
+
["bordered", [
|
|
51
|
+
"spiffy-tw-bg-[--spiffy-colors-background-secondary]",
|
|
52
|
+
"spiffy-tw-border",
|
|
53
|
+
"spiffy-tw-border-[--spiffy-colors-border-light]"
|
|
54
|
+
]],
|
|
55
|
+
["minimal", ["spiffy-tw-bg-transparent"]],
|
|
56
|
+
["transparentBordered", [
|
|
57
|
+
"spiffy-tw-bg-transparent",
|
|
58
|
+
"spiffy-tw-border",
|
|
59
|
+
"spiffy-tw-border-[--spiffy-colors-border-light]"
|
|
60
|
+
]]
|
|
61
|
+
]);
|
|
62
|
+
const variantHoverClassMap = new Map([["backgroundDark", ["hover:spiffy-tw-bg-[--spiffy-colors-background-secondary-dark]"]], ["none", []]]);
|
|
63
|
+
const variantTitleColorMap = new Map([
|
|
64
|
+
["filled", "spiffy-tw-text-[--spiffy-colors-text-link]"],
|
|
65
|
+
["bordered", "spiffy-tw-text-[--spiffy-colors-text-primary]"],
|
|
66
|
+
["minimal", "spiffy-tw-text-[--spiffy-colors-text-primary]"],
|
|
67
|
+
["transparentBordered", "spiffy-tw-text-[--spiffy-colors-text-primary]"]
|
|
68
|
+
]);
|
|
69
|
+
const productCardLayoutVariantClasses = {
|
|
70
|
+
normal: {
|
|
71
|
+
productTitle: ["spiffy-product-card-title"],
|
|
72
|
+
container: ["spiffy-tw-w-[208px]"],
|
|
73
|
+
verticalContainer: ["spiffy-tw-rounded-[8px]", "spiffy-tw-h-[268px]"]
|
|
74
|
+
},
|
|
75
|
+
tall: {
|
|
76
|
+
productTitle: ["spiffy-product-card-title-tall", "spiffy-tw-pt-[8px]"],
|
|
77
|
+
container: ["spiffy-tw-w-[160px] lg:spiffy-tw-w-[300px]"],
|
|
78
|
+
verticalContainer: ["lg:spiffy-tw-h-[496px]"]
|
|
79
|
+
},
|
|
80
|
+
square: {
|
|
81
|
+
productTitle: ["spiffy-product-card-title-tall", "spiffy-tw-pt-[8px]"],
|
|
82
|
+
container: ["spiffy-tw-w-[160px] lg:spiffy-tw-w-[280px]"],
|
|
83
|
+
verticalContainer: ["lg:spiffy-tw-h-[400px]"]
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/components/ProductCard/ProductCard.tsx
|
|
89
|
+
const formatReviews = (stars) => String(Number(stars).toLocaleString("en-US", {
|
|
90
|
+
minimumFractionDigits: 1,
|
|
91
|
+
maximumFractionDigits: 1
|
|
92
|
+
}));
|
|
93
|
+
const RatingSummary = ({ stars, reviewCount, className }) => {
|
|
94
|
+
const group = (0, classnames.default)("spiffy-product-card-rating", "spiffy-product-card-text-color", "spiffy-tw-flex", "spiffy-tw-flex-row", "spiffy-tw-items-center", "spiffy-tw-gap-1", "spiffy-tw-text-[--spiffy-colors-text-primary]", "spiffy-tw-tracking-[0.8px]");
|
|
95
|
+
const starClassnames = (0, classnames.default)("spiffy-product-card-rating-star-color", "spiffy-tw-fill-[--spiffy-colors-accent-primary]", "spiffy-tw-w-[14px]", "spiffy-tw-h-[14px]");
|
|
96
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
97
|
+
className,
|
|
98
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
99
|
+
className: group,
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_icons_md.MdStar, { className: starClassnames }),
|
|
102
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
103
|
+
variant: "body3",
|
|
104
|
+
children: formatReviews(stars)
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Typography.Typography, {
|
|
107
|
+
variant: "body3",
|
|
108
|
+
children: [
|
|
109
|
+
"(",
|
|
110
|
+
reviewCount,
|
|
111
|
+
")"
|
|
112
|
+
]
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
const PriceSection = ({ originalPrice, salePrice, pricePrefix }) => {
|
|
119
|
+
if (!originalPrice) return null;
|
|
120
|
+
const priceClassName = (0, classnames.default)("spiffy-product-card-price", "spiffy-product-card-text-color", "spiffy-tw-font-regular", "spiffy-tw-flex", "spiffy-tw-flex-wrap", "spiffy-tw-gap-1", "spiffy-tw-text-sm", "spiffy-tw-font-[400]", "spiffy-tw-leading-[100%]", "spiffy-tw-tracking-[0.8px]", "spiffy-tw-text-[--spiffy-colors-text-primary]");
|
|
121
|
+
const showSalePrice = salePrice && originalPrice !== salePrice;
|
|
122
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
123
|
+
className: priceClassName,
|
|
124
|
+
children: [
|
|
125
|
+
pricePrefix && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, { children: pricePrefix }),
|
|
126
|
+
showSalePrice && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, { children: salePrice }),
|
|
127
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
128
|
+
className: showSalePrice ? "spiffy-tw-line-through" : "",
|
|
129
|
+
children: originalPrice
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
const ProductCard = ({ productCardConfig, merchantShortName, imageUrl, title, url, originalPrice, averageRating, numberReviews, salePrice, variant, hoverVariant, dataTestId, layoutVariant = "normal", zoomOnHover = false, aspectRatio = "none", growWithContainer = false, handleClick }) => {
|
|
135
|
+
const { resolve } = (0, __envive_ai_react_hooks_hooks_ImageResolver.useImageResolver)();
|
|
136
|
+
const finalVariant = variant ?? productCardConfig?.variant ?? "filled";
|
|
137
|
+
const finalHoverVariant = hoverVariant ?? productCardConfig?.hoverVariant ?? "backgroundDark";
|
|
138
|
+
const finalLayoutVariant = layoutVariant ?? productCardConfig?.layoutVariant ?? "normal";
|
|
139
|
+
const pricePrefix = productCardConfig?.pricePrefix;
|
|
140
|
+
if (productCardConfig == null) {
|
|
141
|
+
logger_default.logError("[ProductCard] productCardConfig is null", void 0, { merchant: merchantShortName });
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
const layoutClasses = productCardLayoutVariantClasses[finalLayoutVariant];
|
|
145
|
+
const containerClassnames = (0, classnames.default)("spiffy-tw-cursor-pointer", "spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-inherit", "spiffy-tw-overflow-hidden", {
|
|
146
|
+
"spiffy-tw-h-full": growWithContainer,
|
|
147
|
+
"spiffy-tw-w-full": growWithContainer,
|
|
148
|
+
"spiffy-tw-max-w-full": growWithContainer
|
|
149
|
+
}, !growWithContainer && layoutClasses.container, variantClassMap.get(finalVariant) ?? [], variantHoverClassMap.get(finalHoverVariant) ?? []);
|
|
150
|
+
const verticalContainerVariantClasses = productCardLayoutVariantClasses[layoutVariant].verticalContainer;
|
|
151
|
+
const verticalContainerClassnames = (0, classnames.default)("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-overflow-hidden", "spiffy-tw-gap-inherit", {
|
|
152
|
+
"spiffy-tw-h-full": growWithContainer,
|
|
153
|
+
"spiffy-tw-w-full": growWithContainer,
|
|
154
|
+
"spiffy-tw-flex-1": growWithContainer
|
|
155
|
+
}, ...!growWithContainer && layoutVariant ? verticalContainerVariantClasses : []);
|
|
156
|
+
const linkClassnames = (0, classnames.default)({
|
|
157
|
+
"spiffy-tw-w-full": true,
|
|
158
|
+
"spiffy-tw-h-full": true,
|
|
159
|
+
"spiffy-tw-overflow-hidden": true,
|
|
160
|
+
"spiffy-tw-select-none": true
|
|
161
|
+
});
|
|
162
|
+
const imageClipContainerClassnames = (0, classnames.default)("spiffy-tw-w-full", "spiffy-tw-overflow-hidden", {
|
|
163
|
+
"spiffy-tw-flex-shrink-0": growWithContainer,
|
|
164
|
+
"spiffy-tw-tw-h-full": !growWithContainer
|
|
165
|
+
}, aspectRatio === "3:4" ? "spiffy-tw-aspect-[3/4]" : "", aspectRatio === "square" ? "spiffy-tw-aspect-square" : "");
|
|
166
|
+
const imageContainerClassnames = (0, classnames.default)(linkClassnames, zoomOnHover ? [
|
|
167
|
+
"spiffy-tw-transition-transform",
|
|
168
|
+
"spiffy-tw-duration-200",
|
|
169
|
+
"spiffy-tw-origin-top",
|
|
170
|
+
"hover:spiffy-tw-scale-105"
|
|
171
|
+
] : []);
|
|
172
|
+
const contentClassnames = (0, classnames.default)("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-p-2", "spiffy-tw-pr-2", "spiffy-tw-items-start", "spiffy-tw-justify-end", { "spiffy-tw-flex-grow-0": layoutVariant === "tall" || layoutVariant === "square" });
|
|
173
|
+
const productTitleClassnames = (0, classnames.default)("spiffy-tw-line-clamp-2", "spiffy-tw-overflow-clip", "spiffy-tw-tracking-[0.8px]", "spiffy-tw-whitespace-normal", "spiffy-tw-normal-case", variantTitleColorMap.get(finalVariant) ?? "spiffy-tw-text-[--spiffy-colors-text-primary]", ...layoutClasses.productTitle);
|
|
174
|
+
const priceAndRatingContainerClassnames = (0, classnames.default)("spiffy-tw-flex", "spiffy-tw-flex-row", "spiffy-tw-justify-between", "spiffy-tw-items-center", "spiffy-tw-w-full", "spiffy-tw-pt-2", "spiffy-tw-gap-2");
|
|
175
|
+
const imageClassnames = (0, classnames.default)("spiffy-tw-bg-transparent", "spiffy-tw-w-full", "spiffy-tw-h-full", "spiffy-tw-object-cover", "spiffy-tw-object-top", "spiffy-tw-select-none", "spiffy-tw-pointer-events-none");
|
|
176
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
177
|
+
className: containerClassnames,
|
|
178
|
+
"data-testid": dataTestId,
|
|
179
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
180
|
+
href: url,
|
|
181
|
+
onClick: () => handleClick(url),
|
|
182
|
+
target: "_self",
|
|
183
|
+
draggable: false,
|
|
184
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
185
|
+
className: verticalContainerClassnames,
|
|
186
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
187
|
+
className: imageClipContainerClassnames,
|
|
188
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
189
|
+
className: imageContainerClassnames,
|
|
190
|
+
children: imageUrl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ImageWithFallback.ImageWithFallback, {
|
|
191
|
+
src: resolve(imageUrl, layoutVariant === "tall" ? 300 : 178),
|
|
192
|
+
alt: title,
|
|
193
|
+
fallback: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Spinner.Spinner, { className: "spiffy-tw-w-6 spiffy-tw-h-6" }),
|
|
194
|
+
imageClassnames
|
|
195
|
+
})
|
|
196
|
+
})
|
|
197
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
198
|
+
className: contentClassnames,
|
|
199
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
200
|
+
variant: "h4",
|
|
201
|
+
className: productTitleClassnames,
|
|
202
|
+
children: title
|
|
203
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
204
|
+
className: priceAndRatingContainerClassnames,
|
|
205
|
+
children: [(originalPrice || salePrice) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PriceSection, {
|
|
206
|
+
originalPrice: formatPrice(originalPrice),
|
|
207
|
+
salePrice: formatPrice(salePrice),
|
|
208
|
+
pricePrefix
|
|
209
|
+
}), averageRating && numberReviews && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingSummary, {
|
|
210
|
+
stars: averageRating,
|
|
211
|
+
reviewCount: numberReviews
|
|
212
|
+
})]
|
|
213
|
+
})]
|
|
214
|
+
})]
|
|
215
|
+
})
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/components/ProductCard/types.ts
|
|
222
|
+
let ProductCardSkeletonOverrides = /* @__PURE__ */ function(ProductCardSkeletonOverrides$1) {
|
|
223
|
+
ProductCardSkeletonOverrides$1["PRODUCT_CARD_SKELETON_CONTAINER"] = "spiffy-product-card-skeleton-container";
|
|
224
|
+
ProductCardSkeletonOverrides$1["PRODUCT_CARD_SKELETON"] = "spiffy-product-card-skeleton";
|
|
225
|
+
return ProductCardSkeletonOverrides$1;
|
|
226
|
+
}({});
|
|
227
|
+
let AnimatedProductCardOverrides = /* @__PURE__ */ function(AnimatedProductCardOverrides$1) {
|
|
228
|
+
AnimatedProductCardOverrides$1["PRODUCT_CARD_ANIMATED_CONTAINER"] = "spiffy-product-card-animated-container";
|
|
229
|
+
AnimatedProductCardOverrides$1["PRODUCT_CARD_ANIMATED_IMAGE_CONTAINER"] = "spiffy-product-card-animated";
|
|
230
|
+
return AnimatedProductCardOverrides$1;
|
|
231
|
+
}({});
|
|
232
|
+
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/components/ProductCard/ProductCardSkeleton.tsx
|
|
235
|
+
const ProductCardSkeleton = ({ layoutVariant, aspectRatio, growWithContainer = false }) => {
|
|
236
|
+
const layoutClasses = productCardLayoutVariantClasses[layoutVariant || "normal"];
|
|
237
|
+
const containerClasses = (0, classnames.default)(ProductCardSkeletonOverrides.PRODUCT_CARD_SKELETON_CONTAINER, "spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-inherit", "spiffy-tw-bg-transparent", !growWithContainer ? layoutClasses.container : "");
|
|
238
|
+
const verticalContainerClasses = (0, classnames.default)("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-overflow-hidden", "spiffy-tw-gap-inherit", !growWithContainer ? layoutClasses.verticalContainer : "");
|
|
239
|
+
const imageClipContainerClasses = (0, classnames.default)("spiffy-tw-w-full", aspectRatio === "3:4" ? "spiffy-tw-aspect-[3/4]" : "", aspectRatio === "square" ? "spiffy-tw-aspect-square" : "", "spiffy-tw-overflow-hidden");
|
|
240
|
+
const imageSkeletonClasses = (0, classnames.default)("spiffy-tw-bg-[#F4F4F6]", "spiffy-tw-animate-pulse", "spiffy-tw-opacity-70", "spiffy-tw-w-full", "spiffy-tw-h-full");
|
|
241
|
+
const contentContainerClasses = (0, classnames.default)("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-2", "spiffy-tw-w-full", "spiffy-tw-p-2");
|
|
242
|
+
const textSkeletonClasses = (0, classnames.default)(ProductCardSkeletonOverrides.PRODUCT_CARD_SKELETON, "spiffy-tw-h-[15px]", "spiffy-tw-block", "spiffy-tw-rounded-sm", "spiffy-tw-animate-pulse", "spiffy-tw-opacity-70", "spiffy-tw-bg-[#F4F4F6]");
|
|
243
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
244
|
+
className: containerClasses,
|
|
245
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
246
|
+
className: verticalContainerClasses,
|
|
247
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
248
|
+
className: imageClipContainerClasses,
|
|
249
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: imageSkeletonClasses })
|
|
250
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
251
|
+
className: contentContainerClasses,
|
|
252
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, classnames.default)(textSkeletonClasses, "spiffy-tw-w-full") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, classnames.default)(textSkeletonClasses, "spiffy-tw-w-[60%]") })]
|
|
253
|
+
})]
|
|
254
|
+
})
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
//#endregion
|
|
259
|
+
Object.defineProperty(exports, 'AnimatedProductCardOverrides', {
|
|
260
|
+
enumerable: true,
|
|
261
|
+
get: function () {
|
|
262
|
+
return AnimatedProductCardOverrides;
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
Object.defineProperty(exports, 'PriceSection', {
|
|
266
|
+
enumerable: true,
|
|
267
|
+
get: function () {
|
|
268
|
+
return PriceSection;
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
Object.defineProperty(exports, 'ProductCard', {
|
|
272
|
+
enumerable: true,
|
|
273
|
+
get: function () {
|
|
274
|
+
return ProductCard;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
Object.defineProperty(exports, 'ProductCardSkeleton', {
|
|
278
|
+
enumerable: true,
|
|
279
|
+
get: function () {
|
|
280
|
+
return ProductCardSkeleton;
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
Object.defineProperty(exports, 'ProductCardSkeletonOverrides', {
|
|
284
|
+
enumerable: true,
|
|
285
|
+
get: function () {
|
|
286
|
+
return ProductCardSkeletonOverrides;
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
Object.defineProperty(exports, 'RatingSummary', {
|
|
290
|
+
enumerable: true,
|
|
291
|
+
get: function () {
|
|
292
|
+
return RatingSummary;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
Object.defineProperty(exports, 'productCardLayoutVariantClasses', {
|
|
296
|
+
enumerable: true,
|
|
297
|
+
get: function () {
|
|
298
|
+
return productCardLayoutVariantClasses;
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
Object.defineProperty(exports, 'variantClassMap', {
|
|
302
|
+
enumerable: true,
|
|
303
|
+
get: function () {
|
|
304
|
+
return variantClassMap;
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
Object.defineProperty(exports, 'variantHoverClassMap', {
|
|
308
|
+
enumerable: true,
|
|
309
|
+
get: function () {
|
|
310
|
+
return variantHoverClassMap;
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
Object.defineProperty(exports, 'variantTitleColorMap', {
|
|
314
|
+
enumerable: true,
|
|
315
|
+
get: function () {
|
|
316
|
+
return variantTitleColorMap;
|
|
317
|
+
}
|
|
318
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
require('../Typography-CFNWgbM5.cjs');
|
|
2
|
+
require('../ImageWithFallback-1LqhQK1q.cjs');
|
|
3
|
+
require('../ProductCard-CByKIsUN.cjs');
|
|
4
|
+
require('../Spinner-DjK8ts9E.cjs');
|
|
5
|
+
const require_ProductGrid = require('../ProductGrid-BeFeluHo.cjs');
|
|
6
|
+
|
|
7
|
+
exports.ProductGrid = require_ProductGrid.ProductGrid;
|
|
8
|
+
exports.productGridVariantClasses = require_ProductGrid.productGridVariantClasses;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ProductCardConfig, ProductCardHoverVariant, ProductCardLayoutVariant, ProductCardVariant, ProductGridVariant } from "../index-DDp-fLgm.cjs";
|
|
2
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
3
|
+
import { SearchResponseProduct } from "@spiffy-ai/commerce-api-client";
|
|
4
|
+
|
|
5
|
+
//#region src/components/ProductGrid/ProductGrid.d.ts
|
|
6
|
+
interface ProductGridProps {
|
|
7
|
+
productList: SearchResponseProduct[];
|
|
8
|
+
productGridVariant: ProductGridVariant;
|
|
9
|
+
productGridClasses: string;
|
|
10
|
+
productCardConfig?: ProductCardConfig;
|
|
11
|
+
merchantShortName: string;
|
|
12
|
+
cardsGrowWithContainer?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const ProductGrid: ({
|
|
15
|
+
productList,
|
|
16
|
+
productGridVariant,
|
|
17
|
+
productGridClasses,
|
|
18
|
+
productCardConfig,
|
|
19
|
+
merchantShortName,
|
|
20
|
+
cardsGrowWithContainer
|
|
21
|
+
}: ProductGridProps) => react_jsx_runtime11.JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/components/ProductGrid/productGridVariants.d.ts
|
|
24
|
+
interface ProductGridVariantClasses {
|
|
25
|
+
productCardVariant: ProductCardVariant;
|
|
26
|
+
productCardHoverVariant: ProductCardHoverVariant;
|
|
27
|
+
productCardLayoutVariant: ProductCardLayoutVariant;
|
|
28
|
+
productCardImageAspectRatio: '3:4' | 'square' | 'none';
|
|
29
|
+
zoomOnHover: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare const productGridVariantClasses: Record<ProductGridVariant, ProductGridVariantClasses>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ProductGrid, productGridVariantClasses };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ProductCardConfig, ProductCardHoverVariant, ProductCardLayoutVariant, ProductCardVariant, ProductGridVariant } from "../index-B5p2z61Y.js";
|
|
2
|
+
import * as react_jsx_runtime22 from "react/jsx-runtime";
|
|
3
|
+
import { SearchResponseProduct } from "@spiffy-ai/commerce-api-client";
|
|
4
|
+
|
|
5
|
+
//#region src/components/ProductGrid/ProductGrid.d.ts
|
|
6
|
+
interface ProductGridProps {
|
|
7
|
+
productList: SearchResponseProduct[];
|
|
8
|
+
productGridVariant: ProductGridVariant;
|
|
9
|
+
productGridClasses: string;
|
|
10
|
+
productCardConfig?: ProductCardConfig;
|
|
11
|
+
merchantShortName: string;
|
|
12
|
+
cardsGrowWithContainer?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const ProductGrid: ({
|
|
15
|
+
productList,
|
|
16
|
+
productGridVariant,
|
|
17
|
+
productGridClasses,
|
|
18
|
+
productCardConfig,
|
|
19
|
+
merchantShortName,
|
|
20
|
+
cardsGrowWithContainer
|
|
21
|
+
}: ProductGridProps) => react_jsx_runtime22.JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/components/ProductGrid/productGridVariants.d.ts
|
|
24
|
+
interface ProductGridVariantClasses {
|
|
25
|
+
productCardVariant: ProductCardVariant;
|
|
26
|
+
productCardHoverVariant: ProductCardHoverVariant;
|
|
27
|
+
productCardLayoutVariant: ProductCardLayoutVariant;
|
|
28
|
+
productCardImageAspectRatio: '3:4' | 'square' | 'none';
|
|
29
|
+
zoomOnHover: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare const productGridVariantClasses: Record<ProductGridVariant, ProductGridVariantClasses>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ProductGrid, productGridVariantClasses };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "../Typography-D3vDkBMS.js";
|
|
2
|
+
import "../ImageWithFallback-Ckwsmd8P.js";
|
|
3
|
+
import "../ProductCard-BIlnM2nV.js";
|
|
4
|
+
import "../Spinner-BqTt55uu.js";
|
|
5
|
+
import { ProductGrid, productGridVariantClasses } from "../ProductGrid-Cgkb4vNf.js";
|
|
6
|
+
|
|
7
|
+
export { ProductGrid, productGridVariantClasses };
|