@envive-ai/react-toolkit 0.1.13 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -12
- package/src/atoms/search/types.ts +1 -5
- package/src/components/Accordion/Accordion.tsx +3 -3
- package/src/components/AnimatedChevron/index.ts +1 -0
- package/src/components/AppliedFiltersScrollbar/AppliedFiltersScrollbar.tsx +2 -2
- package/src/components/ButtonBase/ButtonBase.tsx +2 -2
- package/src/components/DynamicFiltersScrollbar/DynamicFiltersScrollbar.tsx +2 -2
- package/src/components/FilterScrollbar/AppliedFiltersScrollbar.tsx +2 -2
- package/src/components/FilterScrollbar/DynamicFiltersScrollbar.tsx +2 -2
- package/src/components/ProductCard/ProductCard.tsx +10 -9
- package/src/components/RadioButton/RadioButton.tsx +2 -2
- package/src/components/SearchFilter/SearchFilterHeader.tsx +3 -3
- package/src/components/SearchFilter/SearchFilterItem.tsx +2 -2
- package/src/components/SearchFilter/index.ts +4 -2
- package/src/components/SearchInput/SearchInput.tsx +1 -1
- package/src/components/SearchInput/searchInputVariants.ts +3 -3
- package/src/components/SearchInputForm/SearchInputForm.tsx +1 -1
- package/src/components/SearchInputForm/index.ts +1 -1
- package/src/components/SearchResultsStates/NoSearchResultsFound.tsx +3 -3
- package/src/components/SearchResultsStates/SearchResultsLoadingGrid.tsx +2 -2
- package/src/components/TextInput/TextInput.tsx +4 -3
- package/src/components/ToggleButton/ToggleButton.tsx +5 -5
- package/src/components/Typography/Typography.spec.tsx +22 -0
- package/src/components/Typography/Typography.tsx +73 -0
- package/src/components/Typography/index.ts +2 -0
- package/src/components/{Text/textVariantClasses.ts → Typography/typographyVariantClasses.ts} +36 -38
- package/src/components/Typography/util.ts +19 -0
- package/dist/Accordion/index.cjs +0 -6
- package/dist/Accordion/index.d.cts +0 -13
- package/dist/Accordion/index.d.ts +0 -13
- package/dist/Accordion/index.js +0 -6
- package/dist/Accordion-D9gO9_y3.cjs +0 -88
- package/dist/Accordion-ZEdp99Ph.js +0 -77
- package/dist/AppliedFiltersScrollbar/index.cjs +0 -48
- package/dist/AppliedFiltersScrollbar/index.d.cts +0 -22
- package/dist/AppliedFiltersScrollbar/index.d.ts +0 -22
- package/dist/AppliedFiltersScrollbar/index.js +0 -44
- package/dist/ButtonBase/index.cjs +0 -7
- package/dist/ButtonBase/index.d.cts +0 -42
- package/dist/ButtonBase/index.d.ts +0 -42
- package/dist/ButtonBase/index.js +0 -6
- package/dist/ButtonBase-0NN6wmX-.js +0 -1
- package/dist/ButtonBase-BIXx56hq.cjs +0 -0
- package/dist/ButtonBase-DgRupM53.js +0 -60
- package/dist/ButtonBase-DrIwVGTR.cjs +0 -75
- package/dist/DynamicFiltersScrollbar/index.cjs +0 -36
- package/dist/DynamicFiltersScrollbar/index.d.cts +0 -28
- package/dist/DynamicFiltersScrollbar/index.d.ts +0 -28
- package/dist/DynamicFiltersScrollbar/index.js +0 -32
- package/dist/DynamicFiltersScrollbar-B1j53y2q.cjs +0 -81
- package/dist/DynamicFiltersScrollbar-D7WYp6x9.js +0 -66
- package/dist/FilterScrollbar/index.cjs +0 -6
- package/dist/FilterScrollbar/index.d.cts +0 -47
- package/dist/FilterScrollbar/index.d.ts +0 -47
- package/dist/FilterScrollbar/index.js +0 -5
- package/dist/Headline/index.cjs +0 -4
- package/dist/Headline/index.d.cts +0 -21
- package/dist/Headline/index.d.ts +0 -21
- package/dist/Headline/index.js +0 -4
- package/dist/Headline-COv0Jbn8.js +0 -64
- package/dist/Headline-Cp79THVF.cjs +0 -72
- package/dist/ImageWithFallback/index.cjs +0 -3
- package/dist/ImageWithFallback/index.d.cts +0 -26
- package/dist/ImageWithFallback/index.d.ts +0 -26
- package/dist/ImageWithFallback/index.js +0 -3
- package/dist/ImageWithFallback-Cx-KNi-D.cjs +0 -51
- package/dist/ImageWithFallback-DqxjwO3i.js +0 -42
- package/dist/ModalSheet/index.cjs +0 -3
- package/dist/ModalSheet/index.d.cts +0 -38
- package/dist/ModalSheet/index.d.ts +0 -38
- package/dist/ModalSheet/index.js +0 -3
- package/dist/ModalSheet-01pxpy_K.js +0 -326
- package/dist/ModalSheet-Csz8HIxs.cjs +0 -337
- package/dist/ProductCard/index.cjs +0 -17
- package/dist/ProductCard/index.d.cts +0 -2
- package/dist/ProductCard/index.d.ts +0 -2
- package/dist/ProductCard/index.js +0 -8
- package/dist/ProductCard-CNwmHggx.js +0 -255
- package/dist/ProductCard-EmdDy2af.cjs +0 -319
- package/dist/ProductGrid/index.cjs +0 -10
- package/dist/ProductGrid/index.d.cts +0 -33
- package/dist/ProductGrid/index.d.ts +0 -33
- package/dist/ProductGrid/index.js +0 -9
- package/dist/ProductGrid-CMoomZLc.cjs +0 -74
- package/dist/ProductGrid-nmWSp0qX.js +0 -60
- package/dist/RadioButton/index.cjs +0 -6
- package/dist/RadioButton/index.d.cts +0 -32
- package/dist/RadioButton/index.d.ts +0 -32
- package/dist/RadioButton/index.js +0 -6
- package/dist/RadioButton-BdKJRzLM.cjs +0 -84
- package/dist/RadioButton-S5dALI2f.js +0 -75
- package/dist/RadioButtonGroup/index.cjs +0 -8
- package/dist/RadioButtonGroup/index.d.cts +0 -36
- package/dist/RadioButtonGroup/index.d.ts +0 -36
- package/dist/RadioButtonGroup/index.js +0 -7
- package/dist/RadioButtonGroup-BipNsoHL.js +0 -38
- package/dist/RadioButtonGroup-TAJMA1j_.cjs +0 -52
- package/dist/SearchAutocomplete/index.cjs +0 -57
- package/dist/SearchAutocomplete/index.d.cts +0 -13
- package/dist/SearchAutocomplete/index.d.ts +0 -13
- package/dist/SearchAutocomplete/index.js +0 -51
- package/dist/SearchFilter/index.cjs +0 -15
- package/dist/SearchFilter/index.d.cts +0 -77
- package/dist/SearchFilter/index.d.ts +0 -77
- package/dist/SearchFilter/index.js +0 -13
- package/dist/SearchFilter-BcLc0TMq.cjs +0 -289
- package/dist/SearchFilter-w-0s2YVu.js +0 -268
- package/dist/SearchInput/index.cjs +0 -97
- package/dist/SearchInput/index.d.cts +0 -33
- package/dist/SearchInput/index.d.ts +0 -33
- package/dist/SearchInput/index.js +0 -90
- package/dist/SearchInputForm/index.cjs +0 -0
- package/dist/SearchInputForm/index.d.cts +0 -2
- package/dist/SearchInputForm/index.d.ts +0 -2
- package/dist/SearchInputForm/index.js +0 -1
- package/dist/SearchResultsContent/index.cjs +0 -47
- package/dist/SearchResultsContent/index.d.cts +0 -48
- package/dist/SearchResultsContent/index.d.ts +0 -48
- package/dist/SearchResultsContent/index.js +0 -44
- package/dist/SearchResultsFilterSidebar/index.cjs +0 -61
- package/dist/SearchResultsFilterSidebar/index.d.cts +0 -2
- package/dist/SearchResultsFilterSidebar/index.d.ts +0 -2
- package/dist/SearchResultsFilterSidebar/index.js +0 -56
- package/dist/SearchResultsStates/index.cjs +0 -17
- package/dist/SearchResultsStates/index.d.cts +0 -69
- package/dist/SearchResultsStates/index.d.ts +0 -69
- package/dist/SearchResultsStates/index.js +0 -15
- package/dist/SearchResultsStates-DlZz14yy.js +0 -110
- package/dist/SearchResultsStates-DwcPrsdd.cjs +0 -132
- package/dist/SparkleAnimation/index.cjs +0 -4
- package/dist/SparkleAnimation/index.d.cts +0 -23
- package/dist/SparkleAnimation/index.d.ts +0 -23
- package/dist/SparkleAnimation/index.js +0 -3
- package/dist/SparkleAnimation-CvGlWUqv.cjs +0 -101
- package/dist/SparkleAnimation-paLhSu5E.js +0 -84
- package/dist/Spinner/index.cjs +0 -3
- package/dist/Spinner/index.d.cts +0 -11
- package/dist/Spinner/index.d.ts +0 -11
- package/dist/Spinner/index.js +0 -3
- package/dist/Spinner-CjGLIRgs.js +0 -38
- package/dist/Spinner-DFor2Szi.cjs +0 -46
- package/dist/SuggestionButton/index.cjs +0 -188
- package/dist/SuggestionButton/index.d.cts +0 -35
- package/dist/SuggestionButton/index.d.ts +0 -35
- package/dist/SuggestionButton/index.js +0 -180
- package/dist/Text/index.cjs +0 -10
- package/dist/Text/index.d.cts +0 -42
- package/dist/Text/index.d.ts +0 -42
- package/dist/Text/index.js +0 -5
- package/dist/Text-BLzNhX4H.js +0 -42
- package/dist/Text-BMsncrpY.js +0 -10
- package/dist/Text-C8t_iEj6.cjs +0 -16
- package/dist/Text-DllCE9_D.cjs +0 -50
- package/dist/TextInput/index.cjs +0 -4
- package/dist/TextInput/index.d.cts +0 -12
- package/dist/TextInput/index.d.ts +0 -12
- package/dist/TextInput/index.js +0 -4
- package/dist/TextInput-DmsOxxPN.js +0 -31
- package/dist/TextInput-HMW0hxLI.cjs +0 -40
- package/dist/ToggleButton/index.cjs +0 -6
- package/dist/ToggleButton/index.d.cts +0 -30
- package/dist/ToggleButton/index.d.ts +0 -30
- package/dist/ToggleButton/index.js +0 -6
- package/dist/ToggleButton-DblAj4Cd.cjs +0 -68
- package/dist/ToggleButton-r7Y7Kzzo.js +0 -60
- package/dist/chunk-CUT6urMc.cjs +0 -30
- package/dist/colorsConfig-B3-SMUSx.cjs +0 -38
- package/dist/colorsConfig-DZ-GSPWy.js +0 -26
- package/dist/index-BKvXn5sj.d.ts +0 -4
- package/dist/index-Br1B7Jta.d.cts +0 -46
- package/dist/index-DADHwW6M.d.ts +0 -325
- package/dist/index-DDp-fLgm.d.cts +0 -325
- package/dist/index-Dh8rcWev.d.ts +0 -46
- package/dist/index-W1wCDiw_.d.cts +0 -4
- package/dist/searchFilterSidebarVariants-J0FJ8pck.js +0 -34
- package/dist/searchFilterSidebarVariants-kkTjYEIF.cjs +0 -39
- package/dist/textVariantClasses-B0gNjzl4.d.cts +0 -174
- package/dist/textVariantClasses-C8OCWZAw.d.ts +0 -174
- package/dist/textVariantClasses-CBre7vXv.cjs +0 -123
- package/dist/textVariantClasses-CRrTb43V.js +0 -99
- package/src/components/Headline/Headline.tsx +0 -81
- package/src/components/Headline/index.ts +0 -1
- package/src/components/SearchInputForm/types.ts +0 -1
- package/src/components/Text/Text.tsx +0 -58
- package/src/components/Text/index.ts +0 -3
- package/src/components/Text/types.ts +0 -23
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
let framer_motion = require("framer-motion");
|
|
3
|
-
framer_motion = require_chunk.__toESM(framer_motion);
|
|
4
|
-
let react = require("react");
|
|
5
|
-
react = require_chunk.__toESM(react);
|
|
6
|
-
let classnames = require("classnames");
|
|
7
|
-
classnames = require_chunk.__toESM(classnames);
|
|
8
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
-
react_jsx_runtime = require_chunk.__toESM(react_jsx_runtime);
|
|
10
|
-
let __envive_ai_react_hooks_hooks_IsSmallScreen = require("@envive-ai/react-hooks/hooks/IsSmallScreen");
|
|
11
|
-
__envive_ai_react_hooks_hooks_IsSmallScreen = require_chunk.__toESM(__envive_ai_react_hooks_hooks_IsSmallScreen);
|
|
12
|
-
|
|
13
|
-
//#region src/components/AnimatedChevron/AnimatedChevron.tsx
|
|
14
|
-
const AnimatedChevron = ({ animationKey, chevronColor }) => {
|
|
15
|
-
const leftRotation = (0, framer_motion.useTransform)(animationKey, [300, 0], [-12, 0]);
|
|
16
|
-
const rightRotation = (0, framer_motion.useTransform)(animationKey, [300, 0], [12, 0]);
|
|
17
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
18
|
-
style: { display: "flex" },
|
|
19
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, { style: {
|
|
20
|
-
x: 1,
|
|
21
|
-
width: "25px",
|
|
22
|
-
height: "4px",
|
|
23
|
-
background: chevronColor,
|
|
24
|
-
borderRadius: "8px",
|
|
25
|
-
rotate: leftRotation
|
|
26
|
-
} }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, { style: {
|
|
27
|
-
x: -1,
|
|
28
|
-
width: "25px",
|
|
29
|
-
height: "4px",
|
|
30
|
-
background: chevronColor,
|
|
31
|
-
borderRadius: "8px",
|
|
32
|
-
rotate: rightRotation
|
|
33
|
-
} })]
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/components/ModalSheet/mobile/mobileHeader.tsx
|
|
39
|
-
const modalSheetVariants$1 = { primary: {
|
|
40
|
-
"spiffy-tw-bg-[--spiffy-colors-background-primary]": true,
|
|
41
|
-
"spiffy-tw-text-[--spiffy-colors-text-light]": true
|
|
42
|
-
} };
|
|
43
|
-
const ModalSheetMobileHeader = ({ headerVariant = "primary", headerContent, handleHeaderClick, chevronColor }) => {
|
|
44
|
-
const animationKey = (0, framer_motion.useMotionValue)(-1);
|
|
45
|
-
const headerClassName = (0, classnames.default)({
|
|
46
|
-
"spiffy-modal-sheet-header": true,
|
|
47
|
-
"spiffy-tw-flex": true,
|
|
48
|
-
"spiffy-tw-items-center": true,
|
|
49
|
-
"spiffy-tw-justify-between": true,
|
|
50
|
-
"spiffy-tw-w-full": true,
|
|
51
|
-
"spiffy-tw-flex-col": true,
|
|
52
|
-
"spiffy-tw-pt-[16px]": true,
|
|
53
|
-
"spiffy-tw-shadow-[0px_-8px_16px_0px_#0000001A]": true,
|
|
54
|
-
...modalSheetVariants$1[headerVariant]
|
|
55
|
-
});
|
|
56
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.motion.div, {
|
|
57
|
-
className: headerClassName,
|
|
58
|
-
onTouchStart: handleHeaderClick,
|
|
59
|
-
onMouseDown: handleHeaderClick,
|
|
60
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedChevron, {
|
|
61
|
-
animationKey,
|
|
62
|
-
chevronColor
|
|
63
|
-
}), headerContent]
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region src/components/ModalSheet/mobile/index.tsx
|
|
69
|
-
const ModalSheetMobile = ({ children, isOpen, closeModal, mobileFullHeight = 180, animationDuration, headerProps, footerProps }) => {
|
|
70
|
-
const [isHidden, setIsHidden] = (0, react.useState)(isOpen ? "block" : "none");
|
|
71
|
-
const [bottom, setBottom] = (0, react.useState)(isOpen ? 0 : 0 - mobileFullHeight);
|
|
72
|
-
const [overlayOpacity, setOverlayOpacity] = (0, react.useState)(isOpen ? 1 : 0);
|
|
73
|
-
(0, react.useEffect)(() => {
|
|
74
|
-
setIsHidden(isOpen ? "block" : "none");
|
|
75
|
-
setBottom(isOpen ? 0 : 0 - mobileFullHeight);
|
|
76
|
-
setOverlayOpacity(isOpen ? 1 : 0);
|
|
77
|
-
}, [mobileFullHeight, isOpen]);
|
|
78
|
-
const overlayClassNames = (0, classnames.default)({
|
|
79
|
-
"spiffy-modal-sheet-overlay": true,
|
|
80
|
-
"spiffy-tw-fixed": true,
|
|
81
|
-
"spiffy-tw-inset-0": true,
|
|
82
|
-
"spiffy-tw-top-[0]": true,
|
|
83
|
-
"spiffy-tw-bottom-[0]": true,
|
|
84
|
-
"spiffy-tw-left-[0]": true,
|
|
85
|
-
"spiffy-tw-right-[0]": true,
|
|
86
|
-
"spiffy-tw-bg-black/30": true,
|
|
87
|
-
"spiffy-tw-z-[100]": true
|
|
88
|
-
});
|
|
89
|
-
const modalClassNames = (0, classnames.default)({
|
|
90
|
-
"spiffy-modal-sheet": true,
|
|
91
|
-
"spiffy-modal-sheet-open": isOpen,
|
|
92
|
-
"spiffy-tw-w-full": true,
|
|
93
|
-
"spiffy-tw-overflow-y-auto": true,
|
|
94
|
-
"spiffy-tw-shadow-lg": true,
|
|
95
|
-
"spiffy-tw-fixed": true,
|
|
96
|
-
"spiffy-tw-bg-white": true,
|
|
97
|
-
"spiffy-tw-border-box": true,
|
|
98
|
-
"spiffy-tw-rounded-t-[16px]": true,
|
|
99
|
-
"spiffy-tw-h-[89%]": true,
|
|
100
|
-
"spiffy-tw-max-h-[89%]": true
|
|
101
|
-
});
|
|
102
|
-
const contentClassNames = (0, classnames.default)({
|
|
103
|
-
"spiffy-modal-sheet-content": true,
|
|
104
|
-
"spiffy-tw-flex": true,
|
|
105
|
-
"spiffy-tw-flex-col": true,
|
|
106
|
-
"spiffy-tw-w-full": true,
|
|
107
|
-
"spiffy-tw-h-full": true
|
|
108
|
-
});
|
|
109
|
-
const headerClassNames = (0, classnames.default)({
|
|
110
|
-
"spiffy-tw-sticky": true,
|
|
111
|
-
"spiffy-tw-top-[0px]": true,
|
|
112
|
-
"spiffy-tw-flex": true,
|
|
113
|
-
"spiffy-tw-flex-col": true
|
|
114
|
-
});
|
|
115
|
-
const { footerContent, footerClassName } = footerProps || {};
|
|
116
|
-
const footerClassNames = (0, classnames.default)({
|
|
117
|
-
"spiffy-tw-sticky": true,
|
|
118
|
-
"spiffy-tw-bottom-[0px]": true,
|
|
119
|
-
"spiffy-modal-sheet-footer": true,
|
|
120
|
-
"spiffy-tw-flex": true,
|
|
121
|
-
"spiffy-tw-flex-col": true
|
|
122
|
-
}, footerClassName);
|
|
123
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
124
|
-
className: overlayClassNames,
|
|
125
|
-
animate: {
|
|
126
|
-
opacity: overlayOpacity,
|
|
127
|
-
display: isHidden
|
|
128
|
-
},
|
|
129
|
-
onClick: closeModal,
|
|
130
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
131
|
-
role: "dialog",
|
|
132
|
-
className: modalClassNames,
|
|
133
|
-
initial: {
|
|
134
|
-
bottom,
|
|
135
|
-
display: isHidden
|
|
136
|
-
},
|
|
137
|
-
animate: {
|
|
138
|
-
bottom,
|
|
139
|
-
display: isHidden
|
|
140
|
-
},
|
|
141
|
-
exit: {
|
|
142
|
-
bottom,
|
|
143
|
-
display: isHidden
|
|
144
|
-
},
|
|
145
|
-
transition: {
|
|
146
|
-
duration: animationDuration,
|
|
147
|
-
ease: "easeIn"
|
|
148
|
-
},
|
|
149
|
-
onClick: (e) => e.stopPropagation(),
|
|
150
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
151
|
-
className: contentClassNames,
|
|
152
|
-
children: [
|
|
153
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
154
|
-
className: headerClassNames,
|
|
155
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalSheetMobileHeader, {
|
|
156
|
-
headerContent: headerProps.headerContent,
|
|
157
|
-
headerVariant: headerProps?.headerVariant,
|
|
158
|
-
handleHeaderClick: closeModal,
|
|
159
|
-
chevronColor: "#000"
|
|
160
|
-
})
|
|
161
|
-
}),
|
|
162
|
-
children,
|
|
163
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "spiffy-tw-flex-grow" }),
|
|
164
|
-
footerContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
165
|
-
className: footerClassNames,
|
|
166
|
-
children: footerContent
|
|
167
|
-
})
|
|
168
|
-
]
|
|
169
|
-
})
|
|
170
|
-
})
|
|
171
|
-
}) });
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
//#endregion
|
|
175
|
-
//#region src/components/ModalSheet/desktop/desktopHeader.tsx
|
|
176
|
-
const modalSheetVariants = { primary: {
|
|
177
|
-
"spiffy-tw-bg-[--spiffy-colors-background-primary]": true,
|
|
178
|
-
"spiffy-tw-text-[--spiffy-colors-text-light]": true
|
|
179
|
-
} };
|
|
180
|
-
const ModalSheetDesktopHeader = ({ headerVariant = "primary", headerContent }) => {
|
|
181
|
-
const headerStyles = (0, classnames.default)({
|
|
182
|
-
"spiffy-modal-sheet-header": true,
|
|
183
|
-
"spiffy-tw-flex": true,
|
|
184
|
-
"spiffy-tw-items-center": true,
|
|
185
|
-
"spiffy-tw-justify-between": true,
|
|
186
|
-
"spiffy-tw-w-full": true,
|
|
187
|
-
...modalSheetVariants[headerVariant]
|
|
188
|
-
});
|
|
189
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
190
|
-
className: headerStyles,
|
|
191
|
-
children: headerContent
|
|
192
|
-
});
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
//#endregion
|
|
196
|
-
//#region src/components/ModalSheet/desktop/index.tsx
|
|
197
|
-
const ModalSheetDesktop = ({ children, isOpen, closeModal, desktopWidth = 512, animationDuration, headerProps, footerProps, showOverlay = false }) => {
|
|
198
|
-
const [isHidden, setIsHidden] = (0, react.useState)(isOpen ? "block" : "none");
|
|
199
|
-
const [right, setRight] = (0, react.useState)(isOpen ? 0 : 0 - desktopWidth);
|
|
200
|
-
const [overlayOpacity, setOverlayOpacity] = (0, react.useState)(0);
|
|
201
|
-
(0, react.useEffect)(() => {
|
|
202
|
-
setIsHidden(isOpen ? "block" : "none");
|
|
203
|
-
setRight(isOpen ? 0 : 0 - desktopWidth);
|
|
204
|
-
setOverlayOpacity(isOpen ? 1 : 0);
|
|
205
|
-
}, [desktopWidth, isOpen]);
|
|
206
|
-
const overlayClassNames = (0, classnames.default)({
|
|
207
|
-
"spiffy-modal-sheet-overlay": true,
|
|
208
|
-
"spiffy-tw-fixed": true,
|
|
209
|
-
"spiffy-tw-inset-0": true,
|
|
210
|
-
"spiffy-tw-top-[0]": true,
|
|
211
|
-
"spiffy-tw-bottom-[0]": true,
|
|
212
|
-
"spiffy-tw-left-[0]": true,
|
|
213
|
-
"spiffy-tw-right-[0]": true,
|
|
214
|
-
"spiffy-tw-z-[2147483647]": true,
|
|
215
|
-
"spiffy-tw-bg-black/30": showOverlay
|
|
216
|
-
});
|
|
217
|
-
const modalClassNames = (0, classnames.default)({
|
|
218
|
-
"spiffy-modal-sheet": true,
|
|
219
|
-
"spiffy-modal-sheet-open": isOpen,
|
|
220
|
-
"spiffy-tw-max-h-full": true,
|
|
221
|
-
"spiffy-tw-h-screen": true,
|
|
222
|
-
"spiffy-tw-w-[512px]": true,
|
|
223
|
-
"spiffy-tw-shadow-lg": true,
|
|
224
|
-
"spiffy-tw-top-[0]": true,
|
|
225
|
-
"spiffy-tw-bottom-[0]": true,
|
|
226
|
-
"spiffy-tw-fixed": true,
|
|
227
|
-
"spiffy-tw-bg-white": true,
|
|
228
|
-
"spiffy-tw-border-box": true
|
|
229
|
-
});
|
|
230
|
-
const contentClassNames = (0, classnames.default)({
|
|
231
|
-
"spiffy-modal-sheet-content": true,
|
|
232
|
-
"spiffy-tw-overflow-y-auto": true,
|
|
233
|
-
"spiffy-tw-overflow-x-hidden": true,
|
|
234
|
-
"spiffy-tw-flex": true,
|
|
235
|
-
"spiffy-tw-flex-col": true,
|
|
236
|
-
"spiffy-tw-h-full": true,
|
|
237
|
-
"spiffy-tw-w-full": true
|
|
238
|
-
});
|
|
239
|
-
const headerClassNames = (0, classnames.default)({
|
|
240
|
-
"spiffy-tw-sticky": true,
|
|
241
|
-
"spiffy-tw-top-0": true,
|
|
242
|
-
"spiffy-tw-flex": true,
|
|
243
|
-
"spiffy-tw-flex-col": true
|
|
244
|
-
});
|
|
245
|
-
const { footerContent, footerClassName } = footerProps || {};
|
|
246
|
-
const footerClassNames = (0, classnames.default)({
|
|
247
|
-
"spiffy-tw-sticky": true,
|
|
248
|
-
"spiffy-tw-bottom-0": true,
|
|
249
|
-
"spiffy-modal-sheet-footer": true,
|
|
250
|
-
"spiffy-tw-flex": true,
|
|
251
|
-
"spiffy-tw-flex-col": true
|
|
252
|
-
}, footerClassName);
|
|
253
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
254
|
-
className: overlayClassNames,
|
|
255
|
-
initial: {
|
|
256
|
-
opacity: 0,
|
|
257
|
-
display: "none"
|
|
258
|
-
},
|
|
259
|
-
animate: {
|
|
260
|
-
opacity: overlayOpacity,
|
|
261
|
-
display: isHidden
|
|
262
|
-
},
|
|
263
|
-
onClick: closeModal,
|
|
264
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
265
|
-
role: "dialog",
|
|
266
|
-
className: modalClassNames,
|
|
267
|
-
initial: {
|
|
268
|
-
right,
|
|
269
|
-
display: isHidden
|
|
270
|
-
},
|
|
271
|
-
animate: {
|
|
272
|
-
right,
|
|
273
|
-
display: isHidden
|
|
274
|
-
},
|
|
275
|
-
exit: {
|
|
276
|
-
right,
|
|
277
|
-
display: isHidden
|
|
278
|
-
},
|
|
279
|
-
transition: {
|
|
280
|
-
duration: animationDuration,
|
|
281
|
-
ease: "easeIn"
|
|
282
|
-
},
|
|
283
|
-
style: { width: desktopWidth },
|
|
284
|
-
onClick: (e) => e.stopPropagation(),
|
|
285
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
286
|
-
className: contentClassNames,
|
|
287
|
-
children: [
|
|
288
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
289
|
-
className: headerClassNames,
|
|
290
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalSheetDesktopHeader, {
|
|
291
|
-
headerContent: headerProps.headerContent,
|
|
292
|
-
headerVariant: headerProps?.headerVariant,
|
|
293
|
-
chevronColor: "#000"
|
|
294
|
-
})
|
|
295
|
-
}),
|
|
296
|
-
children,
|
|
297
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "spiffy-tw-flex-grow" }),
|
|
298
|
-
footerContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
299
|
-
className: footerClassNames,
|
|
300
|
-
children: footerContent
|
|
301
|
-
})
|
|
302
|
-
]
|
|
303
|
-
})
|
|
304
|
-
})
|
|
305
|
-
}) });
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
//#endregion
|
|
309
|
-
//#region src/components/ModalSheet/ModalSheet.tsx
|
|
310
|
-
const ANIMATION_DURATION = .3;
|
|
311
|
-
const ModalSheet = ({ children, isOpen, closeModal, animationDuration = ANIMATION_DURATION, desktopWidth = 512, headerProps, footerProps }) => {
|
|
312
|
-
return (0, __envive_ai_react_hooks_hooks_IsSmallScreen.useIsSmallScreen)() ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalSheetMobile, {
|
|
313
|
-
isOpen,
|
|
314
|
-
closeModal,
|
|
315
|
-
desktopWidth,
|
|
316
|
-
animationDuration,
|
|
317
|
-
headerProps,
|
|
318
|
-
footerProps,
|
|
319
|
-
children
|
|
320
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalSheetDesktop, {
|
|
321
|
-
isOpen,
|
|
322
|
-
closeModal,
|
|
323
|
-
desktopWidth,
|
|
324
|
-
animationDuration,
|
|
325
|
-
headerProps,
|
|
326
|
-
footerProps,
|
|
327
|
-
children
|
|
328
|
-
});
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
//#endregion
|
|
332
|
-
Object.defineProperty(exports, 'ModalSheet', {
|
|
333
|
-
enumerable: true,
|
|
334
|
-
get: function () {
|
|
335
|
-
return ModalSheet;
|
|
336
|
-
}
|
|
337
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
require('../textVariantClasses-CBre7vXv.cjs');
|
|
2
|
-
require('../Text-DllCE9_D.cjs');
|
|
3
|
-
require('../Headline-Cp79THVF.cjs');
|
|
4
|
-
require('../ImageWithFallback-Cx-KNi-D.cjs');
|
|
5
|
-
const require_ProductCard = require('../ProductCard-EmdDy2af.cjs');
|
|
6
|
-
require('../Spinner-DFor2Szi.cjs');
|
|
7
|
-
|
|
8
|
-
exports.AnimatedProductCardOverrides = require_ProductCard.AnimatedProductCardOverrides;
|
|
9
|
-
exports.PriceSection = require_ProductCard.PriceSection;
|
|
10
|
-
exports.ProductCard = require_ProductCard.ProductCard;
|
|
11
|
-
exports.ProductCardSkeleton = require_ProductCard.ProductCardSkeleton;
|
|
12
|
-
exports.ProductCardSkeletonOverrides = require_ProductCard.ProductCardSkeletonOverrides;
|
|
13
|
-
exports.RatingSummary = require_ProductCard.RatingSummary;
|
|
14
|
-
exports.productCardLayoutVariantClasses = require_ProductCard.productCardLayoutVariantClasses;
|
|
15
|
-
exports.variantClassMap = require_ProductCard.variantClassMap;
|
|
16
|
-
exports.variantHoverClassMap = require_ProductCard.variantHoverClassMap;
|
|
17
|
-
exports.variantTitleColorMap = require_ProductCard.variantTitleColorMap;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { AnimatedProductCardOverrides, PriceSection, ProductCard, ProductCardConfig, ProductCardHoverVariant, ProductCardImageAspectRatio, ProductCardLayoutVariant, ProductCardSkeleton, ProductCardSkeletonOverrides, ProductCardSkeletonProps, ProductCardVariant, ProductGridProps, ProductGridVariant, RatingSummary, RatingSummaryProps, SearchResponseProductAttributes, productCardLayoutVariantClasses, variantClassMap, variantHoverClassMap, variantTitleColorMap } from "../index-DDp-fLgm.cjs";
|
|
2
|
-
export { AnimatedProductCardOverrides, PriceSection, ProductCard, ProductCardConfig, ProductCardHoverVariant, ProductCardImageAspectRatio, ProductCardLayoutVariant, ProductCardSkeleton, ProductCardSkeletonOverrides, ProductCardSkeletonProps, ProductCardVariant, ProductGridProps, ProductGridVariant, RatingSummary, RatingSummaryProps, SearchResponseProductAttributes, productCardLayoutVariantClasses, variantClassMap, variantHoverClassMap, variantTitleColorMap };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { AnimatedProductCardOverrides, PriceSection, ProductCard, ProductCardConfig, ProductCardHoverVariant, ProductCardImageAspectRatio, ProductCardLayoutVariant, ProductCardSkeleton, ProductCardSkeletonOverrides, ProductCardSkeletonProps, ProductCardVariant, ProductGridProps, ProductGridVariant, RatingSummary, RatingSummaryProps, SearchResponseProductAttributes, productCardLayoutVariantClasses, variantClassMap, variantHoverClassMap, variantTitleColorMap } from "../index-DADHwW6M.js";
|
|
2
|
-
export { AnimatedProductCardOverrides, PriceSection, ProductCard, ProductCardConfig, ProductCardHoverVariant, ProductCardImageAspectRatio, ProductCardLayoutVariant, ProductCardSkeleton, ProductCardSkeletonOverrides, ProductCardSkeletonProps, ProductCardVariant, ProductGridProps, ProductGridVariant, RatingSummary, RatingSummaryProps, SearchResponseProductAttributes, productCardLayoutVariantClasses, variantClassMap, variantHoverClassMap, variantTitleColorMap };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "../textVariantClasses-CRrTb43V.js";
|
|
2
|
-
import "../Text-BLzNhX4H.js";
|
|
3
|
-
import "../Headline-COv0Jbn8.js";
|
|
4
|
-
import "../ImageWithFallback-DqxjwO3i.js";
|
|
5
|
-
import { AnimatedProductCardOverrides, PriceSection, ProductCard, ProductCardSkeleton, ProductCardSkeletonOverrides, RatingSummary, productCardLayoutVariantClasses, variantClassMap, variantHoverClassMap, variantTitleColorMap } from "../ProductCard-CNwmHggx.js";
|
|
6
|
-
import "../Spinner-CjGLIRgs.js";
|
|
7
|
-
|
|
8
|
-
export { AnimatedProductCardOverrides, PriceSection, ProductCard, ProductCardSkeleton, ProductCardSkeletonOverrides, RatingSummary, productCardLayoutVariantClasses, variantClassMap, variantHoverClassMap, variantTitleColorMap };
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import { Text } from "./Text-BLzNhX4H.js";
|
|
2
|
-
import { Headline } from "./Headline-COv0Jbn8.js";
|
|
3
|
-
import { ImageWithFallback } from "./ImageWithFallback-DqxjwO3i.js";
|
|
4
|
-
import { Spinner } from "./Spinner-CjGLIRgs.js";
|
|
5
|
-
import classNames from "classnames";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { MdStar } from "react-icons/md";
|
|
8
|
-
import { useImageResolver } from "@envive-ai/react-hooks/hooks/ImageResolver";
|
|
9
|
-
|
|
10
|
-
//#region src/logging/logger.ts
|
|
11
|
-
var Logger = class {
|
|
12
|
-
static logInfo(message, ...args) {
|
|
13
|
-
console.info(`INFO: ${message}`, ...args);
|
|
14
|
-
}
|
|
15
|
-
static logDebug(message, ...args) {
|
|
16
|
-
console.debug(`DEBUG: ${message}`, ...args);
|
|
17
|
-
}
|
|
18
|
-
static logError(message, error, ...args) {
|
|
19
|
-
console.error(`ERROR: ${message} error=${error}`, args);
|
|
20
|
-
}
|
|
21
|
-
static logWarn(message, error, ...args) {
|
|
22
|
-
console.warn(`WARN: ${message} error=${error}`, args);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
var logger_default = Logger;
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/util/formatPrice.ts
|
|
29
|
-
const formatPrice = (price, currency = "$") => {
|
|
30
|
-
if (price == null) return "";
|
|
31
|
-
const options = {};
|
|
32
|
-
if (!Number.isInteger(price)) {
|
|
33
|
-
options.minimumFractionDigits = 2;
|
|
34
|
-
options.maximumFractionDigits = 2;
|
|
35
|
-
}
|
|
36
|
-
return `${currency}${price.toLocaleString("en-US", options)}`;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region src/components/ProductCard/productCardVariants.ts
|
|
41
|
-
/**
|
|
42
|
-
* Shared variant mapping configurations for ProductCard components
|
|
43
|
-
*/
|
|
44
|
-
const variantClassMap = new Map([
|
|
45
|
-
["filled", ["spiffy-tw-bg-[--spiffy-colors-background-secondary]", "spiffy-tw-shadow-md"]],
|
|
46
|
-
["bordered", [
|
|
47
|
-
"spiffy-tw-bg-[--spiffy-colors-background-secondary]",
|
|
48
|
-
"spiffy-tw-border",
|
|
49
|
-
"spiffy-tw-border-[--spiffy-colors-border-light]"
|
|
50
|
-
]],
|
|
51
|
-
["minimal", ["spiffy-tw-bg-transparent"]],
|
|
52
|
-
["transparentBordered", [
|
|
53
|
-
"spiffy-tw-bg-transparent",
|
|
54
|
-
"spiffy-tw-border",
|
|
55
|
-
"spiffy-tw-border-[--spiffy-colors-border-light]"
|
|
56
|
-
]]
|
|
57
|
-
]);
|
|
58
|
-
const variantHoverClassMap = new Map([["backgroundDark", ["hover:spiffy-tw-bg-[--spiffy-colors-background-secondary-dark]"]], ["none", []]]);
|
|
59
|
-
const variantTitleColorMap = new Map([
|
|
60
|
-
["filled", "spiffy-tw-text-[--spiffy-colors-text-link]"],
|
|
61
|
-
["bordered", "spiffy-tw-text-[--spiffy-colors-text-primary]"],
|
|
62
|
-
["minimal", "spiffy-tw-text-[--spiffy-colors-text-primary]"],
|
|
63
|
-
["transparentBordered", "spiffy-tw-text-[--spiffy-colors-text-primary]"]
|
|
64
|
-
]);
|
|
65
|
-
const productCardLayoutVariantClasses = {
|
|
66
|
-
normal: {
|
|
67
|
-
productTitle: ["spiffy-product-card-title"],
|
|
68
|
-
container: ["spiffy-tw-w-[208px]"],
|
|
69
|
-
verticalContainer: ["spiffy-tw-rounded-[8px]", "spiffy-tw-h-[268px]"]
|
|
70
|
-
},
|
|
71
|
-
tall: {
|
|
72
|
-
productTitle: ["spiffy-product-card-title-tall", "spiffy-tw-pt-[8px]"],
|
|
73
|
-
container: ["spiffy-tw-w-[160px] lg:spiffy-tw-w-[300px]"],
|
|
74
|
-
verticalContainer: ["lg:spiffy-tw-h-[496px]"]
|
|
75
|
-
},
|
|
76
|
-
square: {
|
|
77
|
-
productTitle: ["spiffy-product-card-title-tall", "spiffy-tw-pt-[8px]"],
|
|
78
|
-
container: ["spiffy-tw-w-[160px] lg:spiffy-tw-w-[280px]"],
|
|
79
|
-
verticalContainer: ["lg:spiffy-tw-h-[400px]"]
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/components/ProductCard/ProductCard.tsx
|
|
85
|
-
const formatReviews = (stars) => String(Number(stars).toLocaleString("en-US", {
|
|
86
|
-
minimumFractionDigits: 1,
|
|
87
|
-
maximumFractionDigits: 1
|
|
88
|
-
}));
|
|
89
|
-
const RatingSummary = ({ stars, reviewCount, className }) => {
|
|
90
|
-
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]");
|
|
91
|
-
const starClassnames = classNames("spiffy-product-card-rating-star-color", "spiffy-tw-fill-[--spiffy-colors-accent-primary]", "spiffy-tw-w-[14px]", "spiffy-tw-h-[14px]");
|
|
92
|
-
return /* @__PURE__ */ jsx("div", {
|
|
93
|
-
className,
|
|
94
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
95
|
-
className: group,
|
|
96
|
-
children: [
|
|
97
|
-
/* @__PURE__ */ jsx(MdStar, { className: starClassnames }),
|
|
98
|
-
/* @__PURE__ */ jsx(Text, {
|
|
99
|
-
variant: "body3",
|
|
100
|
-
children: formatReviews(stars)
|
|
101
|
-
}),
|
|
102
|
-
/* @__PURE__ */ jsxs(Text, {
|
|
103
|
-
variant: "body3",
|
|
104
|
-
children: [
|
|
105
|
-
"(",
|
|
106
|
-
reviewCount,
|
|
107
|
-
")"
|
|
108
|
-
]
|
|
109
|
-
})
|
|
110
|
-
]
|
|
111
|
-
})
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
const PriceSection = ({ originalPrice, salePrice, pricePrefix }) => {
|
|
115
|
-
if (!originalPrice) return null;
|
|
116
|
-
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]");
|
|
117
|
-
const showSalePrice = salePrice && originalPrice !== salePrice;
|
|
118
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
119
|
-
className: priceClassName,
|
|
120
|
-
children: [
|
|
121
|
-
pricePrefix && /* @__PURE__ */ jsx(Text, { children: pricePrefix }),
|
|
122
|
-
showSalePrice && /* @__PURE__ */ jsx(Text, { children: salePrice }),
|
|
123
|
-
/* @__PURE__ */ jsx(Text, {
|
|
124
|
-
className: showSalePrice ? "spiffy-tw-line-through" : "",
|
|
125
|
-
children: originalPrice
|
|
126
|
-
})
|
|
127
|
-
]
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
const ProductCard = ({ productCardConfig, merchantShortName, imageUrl, title, url, originalPrice, averageRating, numberReviews, salePrice, variant, hoverVariant, dataTestId, layoutVariant = "normal", zoomOnHover = false, aspectRatio = "none", growWithContainer = false, handleClick }) => {
|
|
131
|
-
const { resolve } = useImageResolver();
|
|
132
|
-
const finalVariant = variant ?? productCardConfig?.variant ?? "filled";
|
|
133
|
-
const finalHoverVariant = hoverVariant ?? productCardConfig?.hoverVariant ?? "backgroundDark";
|
|
134
|
-
const finalLayoutVariant = layoutVariant ?? productCardConfig?.layoutVariant ?? "normal";
|
|
135
|
-
const pricePrefix = productCardConfig?.pricePrefix;
|
|
136
|
-
if (productCardConfig == null) {
|
|
137
|
-
logger_default.logError("[ProductCard] productCardConfig is null", void 0, { merchant: merchantShortName });
|
|
138
|
-
return null;
|
|
139
|
-
}
|
|
140
|
-
const layoutClasses = productCardLayoutVariantClasses[finalLayoutVariant];
|
|
141
|
-
const containerClassnames = classNames("spiffy-tw-cursor-pointer", "spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-inherit", "spiffy-tw-overflow-hidden", {
|
|
142
|
-
"spiffy-tw-h-full": growWithContainer,
|
|
143
|
-
"spiffy-tw-w-full": growWithContainer,
|
|
144
|
-
"spiffy-tw-max-w-full": growWithContainer
|
|
145
|
-
}, !growWithContainer && layoutClasses.container, variantClassMap.get(finalVariant) ?? [], variantHoverClassMap.get(finalHoverVariant) ?? []);
|
|
146
|
-
const verticalContainerVariantClasses = productCardLayoutVariantClasses[layoutVariant].verticalContainer;
|
|
147
|
-
const verticalContainerClassnames = classNames("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-overflow-hidden", "spiffy-tw-gap-inherit", {
|
|
148
|
-
"spiffy-tw-h-full": growWithContainer,
|
|
149
|
-
"spiffy-tw-w-full": growWithContainer,
|
|
150
|
-
"spiffy-tw-flex-1": growWithContainer
|
|
151
|
-
}, ...!growWithContainer && layoutVariant ? verticalContainerVariantClasses : []);
|
|
152
|
-
const linkClassnames = classNames({
|
|
153
|
-
"spiffy-tw-w-full": true,
|
|
154
|
-
"spiffy-tw-h-full": true,
|
|
155
|
-
"spiffy-tw-overflow-hidden": true,
|
|
156
|
-
"spiffy-tw-select-none": true
|
|
157
|
-
});
|
|
158
|
-
const imageClipContainerClassnames = classNames("spiffy-tw-w-full", "spiffy-tw-overflow-hidden", {
|
|
159
|
-
"spiffy-tw-flex-shrink-0": growWithContainer,
|
|
160
|
-
"spiffy-tw-tw-h-full": !growWithContainer
|
|
161
|
-
}, aspectRatio === "3:4" ? "spiffy-tw-aspect-[3/4]" : "", aspectRatio === "square" ? "spiffy-tw-aspect-square" : "");
|
|
162
|
-
const imageContainerClassnames = classNames(linkClassnames, zoomOnHover ? [
|
|
163
|
-
"spiffy-tw-transition-transform",
|
|
164
|
-
"spiffy-tw-duration-200",
|
|
165
|
-
"spiffy-tw-origin-top",
|
|
166
|
-
"hover:spiffy-tw-scale-105"
|
|
167
|
-
] : []);
|
|
168
|
-
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" });
|
|
169
|
-
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);
|
|
170
|
-
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");
|
|
171
|
-
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");
|
|
172
|
-
return /* @__PURE__ */ jsx("div", {
|
|
173
|
-
className: containerClassnames,
|
|
174
|
-
"data-testid": dataTestId,
|
|
175
|
-
children: /* @__PURE__ */ jsx("a", {
|
|
176
|
-
href: url,
|
|
177
|
-
onClick: () => handleClick(url),
|
|
178
|
-
target: "_self",
|
|
179
|
-
draggable: false,
|
|
180
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
181
|
-
className: verticalContainerClassnames,
|
|
182
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
183
|
-
className: imageClipContainerClassnames,
|
|
184
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
185
|
-
className: imageContainerClassnames,
|
|
186
|
-
children: imageUrl && /* @__PURE__ */ jsx(ImageWithFallback, {
|
|
187
|
-
src: resolve(imageUrl, layoutVariant === "tall" ? 300 : 178),
|
|
188
|
-
alt: title,
|
|
189
|
-
fallback: /* @__PURE__ */ jsx(Spinner, { className: "spiffy-tw-w-6 spiffy-tw-h-6" }),
|
|
190
|
-
imageClassnames
|
|
191
|
-
})
|
|
192
|
-
})
|
|
193
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
194
|
-
className: contentClassnames,
|
|
195
|
-
children: [/* @__PURE__ */ jsx(Headline, {
|
|
196
|
-
variant: "h4",
|
|
197
|
-
className: productTitleClassnames,
|
|
198
|
-
children: title
|
|
199
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
200
|
-
className: priceAndRatingContainerClassnames,
|
|
201
|
-
children: [(originalPrice || salePrice) && /* @__PURE__ */ jsx(PriceSection, {
|
|
202
|
-
originalPrice: formatPrice(originalPrice),
|
|
203
|
-
salePrice: formatPrice(salePrice),
|
|
204
|
-
pricePrefix
|
|
205
|
-
}), averageRating && numberReviews && /* @__PURE__ */ jsx(RatingSummary, {
|
|
206
|
-
stars: averageRating,
|
|
207
|
-
reviewCount: numberReviews
|
|
208
|
-
})]
|
|
209
|
-
})]
|
|
210
|
-
})]
|
|
211
|
-
})
|
|
212
|
-
})
|
|
213
|
-
});
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
//#endregion
|
|
217
|
-
//#region src/components/ProductCard/types.ts
|
|
218
|
-
let ProductCardSkeletonOverrides = /* @__PURE__ */ function(ProductCardSkeletonOverrides$1) {
|
|
219
|
-
ProductCardSkeletonOverrides$1["PRODUCT_CARD_SKELETON_CONTAINER"] = "spiffy-product-card-skeleton-container";
|
|
220
|
-
ProductCardSkeletonOverrides$1["PRODUCT_CARD_SKELETON"] = "spiffy-product-card-skeleton";
|
|
221
|
-
return ProductCardSkeletonOverrides$1;
|
|
222
|
-
}({});
|
|
223
|
-
let AnimatedProductCardOverrides = /* @__PURE__ */ function(AnimatedProductCardOverrides$1) {
|
|
224
|
-
AnimatedProductCardOverrides$1["PRODUCT_CARD_ANIMATED_CONTAINER"] = "spiffy-product-card-animated-container";
|
|
225
|
-
AnimatedProductCardOverrides$1["PRODUCT_CARD_ANIMATED_IMAGE_CONTAINER"] = "spiffy-product-card-animated";
|
|
226
|
-
return AnimatedProductCardOverrides$1;
|
|
227
|
-
}({});
|
|
228
|
-
|
|
229
|
-
//#endregion
|
|
230
|
-
//#region src/components/ProductCard/ProductCardSkeleton.tsx
|
|
231
|
-
const ProductCardSkeleton = ({ layoutVariant, aspectRatio, growWithContainer = false }) => {
|
|
232
|
-
const layoutClasses = productCardLayoutVariantClasses[layoutVariant || "normal"];
|
|
233
|
-
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 : "");
|
|
234
|
-
const verticalContainerClasses = classNames("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-overflow-hidden", "spiffy-tw-gap-inherit", !growWithContainer ? layoutClasses.verticalContainer : "");
|
|
235
|
-
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");
|
|
236
|
-
const imageSkeletonClasses = classNames("spiffy-tw-bg-[#F4F4F6]", "spiffy-tw-animate-pulse", "spiffy-tw-opacity-70", "spiffy-tw-w-full", "spiffy-tw-h-full");
|
|
237
|
-
const contentContainerClasses = classNames("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-2", "spiffy-tw-w-full", "spiffy-tw-p-2");
|
|
238
|
-
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]");
|
|
239
|
-
return /* @__PURE__ */ jsx("div", {
|
|
240
|
-
className: containerClasses,
|
|
241
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
242
|
-
className: verticalContainerClasses,
|
|
243
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
244
|
-
className: imageClipContainerClasses,
|
|
245
|
-
children: /* @__PURE__ */ jsx("div", { className: imageSkeletonClasses })
|
|
246
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
247
|
-
className: contentContainerClasses,
|
|
248
|
-
children: [/* @__PURE__ */ jsx("div", { className: classNames(textSkeletonClasses, "spiffy-tw-w-full") }), /* @__PURE__ */ jsx("div", { className: classNames(textSkeletonClasses, "spiffy-tw-w-[60%]") })]
|
|
249
|
-
})]
|
|
250
|
-
})
|
|
251
|
-
});
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
//#endregion
|
|
255
|
-
export { AnimatedProductCardOverrides, PriceSection, ProductCard, ProductCardSkeleton, ProductCardSkeletonOverrides, RatingSummary, productCardLayoutVariantClasses, variantClassMap, variantHoverClassMap, variantTitleColorMap };
|