@envive-ai/react-toolkit 0.2.4 → 0.2.5
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/dist/Accordion/index.d.cts +2 -2
- package/dist/Accordion/index.d.ts +2 -2
- package/dist/AnimatedChevron/index.d.cts +2 -2
- package/dist/AnimatedChevron/index.d.ts +2 -2
- package/dist/AppliedFiltersScrollbar/index.d.cts +2 -2
- package/dist/AppliedFiltersScrollbar/index.d.ts +2 -2
- package/dist/ButtonBase/index.d.cts +2 -2
- package/dist/ButtonBase/index.d.ts +2 -2
- package/dist/DynamicFiltersScrollbar/index.d.cts +2 -2
- package/dist/DynamicFiltersScrollbar/index.d.ts +2 -2
- package/dist/FilterScrollbar/index.d.cts +3 -3
- package/dist/FilterScrollbar/index.d.ts +3 -3
- package/dist/ImageWithFallback/index.d.cts +2 -2
- package/dist/ImageWithFallback/index.d.ts +2 -2
- package/dist/ModalSheet/index.d.cts +2 -2
- package/dist/ModalSheet/index.d.ts +2 -2
- package/dist/ProductCard/index.d.cts +1 -1
- package/dist/ProductCard/index.d.ts +1 -1
- package/dist/ProductGrid/index.d.cts +3 -3
- package/dist/ProductGrid/index.d.ts +3 -3
- package/dist/RadioButton/index.d.cts +2 -2
- package/dist/RadioButton/index.d.ts +2 -2
- package/dist/RadioButtonGroup/index.d.cts +2 -2
- package/dist/RadioButtonGroup/index.d.ts +2 -2
- package/dist/SearchAutocomplete/index.cjs +2 -1
- package/dist/SearchAutocomplete/index.d.cts +10 -2
- package/dist/SearchAutocomplete/index.d.ts +10 -2
- package/dist/SearchAutocomplete/index.js +2 -1
- package/dist/{SearchAutocomplete-TX8UTczp.cjs → SearchAutocomplete-BBBIDGP_.cjs} +26 -8
- package/dist/SearchAutocomplete-DEY_Cmf6.js +69 -0
- package/dist/SearchFilter/index.cjs +2 -2
- package/dist/SearchFilter/index.d.cts +5 -5
- package/dist/SearchFilter/index.d.ts +5 -5
- package/dist/SearchFilter/index.js +2 -2
- package/dist/{SearchFilter-BQW4o3Xf.js → SearchFilter-B0ICGnqG.js} +1 -1
- package/dist/{SearchFilter-t9or-lnj.cjs → SearchFilter-aSgPzPq-.cjs} +1 -1
- package/dist/SearchInput/index.cjs +4 -4
- package/dist/SearchInput/index.js +4 -4
- package/dist/{SearchInput-BaiWd0_O.js → SearchInput-DY2g3Bra.js} +2 -2
- package/dist/{SearchInput-CO1poiit.cjs → SearchInput-DkGDEb66.cjs} +2 -2
- package/dist/SearchInputForm/index.cjs +50 -30
- package/dist/SearchInputForm/index.d.cts +7 -5
- package/dist/SearchInputForm/index.d.ts +9 -7
- package/dist/SearchInputForm/index.js +49 -31
- package/dist/SearchResultsContent/index.cjs +3 -3
- package/dist/SearchResultsContent/index.d.cts +4 -4
- package/dist/SearchResultsContent/index.d.ts +4 -4
- package/dist/SearchResultsContent/index.js +3 -3
- package/dist/SearchResultsFilterSidebar/index.cjs +5 -5
- package/dist/SearchResultsFilterSidebar/index.d.cts +1 -1
- package/dist/SearchResultsFilterSidebar/index.d.ts +1 -1
- package/dist/SearchResultsFilterSidebar/index.js +5 -5
- package/dist/SearchResultsStates/index.cjs +3 -3
- package/dist/SearchResultsStates/index.d.cts +6 -6
- package/dist/SearchResultsStates/index.d.ts +6 -6
- package/dist/SearchResultsStates/index.js +3 -3
- package/dist/{SearchResultsStates-DUG-117h.js → SearchResultsStates-DzNMYUKh.js} +1 -1
- package/dist/{SearchResultsStates-Bv5NyxPn.cjs → SearchResultsStates-e5W9Ok19.cjs} +1 -1
- package/dist/SparkleAnimation/index.d.ts +2 -2
- package/dist/Spinner/index.d.cts +2 -2
- package/dist/Spinner/index.d.ts +2 -2
- package/dist/SuggestionButton/index.cjs +8 -0
- package/dist/SuggestionButton/index.d.cts +3 -3
- package/dist/SuggestionButton/index.d.ts +3 -3
- package/dist/SuggestionButton/index.js +8 -0
- package/dist/TextInput/index.cjs +1 -1
- package/dist/TextInput/index.js +1 -1
- package/dist/ToggleButton/index.cjs +1 -1
- package/dist/ToggleButton/index.d.cts +2 -2
- package/dist/ToggleButton/index.js +1 -1
- package/dist/{index-Dfe_lkL2.d.cts → index-BQVJifDf.d.cts} +2 -2
- package/dist/{index-DDp-fLgm.d.cts → index-BdNJ2gwC.d.ts} +5 -5
- package/dist/{index-B5p2z61Y.d.ts → index-DWTTeC2a.d.cts} +5 -5
- package/dist/{index-BcvJf9Sr.d.ts → index-fXyRC79n.d.ts} +2 -2
- package/dist/{searchFilterSidebarVariants-DXabOauB.cjs → searchFilterSidebarVariants-CjDvgxxT.cjs} +1 -1
- package/dist/{searchFilterSidebarVariants-BD4SYugF.js → searchFilterSidebarVariants-Clm9ddD5.js} +1 -1
- package/package.json +1 -1
- package/src/components/SearchAutocomplete/SearchAutocomplete.tsx +51 -11
- package/src/components/SearchInputForm/SearchInputForm.tsx +52 -18
- package/src/components/SuggestionButton/SuggestionButton.tsx +15 -0
- package/src/components/SuggestionButton/types.ts +2 -1
- package/dist/SearchAutocomplete-obO19yzL.js +0 -51
- /package/dist/{SettingsVariant-BsBbdjV5.cjs → SettingsVariant-BzZSQvrw.cjs} +0 -0
- /package/dist/{SettingsVariant-CUSFlJEu.js → SettingsVariant-DMgNg4dw.js} +0 -0
- /package/dist/{TextInput-iAKCKHwT.cjs → TextInput-BKNorxPl.cjs} +0 -0
- /package/dist/{TextInput-B_4Bu2vf.js → TextInput-NKOORtYu.js} +0 -0
- /package/dist/{ToggleButton-Br6MgjiG.js → ToggleButton-8P9eNKy1.js} +0 -0
- /package/dist/{ToggleButton-CJ74eu-N.cjs → ToggleButton-DCiR4sB5.cjs} +0 -0
- /package/dist/{colorsConfig-D-MZuBvt.cjs → colorsConfig-CRxY3SQ_.cjs} +0 -0
- /package/dist/{colorsConfig-DEfiLHH0.js → colorsConfig-D_IPWAUL.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/components/SparkleAnimation/SparkleAnimation.d.ts
|
|
4
4
|
interface SparkleAnimationProps {
|
|
@@ -10,7 +10,7 @@ declare const SparkleAnimation: ({
|
|
|
10
10
|
color,
|
|
11
11
|
className,
|
|
12
12
|
animate
|
|
13
|
-
}: SparkleAnimationProps) =>
|
|
13
|
+
}: SparkleAnimationProps) => react_jsx_runtime11.JSX.Element;
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/components/SparkleAnimation/types.d.ts
|
|
16
16
|
declare enum SparkleAnimationOverride {
|
package/dist/Spinner/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/components/Spinner/Spinner.d.ts
|
|
4
4
|
type SpinnerProps = {
|
|
@@ -6,6 +6,6 @@ type SpinnerProps = {
|
|
|
6
6
|
};
|
|
7
7
|
declare const Spinner: ({
|
|
8
8
|
className
|
|
9
|
-
}: SpinnerProps) =>
|
|
9
|
+
}: SpinnerProps) => react_jsx_runtime1.JSX.Element;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Spinner };
|
package/dist/Spinner/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime14 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/components/Spinner/Spinner.d.ts
|
|
4
4
|
type SpinnerProps = {
|
|
@@ -6,6 +6,6 @@ type SpinnerProps = {
|
|
|
6
6
|
};
|
|
7
7
|
declare const Spinner: ({
|
|
8
8
|
className
|
|
9
|
-
}: SpinnerProps) =>
|
|
9
|
+
}: SpinnerProps) => react_jsx_runtime14.JSX.Element;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Spinner };
|
|
@@ -78,6 +78,13 @@ const variantClassMap = new Map([
|
|
|
78
78
|
"spiffy-tw-stroke-[--spiffy-colors-text-accent]",
|
|
79
79
|
BORDER_CLASS
|
|
80
80
|
]],
|
|
81
|
+
["darkAccentContrast", [
|
|
82
|
+
...DARK_BACKGROUND_CLASSES,
|
|
83
|
+
"spiffy-tw-text-[--spiffy-colors-text-light]",
|
|
84
|
+
"spiffy-tw-fill-[--spiffy-colors-accent-primary]",
|
|
85
|
+
"spiffy-tw-stroke-[--spiffy-colors-accent-primary]",
|
|
86
|
+
BORDER_CLASS
|
|
87
|
+
]],
|
|
81
88
|
["transparent", [
|
|
82
89
|
"spiffy-tw-bg-transparent",
|
|
83
90
|
"spiffy-tw-border-[--spiffy-colors-background-light]",
|
|
@@ -120,6 +127,7 @@ const borderedVariants = [
|
|
|
120
127
|
"tertiary",
|
|
121
128
|
"dark",
|
|
122
129
|
"darkAccent",
|
|
130
|
+
"darkAccentContrast",
|
|
123
131
|
"darkPrimary",
|
|
124
132
|
"transparent",
|
|
125
133
|
"transparentDark",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime22 from "react/jsx-runtime";
|
|
2
2
|
import { TestProps } from "@envive-ai/react-hooks/types";
|
|
3
3
|
|
|
4
4
|
//#region src/components/SuggestionButton/types.d.ts
|
|
5
|
-
type SuggestionButtonVariant = 'outlined' | 'outlinedLight' | 'primary' | 'secondary' | 'tertiary' | 'dark' | 'darkAccent' | 'darkPrimary' | 'secondaryDark' | 'secondaryAccent' | 'transparent' | 'transparentDark' | 'lightDark';
|
|
5
|
+
type SuggestionButtonVariant = 'outlined' | 'outlinedLight' | 'primary' | 'secondary' | 'tertiary' | 'dark' | 'darkAccent' | 'darkAccentContrast' | 'darkPrimary' | 'secondaryDark' | 'secondaryAccent' | 'transparent' | 'transparentDark' | 'lightDark';
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/components/SuggestionButton/SuggestionButton.d.ts
|
|
8
8
|
declare const SPIFFY_SUGGESTION_BUTTON_QUESTION_CLASS = "spiffy-suggestion-button-question-class";
|
|
@@ -30,6 +30,6 @@ declare const SuggestionButton: ({
|
|
|
30
30
|
dataAttributes,
|
|
31
31
|
dataTestId,
|
|
32
32
|
onClick
|
|
33
|
-
}: SuggestionButtonProps) =>
|
|
33
|
+
}: SuggestionButtonProps) => react_jsx_runtime22.JSX.Element;
|
|
34
34
|
//#endregion
|
|
35
35
|
export { SPIFFY_SUGGESTION_BUTTON_ANSWER_CLASS, SPIFFY_SUGGESTION_BUTTON_QUESTION_CLASS, SPIFFY_SUGGESTION_BUTTON_TEXT_CLASS, SuggestionButton, SuggestionButtonVariant };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
2
2
|
import { TestProps } from "@envive-ai/react-hooks/types";
|
|
3
3
|
|
|
4
4
|
//#region src/components/SuggestionButton/types.d.ts
|
|
5
|
-
type SuggestionButtonVariant = 'outlined' | 'outlinedLight' | 'primary' | 'secondary' | 'tertiary' | 'dark' | 'darkAccent' | 'darkPrimary' | 'secondaryDark' | 'secondaryAccent' | 'transparent' | 'transparentDark' | 'lightDark';
|
|
5
|
+
type SuggestionButtonVariant = 'outlined' | 'outlinedLight' | 'primary' | 'secondary' | 'tertiary' | 'dark' | 'darkAccent' | 'darkAccentContrast' | 'darkPrimary' | 'secondaryDark' | 'secondaryAccent' | 'transparent' | 'transparentDark' | 'lightDark';
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/components/SuggestionButton/SuggestionButton.d.ts
|
|
8
8
|
declare const SPIFFY_SUGGESTION_BUTTON_QUESTION_CLASS = "spiffy-suggestion-button-question-class";
|
|
@@ -30,6 +30,6 @@ declare const SuggestionButton: ({
|
|
|
30
30
|
dataAttributes,
|
|
31
31
|
dataTestId,
|
|
32
32
|
onClick
|
|
33
|
-
}: SuggestionButtonProps) =>
|
|
33
|
+
}: SuggestionButtonProps) => react_jsx_runtime7.JSX.Element;
|
|
34
34
|
//#endregion
|
|
35
35
|
export { SPIFFY_SUGGESTION_BUTTON_ANSWER_CLASS, SPIFFY_SUGGESTION_BUTTON_QUESTION_CLASS, SPIFFY_SUGGESTION_BUTTON_TEXT_CLASS, SuggestionButton, SuggestionButtonVariant };
|
|
@@ -73,6 +73,13 @@ const variantClassMap = new Map([
|
|
|
73
73
|
"spiffy-tw-stroke-[--spiffy-colors-text-accent]",
|
|
74
74
|
BORDER_CLASS
|
|
75
75
|
]],
|
|
76
|
+
["darkAccentContrast", [
|
|
77
|
+
...DARK_BACKGROUND_CLASSES,
|
|
78
|
+
"spiffy-tw-text-[--spiffy-colors-text-light]",
|
|
79
|
+
"spiffy-tw-fill-[--spiffy-colors-accent-primary]",
|
|
80
|
+
"spiffy-tw-stroke-[--spiffy-colors-accent-primary]",
|
|
81
|
+
BORDER_CLASS
|
|
82
|
+
]],
|
|
76
83
|
["transparent", [
|
|
77
84
|
"spiffy-tw-bg-transparent",
|
|
78
85
|
"spiffy-tw-border-[--spiffy-colors-background-light]",
|
|
@@ -115,6 +122,7 @@ const borderedVariants = [
|
|
|
115
122
|
"tertiary",
|
|
116
123
|
"dark",
|
|
117
124
|
"darkAccent",
|
|
125
|
+
"darkAccentContrast",
|
|
118
126
|
"darkPrimary",
|
|
119
127
|
"transparent",
|
|
120
128
|
"transparentDark",
|
package/dist/TextInput/index.cjs
CHANGED
package/dist/TextInput/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime28 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/components/ToggleButton/ToggleButton.d.ts
|
|
4
4
|
type ToggleButtonProps = {
|
|
@@ -25,6 +25,6 @@ declare const ToggleButton: ({
|
|
|
25
25
|
icon,
|
|
26
26
|
iconClassName,
|
|
27
27
|
variant
|
|
28
|
-
}: ToggleButtonProps) =>
|
|
28
|
+
}: ToggleButtonProps) => react_jsx_runtime28.JSX.Element;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { ToggleButton, ToggleButtonProps, ToggleButtonVariant };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime27 from "react/jsx-runtime";
|
|
2
2
|
import { SearchFilterDatum, SelectFilterItem } from "@envive-ai/react-hooks/types";
|
|
3
3
|
|
|
4
4
|
//#region src/components/SearchResultsFilterSidebar/types.d.ts
|
|
@@ -41,6 +41,6 @@ declare const SearchResultsFilter: ({
|
|
|
41
41
|
onSelectFilterItem,
|
|
42
42
|
onClearAllFilters,
|
|
43
43
|
filterButtonText
|
|
44
|
-
}: SearchResultsFilterProps) =>
|
|
44
|
+
}: SearchResultsFilterProps) => react_jsx_runtime27.JSX.Element;
|
|
45
45
|
//#endregion
|
|
46
46
|
export { CloseIconVariant$1 as CloseIconVariant, SearchFilterSidebarVariant, SearchResultsFilter, SearchResultsFilterProps, searchFilterSidebarVariantClasses };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as react_jsx_runtime13 from "react/jsx-runtime";
|
|
2
|
-
import { TestProps } from "@envive-ai/react-hooks/types";
|
|
3
1
|
import { FC } from "react";
|
|
2
|
+
import * as react_jsx_runtime15 from "react/jsx-runtime";
|
|
3
|
+
import { TestProps } from "@envive-ai/react-hooks/types";
|
|
4
4
|
import { ResponseCategory, SearchResponseProduct } from "@spiffy-ai/commerce-api-client";
|
|
5
5
|
|
|
6
6
|
//#region src/util/trim.d.ts
|
|
@@ -261,7 +261,7 @@ declare const RatingSummary: ({
|
|
|
261
261
|
stars,
|
|
262
262
|
reviewCount,
|
|
263
263
|
className
|
|
264
|
-
}: RatingSummaryProps) =>
|
|
264
|
+
}: RatingSummaryProps) => react_jsx_runtime15.JSX.Element;
|
|
265
265
|
interface PriceSectionProps {
|
|
266
266
|
originalPrice?: string;
|
|
267
267
|
salePrice?: string;
|
|
@@ -271,7 +271,7 @@ declare const PriceSection: ({
|
|
|
271
271
|
originalPrice,
|
|
272
272
|
salePrice,
|
|
273
273
|
pricePrefix
|
|
274
|
-
}: PriceSectionProps) =>
|
|
274
|
+
}: PriceSectionProps) => react_jsx_runtime15.JSX.Element;
|
|
275
275
|
interface ProductCardProps extends TestProps {
|
|
276
276
|
productCardConfig?: ProductCardConfig;
|
|
277
277
|
merchantShortName: string;
|
|
@@ -308,7 +308,7 @@ declare const ProductCard: ({
|
|
|
308
308
|
aspectRatio,
|
|
309
309
|
growWithContainer,
|
|
310
310
|
handleClick
|
|
311
|
-
}: ProductCardProps) =>
|
|
311
|
+
}: ProductCardProps) => react_jsx_runtime15.JSX.Element;
|
|
312
312
|
//#endregion
|
|
313
313
|
//#region src/components/ProductCard/ProductCardSkeleton.d.ts
|
|
314
314
|
declare const ProductCardSkeleton: FC<ProductCardSkeletonProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
1
|
+
import * as react_jsx_runtime15 from "react/jsx-runtime";
|
|
3
2
|
import { TestProps } from "@envive-ai/react-hooks/types";
|
|
3
|
+
import { FC } from "react";
|
|
4
4
|
import { ResponseCategory, SearchResponseProduct } from "@spiffy-ai/commerce-api-client";
|
|
5
5
|
|
|
6
6
|
//#region src/util/trim.d.ts
|
|
@@ -261,7 +261,7 @@ declare const RatingSummary: ({
|
|
|
261
261
|
stars,
|
|
262
262
|
reviewCount,
|
|
263
263
|
className
|
|
264
|
-
}: RatingSummaryProps) =>
|
|
264
|
+
}: RatingSummaryProps) => react_jsx_runtime15.JSX.Element;
|
|
265
265
|
interface PriceSectionProps {
|
|
266
266
|
originalPrice?: string;
|
|
267
267
|
salePrice?: string;
|
|
@@ -271,7 +271,7 @@ declare const PriceSection: ({
|
|
|
271
271
|
originalPrice,
|
|
272
272
|
salePrice,
|
|
273
273
|
pricePrefix
|
|
274
|
-
}: PriceSectionProps) =>
|
|
274
|
+
}: PriceSectionProps) => react_jsx_runtime15.JSX.Element;
|
|
275
275
|
interface ProductCardProps extends TestProps {
|
|
276
276
|
productCardConfig?: ProductCardConfig;
|
|
277
277
|
merchantShortName: string;
|
|
@@ -308,7 +308,7 @@ declare const ProductCard: ({
|
|
|
308
308
|
aspectRatio,
|
|
309
309
|
growWithContainer,
|
|
310
310
|
handleClick
|
|
311
|
-
}: ProductCardProps) =>
|
|
311
|
+
}: ProductCardProps) => react_jsx_runtime15.JSX.Element;
|
|
312
312
|
//#endregion
|
|
313
313
|
//#region src/components/ProductCard/ProductCardSkeleton.d.ts
|
|
314
314
|
declare const ProductCardSkeleton: FC<ProductCardSkeletonProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
2
2
|
import { SearchFilterDatum, SelectFilterItem } from "@envive-ai/react-hooks/types";
|
|
3
3
|
|
|
4
4
|
//#region src/components/SearchResultsFilterSidebar/types.d.ts
|
|
@@ -41,6 +41,6 @@ declare const SearchResultsFilter: ({
|
|
|
41
41
|
onSelectFilterItem,
|
|
42
42
|
onClearAllFilters,
|
|
43
43
|
filterButtonText
|
|
44
|
-
}: SearchResultsFilterProps) =>
|
|
44
|
+
}: SearchResultsFilterProps) => react_jsx_runtime4.JSX.Element;
|
|
45
45
|
//#endregion
|
|
46
46
|
export { CloseIconVariant$1 as CloseIconVariant, SearchFilterSidebarVariant, SearchResultsFilter, SearchResultsFilterProps, searchFilterSidebarVariantClasses };
|
package/dist/{searchFilterSidebarVariants-DXabOauB.cjs → searchFilterSidebarVariants-CjDvgxxT.cjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_colorsConfig = require('./colorsConfig-
|
|
1
|
+
const require_colorsConfig = require('./colorsConfig-CRxY3SQ_.cjs');
|
|
2
2
|
|
|
3
3
|
//#region src/components/SearchResultsFilterSidebar/searchFilterSidebarVariants.ts
|
|
4
4
|
const searchFilterSidebarVariantClasses = {
|
package/package.json
CHANGED
|
@@ -2,26 +2,70 @@ import React from 'react';
|
|
|
2
2
|
import { motion } from 'framer-motion';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import OutlinedStar from '@envive-ai/react-icons/OutlinedStar';
|
|
5
|
+
import { Typography } from '../Typography';
|
|
5
6
|
|
|
6
7
|
interface GlobalSearchAutocompleteProps {
|
|
7
8
|
id: string;
|
|
8
9
|
results: string[];
|
|
9
10
|
focusedIndex: number;
|
|
11
|
+
searchText?: string;
|
|
10
12
|
onSuggestionSelect: (suggestion: string, rankPosition: number) => void;
|
|
11
13
|
iconColor?: string;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
export const SearchAutocomplete
|
|
16
|
+
export const SearchAutocomplete = ({
|
|
15
17
|
id,
|
|
16
18
|
results,
|
|
17
19
|
focusedIndex,
|
|
20
|
+
searchText = '',
|
|
18
21
|
onSuggestionSelect,
|
|
19
22
|
iconColor,
|
|
20
|
-
}) => {
|
|
23
|
+
}: GlobalSearchAutocompleteProps) => {
|
|
21
24
|
if (results.length === 0) {
|
|
22
25
|
return null;
|
|
23
26
|
}
|
|
24
27
|
|
|
28
|
+
const highlightMatchingText = (text: string, searchQuery: string) => {
|
|
29
|
+
if (!searchQuery.trim()) {
|
|
30
|
+
return <Typography variant="body3">{text}</Typography>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const escapedQuery = searchQuery.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
34
|
+
const regex = new RegExp(`(${escapedQuery})`, 'gi');
|
|
35
|
+
const parts = text.split(regex);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Typography variant="body3">
|
|
39
|
+
{parts.map((part, index) => {
|
|
40
|
+
const isMatch = part.toLowerCase() === searchQuery.toLowerCase();
|
|
41
|
+
return isMatch ? (
|
|
42
|
+
<strong key={index} className="spiffy-tw-font-bold">
|
|
43
|
+
{part}
|
|
44
|
+
</strong>
|
|
45
|
+
) : (
|
|
46
|
+
<span key={index}>{part}</span>
|
|
47
|
+
);
|
|
48
|
+
})}
|
|
49
|
+
</Typography>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const containerClasses = classNames(
|
|
54
|
+
'spiffy-tw-mt-[16px]',
|
|
55
|
+
'spiffy-tw-mb-[8px]',
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const getListElementClasses = (index: number) => classNames(
|
|
59
|
+
'spiffy-tw-flex',
|
|
60
|
+
'spiffy-tw-items-center',
|
|
61
|
+
'spiffy-tw-cursor-pointer',
|
|
62
|
+
'spiffy-tw-py-[8px]',
|
|
63
|
+
'spiffy-tw-pl-[16px]',
|
|
64
|
+
'spiffy-tw-text-[--spiffy-colors-text-primary]',
|
|
65
|
+
'hover:spiffy-tw-bg-neutral-100',
|
|
66
|
+
{ 'spiffy-tw-bg-neutral-200': focusedIndex === index },
|
|
67
|
+
);
|
|
68
|
+
|
|
25
69
|
return (
|
|
26
70
|
<motion.div
|
|
27
71
|
className="spiffy-tw-h-full"
|
|
@@ -30,18 +74,14 @@ export const SearchAutocomplete: React.FC<GlobalSearchAutocompleteProps> = ({
|
|
|
30
74
|
exit={{ opacity: 0, y: -10 }}
|
|
31
75
|
transition={{ duration: 0.2 }}
|
|
32
76
|
>
|
|
33
|
-
<ul id={id} role="listbox" className=
|
|
77
|
+
<ul id={id} role="listbox" className={containerClasses}>
|
|
34
78
|
{results.map((result, index) => (
|
|
35
79
|
<li
|
|
36
80
|
key={index}
|
|
37
81
|
id={`option-${index}`}
|
|
38
82
|
role="option"
|
|
39
83
|
aria-selected={index === focusedIndex}
|
|
40
|
-
className={
|
|
41
|
-
'spiffy-tw-flex spiffy-tw-items-center spiffy-tw-cursor-pointer spiffy-tw-py-1',
|
|
42
|
-
{ 'spiffy-tw-bg-neutral-200': index === focusedIndex },
|
|
43
|
-
'hover:spiffy-tw-bg-neutral-100',
|
|
44
|
-
)}
|
|
84
|
+
className={getListElementClasses(index)}
|
|
45
85
|
onClick={() => onSuggestionSelect(result, index)}
|
|
46
86
|
onKeyDown={(event) => {
|
|
47
87
|
if (event.key === 'Enter' || event.keyCode === 13) {
|
|
@@ -50,13 +90,13 @@ export const SearchAutocomplete: React.FC<GlobalSearchAutocompleteProps> = ({
|
|
|
50
90
|
}}
|
|
51
91
|
>
|
|
52
92
|
<OutlinedStar
|
|
53
|
-
className="spiffy-tw-w-[16px] spiffy-tw-h-[16px] spiffy-tw-mr-
|
|
93
|
+
className="spiffy-tw-w-[16px] spiffy-tw-h-[16px] spiffy-tw-mr-[16px]"
|
|
54
94
|
fill={iconColor}
|
|
55
95
|
/>
|
|
56
|
-
|
|
96
|
+
{highlightMatchingText(result, searchText)}
|
|
57
97
|
</li>
|
|
58
98
|
))}
|
|
59
99
|
</ul>
|
|
60
100
|
</motion.div>
|
|
61
101
|
);
|
|
62
|
-
};
|
|
102
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { SEARCH_INPUT_TESTID } from '@envive-ai/react-hooks/config/locators/components/search';
|
|
1
3
|
import { SearchAutocomplete } from '../SearchAutocomplete';
|
|
2
4
|
import { SearchInput } from '../SearchInput/SearchInput';
|
|
3
5
|
import { searchInputVariantClasses } from '../SearchInput/searchInputVariants';
|
|
@@ -9,13 +11,14 @@ interface SearchInputFormProps {
|
|
|
9
11
|
autocompleteResults: string[];
|
|
10
12
|
searchBoxPlaceholder: string;
|
|
11
13
|
focusedOptionId: string | undefined;
|
|
12
|
-
isDirty: boolean;
|
|
13
14
|
focusedIndex: number;
|
|
14
15
|
onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
15
|
-
onAutocompleteSelect: (suggestion: string) => void;
|
|
16
|
+
onAutocompleteSelect: (suggestion: string, rankPosition?: number) => void;
|
|
16
17
|
onSearchInputChange: (value: string) => void;
|
|
17
18
|
onSearchSubmit: () => void;
|
|
18
|
-
|
|
19
|
+
onSearchInputFocus: () => void;
|
|
20
|
+
onSearchInputBlur: () => void;
|
|
21
|
+
shouldShowAutocomplete: boolean;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
export const SearchInputForm = ({
|
|
@@ -24,24 +27,50 @@ export const SearchInputForm = ({
|
|
|
24
27
|
autocompleteResults,
|
|
25
28
|
searchBoxPlaceholder,
|
|
26
29
|
focusedOptionId,
|
|
27
|
-
|
|
30
|
+
shouldShowAutocomplete,
|
|
28
31
|
focusedIndex,
|
|
29
32
|
onKeyDown,
|
|
30
33
|
onAutocompleteSelect,
|
|
31
34
|
onSearchInputChange,
|
|
32
35
|
onSearchSubmit,
|
|
33
|
-
|
|
36
|
+
onSearchInputFocus,
|
|
37
|
+
onSearchInputBlur,
|
|
34
38
|
}: SearchInputFormProps) => {
|
|
35
|
-
const {
|
|
39
|
+
const { autocompleteIconColor } = searchInputVariantClasses[searchInputVariant];
|
|
40
|
+
|
|
41
|
+
const containerClasses = classNames(
|
|
42
|
+
'spiffy-tw-relative',
|
|
43
|
+
'spiffy-tw-w-full'
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const formClasses = classNames({
|
|
47
|
+
'spiffy-tw-grow': true,
|
|
48
|
+
'spiffy-tw-relative': true,
|
|
49
|
+
'spiffy-tw-z-20': shouldShowAutocomplete
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const autocompleteContainerClasses = classNames(
|
|
53
|
+
'spiffy-tw-absolute',
|
|
54
|
+
'spiffy-tw-top-1/2',
|
|
55
|
+
'spiffy-tw-z-10',
|
|
56
|
+
'spiffy-tw-left-0',
|
|
57
|
+
'spiffy-tw-right-0',
|
|
58
|
+
'spiffy-tw-bg-white',
|
|
59
|
+
'spiffy-tw-w-full',
|
|
60
|
+
'spiffy-tw-rounded-b-lg',
|
|
61
|
+
'spiffy-tw-border',
|
|
62
|
+
'spiffy-tw-border-t-0',
|
|
63
|
+
'spiffy-tw-pt-4'
|
|
64
|
+
);
|
|
36
65
|
|
|
37
66
|
return (
|
|
38
|
-
|
|
67
|
+
<div className={containerClasses}>
|
|
39
68
|
<form
|
|
40
69
|
onSubmit={(e) => {
|
|
41
70
|
e.preventDefault();
|
|
42
71
|
onSearchSubmit();
|
|
43
72
|
}}
|
|
44
|
-
className=
|
|
73
|
+
className={formClasses}
|
|
45
74
|
>
|
|
46
75
|
<SearchInput
|
|
47
76
|
value={searchText}
|
|
@@ -49,20 +78,25 @@ export const SearchInputForm = ({
|
|
|
49
78
|
suggestions={autocompleteResults}
|
|
50
79
|
ariaActivedescendant={focusedOptionId}
|
|
51
80
|
searchInputVariant={searchInputVariant}
|
|
52
|
-
dataTestId={
|
|
81
|
+
dataTestId={SEARCH_INPUT_TESTID}
|
|
53
82
|
onKeyDown={onKeyDown}
|
|
54
83
|
onChange={onSearchInputChange}
|
|
84
|
+
onFocus={onSearchInputFocus}
|
|
85
|
+
onBlur={onSearchInputBlur}
|
|
55
86
|
/>
|
|
56
87
|
</form>
|
|
57
|
-
{
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
88
|
+
{shouldShowAutocomplete && (
|
|
89
|
+
<div className={autocompleteContainerClasses}>
|
|
90
|
+
<SearchAutocomplete
|
|
91
|
+
id="autocomplete-results"
|
|
92
|
+
results={autocompleteResults}
|
|
93
|
+
focusedIndex={focusedIndex}
|
|
94
|
+
searchText={searchText}
|
|
95
|
+
iconColor={autocompleteIconColor}
|
|
96
|
+
onSuggestionSelect={onAutocompleteSelect}
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
65
99
|
)}
|
|
66
|
-
|
|
100
|
+
</div>
|
|
67
101
|
);
|
|
68
102
|
};
|
|
@@ -105,6 +105,20 @@ const variantClassMap = new Map<SuggestionButtonVariant, string[]>([
|
|
|
105
105
|
BORDER_CLASS,
|
|
106
106
|
],
|
|
107
107
|
],
|
|
108
|
+
// dark accent appears to have been originally been made with the bg color text-accent
|
|
109
|
+
// instead of the design, acccent-primary. This is a correction to match the design without
|
|
110
|
+
// regressing intentional uses of the other styling. text-accent and accent-primary are often
|
|
111
|
+
// the same or very similar colors but in some cases, they are very different to deal with contrast correctly.
|
|
112
|
+
[
|
|
113
|
+
'darkAccentContrast',
|
|
114
|
+
[
|
|
115
|
+
...DARK_BACKGROUND_CLASSES,
|
|
116
|
+
'spiffy-tw-text-[--spiffy-colors-text-light]', // hover:spiffy-tw-text-[--spiffy-colors-text-light]
|
|
117
|
+
'spiffy-tw-fill-[--spiffy-colors-accent-primary]', // hover:spiffy-tw-fill-[--spiffy-colors-accent-primary]
|
|
118
|
+
'spiffy-tw-stroke-[--spiffy-colors-accent-primary]', // hover:spiffy-tw-stroke-[--spiffy-colors-accent-primary]
|
|
119
|
+
BORDER_CLASS,
|
|
120
|
+
],
|
|
121
|
+
],
|
|
108
122
|
[
|
|
109
123
|
'transparent',
|
|
110
124
|
[
|
|
@@ -169,6 +183,7 @@ const borderedVariants = [
|
|
|
169
183
|
'tertiary',
|
|
170
184
|
'dark',
|
|
171
185
|
'darkAccent',
|
|
186
|
+
'darkAccentContrast',
|
|
172
187
|
'darkPrimary',
|
|
173
188
|
'transparent',
|
|
174
189
|
'transparentDark',
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { motion } from "framer-motion";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import OutlinedStar from "@envive-ai/react-icons/OutlinedStar";
|
|
6
|
-
|
|
7
|
-
//#region src/components/SearchAutocomplete/SearchAutocomplete.tsx
|
|
8
|
-
const SearchAutocomplete = ({ id, results, focusedIndex, onSuggestionSelect, iconColor }) => {
|
|
9
|
-
if (results.length === 0) return null;
|
|
10
|
-
return /* @__PURE__ */ jsx(motion.div, {
|
|
11
|
-
className: "spiffy-tw-h-full",
|
|
12
|
-
initial: {
|
|
13
|
-
opacity: 0,
|
|
14
|
-
y: -10
|
|
15
|
-
},
|
|
16
|
-
animate: {
|
|
17
|
-
opacity: 1,
|
|
18
|
-
y: 0
|
|
19
|
-
},
|
|
20
|
-
exit: {
|
|
21
|
-
opacity: 0,
|
|
22
|
-
y: -10
|
|
23
|
-
},
|
|
24
|
-
transition: { duration: .2 },
|
|
25
|
-
children: /* @__PURE__ */ jsx("ul", {
|
|
26
|
-
id,
|
|
27
|
-
role: "listbox",
|
|
28
|
-
className: "spiffy-tw-mt-4 spiffy-tw-space-y-2",
|
|
29
|
-
children: results.map((result, index) => /* @__PURE__ */ jsxs("li", {
|
|
30
|
-
id: `option-${index}`,
|
|
31
|
-
role: "option",
|
|
32
|
-
"aria-selected": index === focusedIndex,
|
|
33
|
-
className: classNames("spiffy-tw-flex spiffy-tw-items-center spiffy-tw-cursor-pointer spiffy-tw-py-1", { "spiffy-tw-bg-neutral-200": index === focusedIndex }, "hover:spiffy-tw-bg-neutral-100"),
|
|
34
|
-
onClick: () => onSuggestionSelect(result, index),
|
|
35
|
-
onKeyDown: (event) => {
|
|
36
|
-
if (event.key === "Enter" || event.keyCode === 13) onSuggestionSelect(result, index);
|
|
37
|
-
},
|
|
38
|
-
children: [/* @__PURE__ */ jsx(OutlinedStar, {
|
|
39
|
-
className: "spiffy-tw-w-[16px] spiffy-tw-h-[16px] spiffy-tw-mr-2",
|
|
40
|
-
fill: iconColor
|
|
41
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
42
|
-
className: "spiffy-tw-font-bold",
|
|
43
|
-
children: result
|
|
44
|
-
})]
|
|
45
|
-
}, index))
|
|
46
|
-
})
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
//#endregion
|
|
51
|
-
export { SearchAutocomplete };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|