@envive-ai/react-toolkit 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/dist/AppliedFiltersScrollbar-BlcyhZkZ.cjs +53 -0
  2. package/dist/AppliedFiltersScrollbar-DFGzRemu.js +44 -0
  3. package/dist/ButtonBase-C1rsL9gO.js +60 -0
  4. package/dist/ButtonBase-a8uj6c2f.cjs +69 -0
  5. package/dist/DynamicFiltersScrollbar-B2Rr1KnJ.cjs +41 -0
  6. package/dist/DynamicFiltersScrollbar-Dys6geP0.js +32 -0
  7. package/dist/Headline-L7w3BsBF.cjs +72 -0
  8. package/dist/Headline-ro_Nigw5.js +64 -0
  9. package/dist/ImageWithFallback-CfmkC58B.js +42 -0
  10. package/dist/ImageWithFallback-P3AjyL2Y.cjs +51 -0
  11. package/dist/ProductCard-Btg8tHGc.js +172 -0
  12. package/dist/ProductCard-CS6DZAwO.cjs +193 -0
  13. package/dist/ProductCardSkeleton-BPfp6IOp.js +38 -0
  14. package/dist/ProductCardSkeleton-BgvDlaty.cjs +46 -0
  15. package/dist/ProductGrid-B7QZfW-v.cjs +77 -0
  16. package/dist/ProductGrid-DB_Uq5F-.js +69 -0
  17. package/dist/SearchAutocomplete-C5FL82xC.js +51 -0
  18. package/dist/SearchAutocomplete-wr18dJ8L.cjs +62 -0
  19. package/dist/SearchFilter-D-2IdBKS.js +62 -0
  20. package/dist/SearchFilter-D0IzBlG5.cjs +70 -0
  21. package/dist/SearchFilterHeader-BQT0-ssS.js +37 -0
  22. package/dist/SearchFilterHeader-C3EklfoO.cjs +45 -0
  23. package/dist/SearchFilterItem-BodtWLoP.js +26 -0
  24. package/dist/SearchFilterItem-DmMkiqNC.cjs +34 -0
  25. package/dist/SearchInput-BrcAgcvI.js +89 -0
  26. package/dist/SearchInput-DSB9CwIq.cjs +106 -0
  27. package/dist/SparkleAnimation-BpLwrEqM.cjs +96 -0
  28. package/dist/SparkleAnimation-CXs58sFd.js +85 -0
  29. package/dist/Spinner-BZ-kTOpm.js +38 -0
  30. package/dist/Spinner-CfQ85Ajl.cjs +46 -0
  31. package/dist/Text-Bdv7F5-u.js +42 -0
  32. package/dist/Text-C04c4Z93.cjs +50 -0
  33. package/dist/TextInput-BO80ixsV.cjs +40 -0
  34. package/dist/TextInput-CEGWfdPC.js +31 -0
  35. package/dist/chunk-CUT6urMc.cjs +30 -0
  36. package/dist/colorsConfig-TCONYTQ7.cjs +38 -0
  37. package/dist/colorsConfig-l0ODUVhu.js +26 -0
  38. package/dist/common/ButtonBase/ButtonBase.cjs +5 -0
  39. package/dist/common/ButtonBase/ButtonBase.d.cts +35 -0
  40. package/dist/common/ButtonBase/ButtonBase.d.ts +35 -0
  41. package/dist/common/ButtonBase/ButtonBase.js +5 -0
  42. package/dist/common/Headline/Headline.cjs +4 -0
  43. package/dist/common/Headline/Headline.d.cts +21 -0
  44. package/dist/common/Headline/Headline.d.ts +21 -0
  45. package/dist/common/Headline/Headline.js +4 -0
  46. package/dist/common/ImageWithFallback/ImageWithFallback.cjs +3 -0
  47. package/dist/common/ImageWithFallback/ImageWithFallback.d.cts +26 -0
  48. package/dist/common/ImageWithFallback/ImageWithFallback.d.ts +26 -0
  49. package/dist/common/ImageWithFallback/ImageWithFallback.js +3 -0
  50. package/dist/common/ProductCard/ProductCard.cjs +11 -0
  51. package/dist/common/ProductCard/ProductCard.d.cts +91 -0
  52. package/dist/common/ProductCard/ProductCard.d.ts +91 -0
  53. package/dist/common/ProductCard/ProductCard.js +9 -0
  54. package/dist/common/ProductCard/ProductCardSkeleton.cjs +4 -0
  55. package/dist/common/ProductCard/ProductCardSkeleton.d.cts +12 -0
  56. package/dist/common/ProductCard/ProductCardSkeleton.d.ts +12 -0
  57. package/dist/common/ProductCard/ProductCardSkeleton.js +4 -0
  58. package/dist/common/ProductGrid/ProductGrid.cjs +11 -0
  59. package/dist/common/ProductGrid/ProductGrid.d.cts +26 -0
  60. package/dist/common/ProductGrid/ProductGrid.d.ts +26 -0
  61. package/dist/common/ProductGrid/ProductGrid.js +11 -0
  62. package/dist/common/SparkleAnimation/SparkleAnimation.cjs +3 -0
  63. package/dist/common/SparkleAnimation/SparkleAnimation.d.cts +15 -0
  64. package/dist/common/SparkleAnimation/SparkleAnimation.d.ts +15 -0
  65. package/dist/common/SparkleAnimation/SparkleAnimation.js +3 -0
  66. package/dist/common/Spinner/Spinner.cjs +3 -0
  67. package/dist/common/Spinner/Spinner.d.cts +11 -0
  68. package/dist/common/Spinner/Spinner.d.ts +11 -0
  69. package/dist/common/Spinner/Spinner.js +3 -0
  70. package/dist/common/SuggestionButton/SuggestionButton.cjs +188 -0
  71. package/dist/common/SuggestionButton/SuggestionButton.d.cts +35 -0
  72. package/dist/common/SuggestionButton/SuggestionButton.d.ts +35 -0
  73. package/dist/common/SuggestionButton/SuggestionButton.js +180 -0
  74. package/dist/common/Text/Text.cjs +4 -0
  75. package/dist/common/Text/Text.d.cts +28 -0
  76. package/dist/common/Text/Text.d.ts +28 -0
  77. package/dist/common/Text/Text.js +4 -0
  78. package/dist/common/TextInput/TextInput.cjs +4 -0
  79. package/dist/common/TextInput/TextInput.d.cts +98 -0
  80. package/dist/common/TextInput/TextInput.d.ts +98 -0
  81. package/dist/common/TextInput/TextInput.js +4 -0
  82. package/dist/productCardVariants-C_QIZ-KF.js +45 -0
  83. package/dist/productCardVariants-Dd-wrJKP.cjs +69 -0
  84. package/dist/productGridVariants-CxCKx5Fq.js +20 -0
  85. package/dist/productGridVariants-DVzvjK9i.cjs +26 -0
  86. package/dist/search/FilterScrollbar/AppliedFiltersScrollbar.cjs +5 -0
  87. package/dist/search/FilterScrollbar/AppliedFiltersScrollbar.d.cts +22 -0
  88. package/dist/search/FilterScrollbar/AppliedFiltersScrollbar.d.ts +22 -0
  89. package/dist/search/FilterScrollbar/AppliedFiltersScrollbar.js +5 -0
  90. package/dist/search/FilterScrollbar/DynamicFiltersScrollbar.cjs +5 -0
  91. package/dist/search/FilterScrollbar/DynamicFiltersScrollbar.d.cts +28 -0
  92. package/dist/search/FilterScrollbar/DynamicFiltersScrollbar.d.ts +28 -0
  93. package/dist/search/FilterScrollbar/DynamicFiltersScrollbar.js +5 -0
  94. package/dist/search/SearchFilter/SearchFilter.cjs +7 -0
  95. package/dist/search/SearchFilter/SearchFilter.d.cts +18 -0
  96. package/dist/search/SearchFilter/SearchFilter.d.ts +18 -0
  97. package/dist/search/SearchFilter/SearchFilter.js +7 -0
  98. package/dist/search/SearchFilter/SearchFilterHeader.cjs +5 -0
  99. package/dist/search/SearchFilter/SearchFilterHeader.d.cts +12 -0
  100. package/dist/search/SearchFilter/SearchFilterHeader.d.ts +12 -0
  101. package/dist/search/SearchFilter/SearchFilterHeader.js +5 -0
  102. package/dist/search/SearchFilter/SearchFilterItem.cjs +5 -0
  103. package/dist/search/SearchFilter/SearchFilterItem.d.cts +13 -0
  104. package/dist/search/SearchFilter/SearchFilterItem.d.ts +13 -0
  105. package/dist/search/SearchFilter/SearchFilterItem.js +5 -0
  106. package/dist/search/SearchInput/SearchInput.cjs +6 -0
  107. package/dist/search/SearchInput/SearchInput.d.cts +20 -0
  108. package/dist/search/SearchInput/SearchInput.d.ts +20 -0
  109. package/dist/search/SearchInput/SearchInput.js +6 -0
  110. package/dist/search/SearchInputAutocomplete/SearchAutocomplete.cjs +3 -0
  111. package/dist/search/SearchInputAutocomplete/SearchAutocomplete.d.cts +13 -0
  112. package/dist/search/SearchInputAutocomplete/SearchAutocomplete.d.ts +13 -0
  113. package/dist/search/SearchInputAutocomplete/SearchAutocomplete.js +3 -0
  114. package/dist/search/SearchInputForm/SearchInputForm.cjs +38 -0
  115. package/dist/search/SearchInputForm/SearchInputForm.d.cts +32 -0
  116. package/dist/search/SearchInputForm/SearchInputForm.d.ts +32 -0
  117. package/dist/search/SearchInputForm/SearchInputForm.js +36 -0
  118. package/dist/search/SearchResultsFilterSidebar/SearchResultsFilter.cjs +52 -0
  119. package/dist/search/SearchResultsFilterSidebar/SearchResultsFilter.d.cts +28 -0
  120. package/dist/search/SearchResultsFilterSidebar/SearchResultsFilter.d.ts +28 -0
  121. package/dist/search/SearchResultsFilterSidebar/SearchResultsFilter.js +49 -0
  122. package/dist/search/SearchResultsStates/NoSearchResultsFound.cjs +30 -0
  123. package/dist/search/SearchResultsStates/NoSearchResultsFound.d.cts +17 -0
  124. package/dist/search/SearchResultsStates/NoSearchResultsFound.d.ts +17 -0
  125. package/dist/search/SearchResultsStates/NoSearchResultsFound.js +26 -0
  126. package/dist/search/SearchResultsStates/SearchResultsGrid.cjs +66 -0
  127. package/dist/search/SearchResultsStates/SearchResultsGrid.d.cts +41 -0
  128. package/dist/search/SearchResultsStates/SearchResultsGrid.d.ts +41 -0
  129. package/dist/search/SearchResultsStates/SearchResultsGrid.js +62 -0
  130. package/dist/search/SearchResultsStates/SearchResultsLoadingGrid.cjs +52 -0
  131. package/dist/search/SearchResultsStates/SearchResultsLoadingGrid.d.cts +15 -0
  132. package/dist/search/SearchResultsStates/SearchResultsLoadingGrid.d.ts +15 -0
  133. package/dist/search/SearchResultsStates/SearchResultsLoadingGrid.js +49 -0
  134. package/dist/searchFilterSidebarVariants-GfFbQzGf.cjs +39 -0
  135. package/dist/searchFilterSidebarVariants-lJVVZT_2.js +34 -0
  136. package/dist/textVariantClasses-5t3OricK.js +101 -0
  137. package/dist/textVariantClasses-Bhf4VY5z.cjs +125 -0
  138. package/dist/types-53zIialA.d.ts +35 -0
  139. package/dist/types-B4BGZSlV.d.cts +4 -0
  140. package/dist/types-BQNqA5xL.d.ts +46 -0
  141. package/dist/types-BRLWwGMI.d.ts +4 -0
  142. package/dist/types-CImLkcNh.d.cts +46 -0
  143. package/dist/types-Cph97xkm.d.ts +6 -0
  144. package/dist/types-CpiJO5UH.d.ts +4 -0
  145. package/dist/types-DFetqNL2.d.ts +8 -0
  146. package/dist/types-DaSkJnT_.d.cts +8 -0
  147. package/dist/types-Dy4_w6Cf.d.cts +4 -0
  148. package/dist/types-TYhhwWZw.d.cts +6 -0
  149. package/dist/types-aa4flfRE.d.cts +35 -0
  150. package/package.json +8 -8
  151. package/src/components/common/ButtonBase/ButtonBase.tsx +2 -2
  152. package/src/components/common/ButtonBase/types.ts +2 -3
  153. package/dist/src/atoms/search/types.d.ts +0 -5
  154. package/dist/src/atoms/search/types.js +0 -1
  155. package/dist/src/components/common/ButtonBase/ButtonBase.d.ts +0 -2
  156. package/dist/src/components/common/ButtonBase/ButtonBase.js +0 -41
  157. package/dist/src/components/common/ButtonBase/types.d.ts +0 -24
  158. package/dist/src/components/common/ButtonBase/types.js +0 -6
  159. package/dist/src/components/common/Headline/Headline.d.ts +0 -10
  160. package/dist/src/components/common/Headline/Headline.js +0 -34
  161. package/dist/src/components/common/ImageWithFallback/ImageWithFallback.d.ts +0 -12
  162. package/dist/src/components/common/ImageWithFallback/ImageWithFallback.js +0 -26
  163. package/dist/src/components/common/ProductCard/ProductCard.d.ts +0 -39
  164. package/dist/src/components/common/ProductCard/ProductCard.js +0 -84
  165. package/dist/src/components/common/ProductCard/ProductCardSkeleton.d.ts +0 -9
  166. package/dist/src/components/common/ProductCard/ProductCardSkeleton.js +0 -15
  167. package/dist/src/components/common/ProductCard/productCardVariants.d.ts +0 -8
  168. package/dist/src/components/common/ProductCard/productCardVariants.js +0 -50
  169. package/dist/src/components/common/ProductCard/types.d.ts +0 -39
  170. package/dist/src/components/common/ProductCard/types.js +0 -10
  171. package/dist/src/components/common/ProductGrid/ProductGrid.d.ts +0 -14
  172. package/dist/src/components/common/ProductGrid/ProductGrid.js +0 -13
  173. package/dist/src/components/common/ProductGrid/productGridVariants.d.ts +0 -10
  174. package/dist/src/components/common/ProductGrid/productGridVariants.js +0 -16
  175. package/dist/src/components/common/SparkleAnimation/SparkleAnimation.d.ts +0 -7
  176. package/dist/src/components/common/SparkleAnimation/SparkleAnimation.js +0 -40
  177. package/dist/src/components/common/SparkleAnimation/types.d.ts +0 -6
  178. package/dist/src/components/common/SparkleAnimation/types.js +0 -7
  179. package/dist/src/components/common/Spinner/Spinner.d.ts +0 -5
  180. package/dist/src/components/common/Spinner/Spinner.js +0 -16
  181. package/dist/src/components/common/SuggestionButton/SuggestionButton.d.ts +0 -18
  182. package/dist/src/components/common/SuggestionButton/SuggestionButton.js +0 -210
  183. package/dist/src/components/common/SuggestionButton/types.d.ts +0 -1
  184. package/dist/src/components/common/SuggestionButton/types.js +0 -1
  185. package/dist/src/components/common/Text/Text.d.ts +0 -12
  186. package/dist/src/components/common/Text/Text.js +0 -26
  187. package/dist/src/components/common/Text/textVariantClasses.d.ts +0 -171
  188. package/dist/src/components/common/Text/textVariantClasses.js +0 -103
  189. package/dist/src/components/common/Text/types.d.ts +0 -16
  190. package/dist/src/components/common/Text/types.js +0 -6
  191. package/dist/src/components/common/TextInput/TextInput.d.ts +0 -8
  192. package/dist/src/components/common/TextInput/TextInput.js +0 -25
  193. package/dist/src/components/models/colorsConfig.d.ts +0 -26
  194. package/dist/src/components/models/colorsConfig.js +0 -23
  195. package/dist/src/components/search/FilterScrollbar/AppliedFiltersScrollbar.d.ts +0 -11
  196. package/dist/src/components/search/FilterScrollbar/AppliedFiltersScrollbar.js +0 -18
  197. package/dist/src/components/search/FilterScrollbar/DynamicFiltersScrollbar.d.ts +0 -15
  198. package/dist/src/components/search/FilterScrollbar/DynamicFiltersScrollbar.js +0 -15
  199. package/dist/src/components/search/SearchFilter/SearchFilter.d.ts +0 -2
  200. package/dist/src/components/search/SearchFilter/SearchFilter.js +0 -24
  201. package/dist/src/components/search/SearchFilter/SearchFilterHeader.d.ts +0 -2
  202. package/dist/src/components/search/SearchFilter/SearchFilterHeader.js +0 -9
  203. package/dist/src/components/search/SearchFilter/SearchFilterItem.d.ts +0 -2
  204. package/dist/src/components/search/SearchFilter/SearchFilterItem.js +0 -13
  205. package/dist/src/components/search/SearchFilter/types.d.ts +0 -42
  206. package/dist/src/components/search/SearchFilter/types.js +0 -1
  207. package/dist/src/components/search/SearchInput/SearchInput.d.ts +0 -16
  208. package/dist/src/components/search/SearchInput/SearchInput.js +0 -38
  209. package/dist/src/components/search/SearchInput/searchInputVariants.d.ts +0 -13
  210. package/dist/src/components/search/SearchInput/searchInputVariants.js +0 -12
  211. package/dist/src/components/search/SearchInputAutocomplete/SearchAutocomplete.d.ts +0 -10
  212. package/dist/src/components/search/SearchInputAutocomplete/SearchAutocomplete.js +0 -14
  213. package/dist/src/components/search/SearchInputForm/SearchInputForm.d.ts +0 -16
  214. package/dist/src/components/search/SearchInputForm/SearchInputForm.js +0 -13
  215. package/dist/src/components/search/SearchInputForm/types.d.ts +0 -1
  216. package/dist/src/components/search/SearchInputForm/types.js +0 -1
  217. package/dist/src/components/search/SearchResultsFilterSidebar/SearchResultsFilter.d.ts +0 -14
  218. package/dist/src/components/search/SearchResultsFilterSidebar/SearchResultsFilter.js +0 -15
  219. package/dist/src/components/search/SearchResultsFilterSidebar/searchFilterSidebarVariants.d.ts +0 -16
  220. package/dist/src/components/search/SearchResultsFilterSidebar/searchFilterSidebarVariants.js +0 -29
  221. package/dist/src/components/search/SearchResultsFilterSidebar/types.d.ts +0 -2
  222. package/dist/src/components/search/SearchResultsFilterSidebar/types.js +0 -1
  223. package/dist/src/components/search/SearchResultsStates/NoSearchResultsFound.d.ts +0 -8
  224. package/dist/src/components/search/SearchResultsStates/NoSearchResultsFound.js +0 -10
  225. package/dist/src/components/search/SearchResultsStates/SearchResultsGrid.d.ts +0 -24
  226. package/dist/src/components/search/SearchResultsStates/SearchResultsGrid.js +0 -19
  227. package/dist/src/components/search/SearchResultsStates/SearchResultsLoadingGrid.d.ts +0 -6
  228. package/dist/src/components/search/SearchResultsStates/SearchResultsLoadingGrid.js +0 -10
  229. package/dist/src/components/search/types.d.ts +0 -5
  230. package/dist/src/components/search/types.js +0 -6
  231. package/dist/src/components/test/types.d.ts +0 -3
  232. package/dist/src/components/test/types.js +0 -1
  233. package/dist/src/config/chatElementDisplayLocation.d.ts +0 -21
  234. package/dist/src/config/chatElementDisplayLocation.js +0 -23
  235. package/dist/src/index.d.ts +0 -45
  236. package/dist/src/index.js +0 -49
  237. package/dist/src/logging/logger.d.ts +0 -7
  238. package/dist/src/logging/logger.js +0 -16
  239. package/dist/src/types/external.d.ts +0 -21
  240. package/dist/src/types/external.js +0 -5
  241. package/dist/src/util/camelCase.d.ts +0 -65
  242. package/dist/src/util/camelCase.js +0 -2
  243. package/dist/src/util/camelCasedPropertiesDeep.d.ts +0 -53
  244. package/dist/src/util/camelCasedPropertiesDeep.js +0 -1
  245. package/dist/src/util/formatPrice.d.ts +0 -1
  246. package/dist/src/util/formatPrice.js +0 -11
  247. package/dist/src/util/internal.d.ts +0 -27
  248. package/dist/src/util/internal.js +0 -4
  249. package/dist/src/util/primitive.d.ts +0 -6
  250. package/dist/src/util/primitive.js +0 -2
  251. package/dist/src/util/splitWords.d.ts +0 -55
  252. package/dist/src/util/splitWords.js +0 -2
  253. package/dist/src/util/trim.d.ts +0 -24
  254. package/dist/src/util/trim.js +0 -2
  255. package/dist/src/util/unknownArray.d.ts +0 -25
  256. package/dist/src/util/unknownArray.js +0 -1
  257. package/src/index.ts +0 -59
@@ -1,84 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import classNames from 'classnames';
3
- import { MdStar } from 'react-icons/md';
4
- import { Text } from '../../../components/common/Text/Text';
5
- import { variantClassMap, variantHoverClassMap, productCardLayoutVariantClasses, variantTitleColorMap, } from './productCardVariants';
6
- import { Headline } from '../Headline/Headline';
7
- import { ImageWithFallback } from '../../../components/common/ImageWithFallback/ImageWithFallback';
8
- import Logger from '../../../logging/logger';
9
- import { Spinner } from '../Spinner/Spinner';
10
- import { formatPrice } from '../../../util/formatPrice';
11
- const formatReviews = (stars) => String(Number(stars).toLocaleString('en-US', { minimumFractionDigits: 1, maximumFractionDigits: 1 }));
12
- export const RatingSummary = ({ stars, reviewCount, className }) => {
13
- 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]');
14
- const starClassnames = classNames('spiffy-product-card-rating-star-color', 'spiffy-tw-fill-[--spiffy-colors-accent-primary]', 'spiffy-tw-w-[14px]', 'spiffy-tw-h-[14px]');
15
- return (_jsx("div", { className: className, children: _jsxs("div", { className: group, children: [_jsx(MdStar, { className: starClassnames }), _jsx(Text, { variant: "body3", children: formatReviews(stars) }), _jsxs(Text, { variant: "body3", children: ["(", reviewCount, ")"] })] }) }));
16
- };
17
- export const PriceSection = ({ originalPrice, salePrice, pricePrefix }) => {
18
- if (!originalPrice)
19
- return null;
20
- 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]');
21
- const showSalePrice = salePrice && originalPrice !== salePrice;
22
- return (_jsxs("div", { className: priceClassName, children: [pricePrefix && _jsx(Text, { children: pricePrefix }), showSalePrice && _jsx(Text, { children: salePrice }), _jsx(Text, { className: showSalePrice ? 'spiffy-tw-line-through' : '', children: originalPrice })] }));
23
- };
24
- export const ProductCard = ({ productCardConfig, merchantShortName, imageUrl, title, url, originalPrice, averageRating, numberReviews, salePrice, variant, hoverVariant, dataTestId, layoutVariant = 'normal', zoomOnHover = false, aspectRatio = 'none', growWithContainer = false, handleClick, }) => {
25
- // const orgUIConfig = useAtomValue(orgUIConfigAtom);
26
- // const { productCardConfig } = orgUIConfig;
27
- const finalVariant = variant ?? productCardConfig?.variant ?? 'filled';
28
- const finalHoverVariant = hoverVariant ?? productCardConfig?.hoverVariant ?? 'backgroundDark';
29
- const finalLayoutVariant = layoutVariant ?? productCardConfig?.layoutVariant ?? 'normal';
30
- const pricePrefix = productCardConfig?.pricePrefix;
31
- if (productCardConfig == null) {
32
- Logger.logError('[ProductCard] productCardConfig is null', undefined, {
33
- merchant: merchantShortName,
34
- });
35
- return null;
36
- }
37
- const layoutClasses = productCardLayoutVariantClasses[finalLayoutVariant];
38
- const containerClassnames = classNames('spiffy-tw-cursor-pointer', 'spiffy-tw-flex', 'spiffy-tw-flex-col', 'spiffy-tw-gap-inherit', 'spiffy-tw-overflow-hidden', {
39
- 'spiffy-tw-h-full': growWithContainer,
40
- 'spiffy-tw-w-full': growWithContainer,
41
- 'spiffy-tw-max-w-full': growWithContainer,
42
- }, !growWithContainer && layoutClasses.container, variantClassMap.get(finalVariant) ?? [], variantHoverClassMap.get(finalHoverVariant) ?? []);
43
- const verticalContainerVariantClasses = productCardLayoutVariantClasses[layoutVariant].verticalContainer;
44
- const verticalContainerClassnames = classNames('spiffy-tw-flex', 'spiffy-tw-flex-col', 'spiffy-tw-overflow-hidden', 'spiffy-tw-gap-inherit', {
45
- 'spiffy-tw-h-full': growWithContainer,
46
- 'spiffy-tw-w-full': growWithContainer,
47
- 'spiffy-tw-flex-1': growWithContainer,
48
- }, ...(!growWithContainer && layoutVariant ? verticalContainerVariantClasses : []));
49
- const linkClassnames = classNames({
50
- 'spiffy-tw-w-full': true,
51
- 'spiffy-tw-h-full': true,
52
- 'spiffy-tw-overflow-hidden': true,
53
- 'spiffy-tw-select-none': true,
54
- });
55
- // Fixed outer container that maintains size and clips overflow
56
- // This is useful for zoomOnHover and aspect ratio enforcement
57
- const imageClipContainerClassnames = classNames('spiffy-tw-w-full', 'spiffy-tw-overflow-hidden', // This clips any content that exceeds boundaries
58
- {
59
- 'spiffy-tw-flex-shrink-0': growWithContainer,
60
- 'spiffy-tw-tw-h-full': !growWithContainer,
61
- }, aspectRatio === '3:4' ? 'spiffy-tw-aspect-[3/4]' : '', aspectRatio === 'square' ? 'spiffy-tw-aspect-square' : '');
62
- // Inner container that can scale for zoom effect
63
- const imageContainerClassnames = classNames(linkClassnames, zoomOnHover
64
- ? [
65
- 'spiffy-tw-transition-transform',
66
- 'spiffy-tw-duration-200',
67
- 'spiffy-tw-origin-top',
68
- 'hover:spiffy-tw-scale-105',
69
- ]
70
- : []);
71
- 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', {
72
- 'spiffy-tw-flex-grow-0': layoutVariant === 'tall' || layoutVariant === 'square',
73
- });
74
- 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);
75
- 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');
76
- 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');
77
- return (_jsx("div", { className: containerClassnames, "data-testid": dataTestId, children: _jsx("a", { href: url, onClick: () => handleClick(url || ''), target: "_self", draggable: false, children: _jsxs("div", { className: verticalContainerClassnames, children: [_jsx("div", { className: imageClipContainerClassnames, children: _jsx("div", { className: imageContainerClassnames, children: imageUrl && (_jsx(ImageWithFallback
78
- // TODO: Fix once
79
- // src={resolve(imageUrl, layoutVariant === 'tall' ? 300 : 178)}
80
- , {
81
- // TODO: Fix once
82
- // src={resolve(imageUrl, layoutVariant === 'tall' ? 300 : 178)}
83
- src: imageUrl, alt: title, fallback: _jsx(Spinner, { className: "spiffy-tw-w-6 spiffy-tw-h-6" }), imageClassnames: imageClassnames })) }) }), _jsxs("div", { className: contentClassnames, children: [_jsx(Headline, { variant: "h4", className: productTitleClassnames, children: title }), _jsxs("div", { className: priceAndRatingContainerClassnames, children: [(originalPrice || salePrice) && (_jsx(PriceSection, { originalPrice: formatPrice(originalPrice), salePrice: formatPrice(salePrice), pricePrefix: pricePrefix })), averageRating && numberReviews && (_jsx(RatingSummary, { stars: averageRating, reviewCount: numberReviews }))] })] })] }) }) }));
84
- };
@@ -1,9 +0,0 @@
1
- import type { FC } from 'react';
2
- import { type ProductCardLayoutVariant } from './types';
3
- interface ProductCardSkeletonProps {
4
- layoutVariant: ProductCardLayoutVariant;
5
- aspectRatio?: '3:4' | 'square' | 'none';
6
- growWithContainer?: boolean;
7
- }
8
- export declare const ProductCardSkeleton: FC<ProductCardSkeletonProps>;
9
- export {};
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import classNames from 'classnames';
3
- import { ProductCardSkeletonOverrides } from './types';
4
- import { productCardLayoutVariantClasses } from './productCardVariants';
5
- export const ProductCardSkeleton = ({ layoutVariant, aspectRatio, growWithContainer = false, }) => {
6
- const finalLayoutVariant = layoutVariant || 'normal';
7
- const layoutClasses = productCardLayoutVariantClasses[finalLayoutVariant];
8
- 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 : '');
9
- const verticalContainerClasses = classNames('spiffy-tw-flex', 'spiffy-tw-flex-col', 'spiffy-tw-overflow-hidden', 'spiffy-tw-gap-inherit', !growWithContainer ? layoutClasses.verticalContainer : '');
10
- 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');
11
- const imageSkeletonClasses = classNames('spiffy-tw-bg-[#F4F4F6]', 'spiffy-tw-animate-pulse', 'spiffy-tw-opacity-70', 'spiffy-tw-w-full', 'spiffy-tw-h-full');
12
- const contentContainerClasses = classNames('spiffy-tw-flex', 'spiffy-tw-flex-col', 'spiffy-tw-gap-2', 'spiffy-tw-w-full', 'spiffy-tw-p-2');
13
- 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]');
14
- return (_jsx("div", { className: containerClasses, children: _jsxs("div", { className: verticalContainerClasses, children: [_jsx("div", { className: imageClipContainerClasses, children: _jsx("div", { className: imageSkeletonClasses }) }), _jsxs("div", { className: contentContainerClasses, children: [_jsx("div", { className: classNames(textSkeletonClasses, 'spiffy-tw-w-full') }), _jsx("div", { className: classNames(textSkeletonClasses, 'spiffy-tw-w-[60%]') })] })] }) }));
15
- };
@@ -1,8 +0,0 @@
1
- import type { ProductCardVariant, ProductCardHoverVariant, ProductCardLayoutVariant } from './types';
2
- /**
3
- * Shared variant mapping configurations for ProductCard components
4
- */
5
- export declare const variantClassMap: Map<ProductCardVariant, string[]>;
6
- export declare const variantHoverClassMap: Map<ProductCardHoverVariant, string[]>;
7
- export declare const variantTitleColorMap: Map<ProductCardVariant, string>;
8
- export declare const productCardLayoutVariantClasses: Record<ProductCardLayoutVariant, Record<string, string[]>>;
@@ -1,50 +0,0 @@
1
- /**
2
- * Shared variant mapping configurations for ProductCard components
3
- */
4
- export const variantClassMap = new Map([
5
- ['filled', ['spiffy-tw-bg-[--spiffy-colors-background-secondary]', 'spiffy-tw-shadow-md']],
6
- [
7
- 'bordered',
8
- [
9
- 'spiffy-tw-bg-[--spiffy-colors-background-secondary]',
10
- 'spiffy-tw-border',
11
- 'spiffy-tw-border-[--spiffy-colors-border-light]',
12
- ],
13
- ],
14
- ['minimal', ['spiffy-tw-bg-transparent']],
15
- [
16
- 'transparentBordered',
17
- [
18
- 'spiffy-tw-bg-transparent',
19
- 'spiffy-tw-border',
20
- 'spiffy-tw-border-[--spiffy-colors-border-light]',
21
- ],
22
- ],
23
- ]);
24
- export const variantHoverClassMap = new Map([
25
- ['backgroundDark', ['hover:spiffy-tw-bg-[--spiffy-colors-background-secondary-dark]']],
26
- ['none', []],
27
- ]);
28
- export const variantTitleColorMap = new Map([
29
- ['filled', 'spiffy-tw-text-[--spiffy-colors-text-link]'],
30
- ['bordered', 'spiffy-tw-text-[--spiffy-colors-text-primary]'],
31
- ['minimal', 'spiffy-tw-text-[--spiffy-colors-text-primary]'],
32
- ['transparentBordered', 'spiffy-tw-text-[--spiffy-colors-text-primary]'],
33
- ]);
34
- export const productCardLayoutVariantClasses = {
35
- normal: {
36
- productTitle: ['spiffy-product-card-title'],
37
- container: ['spiffy-tw-w-[208px]'],
38
- verticalContainer: ['spiffy-tw-rounded-[8px]', 'spiffy-tw-h-[268px]'],
39
- },
40
- tall: {
41
- productTitle: ['spiffy-product-card-title-tall', 'spiffy-tw-pt-[8px]'],
42
- container: ['spiffy-tw-w-[160px] lg:spiffy-tw-w-[300px]'],
43
- verticalContainer: ['lg:spiffy-tw-h-[496px]'],
44
- },
45
- square: {
46
- productTitle: ['spiffy-product-card-title-tall', 'spiffy-tw-pt-[8px]'],
47
- container: ['spiffy-tw-w-[160px] lg:spiffy-tw-w-[280px]'],
48
- verticalContainer: ['lg:spiffy-tw-h-[400px]'],
49
- },
50
- };
@@ -1,39 +0,0 @@
1
- import type { ResponseCategory, SearchResponseProduct } from '../../../types/external';
2
- import type { CamelCasedPropertiesDeep } from '../../../util/camelCasedPropertiesDeep';
3
- export declare enum ProductCardSkeletonOverrides {
4
- PRODUCT_CARD_SKELETON_CONTAINER = "spiffy-product-card-skeleton-container",
5
- PRODUCT_CARD_SKELETON = "spiffy-product-card-skeleton"
6
- }
7
- export declare enum AnimatedProductCardOverrides {
8
- PRODUCT_CARD_ANIMATED_CONTAINER = "spiffy-product-card-animated-container",
9
- PRODUCT_CARD_ANIMATED_IMAGE_CONTAINER = "spiffy-product-card-animated"
10
- }
11
- export type ProductGridVariant = 'standard' | 'square';
12
- export type ProductCardVariant = 'filled' | 'bordered' | 'minimal' | 'transparentBordered';
13
- export type ProductCardHoverVariant = 'backgroundDark' | 'none';
14
- export type ProductCardLayoutVariant = 'normal' | 'tall' | 'square';
15
- export type ProductCardImageAspectRatio = '1/1' | '4/3' | '3/4' | '16/9' | '9/16';
16
- export interface ProductCardConfig {
17
- variant: ProductCardVariant;
18
- hoverVariant: ProductCardHoverVariant;
19
- layoutVariant: ProductCardLayoutVariant;
20
- pricePrefix?: string;
21
- }
22
- export interface SearchResponseProductAttributes {
23
- category: ResponseCategory.Product;
24
- attributes: CamelCasedPropertiesDeep<SearchResponseProduct>;
25
- }
26
- export interface ProductCardSkeletonProps {
27
- layoutVariant: ProductCardLayoutVariant;
28
- aspectRatio: ProductCardImageAspectRatio;
29
- growWithContainer?: boolean;
30
- }
31
- export interface ProductGridProps {
32
- productList: SearchResponseProductAttributes['attributes'][];
33
- productGridVariant: ProductGridVariant;
34
- productGridClasses: string;
35
- productCardConfig?: ProductCardConfig;
36
- merchantShortName: string;
37
- searchResponseId: string;
38
- cardsGrowWithContainer?: boolean;
39
- }
@@ -1,10 +0,0 @@
1
- export var ProductCardSkeletonOverrides;
2
- (function (ProductCardSkeletonOverrides) {
3
- ProductCardSkeletonOverrides["PRODUCT_CARD_SKELETON_CONTAINER"] = "spiffy-product-card-skeleton-container";
4
- ProductCardSkeletonOverrides["PRODUCT_CARD_SKELETON"] = "spiffy-product-card-skeleton";
5
- })(ProductCardSkeletonOverrides || (ProductCardSkeletonOverrides = {}));
6
- export var AnimatedProductCardOverrides;
7
- (function (AnimatedProductCardOverrides) {
8
- AnimatedProductCardOverrides["PRODUCT_CARD_ANIMATED_CONTAINER"] = "spiffy-product-card-animated-container";
9
- AnimatedProductCardOverrides["PRODUCT_CARD_ANIMATED_IMAGE_CONTAINER"] = "spiffy-product-card-animated";
10
- })(AnimatedProductCardOverrides || (AnimatedProductCardOverrides = {}));
@@ -1,14 +0,0 @@
1
- import type { ProductCardConfig, ProductGridVariant } from '../ProductCard/types';
2
- import { SearchResponseProduct } from '../../../types/external';
3
- interface ProductGridProps {
4
- productList: SearchResponseProduct[];
5
- productGridVariant: ProductGridVariant;
6
- productGridClasses: string;
7
- productCardConfig?: ProductCardConfig;
8
- merchantShortName: string;
9
- searchResponseId: string;
10
- cardsGrowWithContainer?: boolean;
11
- handleClick: (clickedUrl: string) => void;
12
- }
13
- export declare const ProductGrid: ({ productList, productGridVariant, productGridClasses, productCardConfig, merchantShortName, searchResponseId, cardsGrowWithContainer, handleClick, }: ProductGridProps) => import("react/jsx-runtime").JSX.Element;
14
- export {};
@@ -1,13 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ProductCard } from '../ProductCard/ProductCard';
3
- import { productGridVariantClasses } from './productGridVariants';
4
- import classNames from 'classnames';
5
- import { ChatElementDisplayLocation } from '../../../config/chatElementDisplayLocation';
6
- export const ProductGrid = ({ productList, productGridVariant, productGridClasses, productCardConfig, merchantShortName, searchResponseId, cardsGrowWithContainer = true, handleClick, }) => {
7
- const { productCardVariant, productCardHoverVariant, productCardLayoutVariant, productCardImageAspectRatio, zoomOnHover, } = productGridVariantClasses[productGridVariant];
8
- const cardContainerClasses = classNames({
9
- 'spiffy-tw-w-full': cardsGrowWithContainer,
10
- 'spiffy-tw-h-full': cardsGrowWithContainer,
11
- });
12
- return (_jsx("div", { className: productGridClasses, children: productList.map((product, index) => (_jsx("div", { className: cardContainerClasses, children: _jsx(ProductCard, { productCardConfig: productCardConfig, merchantShortName: merchantShortName, imageUrl: product.imageUrl, searchResponseId: searchResponseId, productResponseId: product.responseId, title: product.title, url: product.url, originalPrice: product.originalPrice, salePrice: product.salePrice, averageRating: product.averageRating, numberReviews: product.numberReviews, cardDisplayLocation: ChatElementDisplayLocation.PRODUCT_GRID, layoutVariant: productCardLayoutVariant, variant: productCardVariant, hoverVariant: productCardHoverVariant, zoomOnHover: zoomOnHover, aspectRatio: productCardImageAspectRatio, clickPosition: index, growWithContainer: cardsGrowWithContainer, handleClick: handleClick }, product.id) }, product.id))) }));
13
- };
@@ -1,10 +0,0 @@
1
- import type { ProductCardHoverVariant, ProductCardLayoutVariant, ProductCardVariant, ProductGridVariant } from '../ProductCard/types';
2
- interface ProductGridVariantClasses {
3
- productCardVariant: ProductCardVariant;
4
- productCardHoverVariant: ProductCardHoverVariant;
5
- productCardLayoutVariant: ProductCardLayoutVariant;
6
- productCardImageAspectRatio: '3:4' | 'square' | 'none';
7
- zoomOnHover: boolean;
8
- }
9
- export declare const productGridVariantClasses: Record<ProductGridVariant, ProductGridVariantClasses>;
10
- export {};
@@ -1,16 +0,0 @@
1
- export const productGridVariantClasses = {
2
- standard: {
3
- productCardVariant: 'minimal',
4
- productCardHoverVariant: 'backgroundDark',
5
- productCardLayoutVariant: 'tall',
6
- productCardImageAspectRatio: '3:4',
7
- zoomOnHover: true,
8
- },
9
- square: {
10
- productCardVariant: 'minimal',
11
- productCardHoverVariant: 'backgroundDark',
12
- productCardLayoutVariant: 'square',
13
- productCardImageAspectRatio: 'square',
14
- zoomOnHover: true,
15
- },
16
- };
@@ -1,7 +0,0 @@
1
- interface SparkleAnimationProps {
2
- color: string;
3
- className?: string;
4
- animate?: boolean;
5
- }
6
- export declare const SparkleAnimation: ({ color, className, animate }: SparkleAnimationProps) => import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,40 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
3
- import { motion } from 'framer-motion';
4
- import classNames from 'classnames';
5
- import FourPointStar from '@envive-ai/react-icons/src/FourPointStar';
6
- import { SparkleAnimationOverride } from './types';
7
- // Animation timing constants
8
- const ANIMATION_CYCLE_TIME = 1000; // 1 second between cycles
9
- const STAR_DELAY_OFFSET = 250; // 250ms delay between each star
10
- export const SparkleAnimation = ({ color, className, animate = true }) => {
11
- // Star visibility states - start visible if not animating, invisible if animating
12
- const [mainStarScale, setMainStarScale] = useState(animate ? 0 : 1);
13
- const [smallStar1Scale, setSmallStar1Scale] = useState(animate ? 0 : 1);
14
- const [smallStar2Scale, setSmallStar2Scale] = useState(animate ? 0 : 1);
15
- // Container: 24px x 24px with relative positioning
16
- const containerClasses = classNames(SparkleAnimationOverride.CONTAINER, 'spiffy-tw-w-6 spiffy-tw-h-6 spiffy-tw-relative', className);
17
- // When animation is disabled, ensure all stars are visible
18
- useEffect(() => {
19
- if (!animate) {
20
- setMainStarScale(1);
21
- setSmallStar1Scale(1);
22
- setSmallStar2Scale(1);
23
- return;
24
- }
25
- }, [animate]);
26
- // Animation cycle effect
27
- useEffect(() => {
28
- if (!animate)
29
- return;
30
- // Toggle between visible (1) and invisible (0)
31
- const newScale = mainStarScale === 1 ? 0 : 1;
32
- // Stagger the star animations
33
- setTimeout(() => setMainStarScale(newScale), ANIMATION_CYCLE_TIME);
34
- setTimeout(() => setSmallStar1Scale(newScale), ANIMATION_CYCLE_TIME + STAR_DELAY_OFFSET);
35
- setTimeout(() => setSmallStar2Scale(newScale), ANIMATION_CYCLE_TIME + 2 * STAR_DELAY_OFFSET);
36
- }, [mainStarScale, animate]);
37
- // Animation transition settings
38
- const starTransition = { duration: 0.3, ease: 'easeOut' };
39
- return (_jsxs("div", { className: containerClasses, children: [_jsx("div", { className: classNames(SparkleAnimationOverride.STAR_ONE_CONTAINER, 'spiffy-tw-absolute -spiffy-tw-top-[2px] spiffy-tw-left-0'), children: _jsx(motion.div, { animate: { scale: mainStarScale }, transition: starTransition, children: _jsx(FourPointStar, { fill: color, className: "spiffy-tw-w-4 spiffy-tw-h-4 spiffy-tw-inline-block" }) }) }), _jsx("div", { className: classNames(SparkleAnimationOverride.STAR_TWO_CONTAINER, 'spiffy-tw-absolute -spiffy-tw-top-[7px] spiffy-tw-left-[10px]'), children: _jsx(motion.div, { animate: { scale: smallStar1Scale }, transition: starTransition, children: _jsx(FourPointStar, { fill: color, className: "spiffy-tw-w-2 spiffy-tw-h-2 spiffy-tw-inline-block" }) }) }), _jsx("div", { className: classNames(SparkleAnimationOverride.STAR_THREE_CONTAINER, 'spiffy-tw-absolute spiffy-tw-top-[1px] spiffy-tw-left-[12px]'), children: _jsx(motion.div, { animate: { scale: smallStar2Scale }, transition: starTransition, children: _jsx(FourPointStar, { fill: color, className: "spiffy-tw-w-2 spiffy-tw-h-2 spiffy-tw-inline-block" }) }) })] }));
40
- };
@@ -1,6 +0,0 @@
1
- export declare enum SparkleAnimationOverride {
2
- CONTAINER = "spiffy-sparkle-animation-container",
3
- STAR_ONE_CONTAINER = "spiffy-sparkle-animation-star-one-container",
4
- STAR_TWO_CONTAINER = "spiffy-sparkle-animation-star-two-container",
5
- STAR_THREE_CONTAINER = "spiffy-sparkle-animation-star-three-container"
6
- }
@@ -1,7 +0,0 @@
1
- export var SparkleAnimationOverride;
2
- (function (SparkleAnimationOverride) {
3
- SparkleAnimationOverride["CONTAINER"] = "spiffy-sparkle-animation-container";
4
- SparkleAnimationOverride["STAR_ONE_CONTAINER"] = "spiffy-sparkle-animation-star-one-container";
5
- SparkleAnimationOverride["STAR_TWO_CONTAINER"] = "spiffy-sparkle-animation-star-two-container";
6
- SparkleAnimationOverride["STAR_THREE_CONTAINER"] = "spiffy-sparkle-animation-star-three-container";
7
- })(SparkleAnimationOverride || (SparkleAnimationOverride = {}));
@@ -1,5 +0,0 @@
1
- type SpinnerProps = {
2
- className?: string;
3
- };
4
- export declare const Spinner: ({ className }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
5
- export {};
@@ -1,16 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import classNames from "classnames";
3
- export const Spinner = ({ className }) => {
4
- const svgClassnames = classNames({
5
- 'spiffy-tw-w-4': true,
6
- 'spiffy-tw-h-4': true,
7
- 'spiffy-tw-text-gray-200': true,
8
- 'spiffy-tw-animate-spin': true,
9
- 'spiffy-tw-dark:text-gray-600': true,
10
- 'spiffy-tw-fill-black': true,
11
- }, className);
12
- const spanClassnames = classNames({
13
- 'spiffy-tw-sr-only': true,
14
- });
15
- return (_jsxs("div", { role: "status", children: [_jsxs("svg", { "aria-hidden": "true", className: svgClassnames, viewBox: "0 0 100 101", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z", fill: "currentColor" }), _jsx("path", { d: "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z", fill: "currentFill" })] }), _jsx("span", { className: spanClassnames, children: "Loading..." })] }));
16
- };
@@ -1,18 +0,0 @@
1
- import type { SuggestionButtonVariant } from './types';
2
- import { TestProps } from '../../test/types';
3
- export declare const SPIFFY_SUGGESTION_BUTTON_QUESTION_CLASS = "spiffy-suggestion-button-question-class";
4
- export declare const SPIFFY_SUGGESTION_BUTTON_ANSWER_CLASS = "spiffy-suggestion-button-answer-class";
5
- export declare const SPIFFY_SUGGESTION_BUTTON_TEXT_CLASS = "spiffy-suggestion-button-text-class";
6
- interface SuggestionButtonProps extends TestProps {
7
- variant: SuggestionButtonVariant;
8
- hoverVariant: SuggestionButtonVariant;
9
- isDisabled: boolean;
10
- content: string;
11
- boldText?: boolean;
12
- borderRadius?: 'sm' | 'md' | 'lg';
13
- isAnswer?: boolean;
14
- dataAttributes?: Record<string, string>;
15
- onClick: () => void;
16
- }
17
- export declare const SuggestionButton: ({ variant, hoverVariant, isDisabled, content, boldText, borderRadius, isAnswer, dataAttributes, dataTestId, onClick, }: SuggestionButtonProps) => import("react/jsx-runtime").JSX.Element;
18
- export {};
@@ -1,210 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import classNames from 'classnames';
3
- import OutlinedStar from '@envive-ai/react-icons/src/OutlinedStar';
4
- import FourPointStar from '@envive-ai/react-icons/src/FourPointStar';
5
- import { ButtonBase } from '../ButtonBase/ButtonBase';
6
- export const SPIFFY_SUGGESTION_BUTTON_QUESTION_CLASS = 'spiffy-suggestion-button-question-class';
7
- export const SPIFFY_SUGGESTION_BUTTON_ANSWER_CLASS = 'spiffy-suggestion-button-answer-class';
8
- export const SPIFFY_SUGGESTION_BUTTON_TEXT_CLASS = 'spiffy-suggestion-button-text-class';
9
- // Add a comment that includes the hover prefix so that tailwind will pickup and generate the right css
10
- // Common class patterns to avoid duplication
11
- const BORDER_CLASS = 'spiffy-tw-border'; // hover:spiffy-tw-border
12
- const TEXT_LINK_CLASSES = [
13
- 'spiffy-tw-text-[--spiffy-colors-text-link]', // hover:spiffy-tw-text-[--spiffy-colors-text-link]
14
- 'spiffy-tw-fill-[--spiffy-colors-text-link]', // hover:spiffy-tw-fill-[--spiffy-colors-text-link]
15
- 'spiffy-tw-stroke-[--spiffy-colors-text-link]', // hover:spiffy-tw-stroke-[--spiffy-colors-text-link]
16
- ];
17
- const TEXT_LIGHT_CLASSES = [
18
- 'spiffy-tw-text-[--spiffy-colors-text-light]', // hover:spiffy-tw-text-[--spiffy-colors-text-light]
19
- 'spiffy-tw-fill-[--spiffy-colors-text-light]', // hover:spiffy-tw-fill-[--spiffy-colors-text-light]
20
- 'spiffy-tw-stroke-[--spiffy-colors-text-light]', // hover:spiffy-tw-stroke-[--spiffy-colors-text-light]
21
- ];
22
- const TEXT_PRIMARY_CLASSES = [
23
- 'spiffy-tw-text-[--spiffy-colors-text-primary]', // hover:spiffy-tw-text-[--spiffy-colors-text-primary]
24
- 'spiffy-tw-fill-[--spiffy-colors-text-primary]', // hover:spiffy-tw-fill-[--spiffy-colors-text-primary]
25
- 'spiffy-tw-stroke-[--spiffy-colors-text-primary]', // hover:spiffy-tw-stroke-[--spiffy-colors-text-primary]
26
- ];
27
- const ACCENT_PRIMARY_CLASSES = [
28
- 'spiffy-tw-fill-[--spiffy-colors-accent-primary]', // hover:spiffy-tw-fill-[--spiffy-colors-accent-primary]
29
- 'spiffy-tw-stroke-[--spiffy-colors-accent-primary]', // hover:spiffy-tw-stroke-[--spiffy-colors-accent-primary]
30
- ];
31
- const DARK_BACKGROUND_CLASSES = [
32
- 'spiffy-tw-bg-[--spiffy-colors-background-dark]', // hover:spiffy-tw-bg-[--spiffy-colors-background-dark]
33
- 'spiffy-tw-border-[--spiffy-colors-background-dark]', // hover:spiffy-tw-border-[--spiffy-colors-background-secondary]
34
- ];
35
- const SECONDARY_DARK_BACKGROUND_CLASSES = [
36
- 'spiffy-tw-bg-[--spiffy-colors-background-secondary-dark]', // hover:spiffy-tw-bg-[--spiffy-colors-background-secondary-dark]
37
- 'spiffy-tw-border-[--spiffy-colors-background-secondary-dark]', // hover:spiffy-tw-border-[--spiffy-colors-background-secondary-dark]
38
- ];
39
- const variantClassMap = new Map([
40
- [
41
- 'outlined',
42
- [
43
- 'spiffy-tw-border-[--spiffy-colors-border-outline]', // hover:spiffy-tw-border-[--spiffy-colors-border-outline]
44
- ...TEXT_LINK_CLASSES,
45
- ],
46
- ],
47
- [
48
- 'outlinedLight',
49
- [
50
- 'spiffy-tw-border-[--spiffy-colors-border-outline]', // hover:spiffy-tw-border-[--spiffy-colors-border-outline]
51
- 'spiffy-tw-bg-[--spiffy-colors-background-light]', // hover:spiffy-tw-bg-[--spiffy-colors-background-light]
52
- ...TEXT_LINK_CLASSES,
53
- BORDER_CLASS,
54
- ],
55
- ],
56
- [
57
- 'primary',
58
- [
59
- 'spiffy-tw-bg-[--spiffy-colors-background-primary]', // hover:spiffy-tw-bg-[--spiffy-colors-background-primary]
60
- 'spiffy-tw-border-[--spiffy-colors-background-primary]', // hover:spiffy-tw-border-[--spiffy-colors-background-secondary]
61
- ...TEXT_LIGHT_CLASSES,
62
- BORDER_CLASS,
63
- ],
64
- ],
65
- [
66
- 'secondary',
67
- [
68
- 'spiffy-tw-bg-[--spiffy-colors-background-secondary]', // hover:spiffy-tw-bg-[--spiffy-colors-background-secondary]
69
- 'spiffy-tw-text-[--spiffy-colors-text-link]', // hover:spiffy-tw-text-[--spiffy-colors-text-link]
70
- 'spiffy-tw-border-[--spiffy-colors-background-secondary]', // hover:spiffy-tw-border-[--spiffy-colors-background-secondary]
71
- ...ACCENT_PRIMARY_CLASSES,
72
- BORDER_CLASS,
73
- ],
74
- ],
75
- [
76
- 'tertiary',
77
- [
78
- 'spiffy-tw-bg-[--spiffy-colors-background-tertiary]', // hover:spiffy-tw-bg-[--spiffy-colors-background-tertiary]
79
- 'spiffy-tw-border-[--spiffy-colors-background-tertiary]', // hover:spiffy-tw-border-[--spiffy-colors-background-secondary]
80
- ...TEXT_LINK_CLASSES,
81
- BORDER_CLASS,
82
- ],
83
- ],
84
- ['dark', [...DARK_BACKGROUND_CLASSES, ...TEXT_LIGHT_CLASSES, BORDER_CLASS]],
85
- [
86
- 'darkPrimary',
87
- [
88
- ...DARK_BACKGROUND_CLASSES,
89
- 'spiffy-tw-text-[--spiffy-colors-text-light]', // hover:spiffy-tw-text-[--spiffy-colors-text-light]
90
- ...ACCENT_PRIMARY_CLASSES,
91
- BORDER_CLASS,
92
- ],
93
- ],
94
- [
95
- 'darkAccent',
96
- [
97
- ...DARK_BACKGROUND_CLASSES,
98
- 'spiffy-tw-text-[--spiffy-colors-text-light]', // hover:spiffy-tw-text-[--spiffy-colors-text-light]
99
- 'spiffy-tw-fill-[--spiffy-colors-text-accent]', // hover:spiffy-tw-fill-[--spiffy-colors-text-accent]
100
- 'spiffy-tw-stroke-[--spiffy-colors-text-accent]', // hover:spiffy-tw-stroke-[--spiffy-colors-text-accent]
101
- BORDER_CLASS,
102
- ],
103
- ],
104
- [
105
- 'transparent',
106
- [
107
- 'spiffy-tw-bg-transparent', // hover:spiffy-tw-bg-transparent
108
- 'spiffy-tw-border-[--spiffy-colors-background-light]', // hover:spiffy-tw-border-[--spiffy-colors-background-light]
109
- 'spiffy-tw-text-[--spiffy-colors-text-light]', // hover:spiffy-tw-text-[--spiffy-colors-text-light]
110
- 'spiffy-tw-fill-transparent', // hover:spiffy-tw-fill-transparent
111
- 'spiffy-tw-stroke-[--spiffy-colors-text-light]', // hover:spiffy-tw-stroke-[--spiffy-colors-text-light]
112
- BORDER_CLASS,
113
- ],
114
- ],
115
- [
116
- 'transparentDark',
117
- [
118
- 'spiffy-tw-bg-transparent', // hover:spiffy-tw-bg-transparent
119
- 'spiffy-tw-border-[--spiffy-colors-border-light]', // hover:spiffy-tw-border-[--spiffy-colors-border-light]
120
- 'spiffy-tw-text-[--spiffy-colors-text-primary]', // hover:spiffy-tw-text-[--spiffy-colors-text-primary]
121
- 'spiffy-tw-fill-transparent', // hover:spiffy-tw-fill-transparent
122
- 'spiffy-tw-stroke-[--spiffy-colors-text-primary]', // hover:spiffy-tw-stroke-[--spiffy-colors-text-primary]
123
- BORDER_CLASS,
124
- ],
125
- ],
126
- // This is used as the hover state for transparent
127
- ['secondaryDark', [...SECONDARY_DARK_BACKGROUND_CLASSES, ...TEXT_LINK_CLASSES, BORDER_CLASS]],
128
- [
129
- 'secondaryAccent',
130
- [
131
- ...SECONDARY_DARK_BACKGROUND_CLASSES,
132
- 'spiffy-tw-text-[--spiffy-colors-text-link]', // hover:spiffy-tw-text-[--spiffy-colors-text-link]
133
- ...ACCENT_PRIMARY_CLASSES,
134
- BORDER_CLASS,
135
- ],
136
- ],
137
- [
138
- 'lightDark',
139
- [
140
- 'spiffy-tw-bg-[--spiffy-colors-background-light]', // hover:spiffy-tw-bg-[--spiffy-colors-background-light]
141
- 'spiffy-tw-border-[--spiffy-colors-background-dark]', // hover:spiffy-tw-border-[--spiffy-colors-background-dark]
142
- ...TEXT_PRIMARY_CLASSES,
143
- BORDER_CLASS,
144
- ],
145
- ],
146
- ]);
147
- const borderedVariants = [
148
- 'outlined',
149
- 'outlinedLight',
150
- 'primary',
151
- 'secondary',
152
- 'tertiary',
153
- 'dark',
154
- 'darkAccent',
155
- 'darkPrimary',
156
- 'transparent',
157
- 'transparentDark',
158
- 'secondaryDark',
159
- 'secondaryAccent',
160
- 'lightDark',
161
- ];
162
- const hoverTransform = (variantClass) => variantClass?.map((className) => `hover:${className}`);
163
- export const SuggestionButton = ({ variant, hoverVariant, isDisabled, content, boldText, borderRadius = 'lg', isAnswer = false, dataAttributes, dataTestId, onClick, }) => {
164
- const buttonClassName = classNames({
165
- [SPIFFY_SUGGESTION_BUTTON_QUESTION_CLASS]: !isAnswer,
166
- [SPIFFY_SUGGESTION_BUTTON_ANSWER_CLASS]: isAnswer,
167
- '!spiffy-tw-rounded-[20px]': borderRadius === 'lg',
168
- '!spiffy-tw-rounded-[8px]': borderRadius === 'md',
169
- '!spiffy-tw-rounded-[0px]': borderRadius === 'sm',
170
- 'spiffy-tw-border-[1px]': borderedVariants.includes(variant),
171
- 'spiffy-tw-border-solid': borderedVariants.includes(variant),
172
- });
173
- const textClassName = classNames({
174
- 'spiffy-tw-text-[14px]': true,
175
- 'spiffy-tw-leading-[100%]': true,
176
- '!spiffy-tw-font-bold': boldText,
177
- });
178
- const iconClass = classNames({
179
- 'spiffy-tw-w-[11px]': true,
180
- 'spiffy-tw-h-[11px]': true,
181
- 'spiffy-tw-stroke-inherit': true,
182
- 'spiffy-tw-fill-inherit': true,
183
- });
184
- const baseClasses = variantClassMap.get(variant) ?? [];
185
- const hoverClasses = variantClassMap.get(hoverVariant) ?? [];
186
- // Separate border classes for proper cascading
187
- const baseBorderClasses = baseClasses.filter((cls) => cls.includes('border'));
188
- const baseNonBorderClasses = baseClasses.filter((cls) => !cls.includes('border'));
189
- const hoverBorderClasses = hoverClasses.filter((cls) => cls.includes('border'));
190
- const hoverNonBorderClasses = hoverClasses.filter((cls) => !cls.includes('border'));
191
- const variantClasses = [
192
- ...baseNonBorderClasses,
193
- ...hoverTransform(hoverNonBorderClasses),
194
- ...baseBorderClasses,
195
- ...hoverTransform(hoverBorderClasses),
196
- ];
197
- const buttonClass = `${buttonClassName} ${variantClasses.join(' ')}`;
198
- // Choose icon based on variant to match legacy exactly
199
- const getIcon = () => {
200
- if (isAnswer)
201
- return undefined;
202
- if (variant === 'transparentDark') {
203
- return OutlinedStar;
204
- }
205
- return FourPointStar;
206
- };
207
- return (_jsx(ButtonBase, { text: content, dataAttributes: dataAttributes, dataTestId: dataTestId, isDisabled: isDisabled,
208
- // we may want to support custom icons in the future
209
- icon: getIcon(), iconClass: isAnswer ? undefined : iconClass, textClass: `${SPIFFY_SUGGESTION_BUTTON_TEXT_CLASS} ${textClassName}`, buttonClass: buttonClass, onClick: onClick }));
210
- };
@@ -1 +0,0 @@
1
- export type SuggestionButtonVariant = 'outlined' | 'outlinedLight' | 'primary' | 'secondary' | 'tertiary' | 'dark' | 'darkAccent' | 'darkPrimary' | 'secondaryDark' | 'secondaryAccent' | 'transparent' | 'transparentDark' | 'lightDark';
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- import { type TextType, type TextVariant } from './types';
2
- type TextProps = {
3
- children: React.ReactNode;
4
- noOfLines?: number;
5
- className?: string;
6
- style?: React.CSSProperties;
7
- variant?: TextVariant;
8
- type?: TextType;
9
- testId?: string;
10
- };
11
- export declare const Text: ({ children, className, style, noOfLines, testId, type, variant, }: TextProps) => import("react/jsx-runtime").JSX.Element;
12
- export {};