@envive-ai/react-toolkit 0.1.13 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/package.json +13 -12
  2. package/src/atoms/search/types.ts +1 -5
  3. package/src/components/Accordion/Accordion.tsx +3 -3
  4. package/src/components/AnimatedChevron/index.ts +1 -0
  5. package/src/components/AppliedFiltersScrollbar/AppliedFiltersScrollbar.tsx +2 -2
  6. package/src/components/ButtonBase/ButtonBase.tsx +2 -2
  7. package/src/components/DynamicFiltersScrollbar/DynamicFiltersScrollbar.tsx +2 -2
  8. package/src/components/FilterScrollbar/AppliedFiltersScrollbar.tsx +2 -2
  9. package/src/components/FilterScrollbar/DynamicFiltersScrollbar.tsx +2 -2
  10. package/src/components/ProductCard/ProductCard.tsx +10 -9
  11. package/src/components/RadioButton/RadioButton.tsx +2 -2
  12. package/src/components/SearchFilter/SearchFilterHeader.tsx +3 -3
  13. package/src/components/SearchFilter/SearchFilterItem.tsx +2 -2
  14. package/src/components/SearchFilter/index.ts +4 -2
  15. package/src/components/SearchInput/SearchInput.tsx +1 -1
  16. package/src/components/SearchInput/searchInputVariants.ts +3 -3
  17. package/src/components/SearchInputForm/SearchInputForm.tsx +1 -1
  18. package/src/components/SearchInputForm/index.ts +1 -1
  19. package/src/components/SearchResultsStates/NoSearchResultsFound.tsx +3 -3
  20. package/src/components/SearchResultsStates/SearchResultsLoadingGrid.tsx +2 -2
  21. package/src/components/TextInput/TextInput.tsx +4 -3
  22. package/src/components/ToggleButton/ToggleButton.tsx +5 -5
  23. package/src/components/Typography/Typography.spec.tsx +22 -0
  24. package/src/components/Typography/Typography.tsx +73 -0
  25. package/src/components/Typography/index.ts +2 -0
  26. package/src/components/{Text/textVariantClasses.ts → Typography/typographyVariantClasses.ts} +36 -38
  27. package/src/components/Typography/util.ts +19 -0
  28. package/dist/Accordion/index.cjs +0 -6
  29. package/dist/Accordion/index.d.cts +0 -13
  30. package/dist/Accordion/index.d.ts +0 -13
  31. package/dist/Accordion/index.js +0 -6
  32. package/dist/Accordion-D9gO9_y3.cjs +0 -88
  33. package/dist/Accordion-ZEdp99Ph.js +0 -77
  34. package/dist/AppliedFiltersScrollbar/index.cjs +0 -48
  35. package/dist/AppliedFiltersScrollbar/index.d.cts +0 -22
  36. package/dist/AppliedFiltersScrollbar/index.d.ts +0 -22
  37. package/dist/AppliedFiltersScrollbar/index.js +0 -44
  38. package/dist/ButtonBase/index.cjs +0 -7
  39. package/dist/ButtonBase/index.d.cts +0 -42
  40. package/dist/ButtonBase/index.d.ts +0 -42
  41. package/dist/ButtonBase/index.js +0 -6
  42. package/dist/ButtonBase-0NN6wmX-.js +0 -1
  43. package/dist/ButtonBase-BIXx56hq.cjs +0 -0
  44. package/dist/ButtonBase-DgRupM53.js +0 -60
  45. package/dist/ButtonBase-DrIwVGTR.cjs +0 -75
  46. package/dist/DynamicFiltersScrollbar/index.cjs +0 -36
  47. package/dist/DynamicFiltersScrollbar/index.d.cts +0 -28
  48. package/dist/DynamicFiltersScrollbar/index.d.ts +0 -28
  49. package/dist/DynamicFiltersScrollbar/index.js +0 -32
  50. package/dist/DynamicFiltersScrollbar-B1j53y2q.cjs +0 -81
  51. package/dist/DynamicFiltersScrollbar-D7WYp6x9.js +0 -66
  52. package/dist/FilterScrollbar/index.cjs +0 -6
  53. package/dist/FilterScrollbar/index.d.cts +0 -47
  54. package/dist/FilterScrollbar/index.d.ts +0 -47
  55. package/dist/FilterScrollbar/index.js +0 -5
  56. package/dist/Headline/index.cjs +0 -4
  57. package/dist/Headline/index.d.cts +0 -21
  58. package/dist/Headline/index.d.ts +0 -21
  59. package/dist/Headline/index.js +0 -4
  60. package/dist/Headline-COv0Jbn8.js +0 -64
  61. package/dist/Headline-Cp79THVF.cjs +0 -72
  62. package/dist/ImageWithFallback/index.cjs +0 -3
  63. package/dist/ImageWithFallback/index.d.cts +0 -26
  64. package/dist/ImageWithFallback/index.d.ts +0 -26
  65. package/dist/ImageWithFallback/index.js +0 -3
  66. package/dist/ImageWithFallback-Cx-KNi-D.cjs +0 -51
  67. package/dist/ImageWithFallback-DqxjwO3i.js +0 -42
  68. package/dist/ModalSheet/index.cjs +0 -3
  69. package/dist/ModalSheet/index.d.cts +0 -38
  70. package/dist/ModalSheet/index.d.ts +0 -38
  71. package/dist/ModalSheet/index.js +0 -3
  72. package/dist/ModalSheet-01pxpy_K.js +0 -326
  73. package/dist/ModalSheet-Csz8HIxs.cjs +0 -337
  74. package/dist/ProductCard/index.cjs +0 -17
  75. package/dist/ProductCard/index.d.cts +0 -2
  76. package/dist/ProductCard/index.d.ts +0 -2
  77. package/dist/ProductCard/index.js +0 -8
  78. package/dist/ProductCard-CNwmHggx.js +0 -255
  79. package/dist/ProductCard-EmdDy2af.cjs +0 -319
  80. package/dist/ProductGrid/index.cjs +0 -10
  81. package/dist/ProductGrid/index.d.cts +0 -33
  82. package/dist/ProductGrid/index.d.ts +0 -33
  83. package/dist/ProductGrid/index.js +0 -9
  84. package/dist/ProductGrid-CMoomZLc.cjs +0 -74
  85. package/dist/ProductGrid-nmWSp0qX.js +0 -60
  86. package/dist/RadioButton/index.cjs +0 -6
  87. package/dist/RadioButton/index.d.cts +0 -32
  88. package/dist/RadioButton/index.d.ts +0 -32
  89. package/dist/RadioButton/index.js +0 -6
  90. package/dist/RadioButton-BdKJRzLM.cjs +0 -84
  91. package/dist/RadioButton-S5dALI2f.js +0 -75
  92. package/dist/RadioButtonGroup/index.cjs +0 -8
  93. package/dist/RadioButtonGroup/index.d.cts +0 -36
  94. package/dist/RadioButtonGroup/index.d.ts +0 -36
  95. package/dist/RadioButtonGroup/index.js +0 -7
  96. package/dist/RadioButtonGroup-BipNsoHL.js +0 -38
  97. package/dist/RadioButtonGroup-TAJMA1j_.cjs +0 -52
  98. package/dist/SearchAutocomplete/index.cjs +0 -57
  99. package/dist/SearchAutocomplete/index.d.cts +0 -13
  100. package/dist/SearchAutocomplete/index.d.ts +0 -13
  101. package/dist/SearchAutocomplete/index.js +0 -51
  102. package/dist/SearchFilter/index.cjs +0 -15
  103. package/dist/SearchFilter/index.d.cts +0 -77
  104. package/dist/SearchFilter/index.d.ts +0 -77
  105. package/dist/SearchFilter/index.js +0 -13
  106. package/dist/SearchFilter-BcLc0TMq.cjs +0 -289
  107. package/dist/SearchFilter-w-0s2YVu.js +0 -268
  108. package/dist/SearchInput/index.cjs +0 -97
  109. package/dist/SearchInput/index.d.cts +0 -33
  110. package/dist/SearchInput/index.d.ts +0 -33
  111. package/dist/SearchInput/index.js +0 -90
  112. package/dist/SearchInputForm/index.cjs +0 -0
  113. package/dist/SearchInputForm/index.d.cts +0 -2
  114. package/dist/SearchInputForm/index.d.ts +0 -2
  115. package/dist/SearchInputForm/index.js +0 -1
  116. package/dist/SearchResultsContent/index.cjs +0 -47
  117. package/dist/SearchResultsContent/index.d.cts +0 -48
  118. package/dist/SearchResultsContent/index.d.ts +0 -48
  119. package/dist/SearchResultsContent/index.js +0 -44
  120. package/dist/SearchResultsFilterSidebar/index.cjs +0 -61
  121. package/dist/SearchResultsFilterSidebar/index.d.cts +0 -2
  122. package/dist/SearchResultsFilterSidebar/index.d.ts +0 -2
  123. package/dist/SearchResultsFilterSidebar/index.js +0 -56
  124. package/dist/SearchResultsStates/index.cjs +0 -17
  125. package/dist/SearchResultsStates/index.d.cts +0 -69
  126. package/dist/SearchResultsStates/index.d.ts +0 -69
  127. package/dist/SearchResultsStates/index.js +0 -15
  128. package/dist/SearchResultsStates-DlZz14yy.js +0 -110
  129. package/dist/SearchResultsStates-DwcPrsdd.cjs +0 -132
  130. package/dist/SparkleAnimation/index.cjs +0 -4
  131. package/dist/SparkleAnimation/index.d.cts +0 -23
  132. package/dist/SparkleAnimation/index.d.ts +0 -23
  133. package/dist/SparkleAnimation/index.js +0 -3
  134. package/dist/SparkleAnimation-CvGlWUqv.cjs +0 -101
  135. package/dist/SparkleAnimation-paLhSu5E.js +0 -84
  136. package/dist/Spinner/index.cjs +0 -3
  137. package/dist/Spinner/index.d.cts +0 -11
  138. package/dist/Spinner/index.d.ts +0 -11
  139. package/dist/Spinner/index.js +0 -3
  140. package/dist/Spinner-CjGLIRgs.js +0 -38
  141. package/dist/Spinner-DFor2Szi.cjs +0 -46
  142. package/dist/SuggestionButton/index.cjs +0 -188
  143. package/dist/SuggestionButton/index.d.cts +0 -35
  144. package/dist/SuggestionButton/index.d.ts +0 -35
  145. package/dist/SuggestionButton/index.js +0 -180
  146. package/dist/Text/index.cjs +0 -10
  147. package/dist/Text/index.d.cts +0 -42
  148. package/dist/Text/index.d.ts +0 -42
  149. package/dist/Text/index.js +0 -5
  150. package/dist/Text-BLzNhX4H.js +0 -42
  151. package/dist/Text-BMsncrpY.js +0 -10
  152. package/dist/Text-C8t_iEj6.cjs +0 -16
  153. package/dist/Text-DllCE9_D.cjs +0 -50
  154. package/dist/TextInput/index.cjs +0 -4
  155. package/dist/TextInput/index.d.cts +0 -12
  156. package/dist/TextInput/index.d.ts +0 -12
  157. package/dist/TextInput/index.js +0 -4
  158. package/dist/TextInput-DmsOxxPN.js +0 -31
  159. package/dist/TextInput-HMW0hxLI.cjs +0 -40
  160. package/dist/ToggleButton/index.cjs +0 -6
  161. package/dist/ToggleButton/index.d.cts +0 -30
  162. package/dist/ToggleButton/index.d.ts +0 -30
  163. package/dist/ToggleButton/index.js +0 -6
  164. package/dist/ToggleButton-DblAj4Cd.cjs +0 -68
  165. package/dist/ToggleButton-r7Y7Kzzo.js +0 -60
  166. package/dist/chunk-CUT6urMc.cjs +0 -30
  167. package/dist/colorsConfig-B3-SMUSx.cjs +0 -38
  168. package/dist/colorsConfig-DZ-GSPWy.js +0 -26
  169. package/dist/index-BKvXn5sj.d.ts +0 -4
  170. package/dist/index-Br1B7Jta.d.cts +0 -46
  171. package/dist/index-DADHwW6M.d.ts +0 -325
  172. package/dist/index-DDp-fLgm.d.cts +0 -325
  173. package/dist/index-Dh8rcWev.d.ts +0 -46
  174. package/dist/index-W1wCDiw_.d.cts +0 -4
  175. package/dist/searchFilterSidebarVariants-J0FJ8pck.js +0 -34
  176. package/dist/searchFilterSidebarVariants-kkTjYEIF.cjs +0 -39
  177. package/dist/textVariantClasses-B0gNjzl4.d.cts +0 -174
  178. package/dist/textVariantClasses-C8OCWZAw.d.ts +0 -174
  179. package/dist/textVariantClasses-CBre7vXv.cjs +0 -123
  180. package/dist/textVariantClasses-CRrTb43V.js +0 -99
  181. package/src/components/Headline/Headline.tsx +0 -81
  182. package/src/components/Headline/index.ts +0 -1
  183. package/src/components/SearchInputForm/types.ts +0 -1
  184. package/src/components/Text/Text.tsx +0 -58
  185. package/src/components/Text/index.ts +0 -3
  186. package/src/components/Text/types.ts +0 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envive-ai/react-toolkit",
3
- "version": "0.1.13",
3
+ "version": "0.2.1",
4
4
  "description": "React component library for Envive services.",
5
5
  "keywords": [
6
6
  "react",
@@ -24,10 +24,10 @@
24
24
  "build": "tsdown",
25
25
  "build:watch": "tsdown --watch",
26
26
  "prepublish": "npm run build",
27
- "typecheck": "tsc"
27
+ "typecheck": "tsc",
28
+ "test": "vitest"
28
29
  },
29
30
  "dependencies": {
30
- "@envive-ai/react-icons": "0.1.1",
31
31
  "@envive-ai/react-hooks": "^0.1.8",
32
32
  "@tailwindcss/typography": "^0.5.15",
33
33
  "classnames": "^2.5.1",
@@ -45,13 +45,18 @@
45
45
  "postcss": "^8.5.6",
46
46
  "tailwindcss": "^3.4.17",
47
47
  "tsdown": "^0.14.2",
48
- "typescript": "^5.4.3"
48
+ "typescript": "^5.4.3",
49
+ "vitest": "^3.2.4"
49
50
  },
50
51
  "exports": {
51
52
  "./Accordion": {
52
53
  "import": "./dist/Accordion/index.js",
53
54
  "require": "./dist/Accordion/index.cjs"
54
55
  },
56
+ "./AnimatedChevron": {
57
+ "import": "./dist/AnimatedChevron/index.js",
58
+ "require": "./dist/AnimatedChevron/index.cjs"
59
+ },
55
60
  "./AppliedFiltersScrollbar": {
56
61
  "import": "./dist/AppliedFiltersScrollbar/index.js",
57
62
  "require": "./dist/AppliedFiltersScrollbar/index.cjs"
@@ -68,10 +73,6 @@
68
73
  "import": "./dist/FilterScrollbar/index.js",
69
74
  "require": "./dist/FilterScrollbar/index.cjs"
70
75
  },
71
- "./Headline": {
72
- "import": "./dist/Headline/index.js",
73
- "require": "./dist/Headline/index.cjs"
74
- },
75
76
  "./ImageWithFallback": {
76
77
  "import": "./dist/ImageWithFallback/index.js",
77
78
  "require": "./dist/ImageWithFallback/index.cjs"
@@ -136,10 +137,6 @@
136
137
  "import": "./dist/SuggestionButton/index.js",
137
138
  "require": "./dist/SuggestionButton/index.cjs"
138
139
  },
139
- "./Text": {
140
- "import": "./dist/Text/index.js",
141
- "require": "./dist/Text/index.cjs"
142
- },
143
140
  "./TextInput": {
144
141
  "import": "./dist/TextInput/index.js",
145
142
  "require": "./dist/TextInput/index.cjs"
@@ -148,6 +145,10 @@
148
145
  "import": "./dist/ToggleButton/index.js",
149
146
  "require": "./dist/ToggleButton/index.cjs"
150
147
  },
148
+ "./Typography": {
149
+ "import": "./dist/Typography/index.js",
150
+ "require": "./dist/Typography/index.cjs"
151
+ },
151
152
  "./package.json": "./package.json"
152
153
  }
153
154
  }
@@ -1,5 +1 @@
1
- export type SelectedFilterOption = {
2
- id: string;
3
- displayName: string;
4
- value: string;
5
- };
1
+ export type SearchInputVariant = 'standard';
@@ -1,7 +1,7 @@
1
1
  import { motion } from 'framer-motion';
2
2
  import { useRef, useState } from 'react';
3
3
  import classNames from 'classnames';
4
- import { Text } from 'src/components/Text';
4
+ import { Typography } from 'src/components/Typography';
5
5
  import ChevronDown from '@envive-ai/react-icons/ChevronDown';
6
6
 
7
7
  interface AccordionProps {
@@ -46,9 +46,9 @@ export const Accordion = ({ title, content }: AccordionProps) => {
46
46
  className={titleWrapperClasses}
47
47
  onClick={() => setIsOpen(!isOpen)}
48
48
  >
49
- <Text variant="body4" className={titleClasses}>
49
+ <Typography variant="body4" className={titleClasses}>
50
50
  {title}
51
- </Text>
51
+ </Typography>
52
52
  <motion.div
53
53
  variants={{
54
54
  open: {
@@ -0,0 +1 @@
1
+ export * from './AnimatedChevron';
@@ -1,6 +1,6 @@
1
1
  import classNames from 'classnames';
2
2
  import ScrollContainer from 'react-indiana-drag-scroll';
3
- import { Text } from 'src/components/Text';
3
+ import { Typography } from 'src/components/Typography';
4
4
  import { SelectedFilterOption } from '@envive-ai/react-hooks/atoms/search';
5
5
 
6
6
  interface AppliedFiltersScrollbarProps {
@@ -47,7 +47,7 @@ export const AppliedFiltersScrollbar = ({
47
47
  aria-label={`Remove filter: ${filter.displayName}`}
48
48
  >
49
49
  <div className="spiffy-tw-flex spiffy-tw-items-center spiffy-tw-gap-[8px]">
50
- <Text variant="body3">{filter.displayName}</Text>
50
+ <Typography variant="body3">{filter.displayName}</Typography>
51
51
  <svg
52
52
  xmlns="http://www.w3.org/2000/svg"
53
53
  width="10"
@@ -1,7 +1,7 @@
1
1
  import classNames from 'classnames';
2
2
  import { createElement, useEffect, useRef } from 'react';
3
3
  import { ButtonBaseOverrides, ButtonBaseProps } from './types';
4
- import { Text } from '../Text/Text';
4
+ import { Typography } from '../Typography';
5
5
 
6
6
  export const ButtonBase = ({
7
7
  isDisabled = false,
@@ -63,7 +63,7 @@ export const ButtonBase = ({
63
63
  createElement(icon, {
64
64
  className: iconClassName,
65
65
  })}
66
- <Text className={textClassName}>{text}</Text>
66
+ <Typography className={textClassName}>{text}</Typography>
67
67
  </button>
68
68
  );
69
69
  };
@@ -1,6 +1,6 @@
1
1
  import classNames from 'classnames';
2
2
  import ScrollContainer from 'react-indiana-drag-scroll';
3
- import { Text } from 'src/components/Text';
3
+ import { Typography } from 'src/components/Typography';
4
4
 
5
5
  interface DynamicFiltersScrollbarProps {
6
6
  availableDynamicFilters: { name: string; displayName: string }[];
@@ -42,7 +42,7 @@ export const DynamicFiltersScrollbar = ({
42
42
  });
43
43
  }}
44
44
  >
45
- <Text variant="body3">{displayName}</Text>
45
+ <Typography variant="body3">{displayName}</Typography>
46
46
  </button>
47
47
  );
48
48
  })}
@@ -1,7 +1,7 @@
1
1
  import { SelectedFilterOption } from '@envive-ai/react-hooks/atoms/search';
2
2
  import classNames from 'classnames';
3
3
  import ScrollContainer from 'react-indiana-drag-scroll';
4
- import { Text } from 'src/components/Text/Text';
4
+ import { Typography } from 'src/components/Typography';
5
5
 
6
6
  interface AppliedFiltersScrollbarProps {
7
7
  selectedFilterOptions: SelectedFilterOption[];
@@ -47,7 +47,7 @@ export const AppliedFiltersScrollbar = ({
47
47
  aria-label={`Remove filter: ${filter.displayName}`}
48
48
  >
49
49
  <div className="spiffy-tw-flex spiffy-tw-items-center spiffy-tw-gap-[8px]">
50
- <Text variant="body3">{filter.displayName}</Text>
50
+ <Typography variant="body3">{filter.displayName}</Typography>
51
51
  <svg
52
52
  xmlns="http://www.w3.org/2000/svg"
53
53
  width="10"
@@ -1,6 +1,6 @@
1
1
  import classNames from 'classnames';
2
2
  import ScrollContainer from 'react-indiana-drag-scroll';
3
- import { Text } from 'src/components/Text/Text';
3
+ import { Typography } from 'src/components/Typography';
4
4
 
5
5
  interface DynamicFiltersScrollbarProps {
6
6
  availableDynamicFilters: { name: string; displayName: string }[];
@@ -42,7 +42,7 @@ export const DynamicFiltersScrollbar = ({
42
42
  });
43
43
  }}
44
44
  >
45
- <Text variant="body3">{displayName}</Text>
45
+ <Typography variant="body3">{displayName}</Typography>
46
46
  </button>
47
47
  );
48
48
  })}
@@ -1,7 +1,7 @@
1
1
  import classNames from 'classnames';
2
2
  import { MdStar } from 'react-icons/md';
3
3
  import Logger from 'src/logging/logger';
4
- import { Text } from 'src/components/Text/Text';
4
+ import { Typography } from 'src/components/Typography';
5
5
  import { formatPrice } from 'src/util/formatPrice';
6
6
  import { TestProps } from '@envive-ai/react-hooks/types';
7
7
  import { useImageResolver } from '@envive-ai/react-hooks/hooks/ImageResolver';
@@ -11,7 +11,6 @@ import {
11
11
  productCardLayoutVariantClasses,
12
12
  variantTitleColorMap,
13
13
  } from './productCardVariants';
14
- import { Headline } from '../Headline';
15
14
  import { ImageWithFallback } from '../ImageWithFallback';
16
15
  import { Spinner } from '../Spinner';
17
16
  import {
@@ -55,8 +54,8 @@ export const RatingSummary = ({ stars, reviewCount, className }: RatingSummaryPr
55
54
  <div className={className}>
56
55
  <div className={group}>
57
56
  <MdStar className={starClassnames} />
58
- <Text variant="body3">{formatReviews(stars)}</Text>
59
- <Text variant="body3">({reviewCount})</Text>
57
+ <Typography variant="body3">{formatReviews(stars)}</Typography>
58
+ <Typography variant="body3">({reviewCount})</Typography>
60
59
  </div>
61
60
  </div>
62
61
  );
@@ -88,9 +87,11 @@ export const PriceSection = ({ originalPrice, salePrice, pricePrefix }: PriceSec
88
87
 
89
88
  return (
90
89
  <div className={priceClassName}>
91
- {pricePrefix && <Text>{pricePrefix}</Text>}
92
- {showSalePrice && <Text>{salePrice}</Text>}
93
- <Text className={showSalePrice ? 'spiffy-tw-line-through' : ''}>{originalPrice}</Text>
90
+ {pricePrefix && <Typography>{pricePrefix}</Typography>}
91
+ {showSalePrice && <Typography>{salePrice}</Typography>}
92
+ <Typography className={showSalePrice ? 'spiffy-tw-line-through' : ''}>
93
+ {originalPrice}
94
+ </Typography>
94
95
  </div>
95
96
  );
96
97
  };
@@ -275,9 +276,9 @@ export const ProductCard = ({
275
276
  </div>
276
277
  </div>
277
278
  <div className={contentClassnames}>
278
- <Headline variant="h4" className={productTitleClassnames}>
279
+ <Typography variant="h4" className={productTitleClassnames}>
279
280
  {title}
280
- </Headline>
281
+ </Typography>
281
282
  <div className={priceAndRatingContainerClassnames}>
282
283
  {(originalPrice || salePrice) && (
283
284
  <PriceSection
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import { Text } from 'src/components/Text';
2
+ import { Typography } from 'src/components/Typography';
3
3
  import { useState } from 'react';
4
4
  import { TestProps } from '@envive-ai/react-hooks/types';
5
5
 
@@ -91,7 +91,7 @@ export const RadioButton = ({
91
91
  {checked && <circle cx="12" cy="12" r="9" fill={getFillColor()} />}
92
92
  </svg>
93
93
  </div>
94
- <Text variant="body3">{label}</Text>
94
+ <Typography variant="body3">{label}</Typography>
95
95
  </>
96
96
  );
97
97
  };
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import { Text } from 'src/components/Text/Text';
2
+ import { Typography } from 'src/components/Typography';
3
3
  import type { SearchFilterHeaderProps } from './types';
4
4
 
5
5
  export const SearchFilterHeader = ({
@@ -20,9 +20,9 @@ export const SearchFilterHeader = ({
20
20
  headerClassName,
21
21
  )}
22
22
  >
23
- <Text variant="body2" className="spiffy-tw-font-medium">
23
+ <Typography variant="body2" className="spiffy-tw-font-medium">
24
24
  Filters ({productCount})
25
- </Text>
25
+ </Typography>
26
26
  <button
27
27
  onClick={closeModal}
28
28
  className="spiffy-tw-p-2"
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import { Text } from 'src/components/Text/Text';
2
+ import { Typography } from 'src/components/Typography';
3
3
  import type { SearchFilterItemProps } from './types';
4
4
 
5
5
  export const SearchFilterItem = ({
@@ -40,7 +40,7 @@ export const SearchFilterItem = ({
40
40
  }
41
41
  }}
42
42
  >
43
- <Text variant="body3">{displayName}</Text>
43
+ <Typography variant="body3">{displayName}</Typography>
44
44
  <div className={radioClasses}>
45
45
  {isSelected && (
46
46
  <div
@@ -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';
@@ -2,7 +2,7 @@ import React, { useRef, useImperativeHandle } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import MagnifyingGlassStarVariant from '@envive-ai/react-icons/MagnifyingGlassStarVariant';
4
4
  import { IconClose } from '@envive-ai/react-icons/src/index.js';
5
- import { SearchInputVariant } from '../SearchInputForm/types';
5
+ import { SearchInputVariant } from '@envive-ai/react-hooks/contexts/types';
6
6
  import { TextInput } from '../TextInput';
7
7
  import { searchInputVariantClasses } from './searchInputVariants';
8
8
 
@@ -1,6 +1,6 @@
1
1
  import { colorVar, ColorNames } from 'src/models/colorsConfig';
2
- import { SearchInputVariant } from '../SearchInputForm';
3
- import { TextStyleVariantMap } from '../Text/textVariantClasses';
2
+ import { SearchInputVariant } from '../../atoms/search/types';
3
+ import { TypographyVariantMap } from '../Typography/typographyVariantClasses';
4
4
 
5
5
  type SearchInputVariantClasses = {
6
6
  searchInputIconColor: string;
@@ -9,7 +9,7 @@ type SearchInputVariantClasses = {
9
9
  searchInputActiveStarClasses: string;
10
10
  autocompleteIconColor: string;
11
11
  searchInputClasses: string;
12
- placeholderVariant: keyof typeof TextStyleVariantMap;
12
+ placeholderVariant: keyof typeof TypographyVariantMap;
13
13
  };
14
14
 
15
15
  export const searchInputVariantClasses: Record<SearchInputVariant, 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 +1 @@
1
- export * from './types';
1
+ export * from './SearchInputForm';
@@ -1,6 +1,6 @@
1
1
  import classNames from 'classnames';
2
2
  import Sparkles from '@envive-ai/react-icons/Sparkles';
3
- import { Text } from 'src/components/Text';
3
+ import { Typography } from 'src/components/Typography';
4
4
 
5
5
  interface NoSearchResultsFoundProps {
6
6
  containerPaddingClasses: string;
@@ -23,7 +23,7 @@ export const NoSearchResultsFound = ({
23
23
 
24
24
  const textPrompt =
25
25
  noResultsFoundText ||
26
- 'I’m sorry, I wasnt able to find an exact match. Try changing your filters or adjusting your search query.';
26
+ "I'm sorry, I wasn't able to find an exact match. Try changing your filters or adjusting your search query.";
27
27
 
28
28
  return (
29
29
  <div className={containerClasses}>
@@ -34,7 +34,7 @@ export const NoSearchResultsFound = ({
34
34
  style={{ color: sparkleIconColor }}
35
35
  />
36
36
  </div>
37
- <Text variant="body2">{textPrompt}</Text>
37
+ <Typography variant="body2">{textPrompt}</Typography>
38
38
  </div>
39
39
  </div>
40
40
  );
@@ -1,5 +1,5 @@
1
1
  import { motion } from 'framer-motion';
2
- import { Text } from 'src/components/Text';
2
+ import { Typography } from 'src/components/Typography';
3
3
  import { ProductGridVariant, ProductCardSkeleton } from '../ProductCard';
4
4
  import { productGridVariantClasses } from '../ProductGrid';
5
5
  import { SparkleAnimation } from '../SparkleAnimation';
@@ -30,7 +30,7 @@ export const SearchResultsLoadingGrid = ({
30
30
  <div className="spiffy-tw-width-[24px]">
31
31
  <SparkleAnimation color={sparkleIconColor} animate />
32
32
  </div>
33
- <Text variant="body2">Finding the best options for you...</Text>
33
+ <Typography variant="body2">Finding the best options for you...</Typography>
34
34
  </div>
35
35
  </div>
36
36
  <div className={productGridClasses}>
@@ -4,17 +4,18 @@
4
4
  // Keeping it enabled requires listing every possible prop.
5
5
  import React from 'react';
6
6
  import classNames from 'classnames';
7
- import { getVariantPlaceholderClassNames, TextStyleVariantMap } from '../Text/textVariantClasses';
7
+
8
+ import { getVariantPlaceholderClassNames, TypographyVariantMap } from '../Typography';
8
9
 
9
10
  export interface TextInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
10
11
  borderRadius: 'sm' | 'md' | 'lg' | 'xl';
11
12
  borderColorClass?: string;
12
- placeholderVariant?: keyof typeof TextStyleVariantMap;
13
+ placeholderVariant?: keyof typeof TypographyVariantMap;
13
14
  }
14
15
 
15
16
  export const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
16
17
  ({ className, borderRadius, borderColorClass, placeholderVariant, ...rest }, ref) => {
17
- const variantClassNames = placeholderVariant ? TextStyleVariantMap[placeholderVariant] : {};
18
+ const variantClassNames = placeholderVariant ? TypographyVariantMap[placeholderVariant] : {};
18
19
  const placeholderVariantClassNames = getVariantPlaceholderClassNames(variantClassNames);
19
20
  const inputClasses = classNames([
20
21
  {
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import { Text } from 'src/components/Text';
2
+ import { Typography } from 'src/components/Typography';
3
3
 
4
4
  export type ToggleButtonProps = {
5
5
  isSelected: boolean;
@@ -85,13 +85,13 @@ export const ToggleButton = ({
85
85
  return (
86
86
  <button className={buttonClassNames} onClick={onClick} type="button">
87
87
  {icon && <div className={iconClassName}>{icon}</div>}
88
- <Text variant="body3" className={labelClassNames}>
88
+ <Typography variant="body3" className={labelClassNames}>
89
89
  {label}
90
- </Text>
90
+ </Typography>
91
91
  {secondaryLabel && (
92
- <Text variant="body4" className={secondaryLabelClassNames}>
92
+ <Typography variant="body4" className={secondaryLabelClassNames}>
93
93
  {secondaryLabel}
94
- </Text>
94
+ </Typography>
95
95
  )}
96
96
  </button>
97
97
  );
@@ -0,0 +1,22 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { getElementTypeFromVariant } from './util';
3
+
4
+ describe('getElementTypeFromVariant', () => {
5
+ it('should return the mapped header element when isHeadline is true and variant exists in TypographyDomVariantMap', () => {
6
+ expect(getElementTypeFromVariant('h1', true)).toBe('h1');
7
+ expect(getElementTypeFromVariant('h2', true)).toBe('h2');
8
+ expect(getElementTypeFromVariant('h3', true)).toBe('h3');
9
+ expect(getElementTypeFromVariant('h4', true)).toBe('h4');
10
+ });
11
+
12
+ it('should return "h3" when isHeadline is true and variant does not exist in TypographyDomVariantMap', () => {
13
+ expect(getElementTypeFromVariant('t1', true)).toBe('h3');
14
+ expect(getElementTypeFromVariant('body1', true)).toBe('h3');
15
+ });
16
+
17
+ it('should return "span" when isHeadline is false', () => {
18
+ expect(getElementTypeFromVariant('h1', false)).toBe('span');
19
+ expect(getElementTypeFromVariant('t1', false)).toBe('span');
20
+ expect(getElementTypeFromVariant('body1', false)).toBe('span');
21
+ });
22
+ });
@@ -0,0 +1,73 @@
1
+ import React, { useCallback, useMemo } from 'react';
2
+ import classNames from 'classnames';
3
+ import {
4
+ ElementTypes,
5
+ TypographyVariantMap,
6
+ } from 'src/components/Typography/typographyVariantClasses';
7
+ import { getElementTypeFromVariant } from './util';
8
+
9
+ export type TypographyProps = {
10
+ children: React.ReactNode;
11
+ noOfLines?: number;
12
+ className?: string;
13
+ style?: React.CSSProperties;
14
+ variant?: keyof typeof TypographyVariantMap;
15
+ elementType?: ElementTypes;
16
+ testId?: string;
17
+ id?: string;
18
+ };
19
+
20
+ export const Typography = ({
21
+ children,
22
+ className,
23
+ style,
24
+ noOfLines,
25
+ testId,
26
+ elementType,
27
+ variant = 'body3',
28
+ id,
29
+ }: TypographyProps) => {
30
+ const variantClassNames = variant ? TypographyVariantMap[variant] : {};
31
+ const isHeadline = useCallback(
32
+ () => ['t1', 't2', 't3', 'h1', 'h2', 'h3', 'h4'].includes(variant),
33
+ [variant],
34
+ );
35
+
36
+ const renderedElementType = useMemo(() => {
37
+ if (elementType) {
38
+ return elementType;
39
+ }
40
+ if (!elementType) {
41
+ if (isHeadline()) {
42
+ return getElementTypeFromVariant(variant, isHeadline());
43
+ }
44
+ }
45
+ return 'span'; // default to span for body variants.
46
+ }, [isHeadline, variant, elementType]);
47
+
48
+ const textClassNames = classNames(className, variantClassNames, {
49
+ 'spiffy-tw-font-[Poppins,sans-serif]': isHeadline(),
50
+ 'spiffy-tw-font-["Inter Variable,sans-serif"]': !isHeadline(),
51
+ 'spiffy-tw-line-clamp-1': noOfLines === 1,
52
+ 'spiffy-tw-line-clamp-2': noOfLines === 2,
53
+ 'spiffy-tw-line-clamp-3': noOfLines === 3,
54
+ 'spiffy-tw-line-clamp-4': noOfLines === 4,
55
+ 'spiffy-tw-line-clamp-5': noOfLines === 5,
56
+ 'spiffy-tw-line-clamp-6': noOfLines === 6,
57
+ 'spiffy-tw-line-clamp-7': noOfLines === 7,
58
+ });
59
+
60
+ const renderElement = (elementTypeToRender: ElementTypes) =>
61
+ React.createElement(
62
+ elementTypeToRender,
63
+ {
64
+ 'data-testid': testId,
65
+ className: textClassNames,
66
+ style,
67
+ id,
68
+ },
69
+ children,
70
+ );
71
+
72
+ return renderElement(renderedElementType);
73
+ };
@@ -0,0 +1,2 @@
1
+ export * from './Typography';
2
+ export * from './typographyVariantClasses';