@envive-ai/react-toolkit 0.1.11 → 0.1.13

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 (189) 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/AppliedFiltersScrollbar/index.cjs +25 -27
  8. package/dist/AppliedFiltersScrollbar/index.d.cts +2 -2
  9. package/dist/AppliedFiltersScrollbar/index.d.ts +2 -2
  10. package/dist/AppliedFiltersScrollbar/index.js +25 -27
  11. package/dist/ButtonBase/index.cjs +3 -3
  12. package/dist/ButtonBase/index.d.cts +2 -3
  13. package/dist/ButtonBase/index.d.ts +2 -3
  14. package/dist/ButtonBase/index.js +3 -3
  15. package/dist/{ButtonBase-BAf-nlCm.js → ButtonBase-DgRupM53.js} +3 -3
  16. package/dist/{ButtonBase-Do88ndKa.cjs → ButtonBase-DrIwVGTR.cjs} +3 -3
  17. package/dist/DynamicFiltersScrollbar/index.cjs +23 -25
  18. package/dist/DynamicFiltersScrollbar/index.d.cts +2 -2
  19. package/dist/DynamicFiltersScrollbar/index.d.ts +2 -2
  20. package/dist/DynamicFiltersScrollbar/index.js +23 -25
  21. package/dist/DynamicFiltersScrollbar-B1j53y2q.cjs +81 -0
  22. package/dist/DynamicFiltersScrollbar-D7WYp6x9.js +66 -0
  23. package/dist/FilterScrollbar/index.cjs +3 -3
  24. package/dist/FilterScrollbar/index.d.cts +3 -3
  25. package/dist/FilterScrollbar/index.d.ts +3 -3
  26. package/dist/FilterScrollbar/index.js +3 -3
  27. package/dist/Headline/index.cjs +2 -2
  28. package/dist/Headline/index.d.cts +2 -2
  29. package/dist/Headline/index.d.ts +2 -2
  30. package/dist/Headline/index.js +2 -2
  31. package/dist/{Headline-DNEWF8ly.js → Headline-COv0Jbn8.js} +1 -1
  32. package/dist/{Headline-DTT4RSv2.cjs → Headline-Cp79THVF.cjs} +1 -1
  33. package/dist/ImageWithFallback/index.d.cts +2 -2
  34. package/dist/ImageWithFallback/index.d.ts +2 -2
  35. package/dist/ModalSheet/index.cjs +1 -1
  36. package/dist/ModalSheet/index.d.cts +2 -2
  37. package/dist/ModalSheet/index.d.ts +2 -2
  38. package/dist/ModalSheet/index.js +1 -1
  39. package/dist/{ModalSheet-CZd5pssv.js → ModalSheet-01pxpy_K.js} +5 -3
  40. package/dist/{ModalSheet-CXZgyZ4a.cjs → ModalSheet-Csz8HIxs.cjs} +7 -5
  41. package/dist/ProductCard/index.cjs +4 -4
  42. package/dist/ProductCard/index.d.cts +1 -1
  43. package/dist/ProductCard/index.d.ts +1 -1
  44. package/dist/ProductCard/index.js +4 -4
  45. package/dist/{ProductCard-D-lyh8uV.js → ProductCard-CNwmHggx.js} +33 -33
  46. package/dist/{ProductCard-F49krjHk.cjs → ProductCard-EmdDy2af.cjs} +35 -35
  47. package/dist/ProductGrid/index.cjs +5 -5
  48. package/dist/ProductGrid/index.d.cts +4 -8
  49. package/dist/ProductGrid/index.d.ts +4 -8
  50. package/dist/ProductGrid/index.js +5 -5
  51. package/dist/{ProductGrid-QeoaIfcq.cjs → ProductGrid-CMoomZLc.cjs} +3 -7
  52. package/dist/{ProductGrid-FIf5wFQx.js → ProductGrid-nmWSp0qX.js} +3 -7
  53. package/dist/RadioButton/index.cjs +3 -3
  54. package/dist/RadioButton/index.d.cts +5 -3
  55. package/dist/RadioButton/index.d.ts +5 -3
  56. package/dist/RadioButton/index.js +3 -3
  57. package/dist/{RadioButton-DZ6QXkrN.cjs → RadioButton-BdKJRzLM.cjs} +17 -10
  58. package/dist/{RadioButton-Bf68dZl7.js → RadioButton-S5dALI2f.js} +18 -11
  59. package/dist/RadioButtonGroup/index.cjs +4 -4
  60. package/dist/RadioButtonGroup/index.d.cts +2 -2
  61. package/dist/RadioButtonGroup/index.d.ts +2 -2
  62. package/dist/RadioButtonGroup/index.js +4 -4
  63. package/dist/{RadioButtonGroup-8k7hkJYB.js → RadioButtonGroup-BipNsoHL.js} +2 -1
  64. package/dist/{RadioButtonGroup-Dc_n5amh.cjs → RadioButtonGroup-TAJMA1j_.cjs} +2 -1
  65. package/dist/SearchAutocomplete/index.cjs +56 -2
  66. package/dist/SearchAutocomplete/index.js +49 -1
  67. package/dist/SearchFilter/index.cjs +9 -9
  68. package/dist/SearchFilter/index.d.cts +4 -4
  69. package/dist/SearchFilter/index.d.ts +4 -4
  70. package/dist/SearchFilter/index.js +9 -9
  71. package/dist/{SearchFilter-BtLKnFMm.cjs → SearchFilter-BcLc0TMq.cjs} +27 -17
  72. package/dist/{SearchFilter-BOwErEyI.js → SearchFilter-w-0s2YVu.js} +27 -17
  73. package/dist/SearchInput/index.cjs +96 -6
  74. package/dist/SearchInput/index.d.cts +1 -1
  75. package/dist/SearchInput/index.d.ts +2 -2
  76. package/dist/SearchInput/index.js +88 -4
  77. package/dist/SearchInputForm/index.cjs +0 -39
  78. package/dist/SearchInputForm/index.d.cts +2 -2
  79. package/dist/SearchInputForm/index.d.ts +2 -2
  80. package/dist/SearchInputForm/index.js +1 -37
  81. package/dist/SearchResultsContent/index.cjs +36 -39
  82. package/dist/SearchResultsContent/index.d.cts +5 -7
  83. package/dist/SearchResultsContent/index.d.ts +5 -7
  84. package/dist/SearchResultsContent/index.js +35 -38
  85. package/dist/SearchResultsFilterSidebar/index.cjs +11 -11
  86. package/dist/SearchResultsFilterSidebar/index.d.cts +1 -1
  87. package/dist/SearchResultsFilterSidebar/index.d.ts +1 -1
  88. package/dist/SearchResultsFilterSidebar/index.js +11 -11
  89. package/dist/SearchResultsStates/index.cjs +10 -10
  90. package/dist/SearchResultsStates/index.d.cts +6 -8
  91. package/dist/SearchResultsStates/index.d.ts +6 -8
  92. package/dist/SearchResultsStates/index.js +10 -10
  93. package/dist/{SearchResultsStates-CB5k1xkK.js → SearchResultsStates-DlZz14yy.js} +8 -10
  94. package/dist/{SearchResultsStates-DywK7vvp.cjs → SearchResultsStates-DwcPrsdd.cjs} +8 -10
  95. package/dist/SparkleAnimation/index.cjs +1 -1
  96. package/dist/SparkleAnimation/index.d.cts +2 -2
  97. package/dist/SparkleAnimation/index.d.ts +2 -2
  98. package/dist/SparkleAnimation/index.js +1 -1
  99. package/dist/{SparkleAnimation-Edzqyb48.cjs → SparkleAnimation-CvGlWUqv.cjs} +0 -1
  100. package/dist/{SparkleAnimation-AM4XoegD.js → SparkleAnimation-paLhSu5E.js} +0 -1
  101. package/dist/Spinner/index.d.cts +2 -2
  102. package/dist/Spinner/index.d.ts +2 -2
  103. package/dist/SuggestionButton/index.cjs +3 -3
  104. package/dist/SuggestionButton/index.d.cts +2 -2
  105. package/dist/SuggestionButton/index.d.ts +2 -2
  106. package/dist/SuggestionButton/index.js +3 -3
  107. package/dist/Text/index.cjs +2 -2
  108. package/dist/Text/index.d.cts +2 -2
  109. package/dist/Text/index.d.ts +3 -3
  110. package/dist/Text/index.js +2 -2
  111. package/dist/{Text-Bod4OMPk.js → Text-BLzNhX4H.js} +1 -1
  112. package/dist/{Text-MQjxqgZZ.cjs → Text-DllCE9_D.cjs} +1 -1
  113. package/dist/TextInput/index.cjs +2 -2
  114. package/dist/TextInput/index.d.ts +1 -1
  115. package/dist/TextInput/index.js +2 -2
  116. package/dist/{TextInput-BVPdz7e8.js → TextInput-DmsOxxPN.js} +1 -1
  117. package/dist/{TextInput-CnXhppYn.cjs → TextInput-HMW0hxLI.cjs} +1 -1
  118. package/dist/ToggleButton/index.cjs +3 -3
  119. package/dist/ToggleButton/index.d.cts +2 -2
  120. package/dist/ToggleButton/index.d.ts +2 -2
  121. package/dist/ToggleButton/index.js +3 -3
  122. package/dist/{ToggleButton-D90UO4qv.cjs → ToggleButton-DblAj4Cd.cjs} +1 -1
  123. package/dist/{ToggleButton-BKRR_-69.js → ToggleButton-r7Y7Kzzo.js} +1 -1
  124. package/dist/index-BKvXn5sj.d.ts +4 -0
  125. package/dist/{index-Cl4d_pDw.d.ts → index-Br1B7Jta.d.cts} +2 -3
  126. package/dist/{index-1x_hMlEf.d.cts → index-DADHwW6M.d.ts} +5 -9
  127. package/dist/{index-QMTPxKA9.d.ts → index-DDp-fLgm.d.cts} +5 -9
  128. package/dist/{index-CgjZdKpL.d.cts → index-Dh8rcWev.d.ts} +2 -3
  129. package/dist/index-W1wCDiw_.d.cts +4 -0
  130. package/dist/{searchFilterSidebarVariants-CDFCHVeZ.js → searchFilterSidebarVariants-J0FJ8pck.js} +1 -1
  131. package/dist/{searchFilterSidebarVariants-CtmuwSBQ.cjs → searchFilterSidebarVariants-kkTjYEIF.cjs} +1 -1
  132. package/dist/{textVariantClasses-Dgz7Zaql.cjs → textVariantClasses-CBre7vXv.cjs} +5 -7
  133. package/dist/{textVariantClasses-D77TGEy1.js → textVariantClasses-CRrTb43V.js} +5 -7
  134. package/package.json +3 -7
  135. package/src/components/AppliedFiltersScrollbar/AppliedFiltersScrollbar.tsx +25 -27
  136. package/src/components/ButtonBase/ButtonBase.tsx +1 -2
  137. package/src/components/DynamicFiltersScrollbar/DynamicFiltersScrollbar.tsx +26 -28
  138. package/src/components/FilterScrollbar/AppliedFiltersScrollbar.tsx +25 -27
  139. package/src/components/FilterScrollbar/DynamicFiltersScrollbar.tsx +26 -28
  140. package/src/components/ModalSheet/ModalSheet.tsx +1 -1
  141. package/src/components/ModalSheet/common/closeIcon.tsx +2 -2
  142. package/src/components/ModalSheet/desktop/index.tsx +1 -0
  143. package/src/components/ModalSheet/mobile/index.tsx +1 -0
  144. package/src/components/ModalSheet/mobile/mobileHeader.tsx +1 -1
  145. package/src/components/ProductCard/ProductCard.tsx +5 -28
  146. package/src/components/ProductGrid/ProductGrid.tsx +3 -11
  147. package/src/components/RadioButton/RadioButton.tsx +15 -6
  148. package/src/components/RadioButtonGroup/RadioButtonGroup.tsx +1 -0
  149. package/src/components/SearchFilter/SearchFilter.tsx +2 -2
  150. package/src/components/SearchFilter/SearchFilterFooter.tsx +1 -1
  151. package/src/components/SearchFilter/SearchFilterHeader.tsx +6 -1
  152. package/src/components/SearchFilter/SearchFilterItem.tsx +17 -3
  153. package/src/components/SearchFilter/useHasFilterStateChanged.tsx +1 -0
  154. package/src/components/SearchFilter/utils.ts +4 -6
  155. package/src/components/SearchInput/SearchInput.tsx +2 -2
  156. package/src/components/SearchInputForm/index.ts +0 -1
  157. package/src/components/SearchResultsContent/SearchResultsContent.tsx +33 -38
  158. package/src/components/SearchResultsFilterSidebar/SearchResultsFilter.tsx +2 -3
  159. package/src/components/SearchResultsFilterSidebar/searchFilterSidebarVariants.ts +1 -1
  160. package/src/components/SearchResultsStates/SearchResultsGrid.tsx +4 -8
  161. package/src/components/SearchResultsStates/SearchResultsLoadingGrid.tsx +3 -3
  162. package/src/components/SparkleAnimation/SparkleAnimation.tsx +0 -1
  163. package/src/components/Spinner/Spinner.tsx +29 -14
  164. package/src/components/SuggestionButton/SuggestionButton.tsx +1 -1
  165. package/src/components/SuggestionButton/types.ts +1 -1
  166. package/src/components/Text/textVariantClasses.ts +12 -10
  167. package/src/components/TextInput/TextInput.tsx +1 -0
  168. package/src/util/camelCasedPropertiesDeep.ts +22 -22
  169. package/src/util/internal.ts +4 -2
  170. package/src/util/splitWords.ts +35 -31
  171. package/dist/DynamicFiltersScrollbar-C4kdNSJ9.js +0 -70
  172. package/dist/DynamicFiltersScrollbar-CVw1PINp.cjs +0 -85
  173. package/dist/SearchAutocomplete-C6omCGJp.js +0 -51
  174. package/dist/SearchAutocomplete-Cofuvwwp.cjs +0 -62
  175. package/dist/SearchInput-BBaYEwkR.js +0 -89
  176. package/dist/SearchInput-BTNvgrIa.cjs +0 -106
  177. package/dist/Styles/index.cjs +0 -274
  178. package/dist/Styles/index.d.cts +0 -258
  179. package/dist/Styles/index.d.ts +0 -258
  180. package/dist/Styles/index.js +0 -274
  181. package/dist/index-H_9LhS_1.d.cts +0 -36
  182. package/dist/index-gfYBM7Ul.d.ts +0 -36
  183. package/src/components/ModalSheet/common/enviveWatermark.tsx +0 -30
  184. package/src/components/Styles/EnviveTailwindPreset.ts +0 -285
  185. package/src/components/Styles/index.ts +0 -2
  186. package/tailwind-preset.js +0 -3
  187. /package/dist/{colorsConfig-DFL3mBwB.cjs → colorsConfig-B3-SMUSx.cjs} +0 -0
  188. /package/dist/{colorsConfig-5Yf4nrEe.js → colorsConfig-DZ-GSPWy.js} +0 -0
  189. /package/dist/{textVariantClasses-kyZtL8F5.d.ts → textVariantClasses-C8OCWZAw.d.ts} +0 -0
@@ -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
  };
@@ -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 '../SearchInputForm/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,2 +1 @@
1
- export * from './SearchInputForm';
2
1
  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';
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';
@@ -94,13 +94,15 @@ export const TextStyleVariantMap = {
94
94
  ...HeadlineVariantMap,
95
95
  };
96
96
 
97
- export const getVariantPlaceholderClassNames = (classes: Record<string, boolean>) => {
98
- return Object.keys(classes).reduce((acc, key) => {
99
- if(key.includes('spiffy-tw')){
100
- acc[`placeholder:${key}`] = classes[key];
101
- } else {
102
- acc[`${key}-placeholder`] = classes[key];
103
- }
104
- return acc;
105
- }, {} as Record<string, boolean>);
106
- }
97
+ export const getVariantPlaceholderClassNames = (classes: Record<string, boolean>) =>
98
+ Object.keys(classes).reduce(
99
+ (acc, key) => {
100
+ if (key.includes('spiffy-tw')) {
101
+ acc[`placeholder:${key}`] = classes[key];
102
+ } else {
103
+ acc[`${key}-placeholder`] = classes[key];
104
+ }
105
+ return acc;
106
+ },
107
+ {} as Record<string, boolean>,
108
+ );
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/jsx-props-no-spreading */
1
2
  // Disabling this prevents an otherwise simple wrapper around input
2
3
  // from becoming needlessly verbose while maintaining flexibility.
3
4
  // Keeping it enabled requires listing every possible prop.
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-unsafe-function-type */
2
1
  import type { CamelCase, CamelCaseOptions } from './camelCase';
3
2
  import type { UnknownArray } from './unknownArray';
4
3
 
@@ -49,33 +48,34 @@ import type { UnknownArray } from './unknownArray';
49
48
  export type CamelCasedPropertiesDeep<
50
49
  Value,
51
50
  Options extends CamelCaseOptions = { preserveConsecutiveUppercase: true },
51
+ // eslint-disable-next-line @typescript-eslint/ban-types
52
52
  > = Value extends Function
53
53
  ? Value
54
54
  : Value extends UnknownArray
55
- ? CamelCasedPropertiesArrayDeep<Value>
56
- : Value extends Set<infer U>
57
- ? Set<CamelCasedPropertiesDeep<U, Options>>
58
- : {
59
- [K in keyof Value as CamelCase<K, Options>]: CamelCasedPropertiesDeep<Value[K], Options>;
60
- };
55
+ ? CamelCasedPropertiesArrayDeep<Value>
56
+ : Value extends Set<infer U>
57
+ ? Set<CamelCasedPropertiesDeep<U, Options>>
58
+ : {
59
+ [K in keyof Value as CamelCase<K, Options>]: CamelCasedPropertiesDeep<Value[K], Options>;
60
+ };
61
61
 
62
62
  // This is a copy of DelimiterCasedPropertiesArrayDeep (see: delimiter-cased-properties-deep.d.ts).
63
63
  // These types should be kept in sync.
64
64
  type CamelCasedPropertiesArrayDeep<Value extends UnknownArray> = Value extends []
65
65
  ? []
66
66
  : // Tailing spread array
67
- Value extends [infer U, ...infer V]
68
- ? [CamelCasedPropertiesDeep<U>, ...CamelCasedPropertiesDeep<V>]
69
- : Value extends readonly [infer U, ...infer V]
70
- ? readonly [CamelCasedPropertiesDeep<U>, ...CamelCasedPropertiesDeep<V>]
71
- : // Leading spread array
72
- Value extends readonly [...infer U, infer V]
73
- ? [...CamelCasedPropertiesDeep<U>, CamelCasedPropertiesDeep<V>]
74
- : Value extends readonly [...infer U, infer V]
75
- ? readonly [...CamelCasedPropertiesDeep<U>, CamelCasedPropertiesDeep<V>]
76
- : // Array
77
- Value extends Array<infer U>
78
- ? Array<CamelCasedPropertiesDeep<U>>
79
- : Value extends ReadonlyArray<infer U>
80
- ? ReadonlyArray<CamelCasedPropertiesDeep<U>>
81
- : never;
67
+ Value extends [infer U, ...infer V]
68
+ ? [CamelCasedPropertiesDeep<U>, ...CamelCasedPropertiesDeep<V>]
69
+ : Value extends readonly [infer U, ...infer V]
70
+ ? readonly [CamelCasedPropertiesDeep<U>, ...CamelCasedPropertiesDeep<V>]
71
+ : // Leading spread array
72
+ Value extends readonly [...infer U, infer V]
73
+ ? [...CamelCasedPropertiesDeep<U>, CamelCasedPropertiesDeep<V>]
74
+ : Value extends readonly [...infer U, infer V]
75
+ ? readonly [...CamelCasedPropertiesDeep<U>, CamelCasedPropertiesDeep<V>]
76
+ : // Array
77
+ Value extends Array<infer U>
78
+ ? Array<CamelCasedPropertiesDeep<U>>
79
+ : Value extends ReadonlyArray<infer U>
80
+ ? ReadonlyArray<CamelCasedPropertiesDeep<U>>
81
+ : never;
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable @typescript-eslint/no-unsafe-function-type */
3
2
  // these types come from https://github.com/sindresorhus/type-fest/blob/main/source/internal.d.ts
4
3
 
5
4
  import type { Primitive } from './primitive';
@@ -13,7 +12,10 @@ export type BuiltIns = Primitive | void | Date | RegExp;
13
12
  /**
14
13
  * Matches non-recursive types.
15
14
  */
16
- export type NonRecursiveType = BuiltIns | Function | (new (...arguments_: any[]) => unknown);
15
+ export type NonRecursiveType =
16
+ | BuiltIns
17
+ | ((...arguments_: any[]) => unknown)
18
+ | (new (...arguments_: any[]) => unknown);
17
19
 
18
20
  /**
19
21
  * Returns a boolean for whether the string is numeric.