@envive-ai/react-toolkit 0.1.12 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/dist/Accordion/index.cjs +3 -3
  2. package/dist/Accordion/index.d.cts +2 -2
  3. package/dist/Accordion/index.d.ts +2 -2
  4. package/dist/Accordion/index.js +3 -3
  5. package/dist/{Accordion-DBZpiQe7.cjs → Accordion-D9gO9_y3.cjs} +1 -1
  6. package/dist/{Accordion-Cp3Hx2zm.js → Accordion-ZEdp99Ph.js} +1 -1
  7. package/dist/AnimatedChevron/index.cjs +3 -0
  8. package/dist/AnimatedChevron/index.d.cts +11 -0
  9. package/dist/AnimatedChevron/index.d.ts +11 -0
  10. package/dist/AnimatedChevron/index.js +3 -0
  11. package/dist/AnimatedChevron-CwuXgR2r.js +29 -0
  12. package/dist/AnimatedChevron-e_UzWBl0.cjs +37 -0
  13. package/dist/AppliedFiltersScrollbar/index.cjs +25 -27
  14. package/dist/AppliedFiltersScrollbar/index.d.ts +2 -2
  15. package/dist/AppliedFiltersScrollbar/index.js +25 -27
  16. package/dist/ButtonBase/index.cjs +4 -4
  17. package/dist/ButtonBase/index.d.cts +3 -4
  18. package/dist/ButtonBase/index.d.ts +2 -3
  19. package/dist/ButtonBase/index.js +4 -4
  20. package/dist/{ButtonBase-BAf-nlCm.js → ButtonBase-BJ0qXMWD.js} +3 -3
  21. package/dist/{ButtonBase-Do88ndKa.cjs → ButtonBase-VIv-tn7H.cjs} +3 -3
  22. package/dist/DynamicFiltersScrollbar/index.cjs +23 -25
  23. package/dist/DynamicFiltersScrollbar/index.d.cts +2 -2
  24. package/dist/DynamicFiltersScrollbar/index.d.ts +2 -2
  25. package/dist/DynamicFiltersScrollbar/index.js +23 -25
  26. package/dist/DynamicFiltersScrollbar-HCYZjI14.cjs +81 -0
  27. package/dist/DynamicFiltersScrollbar-O0ai3cIG.js +66 -0
  28. package/dist/FilterScrollbar/index.cjs +3 -3
  29. package/dist/FilterScrollbar/index.d.cts +3 -3
  30. package/dist/FilterScrollbar/index.d.ts +3 -3
  31. package/dist/FilterScrollbar/index.js +3 -3
  32. package/dist/Headline/index.cjs +2 -2
  33. package/dist/Headline/index.d.cts +2 -2
  34. package/dist/Headline/index.d.ts +2 -2
  35. package/dist/Headline/index.js +2 -2
  36. package/dist/{Headline-DTT4RSv2.cjs → Headline-CKJmd2w4.cjs} +1 -1
  37. package/dist/{Headline-DNEWF8ly.js → Headline-DtjTB4xS.js} +1 -1
  38. package/dist/ImageWithFallback/index.cjs +1 -1
  39. package/dist/ImageWithFallback/index.d.cts +2 -2
  40. package/dist/ImageWithFallback/index.d.ts +2 -2
  41. package/dist/ImageWithFallback/index.js +1 -1
  42. package/dist/ModalSheet/index.cjs +2 -1
  43. package/dist/ModalSheet/index.d.cts +2 -2
  44. package/dist/ModalSheet/index.d.ts +2 -2
  45. package/dist/ModalSheet/index.js +2 -1
  46. package/dist/{ModalSheet-Csz8HIxs.cjs → ModalSheet-DwnbbFh7.cjs} +2 -26
  47. package/dist/{ModalSheet-01pxpy_K.js → ModalSheet-sMg44OLz.js} +2 -26
  48. package/dist/ProductCard/index.cjs +6 -6
  49. package/dist/ProductCard/index.d.cts +1 -1
  50. package/dist/ProductCard/index.d.ts +1 -1
  51. package/dist/ProductCard/index.js +6 -6
  52. package/dist/{ProductCard-FDyIMnZs.cjs → ProductCard-BDz80MCQ.cjs} +34 -34
  53. package/dist/{ProductCard-C3MjnfZJ.js → ProductCard-CqhNJShq.js} +34 -34
  54. package/dist/ProductGrid/index.cjs +7 -7
  55. package/dist/ProductGrid/index.d.cts +4 -8
  56. package/dist/ProductGrid/index.d.ts +4 -8
  57. package/dist/ProductGrid/index.js +7 -7
  58. package/dist/{ProductGrid-C9OKsyB2.js → ProductGrid-8n4XgcMr.js} +3 -7
  59. package/dist/{ProductGrid-TlntVJ6h.cjs → ProductGrid-RRcdkY5J.cjs} +3 -7
  60. package/dist/RadioButton/index.cjs +3 -3
  61. package/dist/RadioButton/index.d.cts +5 -3
  62. package/dist/RadioButton/index.d.ts +5 -3
  63. package/dist/RadioButton/index.js +3 -3
  64. package/dist/{RadioButton-DZ6QXkrN.cjs → RadioButton-BWnaUI8o.cjs} +17 -10
  65. package/dist/{RadioButton-Bf68dZl7.js → RadioButton-CG8_M0hY.js} +18 -11
  66. package/dist/RadioButtonGroup/index.cjs +4 -4
  67. package/dist/RadioButtonGroup/index.d.cts +2 -2
  68. package/dist/RadioButtonGroup/index.d.ts +2 -2
  69. package/dist/RadioButtonGroup/index.js +4 -4
  70. package/dist/{RadioButtonGroup-8k7hkJYB.js → RadioButtonGroup-B7EuiEP1.js} +2 -1
  71. package/dist/{RadioButtonGroup-Dc_n5amh.cjs → RadioButtonGroup-ReQqakpS.cjs} +2 -1
  72. package/dist/SearchAutocomplete/index.cjs +1 -1
  73. package/dist/SearchAutocomplete/index.js +1 -1
  74. package/dist/SearchFilter/index.cjs +15 -11
  75. package/dist/SearchFilter/index.d.cts +20 -6
  76. package/dist/SearchFilter/index.d.ts +20 -6
  77. package/dist/SearchFilter/index.js +12 -11
  78. package/dist/{SearchFilter-DvqBIXa1.js → SearchFilter-C8mgj84o.js} +28 -18
  79. package/dist/{SearchFilter-CTVBi5s3.cjs → SearchFilter-FrdHPM5O.cjs} +45 -17
  80. package/dist/SearchInput/index.cjs +4 -4
  81. package/dist/SearchInput/index.d.cts +3 -2
  82. package/dist/SearchInput/index.d.ts +4 -3
  83. package/dist/SearchInput/index.js +4 -4
  84. package/dist/{SearchInput-vJMWoLzS.cjs → SearchInput--x9NTMTb.cjs} +2 -2
  85. package/dist/{SearchInput-CVaCPWCE.js → SearchInput-IBq83nqF.js} +2 -2
  86. package/dist/SearchInputForm/index.cjs +5 -5
  87. package/dist/SearchInputForm/index.d.cts +34 -2
  88. package/dist/SearchInputForm/index.d.ts +34 -2
  89. package/dist/SearchInputForm/index.js +5 -5
  90. package/dist/SearchResultsContent/index.cjs +36 -39
  91. package/dist/SearchResultsContent/index.d.cts +4 -6
  92. package/dist/SearchResultsContent/index.d.ts +4 -6
  93. package/dist/SearchResultsContent/index.js +36 -39
  94. package/dist/SearchResultsFilterSidebar/index.cjs +13 -12
  95. package/dist/SearchResultsFilterSidebar/index.d.cts +1 -1
  96. package/dist/SearchResultsFilterSidebar/index.d.ts +1 -1
  97. package/dist/SearchResultsFilterSidebar/index.js +13 -12
  98. package/dist/SearchResultsStates/index.cjs +12 -12
  99. package/dist/SearchResultsStates/index.d.cts +6 -8
  100. package/dist/SearchResultsStates/index.d.ts +6 -8
  101. package/dist/SearchResultsStates/index.js +12 -12
  102. package/dist/{SearchResultsStates-iKz64Pd4.js → SearchResultsStates-D7dM35qq.js} +8 -10
  103. package/dist/{SearchResultsStates-CH4agenX.cjs → SearchResultsStates-nlaPbkj3.cjs} +8 -10
  104. package/dist/SparkleAnimation/index.cjs +1 -1
  105. package/dist/SparkleAnimation/index.d.cts +2 -2
  106. package/dist/SparkleAnimation/index.d.ts +2 -2
  107. package/dist/SparkleAnimation/index.js +1 -1
  108. package/dist/{SparkleAnimation-qi5WCJ9B.cjs → SparkleAnimation-D1aZE-7A.cjs} +0 -1
  109. package/dist/{SparkleAnimation-BLfNojLv.js → SparkleAnimation-DtWkXmkN.js} +0 -1
  110. package/dist/Spinner/index.cjs +1 -1
  111. package/dist/Spinner/index.d.cts +2 -2
  112. package/dist/Spinner/index.d.ts +2 -2
  113. package/dist/Spinner/index.js +1 -1
  114. package/dist/SuggestionButton/index.cjs +3 -3
  115. package/dist/SuggestionButton/index.d.ts +2 -2
  116. package/dist/SuggestionButton/index.js +3 -3
  117. package/dist/Text/index.cjs +2 -2
  118. package/dist/Text/index.d.cts +2 -2
  119. package/dist/Text/index.d.ts +3 -3
  120. package/dist/Text/index.js +2 -2
  121. package/dist/{Text-Bod4OMPk.js → Text-BLzNhX4H.js} +1 -1
  122. package/dist/{Text-MQjxqgZZ.cjs → Text-DllCE9_D.cjs} +1 -1
  123. package/dist/TextInput/index.cjs +2 -2
  124. package/dist/TextInput/index.d.ts +1 -1
  125. package/dist/TextInput/index.js +2 -2
  126. package/dist/{TextInput-DoM41M53.js → TextInput-BeHPlVHT.js} +1 -1
  127. package/dist/{TextInput-B3dTeD3q.cjs → TextInput-CGs4BY1q.cjs} +1 -1
  128. package/dist/ToggleButton/index.cjs +3 -3
  129. package/dist/ToggleButton/index.d.cts +2 -2
  130. package/dist/ToggleButton/index.d.ts +2 -2
  131. package/dist/ToggleButton/index.js +3 -3
  132. package/dist/{ToggleButton-GIVd2-Z4.js → ToggleButton-CRiPqTCb.js} +1 -1
  133. package/dist/{ToggleButton-CK_vkMvt.cjs → ToggleButton-DfJZ8POQ.cjs} +1 -1
  134. package/dist/{index-CFH3KUVw.d.cts → index-B9WeFNlO.d.cts} +5 -9
  135. package/dist/{index-B8l3muO3.d.ts → index-CLGe_Pam.d.cts} +2 -3
  136. package/dist/{index-Vck3pox6.d.ts → index-CeECGrFM.d.ts} +4 -8
  137. package/dist/{index-BMt66uqr.d.cts → index-PSzeHU2s.d.ts} +2 -3
  138. package/dist/{searchFilterSidebarVariants-CI782ylo.js → searchFilterSidebarVariants-B05f5SD5.js} +1 -1
  139. package/dist/{searchFilterSidebarVariants-DFfOTqjc.cjs → searchFilterSidebarVariants-NQhqq-NT.cjs} +1 -1
  140. package/dist/{textVariantClasses-Dgz7Zaql.cjs → textVariantClasses-CBre7vXv.cjs} +5 -7
  141. package/dist/{textVariantClasses-D77TGEy1.js → textVariantClasses-CRrTb43V.js} +5 -7
  142. package/dist/types-BhGjnuWx.d.cts +4 -0
  143. package/dist/types-CTOdb0G0.d.ts +4 -0
  144. package/package.json +7 -7
  145. package/src/atoms/search/types.ts +1 -5
  146. package/src/components/AnimatedChevron/index.ts +1 -0
  147. package/src/components/AppliedFiltersScrollbar/AppliedFiltersScrollbar.tsx +25 -27
  148. package/src/components/ButtonBase/ButtonBase.tsx +1 -2
  149. package/src/components/DynamicFiltersScrollbar/DynamicFiltersScrollbar.tsx +26 -28
  150. package/src/components/FilterScrollbar/AppliedFiltersScrollbar.tsx +25 -27
  151. package/src/components/FilterScrollbar/DynamicFiltersScrollbar.tsx +26 -28
  152. package/src/components/ModalSheet/ModalSheet.tsx +1 -1
  153. package/src/components/ModalSheet/common/closeIcon.tsx +2 -2
  154. package/src/components/ModalSheet/mobile/mobileHeader.tsx +1 -1
  155. package/src/components/ProductCard/ProductCard.tsx +5 -28
  156. package/src/components/ProductGrid/ProductGrid.tsx +3 -11
  157. package/src/components/RadioButton/RadioButton.tsx +15 -6
  158. package/src/components/RadioButtonGroup/RadioButtonGroup.tsx +1 -0
  159. package/src/components/SearchFilter/SearchFilter.tsx +2 -2
  160. package/src/components/SearchFilter/SearchFilterFooter.tsx +1 -1
  161. package/src/components/SearchFilter/SearchFilterHeader.tsx +6 -1
  162. package/src/components/SearchFilter/SearchFilterItem.tsx +17 -3
  163. package/src/components/SearchFilter/index.ts +4 -2
  164. package/src/components/SearchFilter/useHasFilterStateChanged.tsx +1 -0
  165. package/src/components/SearchFilter/utils.ts +4 -6
  166. package/src/components/SearchInput/SearchInput.tsx +2 -2
  167. package/src/components/SearchInput/searchInputVariants.ts +1 -1
  168. package/src/components/SearchInputForm/SearchInputForm.tsx +1 -1
  169. package/src/components/SearchInputForm/index.ts +0 -1
  170. package/src/components/SearchResultsContent/SearchResultsContent.tsx +33 -38
  171. package/src/components/SearchResultsFilterSidebar/SearchResultsFilter.tsx +2 -3
  172. package/src/components/SearchResultsFilterSidebar/searchFilterSidebarVariants.ts +1 -1
  173. package/src/components/SearchResultsStates/SearchResultsGrid.tsx +4 -8
  174. package/src/components/SearchResultsStates/SearchResultsLoadingGrid.tsx +3 -3
  175. package/src/components/SparkleAnimation/SparkleAnimation.tsx +0 -1
  176. package/src/components/Spinner/Spinner.tsx +29 -14
  177. package/src/components/SuggestionButton/SuggestionButton.tsx +1 -1
  178. package/src/components/SuggestionButton/types.ts +1 -1
  179. package/src/components/Text/textVariantClasses.ts +12 -10
  180. package/src/components/TextInput/TextInput.tsx +1 -0
  181. package/src/util/camelCasedPropertiesDeep.ts +22 -22
  182. package/src/util/internal.ts +4 -2
  183. package/src/util/splitWords.ts +35 -31
  184. package/dist/DynamicFiltersScrollbar-C4kdNSJ9.js +0 -70
  185. package/dist/DynamicFiltersScrollbar-CVw1PINp.cjs +0 -85
  186. package/dist/Styles/index.cjs +0 -274
  187. package/dist/Styles/index.d.cts +0 -258
  188. package/dist/Styles/index.d.ts +0 -258
  189. package/dist/Styles/index.js +0 -274
  190. package/dist/index-H_9LhS_1.d.cts +0 -36
  191. package/dist/index-h-QwQNnu.d.ts +0 -36
  192. package/src/components/SearchInputForm/types.ts +0 -1
  193. package/src/components/Styles/EnviveTailwindPreset.ts +0 -285
  194. package/src/components/Styles/index.ts +0 -2
  195. package/tailwind-preset.js +0 -3
  196. /package/dist/{ButtonBase-0NN6wmX-.js → ButtonBase-BktteD9c.js} +0 -0
  197. /package/dist/{ButtonBase-BIXx56hq.cjs → ButtonBase-Cb6Iec6f.cjs} +0 -0
  198. /package/dist/{ImageWithFallback-DqxjwO3i.js → ImageWithFallback-CbYsD1_a.js} +0 -0
  199. /package/dist/{ImageWithFallback-Cx-KNi-D.cjs → ImageWithFallback-Km9h16Vz.cjs} +0 -0
  200. /package/dist/{SearchAutocomplete-BlpII8Xs.js → SearchAutocomplete-BMNYZiJL.js} +0 -0
  201. /package/dist/{SearchAutocomplete-DIEhLT4C.cjs → SearchAutocomplete-BmHdijOv.cjs} +0 -0
  202. /package/dist/{Spinner-CjGLIRgs.js → Spinner-bg6jb_ks.js} +0 -0
  203. /package/dist/{Spinner-DFor2Szi.cjs → Spinner-rcWX566W.cjs} +0 -0
  204. /package/dist/{colorsConfig-DEfiLHH0.js → colorsConfig-Ck2jeqWe.js} +0 -0
  205. /package/dist/{colorsConfig-D-MZuBvt.cjs → colorsConfig-CqCKftuM.cjs} +0 -0
  206. /package/dist/{textVariantClasses-kyZtL8F5.d.ts → textVariantClasses-Bl8SAGwZ.d.ts} +0 -0
@@ -1,12 +1,16 @@
1
1
  import classNames from 'classnames';
2
2
  import { MdStar } from 'react-icons/md';
3
+ import Logger from 'src/logging/logger';
4
+ import { Text } from 'src/components/Text/Text';
5
+ import { formatPrice } from 'src/util/formatPrice';
6
+ import { TestProps } from '@envive-ai/react-hooks/types';
7
+ import { useImageResolver } from '@envive-ai/react-hooks/hooks/ImageResolver';
3
8
  import {
4
9
  variantClassMap,
5
10
  variantHoverClassMap,
6
11
  productCardLayoutVariantClasses,
7
12
  variantTitleColorMap,
8
13
  } from './productCardVariants';
9
- import Logger from 'src/logging/logger';
10
14
  import { Headline } from '../Headline';
11
15
  import { ImageWithFallback } from '../ImageWithFallback';
12
16
  import { Spinner } from '../Spinner';
@@ -16,10 +20,6 @@ import {
16
20
  ProductCardHoverVariant,
17
21
  ProductCardLayoutVariant,
18
22
  } from './types';
19
- import { Text } from 'src/components/Text/Text';
20
- import { formatPrice } from 'src/util/formatPrice';
21
- import { TestProps } from '@envive-ai/react-hooks/types';
22
- import { useImageResolver } from '@envive-ai/react-hooks/hooks/ImageResolver';
23
23
 
24
24
  const formatReviews = (stars: number) =>
25
25
  String(
@@ -95,29 +95,11 @@ export const PriceSection = ({ originalPrice, salePrice, pricePrefix }: PriceSec
95
95
  );
96
96
  };
97
97
 
98
- // export const formatPrice = (price?: number, currency: string = '$'): string => {
99
- // if (price == null) {
100
- // return '';
101
- // }
102
-
103
- // const options: Intl.NumberFormatOptions = {};
104
-
105
- // if (!Number.isInteger(price)) {
106
- // options.minimumFractionDigits = 2;
107
- // options.maximumFractionDigits = 2;
108
- // }
109
-
110
- // return `${currency}${price.toLocaleString('en-US', options)}`;
111
- // };
112
-
113
98
  interface ProductCardProps extends TestProps {
114
99
  productCardConfig?: ProductCardConfig;
115
100
  merchantShortName: string;
116
101
  title: string;
117
102
  url: string;
118
- searchResponseId?: string;
119
- productResponseId?: string;
120
- cardDisplayLocation: string;
121
103
  imageUrl?: string;
122
104
  originalPrice?: number;
123
105
  averageRating?: number;
@@ -128,7 +110,6 @@ interface ProductCardProps extends TestProps {
128
110
  layoutVariant?: ProductCardLayoutVariant;
129
111
  zoomOnHover?: boolean;
130
112
  aspectRatio?: '3:4' | 'square' | 'none';
131
- clickPosition?: number | null;
132
113
  growWithContainer?: boolean;
133
114
  handleClick?: (clickedUrl: string) => void;
134
115
  }
@@ -139,8 +120,6 @@ export const ProductCard = ({
139
120
  imageUrl,
140
121
  title,
141
122
  url,
142
- // searchResponseId,
143
- // productResponseId,
144
123
  originalPrice,
145
124
  averageRating,
146
125
  numberReviews,
@@ -149,10 +128,8 @@ export const ProductCard = ({
149
128
  hoverVariant,
150
129
  dataTestId,
151
130
  layoutVariant = 'normal',
152
- // cardDisplayLocation,
153
131
  zoomOnHover = false,
154
132
  aspectRatio = 'none',
155
- // clickPosition = null,
156
133
  growWithContainer = false,
157
134
  handleClick,
158
135
  }: ProductCardProps) => {
@@ -1,8 +1,8 @@
1
- import { ProductGridVariant, ProductCardConfig, ProductCard } from '../ProductCard';
2
- import { productGridVariantClasses } from './productGridVariants';
3
1
  import classNames from 'classnames';
4
2
  import { SearchResponseProduct } from '@spiffy-ai/commerce-api-client';
5
3
  import { CamelCasedPropertiesDeep } from 'src/util/camelCasedPropertiesDeep';
4
+ import { productGridVariantClasses } from './productGridVariants';
5
+ import { ProductGridVariant, ProductCardConfig, ProductCard } from '../ProductCard';
6
6
 
7
7
  interface ProductGridProps {
8
8
  productList: SearchResponseProduct[];
@@ -10,9 +10,7 @@ interface ProductGridProps {
10
10
  productGridClasses: string;
11
11
  productCardConfig?: ProductCardConfig;
12
12
  merchantShortName: string;
13
- searchResponseId: string;
14
13
  cardsGrowWithContainer?: boolean;
15
- cardDisplayLocation: string;
16
14
  }
17
15
 
18
16
  export const ProductGrid = ({
@@ -21,9 +19,7 @@ export const ProductGrid = ({
21
19
  productGridClasses,
22
20
  productCardConfig,
23
21
  merchantShortName,
24
- searchResponseId,
25
22
  cardsGrowWithContainer = true,
26
- cardDisplayLocation,
27
23
  }: ProductGridProps) => {
28
24
  const {
29
25
  productCardVariant,
@@ -40,7 +36,7 @@ export const ProductGrid = ({
40
36
 
41
37
  return (
42
38
  <div className={productGridClasses}>
43
- {productList.map((product: SearchResponseProduct, index: number) => {
39
+ {productList.map((product: SearchResponseProduct) => {
44
40
  const camelCasedProduct: CamelCasedPropertiesDeep<SearchResponseProduct> = product;
45
41
  return (
46
42
  <div key={camelCasedProduct.id} className={cardContainerClasses}>
@@ -49,21 +45,17 @@ export const ProductGrid = ({
49
45
  merchantShortName={merchantShortName}
50
46
  key={camelCasedProduct.id}
51
47
  imageUrl={camelCasedProduct.imageUrl}
52
- searchResponseId={searchResponseId}
53
- productResponseId={camelCasedProduct.responseId}
54
48
  title={camelCasedProduct.title}
55
49
  url={camelCasedProduct.url}
56
50
  originalPrice={camelCasedProduct.originalPrice}
57
51
  salePrice={camelCasedProduct.salePrice}
58
52
  averageRating={camelCasedProduct.averageRating}
59
53
  numberReviews={camelCasedProduct.numberReviews}
60
- cardDisplayLocation={cardDisplayLocation}
61
54
  layoutVariant={productCardLayoutVariant}
62
55
  variant={productCardVariant}
63
56
  hoverVariant={productCardHoverVariant}
64
57
  zoomOnHover={zoomOnHover}
65
58
  aspectRatio={productCardImageAspectRatio}
66
- clickPosition={index}
67
59
  growWithContainer={cardsGrowWithContainer}
68
60
  />
69
61
  </div>
@@ -14,6 +14,7 @@ interface RadioButtonProps extends TestProps {
14
14
  uncheckedBorderColor?: string;
15
15
  checked?: boolean;
16
16
  onChange: (value: string) => void;
17
+ id;
17
18
  }
18
19
 
19
20
  export const RadioButton = ({
@@ -27,6 +28,7 @@ export const RadioButton = ({
27
28
  uncheckedBorderColor,
28
29
  checked = false,
29
30
  onChange,
31
+ id,
30
32
  }: RadioButtonProps) => {
31
33
  const [isHovered, setIsHovered] = useState(false);
32
34
 
@@ -54,14 +56,21 @@ export const RadioButton = ({
54
56
  };
55
57
 
56
58
  return (
57
- <label
58
- className={containerClassName}
59
- onMouseEnter={() => !isDisabled && setIsHovered(true)}
60
- onMouseLeave={() => setIsHovered(false)}
61
- >
59
+ <>
60
+ <label
61
+ className={containerClassName}
62
+ onMouseEnter={() => !isDisabled && setIsHovered(true)}
63
+ onMouseLeave={() => setIsHovered(false)}
64
+ aria-label={label}
65
+ htmlFor={id}
66
+ >
67
+ {label}
68
+ </label>
69
+
62
70
  <div className="spiffy-tw-relative">
63
71
  <input
64
72
  type="radio"
73
+ id={id}
65
74
  name={name}
66
75
  value={value}
67
76
  checked={checked}
@@ -83,6 +92,6 @@ export const RadioButton = ({
83
92
  </svg>
84
93
  </div>
85
94
  <Text variant="body3">{label}</Text>
86
- </label>
95
+ </>
87
96
  );
88
97
  };
@@ -55,6 +55,7 @@ export const RadioButtonGroup = ({
55
55
  {options.map((option) => (
56
56
  <RadioButton
57
57
  key={option.value}
58
+ id={option.value}
58
59
  name={name}
59
60
  value={option.value}
60
61
  fillColor={fillColor}
@@ -1,11 +1,11 @@
1
1
  import classNames from 'classnames';
2
- import { SearchFilterProps } from './types';
3
2
  import { useCallback } from 'react';
3
+ import { FilterItemProps, FilterProps } from '@envive-ai/react-hooks/types';
4
+ import { SearchFilterProps } from './types';
4
5
  import { SearchFilterHeader } from './SearchFilterHeader';
5
6
  import { useHasFilterStateChanged } from './useHasFilterStateChanged';
6
7
  import { getSelectedFilterItemsCount, getTotalSelectedFilterItemsCount } from './utils';
7
8
  import { ModalSheet } from '../ModalSheet';
8
- import { FilterItemProps, FilterProps } from '@envive-ai/react-hooks/types';
9
9
  import { ToggleButton } from '../ToggleButton';
10
10
  import { Accordion } from '../Accordion';
11
11
  import { RadioButtonGroup } from '../RadioButtonGroup';
@@ -1,6 +1,6 @@
1
1
  import classNames from 'classnames';
2
- import { ButtonBase } from '../ButtonBase';
3
2
  import { FilterFooterProps } from '@envive-ai/react-hooks/types';
3
+ import { ButtonBase } from '../ButtonBase';
4
4
 
5
5
  export const SearchFilterFooter = ({
6
6
  closeModal,
@@ -23,7 +23,12 @@ export const SearchFilterHeader = ({
23
23
  <Text variant="body2" className="spiffy-tw-font-medium">
24
24
  Filters ({productCount})
25
25
  </Text>
26
- <button onClick={closeModal} className="spiffy-tw-p-2">
26
+ <button
27
+ onClick={closeModal}
28
+ className="spiffy-tw-p-2"
29
+ type="button"
30
+ aria-label="Open Filter Menu"
31
+ >
27
32
  <svg
28
33
  xmlns="http://www.w3.org/2000/svg"
29
34
  width="14"
@@ -22,9 +22,23 @@ export const SearchFilterItem = ({
22
22
  );
23
23
 
24
24
  return (
25
- <li
26
- className="spiffy-tw-flex spiffy-tw-items-center spiffy-tw-justify-between spiffy-tw-py-2 spiffy-tw-cursor-pointer"
25
+ <button
26
+ type="button"
27
+ role="option"
28
+ aria-selected={isSelected}
29
+ className="spiffy-tw-flex spiffy-tw-items-center spiffy-tw-justify-between spiffy-tw-py-2"
27
30
  onClick={() => onSelectFilterItem(filterItem)}
31
+ onKeyDown={(event) => {
32
+ if (event.key === 'Enter' || event.key === ' ') {
33
+ event.preventDefault();
34
+ onSelectFilterItem(filterItem);
35
+ }
36
+ }}
37
+ onKeyUp={(event) => {
38
+ if (event.key === ' ') {
39
+ event.preventDefault();
40
+ }
41
+ }}
28
42
  >
29
43
  <Text variant="body3">{displayName}</Text>
30
44
  <div className={radioClasses}>
@@ -37,6 +51,6 @@ export const SearchFilterItem = ({
37
51
  />
38
52
  )}
39
53
  </div>
40
- </li>
54
+ </button>
41
55
  );
42
56
  };
@@ -1,3 +1,5 @@
1
- export { SearchFilter } from './SearchFilter';
1
+ export * from './SearchFilter';
2
2
  export * from './SearchFilterHeader';
3
- export { SearchFilterItem } from './SearchFilterItem';
3
+ export * from './SearchFilterFooter';
4
+ export * from './SearchFilterItem';
5
+ export * from './utils';
@@ -34,6 +34,7 @@ export const useHasFilterStateChanged = (filters: SearchFilterDatum[], isOpen: b
34
34
  if (isOpen) {
35
35
  setInitialFilterStates(currentFilterStates);
36
36
  }
37
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37
38
  }, [isOpen]);
38
39
 
39
40
  return hasFiltersChanged;
@@ -1,15 +1,13 @@
1
1
  import { SearchFilterDatum, SearchFilterItemDatum } from '@envive-ai/react-hooks/types';
2
2
 
3
- export const getSelectedFilterItemsCount = (filter: SearchFilterDatum) => {
4
- return filter.items.filter((item: SearchFilterItemDatum) => item.isSelected).length;
5
- };
3
+ export const getSelectedFilterItemsCount = (filter: SearchFilterDatum) =>
4
+ filter.items.filter((item: SearchFilterItemDatum) => item.isSelected).length;
6
5
 
7
6
  // Gets the count of total active filters excluding sort filters
8
- export const getTotalSelectedFilterItemsCount = (filters: SearchFilterDatum[]) => {
9
- return filters.reduce((acc: number, filter: SearchFilterDatum) => {
7
+ export const getTotalSelectedFilterItemsCount = (filters: SearchFilterDatum[]) =>
8
+ filters.reduce((acc: number, filter: SearchFilterDatum) => {
10
9
  if (filter.filterId === 'sort') {
11
10
  return acc;
12
11
  }
13
12
  return acc + getSelectedFilterItemsCount(filter);
14
13
  }, 0);
15
- };
@@ -1,10 +1,10 @@
1
1
  import React, { useRef, useImperativeHandle } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import MagnifyingGlassStarVariant from '@envive-ai/react-icons/MagnifyingGlassStarVariant';
4
- import { SearchInputVariant } from '../SearchInputForm';
4
+ import { IconClose } from '@envive-ai/react-icons/src/index.js';
5
+ import { SearchInputVariant } from '@envive-ai/react-hooks/contexts/types';
5
6
  import { TextInput } from '../TextInput';
6
7
  import { searchInputVariantClasses } from './searchInputVariants';
7
- import { IconClose } from '@envive-ai/react-icons/src/index.js';
8
8
 
9
9
  interface SearchInputProps {
10
10
  searchInputVariant?: SearchInputVariant;
@@ -1,5 +1,5 @@
1
1
  import { colorVar, ColorNames } from 'src/models/colorsConfig';
2
- import { SearchInputVariant } from '../SearchInputForm';
2
+ import { SearchInputVariant } from '../../atoms/search/types';
3
3
  import { TextStyleVariantMap } from '../Text/textVariantClasses';
4
4
 
5
5
  type SearchInputVariantClasses = {
@@ -1,7 +1,7 @@
1
1
  import { SearchAutocomplete } from '../SearchAutocomplete';
2
2
  import { SearchInput } from '../SearchInput/SearchInput';
3
3
  import { searchInputVariantClasses } from '../SearchInput/searchInputVariants';
4
- import { SearchInputVariant } from './types';
4
+ import { SearchInputVariant } from '../../atoms/search/types';
5
5
 
6
6
  interface SearchInputFormProps {
7
7
  searchInputVariant: SearchInputVariant;
@@ -1,2 +1 @@
1
1
  export * from './SearchInputForm';
2
- export * from './types';
@@ -1,4 +1,5 @@
1
1
  import { SelectedFilterOption } from '@envive-ai/react-hooks/atoms/search';
2
+ import { SearchResultsState } from '@envive-ai/react-hooks/hooks/utils';
2
3
  import {
3
4
  ProductCardConfig,
4
5
  ProductGridVariant,
@@ -10,7 +11,6 @@ import {
10
11
  SearchResultsGrid,
11
12
  SearchResultsLoadingGrid,
12
13
  } from '../SearchResultsStates';
13
- import { SearchResultsState } from '@envive-ai/react-hooks/hooks/utils';
14
14
 
15
15
  interface SearchResultsContentProps {
16
16
  searchResultsState: SearchResultsState;
@@ -23,7 +23,6 @@ interface SearchResultsContentProps {
23
23
  containerXPaddingClasses: string;
24
24
  selectedFilterOptions: SelectedFilterOption[];
25
25
  availableDynamicFilters: { name: string; displayName: string }[];
26
- searchResponseId: string;
27
26
  onRemoveFilter: (filter: SelectedFilterOption) => void;
28
27
  onToggleDynamicFilter: ({
29
28
  filter,
@@ -46,42 +45,38 @@ export const SearchResultsContent = ({
46
45
  containerXPaddingClasses,
47
46
  selectedFilterOptions,
48
47
  availableDynamicFilters,
49
- searchResponseId,
50
48
  onRemoveFilter,
51
49
  onToggleDynamicFilter,
52
50
  noResultsFoundText,
53
- }: SearchResultsContentProps) => {
54
- return (
55
- <div>
56
- {searchResultsState === SearchResultsState.NoResults && (
57
- <NoSearchResultsFound
58
- containerPaddingClasses={containerXPaddingClasses}
59
- includeBottomMargin
60
- noResultsFoundText={noResultsFoundText}
61
- />
62
- )}
63
- {searchResultsState === SearchResultsState.Results && (
64
- <SearchResultsGrid
65
- searchFilterSidebarVariant={searchFilterSidebarVariant}
66
- productCardConfig={productCardConfig}
67
- merchantShortName={merchantShortName}
68
- productList={productList}
69
- productGridVariant={productGridVariant}
70
- productGridClasses={productGridClasses}
71
- containerXPaddingClasses={containerXPaddingClasses}
72
- selectedFilterOptions={selectedFilterOptions}
73
- availableDynamicFilters={availableDynamicFilters}
74
- searchResponseId={searchResponseId}
75
- onRemoveFilter={onRemoveFilter}
76
- onToggleDynamicFilter={onToggleDynamicFilter}
77
- />
78
- )}
79
- {searchResultsState === SearchResultsState.Loading && (
80
- <SearchResultsLoadingGrid
81
- productGridVariant={productGridVariant}
82
- productGridClasses={productGridClasses}
83
- />
84
- )}
85
- </div>
86
- );
87
- };
51
+ }: SearchResultsContentProps) => (
52
+ <div>
53
+ {searchResultsState === SearchResultsState.NoResults && (
54
+ <NoSearchResultsFound
55
+ containerPaddingClasses={containerXPaddingClasses}
56
+ includeBottomMargin
57
+ noResultsFoundText={noResultsFoundText}
58
+ />
59
+ )}
60
+ {searchResultsState === SearchResultsState.Results && (
61
+ <SearchResultsGrid
62
+ searchFilterSidebarVariant={searchFilterSidebarVariant}
63
+ productCardConfig={productCardConfig}
64
+ merchantShortName={merchantShortName}
65
+ productList={productList}
66
+ productGridVariant={productGridVariant}
67
+ productGridClasses={productGridClasses}
68
+ containerXPaddingClasses={containerXPaddingClasses}
69
+ selectedFilterOptions={selectedFilterOptions}
70
+ availableDynamicFilters={availableDynamicFilters}
71
+ onRemoveFilter={onRemoveFilter}
72
+ onToggleDynamicFilter={onToggleDynamicFilter}
73
+ />
74
+ )}
75
+ {searchResultsState === SearchResultsState.Loading && (
76
+ <SearchResultsLoadingGrid
77
+ productGridVariant={productGridVariant}
78
+ productGridClasses={productGridClasses}
79
+ />
80
+ )}
81
+ </div>
82
+ );
@@ -1,11 +1,11 @@
1
1
  import { useCallback } from 'react';
2
2
 
3
+ import { SearchFilterDatum, SelectFilterItem } from '@envive-ai/react-hooks/types';
4
+ import SettingsVariant from '@envive-ai/react-icons/src/SettingsVariant.js';
3
5
  import { searchFilterSidebarVariantClasses } from './searchFilterSidebarVariants';
4
6
  import { ButtonBase } from '../ButtonBase';
5
7
  import { SearchFilter, SearchFilterHeader } from '../SearchFilter';
6
8
  import { SearchFilterSidebarVariant } from './types';
7
- import { SearchFilterDatum, SelectFilterItem } from '@envive-ai/react-hooks/types';
8
- import SettingsVariant from '@envive-ai/react-icons/src/SettingsVariant.js';
9
9
 
10
10
  export type SearchResultsFilterProps = {
11
11
  productCount: number;
@@ -13,7 +13,6 @@ export type SearchResultsFilterProps = {
13
13
  setIsOpen: (isOpen: boolean) => void;
14
14
  searchFilters: SearchFilterDatum[];
15
15
  searchFilterSidebarVariant: SearchFilterSidebarVariant;
16
- searchText: string;
17
16
  onSelectFilterItem: SelectFilterItem;
18
17
  onClearAllFilters: () => void;
19
18
  filterButtonText: string;
@@ -1,5 +1,5 @@
1
- import type { SearchFilterSidebarVariant, CloseIconVariant } from './types';
2
1
  import { ColorNames, colorVar } from 'src/models/colorsConfig';
2
+ import type { SearchFilterSidebarVariant, CloseIconVariant } from './types';
3
3
 
4
4
  interface SearchFilterSidebarVariantClasses {
5
5
  searchFilterHeaderClasses: string;
@@ -1,14 +1,14 @@
1
+ import { motion } from 'framer-motion';
2
+ import classNames from 'classnames';
3
+ import { SearchResponseProduct } from '@spiffy-ai/commerce-api-client';
4
+ import { SelectedFilterOption } from '@envive-ai/react-hooks/atoms/search';
1
5
  import { AppliedFiltersScrollbar } from '../FilterScrollbar/AppliedFiltersScrollbar';
2
6
  import { DynamicFiltersScrollbar } from '../FilterScrollbar/DynamicFiltersScrollbar';
3
- import { motion } from 'framer-motion';
4
7
 
5
8
  import { searchFilterSidebarVariantClasses } from '../SearchResultsFilterSidebar/searchFilterSidebarVariants';
6
- import classNames from 'classnames';
7
- import { SearchResponseProduct } from '@spiffy-ai/commerce-api-client';
8
9
  import { ProductCardConfig, ProductGridVariant } from '../ProductCard';
9
10
  import { ProductGrid } from '../ProductGrid';
10
11
  import { SearchFilterSidebarVariant } from '../SearchResultsFilterSidebar';
11
- import { SelectedFilterOption } from '@envive-ai/react-hooks/atoms/search';
12
12
 
13
13
  interface SearchResultsGridProps {
14
14
  productList: SearchResponseProduct[];
@@ -18,7 +18,6 @@ interface SearchResultsGridProps {
18
18
  searchFilterSidebarVariant: SearchFilterSidebarVariant;
19
19
  productGridVariant: ProductGridVariant;
20
20
  selectedFilterOptions: SelectedFilterOption[];
21
- searchResponseId: string;
22
21
  containerXPaddingClasses: string;
23
22
  productGridClasses: string;
24
23
  onRemoveFilter: (filter: SelectedFilterOption) => void;
@@ -39,7 +38,6 @@ export const SearchResultsGrid = ({
39
38
  searchFilterSidebarVariant,
40
39
  productGridVariant,
41
40
  selectedFilterOptions,
42
- searchResponseId,
43
41
  containerXPaddingClasses,
44
42
  productGridClasses,
45
43
  onRemoveFilter,
@@ -100,8 +98,6 @@ export const SearchResultsGrid = ({
100
98
  productGridClasses={productGridClasses}
101
99
  productCardConfig={productCardConfig}
102
100
  merchantShortName={merchantShortName}
103
- searchResponseId={searchResponseId}
104
- cardDisplayLocation=""
105
101
  />
106
102
  </motion.div>
107
103
  );
@@ -1,8 +1,8 @@
1
1
  import { motion } from 'framer-motion';
2
+ import { Text } from 'src/components/Text';
2
3
  import { ProductGridVariant, ProductCardSkeleton } from '../ProductCard';
3
4
  import { productGridVariantClasses } from '../ProductGrid';
4
5
  import { SparkleAnimation } from '../SparkleAnimation';
5
- import { Text } from 'src/components/Text';
6
6
 
7
7
  export const SearchResultsLoadingGrid = ({
8
8
  productGridVariant,
@@ -28,7 +28,7 @@ export const SearchResultsLoadingGrid = ({
28
28
  <div className="spiffy-tw-flex spiffy-tw-items-center spiffy-tw-justify-between spiffy-tw-mb-4">
29
29
  <div className="spiffy-tw-flex spiffy-tw-items-center spiffy-tw-gap-2 spiffy-tw-ml-[16px] md:spiffy-tw-ml-[80px]">
30
30
  <div className="spiffy-tw-width-[24px]">
31
- <SparkleAnimation color={sparkleIconColor} animate={true} />
31
+ <SparkleAnimation color={sparkleIconColor} animate />
32
32
  </div>
33
33
  <Text variant="body2">Finding the best options for you...</Text>
34
34
  </div>
@@ -39,7 +39,7 @@ export const SearchResultsLoadingGrid = ({
39
39
  key={index}
40
40
  layoutVariant={productCardLayoutVariant}
41
41
  aspectRatio={productCardImageAspectRatio}
42
- growWithContainer={true}
42
+ growWithContainer
43
43
  />
44
44
  ))}
45
45
  </div>
@@ -34,7 +34,6 @@ export const SparkleAnimation = ({ color, className, animate = true }: SparkleAn
34
34
  setMainStarScale(1);
35
35
  setSmallStar1Scale(1);
36
36
  setSmallStar2Scale(1);
37
- return;
38
37
  }
39
38
  }, [animate]);
40
39
 
@@ -1,18 +1,21 @@
1
- import classNames from "classnames";
1
+ import classNames from 'classnames';
2
2
 
3
3
  type SpinnerProps = {
4
4
  className?: string;
5
- }
5
+ };
6
6
 
7
7
  export const Spinner = ({ className }: SpinnerProps) => {
8
- const svgClassnames = classNames({
9
- 'spiffy-tw-w-4': true,
10
- 'spiffy-tw-h-4': true,
11
- 'spiffy-tw-text-gray-200': true,
12
- 'spiffy-tw-animate-spin': true,
13
- 'spiffy-tw-dark:text-gray-600': true,
14
- 'spiffy-tw-fill-black': true,
15
- }, className);
8
+ const svgClassnames = classNames(
9
+ {
10
+ 'spiffy-tw-w-4': true,
11
+ 'spiffy-tw-h-4': true,
12
+ 'spiffy-tw-text-gray-200': true,
13
+ 'spiffy-tw-animate-spin': true,
14
+ 'spiffy-tw-dark:text-gray-600': true,
15
+ 'spiffy-tw-fill-black': true,
16
+ },
17
+ className,
18
+ );
16
19
 
17
20
  const spanClassnames = classNames({
18
21
  'spiffy-tw-sr-only': true,
@@ -20,11 +23,23 @@ export const Spinner = ({ className }: SpinnerProps) => {
20
23
 
21
24
  return (
22
25
  <div role="status">
23
- <svg aria-hidden="true" className={svgClassnames} viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
24
- <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"/>
25
- <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"/>
26
+ <svg
27
+ aria-hidden="true"
28
+ className={svgClassnames}
29
+ viewBox="0 0 100 101"
30
+ fill="none"
31
+ xmlns="http://www.w3.org/2000/svg"
32
+ >
33
+ <path
34
+ 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"
35
+ fill="currentColor"
36
+ />
37
+ <path
38
+ 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"
39
+ fill="currentFill"
40
+ />
26
41
  </svg>
27
42
  <span className={spanClassnames}>Loading...</span>
28
43
  </div>
29
44
  );
30
- };
45
+ };
@@ -1,9 +1,9 @@
1
1
  import classNames from 'classnames';
2
2
  import OutlinedStar from '@envive-ai/react-icons/OutlinedStar';
3
3
  import FourPointStar from '@envive-ai/react-icons/FourPointStar';
4
+ import { TestProps } from '@envive-ai/react-hooks/types';
4
5
  import type { SuggestionButtonVariant } from './types';
5
6
  import { ButtonBase } from '../ButtonBase/ButtonBase';
6
- import { TestProps } from '@envive-ai/react-hooks/types';
7
7
 
8
8
  export const SPIFFY_SUGGESTION_BUTTON_QUESTION_CLASS = 'spiffy-suggestion-button-question-class';
9
9
  export const SPIFFY_SUGGESTION_BUTTON_ANSWER_CLASS = 'spiffy-suggestion-button-answer-class';
@@ -11,4 +11,4 @@ export type SuggestionButtonVariant =
11
11
  | 'secondaryAccent'
12
12
  | 'transparent'
13
13
  | 'transparentDark'
14
- | 'lightDark';
14
+ | 'lightDark';