@envive-ai/react-toolkit 0.1.13 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -12
- package/src/atoms/search/types.ts +1 -5
- package/src/components/Accordion/Accordion.tsx +3 -3
- package/src/components/AnimatedChevron/index.ts +1 -0
- package/src/components/AppliedFiltersScrollbar/AppliedFiltersScrollbar.tsx +2 -2
- package/src/components/ButtonBase/ButtonBase.tsx +2 -2
- package/src/components/DynamicFiltersScrollbar/DynamicFiltersScrollbar.tsx +2 -2
- package/src/components/FilterScrollbar/AppliedFiltersScrollbar.tsx +2 -2
- package/src/components/FilterScrollbar/DynamicFiltersScrollbar.tsx +2 -2
- package/src/components/ProductCard/ProductCard.tsx +10 -9
- package/src/components/RadioButton/RadioButton.tsx +2 -2
- package/src/components/SearchFilter/SearchFilterHeader.tsx +3 -3
- package/src/components/SearchFilter/SearchFilterItem.tsx +2 -2
- package/src/components/SearchFilter/index.ts +4 -2
- package/src/components/SearchInput/SearchInput.tsx +1 -1
- package/src/components/SearchInput/searchInputVariants.ts +3 -3
- package/src/components/SearchInputForm/SearchInputForm.tsx +1 -1
- package/src/components/SearchInputForm/index.ts +1 -1
- package/src/components/SearchResultsStates/NoSearchResultsFound.tsx +3 -3
- package/src/components/SearchResultsStates/SearchResultsLoadingGrid.tsx +2 -2
- package/src/components/TextInput/TextInput.tsx +4 -3
- package/src/components/ToggleButton/ToggleButton.tsx +5 -5
- package/src/components/Typography/Typography.spec.tsx +22 -0
- package/src/components/Typography/Typography.tsx +73 -0
- package/src/components/Typography/index.ts +2 -0
- package/src/components/{Text/textVariantClasses.ts → Typography/typographyVariantClasses.ts} +36 -38
- package/src/components/Typography/util.ts +19 -0
- package/dist/Accordion/index.cjs +0 -6
- package/dist/Accordion/index.d.cts +0 -13
- package/dist/Accordion/index.d.ts +0 -13
- package/dist/Accordion/index.js +0 -6
- package/dist/Accordion-D9gO9_y3.cjs +0 -88
- package/dist/Accordion-ZEdp99Ph.js +0 -77
- package/dist/AppliedFiltersScrollbar/index.cjs +0 -48
- package/dist/AppliedFiltersScrollbar/index.d.cts +0 -22
- package/dist/AppliedFiltersScrollbar/index.d.ts +0 -22
- package/dist/AppliedFiltersScrollbar/index.js +0 -44
- package/dist/ButtonBase/index.cjs +0 -7
- package/dist/ButtonBase/index.d.cts +0 -42
- package/dist/ButtonBase/index.d.ts +0 -42
- package/dist/ButtonBase/index.js +0 -6
- package/dist/ButtonBase-0NN6wmX-.js +0 -1
- package/dist/ButtonBase-BIXx56hq.cjs +0 -0
- package/dist/ButtonBase-DgRupM53.js +0 -60
- package/dist/ButtonBase-DrIwVGTR.cjs +0 -75
- package/dist/DynamicFiltersScrollbar/index.cjs +0 -36
- package/dist/DynamicFiltersScrollbar/index.d.cts +0 -28
- package/dist/DynamicFiltersScrollbar/index.d.ts +0 -28
- package/dist/DynamicFiltersScrollbar/index.js +0 -32
- package/dist/DynamicFiltersScrollbar-B1j53y2q.cjs +0 -81
- package/dist/DynamicFiltersScrollbar-D7WYp6x9.js +0 -66
- package/dist/FilterScrollbar/index.cjs +0 -6
- package/dist/FilterScrollbar/index.d.cts +0 -47
- package/dist/FilterScrollbar/index.d.ts +0 -47
- package/dist/FilterScrollbar/index.js +0 -5
- package/dist/Headline/index.cjs +0 -4
- package/dist/Headline/index.d.cts +0 -21
- package/dist/Headline/index.d.ts +0 -21
- package/dist/Headline/index.js +0 -4
- package/dist/Headline-COv0Jbn8.js +0 -64
- package/dist/Headline-Cp79THVF.cjs +0 -72
- package/dist/ImageWithFallback/index.cjs +0 -3
- package/dist/ImageWithFallback/index.d.cts +0 -26
- package/dist/ImageWithFallback/index.d.ts +0 -26
- package/dist/ImageWithFallback/index.js +0 -3
- package/dist/ImageWithFallback-Cx-KNi-D.cjs +0 -51
- package/dist/ImageWithFallback-DqxjwO3i.js +0 -42
- package/dist/ModalSheet/index.cjs +0 -3
- package/dist/ModalSheet/index.d.cts +0 -38
- package/dist/ModalSheet/index.d.ts +0 -38
- package/dist/ModalSheet/index.js +0 -3
- package/dist/ModalSheet-01pxpy_K.js +0 -326
- package/dist/ModalSheet-Csz8HIxs.cjs +0 -337
- package/dist/ProductCard/index.cjs +0 -17
- package/dist/ProductCard/index.d.cts +0 -2
- package/dist/ProductCard/index.d.ts +0 -2
- package/dist/ProductCard/index.js +0 -8
- package/dist/ProductCard-CNwmHggx.js +0 -255
- package/dist/ProductCard-EmdDy2af.cjs +0 -319
- package/dist/ProductGrid/index.cjs +0 -10
- package/dist/ProductGrid/index.d.cts +0 -33
- package/dist/ProductGrid/index.d.ts +0 -33
- package/dist/ProductGrid/index.js +0 -9
- package/dist/ProductGrid-CMoomZLc.cjs +0 -74
- package/dist/ProductGrid-nmWSp0qX.js +0 -60
- package/dist/RadioButton/index.cjs +0 -6
- package/dist/RadioButton/index.d.cts +0 -32
- package/dist/RadioButton/index.d.ts +0 -32
- package/dist/RadioButton/index.js +0 -6
- package/dist/RadioButton-BdKJRzLM.cjs +0 -84
- package/dist/RadioButton-S5dALI2f.js +0 -75
- package/dist/RadioButtonGroup/index.cjs +0 -8
- package/dist/RadioButtonGroup/index.d.cts +0 -36
- package/dist/RadioButtonGroup/index.d.ts +0 -36
- package/dist/RadioButtonGroup/index.js +0 -7
- package/dist/RadioButtonGroup-BipNsoHL.js +0 -38
- package/dist/RadioButtonGroup-TAJMA1j_.cjs +0 -52
- package/dist/SearchAutocomplete/index.cjs +0 -57
- package/dist/SearchAutocomplete/index.d.cts +0 -13
- package/dist/SearchAutocomplete/index.d.ts +0 -13
- package/dist/SearchAutocomplete/index.js +0 -51
- package/dist/SearchFilter/index.cjs +0 -15
- package/dist/SearchFilter/index.d.cts +0 -77
- package/dist/SearchFilter/index.d.ts +0 -77
- package/dist/SearchFilter/index.js +0 -13
- package/dist/SearchFilter-BcLc0TMq.cjs +0 -289
- package/dist/SearchFilter-w-0s2YVu.js +0 -268
- package/dist/SearchInput/index.cjs +0 -97
- package/dist/SearchInput/index.d.cts +0 -33
- package/dist/SearchInput/index.d.ts +0 -33
- package/dist/SearchInput/index.js +0 -90
- package/dist/SearchInputForm/index.cjs +0 -0
- package/dist/SearchInputForm/index.d.cts +0 -2
- package/dist/SearchInputForm/index.d.ts +0 -2
- package/dist/SearchInputForm/index.js +0 -1
- package/dist/SearchResultsContent/index.cjs +0 -47
- package/dist/SearchResultsContent/index.d.cts +0 -48
- package/dist/SearchResultsContent/index.d.ts +0 -48
- package/dist/SearchResultsContent/index.js +0 -44
- package/dist/SearchResultsFilterSidebar/index.cjs +0 -61
- package/dist/SearchResultsFilterSidebar/index.d.cts +0 -2
- package/dist/SearchResultsFilterSidebar/index.d.ts +0 -2
- package/dist/SearchResultsFilterSidebar/index.js +0 -56
- package/dist/SearchResultsStates/index.cjs +0 -17
- package/dist/SearchResultsStates/index.d.cts +0 -69
- package/dist/SearchResultsStates/index.d.ts +0 -69
- package/dist/SearchResultsStates/index.js +0 -15
- package/dist/SearchResultsStates-DlZz14yy.js +0 -110
- package/dist/SearchResultsStates-DwcPrsdd.cjs +0 -132
- package/dist/SparkleAnimation/index.cjs +0 -4
- package/dist/SparkleAnimation/index.d.cts +0 -23
- package/dist/SparkleAnimation/index.d.ts +0 -23
- package/dist/SparkleAnimation/index.js +0 -3
- package/dist/SparkleAnimation-CvGlWUqv.cjs +0 -101
- package/dist/SparkleAnimation-paLhSu5E.js +0 -84
- package/dist/Spinner/index.cjs +0 -3
- package/dist/Spinner/index.d.cts +0 -11
- package/dist/Spinner/index.d.ts +0 -11
- package/dist/Spinner/index.js +0 -3
- package/dist/Spinner-CjGLIRgs.js +0 -38
- package/dist/Spinner-DFor2Szi.cjs +0 -46
- package/dist/SuggestionButton/index.cjs +0 -188
- package/dist/SuggestionButton/index.d.cts +0 -35
- package/dist/SuggestionButton/index.d.ts +0 -35
- package/dist/SuggestionButton/index.js +0 -180
- package/dist/Text/index.cjs +0 -10
- package/dist/Text/index.d.cts +0 -42
- package/dist/Text/index.d.ts +0 -42
- package/dist/Text/index.js +0 -5
- package/dist/Text-BLzNhX4H.js +0 -42
- package/dist/Text-BMsncrpY.js +0 -10
- package/dist/Text-C8t_iEj6.cjs +0 -16
- package/dist/Text-DllCE9_D.cjs +0 -50
- package/dist/TextInput/index.cjs +0 -4
- package/dist/TextInput/index.d.cts +0 -12
- package/dist/TextInput/index.d.ts +0 -12
- package/dist/TextInput/index.js +0 -4
- package/dist/TextInput-DmsOxxPN.js +0 -31
- package/dist/TextInput-HMW0hxLI.cjs +0 -40
- package/dist/ToggleButton/index.cjs +0 -6
- package/dist/ToggleButton/index.d.cts +0 -30
- package/dist/ToggleButton/index.d.ts +0 -30
- package/dist/ToggleButton/index.js +0 -6
- package/dist/ToggleButton-DblAj4Cd.cjs +0 -68
- package/dist/ToggleButton-r7Y7Kzzo.js +0 -60
- package/dist/chunk-CUT6urMc.cjs +0 -30
- package/dist/colorsConfig-B3-SMUSx.cjs +0 -38
- package/dist/colorsConfig-DZ-GSPWy.js +0 -26
- package/dist/index-BKvXn5sj.d.ts +0 -4
- package/dist/index-Br1B7Jta.d.cts +0 -46
- package/dist/index-DADHwW6M.d.ts +0 -325
- package/dist/index-DDp-fLgm.d.cts +0 -325
- package/dist/index-Dh8rcWev.d.ts +0 -46
- package/dist/index-W1wCDiw_.d.cts +0 -4
- package/dist/searchFilterSidebarVariants-J0FJ8pck.js +0 -34
- package/dist/searchFilterSidebarVariants-kkTjYEIF.cjs +0 -39
- package/dist/textVariantClasses-B0gNjzl4.d.cts +0 -174
- package/dist/textVariantClasses-C8OCWZAw.d.ts +0 -174
- package/dist/textVariantClasses-CBre7vXv.cjs +0 -123
- package/dist/textVariantClasses-CRrTb43V.js +0 -99
- package/src/components/Headline/Headline.tsx +0 -81
- package/src/components/Headline/index.ts +0 -1
- package/src/components/SearchInputForm/types.ts +0 -1
- package/src/components/Text/Text.tsx +0 -58
- package/src/components/Text/index.ts +0 -3
- package/src/components/Text/types.ts +0 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envive-ai/react-toolkit",
|
|
3
|
-
"version": "0.1
|
|
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,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 {
|
|
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
|
-
<
|
|
49
|
+
<Typography variant="body4" className={titleClasses}>
|
|
50
50
|
{title}
|
|
51
|
-
</
|
|
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 {
|
|
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
|
-
<
|
|
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 {
|
|
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
|
-
<
|
|
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 {
|
|
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
|
-
<
|
|
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 {
|
|
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
|
-
<
|
|
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 {
|
|
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
|
-
<
|
|
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 {
|
|
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
|
-
<
|
|
59
|
-
<
|
|
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 && <
|
|
92
|
-
{showSalePrice && <
|
|
93
|
-
<
|
|
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
|
-
<
|
|
279
|
+
<Typography variant="h4" className={productTitleClassnames}>
|
|
279
280
|
{title}
|
|
280
|
-
</
|
|
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 {
|
|
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
|
-
<
|
|
94
|
+
<Typography variant="body3">{label}</Typography>
|
|
95
95
|
</>
|
|
96
96
|
);
|
|
97
97
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import {
|
|
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
|
-
<
|
|
23
|
+
<Typography variant="body2" className="spiffy-tw-font-medium">
|
|
24
24
|
Filters ({productCount})
|
|
25
|
-
</
|
|
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 {
|
|
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
|
-
<
|
|
43
|
+
<Typography variant="body3">{displayName}</Typography>
|
|
44
44
|
<div className={radioClasses}>
|
|
45
45
|
{isSelected && (
|
|
46
46
|
<div
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './SearchFilter';
|
|
2
2
|
export * from './SearchFilterHeader';
|
|
3
|
-
export
|
|
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 '
|
|
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 '
|
|
3
|
-
import {
|
|
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
|
|
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 '
|
|
4
|
+
import { SearchInputVariant } from '../../atoms/search/types';
|
|
5
5
|
|
|
6
6
|
interface SearchInputFormProps {
|
|
7
7
|
searchInputVariant: SearchInputVariant;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
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 {
|
|
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
|
-
'
|
|
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
|
-
<
|
|
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 {
|
|
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
|
-
<
|
|
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
|
-
|
|
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
|
|
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 ?
|
|
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 {
|
|
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
|
-
<
|
|
88
|
+
<Typography variant="body3" className={labelClassNames}>
|
|
89
89
|
{label}
|
|
90
|
-
</
|
|
90
|
+
</Typography>
|
|
91
91
|
{secondaryLabel && (
|
|
92
|
-
<
|
|
92
|
+
<Typography variant="body4" className={secondaryLabelClassNames}>
|
|
93
93
|
{secondaryLabel}
|
|
94
|
-
</
|
|
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
|
+
};
|