@envive-ai/react-toolkit 0.1.10 → 0.1.12
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.cjs +3 -82
- package/dist/Accordion/index.d.cts +2 -2
- package/dist/Accordion/index.d.ts +2 -2
- package/dist/Accordion/index.js +2 -75
- package/dist/Accordion-Cp3Hx2zm.js +77 -0
- package/dist/Accordion-DBZpiQe7.cjs +88 -0
- package/dist/AppliedFiltersScrollbar/index.d.cts +2 -2
- package/dist/AppliedFiltersScrollbar/index.d.ts +2 -2
- package/dist/ButtonBase/index.cjs +2 -2
- package/dist/ButtonBase/index.d.cts +2 -2
- package/dist/ButtonBase/index.d.ts +2 -2
- package/dist/ButtonBase/index.js +2 -2
- package/dist/DynamicFiltersScrollbar/index.d.cts +2 -2
- package/dist/DynamicFiltersScrollbar/index.d.ts +2 -2
- package/dist/FilterScrollbar/index.cjs +1 -1
- package/dist/FilterScrollbar/index.d.cts +3 -3
- package/dist/FilterScrollbar/index.d.ts +3 -3
- package/dist/FilterScrollbar/index.js +1 -1
- package/dist/Headline/index.cjs +1 -1
- package/dist/Headline/index.d.cts +2 -2
- package/dist/Headline/index.d.ts +2 -2
- package/dist/Headline/index.js +1 -1
- package/dist/ImageWithFallback/index.d.cts +2 -2
- package/dist/ImageWithFallback/index.d.ts +2 -2
- package/dist/ModalSheet/index.cjs +3 -0
- package/dist/ModalSheet/index.d.cts +38 -0
- package/dist/ModalSheet/index.d.ts +38 -0
- package/dist/ModalSheet/index.js +3 -0
- package/dist/ModalSheet-01pxpy_K.js +326 -0
- package/dist/ModalSheet-Csz8HIxs.cjs +337 -0
- package/dist/ProductCard/index.cjs +3 -3
- package/dist/ProductCard/index.d.cts +1 -1
- package/dist/ProductCard/index.d.ts +1 -1
- package/dist/ProductCard/index.js +3 -3
- package/dist/{ProductCard-Dkkhl9pk.js → ProductCard-C3MjnfZJ.js} +3 -3
- package/dist/{ProductCard-CymUvJnC.cjs → ProductCard-FDyIMnZs.cjs} +5 -5
- package/dist/ProductGrid/index.cjs +4 -4
- package/dist/ProductGrid/index.d.cts +3 -3
- package/dist/ProductGrid/index.d.ts +3 -3
- package/dist/ProductGrid/index.js +4 -4
- package/dist/{ProductGrid-B3Ypqh7j.js → ProductGrid-C9OKsyB2.js} +1 -1
- package/dist/{ProductGrid-ZNRujkuN.cjs → ProductGrid-TlntVJ6h.cjs} +1 -1
- package/dist/RadioButton/index.cjs +6 -0
- package/dist/RadioButton/index.d.cts +30 -0
- package/dist/RadioButton/index.d.ts +30 -0
- package/dist/RadioButton/index.js +6 -0
- package/dist/RadioButton-Bf68dZl7.js +68 -0
- package/dist/RadioButton-DZ6QXkrN.cjs +77 -0
- package/dist/RadioButtonGroup/index.cjs +8 -0
- package/dist/RadioButtonGroup/index.d.cts +36 -0
- package/dist/RadioButtonGroup/index.d.ts +36 -0
- package/dist/RadioButtonGroup/index.js +7 -0
- package/dist/RadioButtonGroup-8k7hkJYB.js +37 -0
- package/dist/RadioButtonGroup-Dc_n5amh.cjs +51 -0
- package/dist/SearchAutocomplete/index.cjs +1 -1
- package/dist/SearchAutocomplete/index.js +1 -1
- package/dist/SearchFilter/index.cjs +9 -2
- package/dist/SearchFilter/index.d.cts +15 -9
- package/dist/SearchFilter/index.d.ts +15 -9
- package/dist/SearchFilter/index.js +9 -2
- package/dist/SearchFilter-CTVBi5s3.cjs +279 -0
- package/dist/SearchFilter-DvqBIXa1.js +258 -0
- package/dist/SearchInput/index.cjs +3 -3
- package/dist/SearchInput/index.d.cts +1 -1
- package/dist/SearchInput/index.d.ts +2 -2
- package/dist/SearchInput/index.js +3 -3
- package/dist/{SearchInput-BT1rrc4F.js → SearchInput-CVaCPWCE.js} +2 -2
- package/dist/{SearchInput-CdR_nsR3.cjs → SearchInput-vJMWoLzS.cjs} +2 -2
- package/dist/SearchInputForm/index.cjs +4 -4
- package/dist/SearchInputForm/index.d.cts +1 -1
- package/dist/SearchInputForm/index.d.ts +1 -1
- package/dist/SearchInputForm/index.js +4 -4
- package/dist/SearchResultsContent/index.cjs +14 -14
- package/dist/SearchResultsContent/index.d.cts +5 -5
- package/dist/SearchResultsContent/index.d.ts +5 -5
- package/dist/SearchResultsContent/index.js +10 -10
- package/dist/SearchResultsFilterSidebar/index.cjs +15 -8
- package/dist/SearchResultsFilterSidebar/index.d.cts +1 -1
- package/dist/SearchResultsFilterSidebar/index.d.ts +1 -1
- package/dist/SearchResultsFilterSidebar/index.js +13 -6
- package/dist/SearchResultsStates/index.cjs +9 -9
- package/dist/SearchResultsStates/index.d.cts +6 -6
- package/dist/SearchResultsStates/index.d.ts +6 -6
- package/dist/SearchResultsStates/index.js +9 -9
- package/dist/{SearchResultsStates-ESlrrf20.cjs → SearchResultsStates-CH4agenX.cjs} +5 -5
- package/dist/{SearchResultsStates-BxJphoL-.js → SearchResultsStates-iKz64Pd4.js} +5 -5
- package/dist/SparkleAnimation/index.cjs +1 -1
- package/dist/SparkleAnimation/index.d.cts +2 -2
- package/dist/SparkleAnimation/index.d.ts +2 -2
- package/dist/SparkleAnimation/index.js +1 -1
- package/dist/Spinner/index.cjs +1 -1
- package/dist/Spinner/index.d.cts +2 -2
- package/dist/Spinner/index.d.ts +2 -2
- package/dist/Spinner/index.js +1 -1
- package/dist/SuggestionButton/index.cjs +1 -1
- package/dist/SuggestionButton/index.d.cts +2 -2
- package/dist/SuggestionButton/index.d.ts +2 -2
- package/dist/SuggestionButton/index.js +1 -1
- package/dist/Text/index.d.cts +2 -2
- package/dist/Text/index.d.ts +3 -3
- package/dist/TextInput/index.cjs +1 -1
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/TextInput/index.js +1 -1
- package/dist/ToggleButton/index.cjs +6 -0
- package/dist/ToggleButton/index.d.cts +30 -0
- package/dist/ToggleButton/index.d.ts +30 -0
- package/dist/ToggleButton/index.js +6 -0
- package/dist/ToggleButton-CK_vkMvt.cjs +68 -0
- package/dist/ToggleButton-GIVd2-Z4.js +60 -0
- package/dist/{index-DV2K-9lE.d.cts → index-B8l3muO3.d.ts} +5 -5
- package/dist/{index-agU5rfIs.d.ts → index-BMt66uqr.d.cts} +5 -5
- package/dist/{index-b4yAASuy.d.cts → index-CFH3KUVw.d.cts} +4 -4
- package/dist/{index-uU3sIiRx.d.ts → index-H_9LhS_1.d.cts} +2 -2
- package/dist/{index-DggZTKvc.d.ts → index-Vck3pox6.d.ts} +4 -4
- package/dist/{index-Bpjv4lP2.d.cts → index-h-QwQNnu.d.ts} +2 -2
- package/dist/{searchFilterSidebarVariants-BnIcOVWR.js → searchFilterSidebarVariants-CI782ylo.js} +1 -1
- package/dist/{searchFilterSidebarVariants-DVZ7wRlb.cjs → searchFilterSidebarVariants-DFfOTqjc.cjs} +1 -1
- package/package.json +20 -3
- package/src/components/AnimatedChevron/AnimatedChevron.tsx +37 -0
- package/src/components/ModalSheet/ModalSheet.tsx +42 -0
- package/src/components/ModalSheet/common/closeIcon.tsx +40 -0
- package/src/components/ModalSheet/desktop/desktopHeader.tsx +24 -0
- package/src/components/ModalSheet/desktop/index.tsx +119 -0
- package/src/components/ModalSheet/index.ts +1 -0
- package/src/components/ModalSheet/mobile/index.tsx +118 -0
- package/src/components/ModalSheet/mobile/mobileHeader.tsx +42 -0
- package/src/components/ModalSheet/types.ts +33 -0
- package/src/components/ProductCard/ProductCard.tsx +1 -1
- package/src/components/RadioButton/RadioButton.tsx +88 -0
- package/src/components/RadioButton/index.ts +1 -0
- package/src/components/RadioButtonGroup/RadioButtonGroup.tsx +72 -0
- package/src/components/RadioButtonGroup/index.ts +1 -0
- package/src/components/SearchFilter/SearchFilter.tsx +161 -64
- package/src/components/SearchFilter/SearchFilterFooter.tsx +55 -0
- package/src/components/SearchFilter/types.ts +2 -1
- package/src/components/SearchFilter/useHasFilterStateChanged.tsx +40 -0
- package/src/components/SearchFilter/utils.ts +15 -0
- package/src/components/SearchResultsContent/SearchResultsContent.tsx +1 -1
- package/src/components/SearchResultsFilterSidebar/SearchResultsFilter.tsx +2 -2
- package/src/components/ToggleButton/ToggleButton.tsx +98 -0
- package/src/components/ToggleButton/index.ts +1 -0
- package/dist/SearchFilter-CLYCSNAa.cjs +0 -137
- package/dist/SearchFilter-qQPpx-34.js +0 -117
- /package/dist/{ButtonBase-C_uKnl48.js → ButtonBase-0NN6wmX-.js} +0 -0
- /package/dist/{ButtonBase-DGbSm0SJ.js → ButtonBase-BAf-nlCm.js} +0 -0
- /package/dist/{ButtonBase-DbWQ25n-.cjs → ButtonBase-BIXx56hq.cjs} +0 -0
- /package/dist/{ButtonBase-DGpQBeLR.cjs → ButtonBase-Do88ndKa.cjs} +0 -0
- /package/dist/{DynamicFiltersScrollbar-Dev5vGsW.js → DynamicFiltersScrollbar-C4kdNSJ9.js} +0 -0
- /package/dist/{DynamicFiltersScrollbar-ChvmEiPB.cjs → DynamicFiltersScrollbar-CVw1PINp.cjs} +0 -0
- /package/dist/{Headline-DTaT30_m.js → Headline-DNEWF8ly.js} +0 -0
- /package/dist/{Headline-DSmu5Mg8.cjs → Headline-DTT4RSv2.cjs} +0 -0
- /package/dist/{SearchAutocomplete-C4RY0IoT.js → SearchAutocomplete-BlpII8Xs.js} +0 -0
- /package/dist/{SearchAutocomplete-hQDnKtwQ.cjs → SearchAutocomplete-DIEhLT4C.cjs} +0 -0
- /package/dist/{SparkleAnimation-fQHP7b-R.js → SparkleAnimation-BLfNojLv.js} +0 -0
- /package/dist/{SparkleAnimation-BY5iw7s0.cjs → SparkleAnimation-qi5WCJ9B.cjs} +0 -0
- /package/dist/{Spinner-BqTt55uu.js → Spinner-CjGLIRgs.js} +0 -0
- /package/dist/{Spinner-DjK8ts9E.cjs → Spinner-DFor2Szi.cjs} +0 -0
- /package/dist/{TextInput-BJrdkZsM.cjs → TextInput-B3dTeD3q.cjs} +0 -0
- /package/dist/{TextInput-DIjjsSMg.js → TextInput-DoM41M53.js} +0 -0
- /package/dist/{colorsConfig-CJTKbJsm.cjs → colorsConfig-D-MZuBvt.cjs} +0 -0
- /package/dist/{colorsConfig-CYZ8f_gj.js → colorsConfig-DEfiLHH0.js} +0 -0
- /package/dist/{textVariantClasses-ypYGLq0h.d.ts → textVariantClasses-kyZtL8F5.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { SearchFilterDatum, SearchFilterItemDatum, SelectFilterItem } from "@envive-ai/react-hooks/types";
|
|
1
|
+
import * as react_jsx_runtime16 from "react/jsx-runtime";
|
|
2
|
+
import { CloseIconVariant, SearchFilterDatum, SearchFilterItemDatum, SelectFilterItem } from "@envive-ai/react-hooks/types";
|
|
3
3
|
|
|
4
4
|
//#region src/components/SearchFilter/types.d.ts
|
|
5
5
|
interface SearchFilterItem$1 extends SearchFilterItemDatum {
|
|
@@ -35,21 +35,27 @@ type SearchFilterProps = {
|
|
|
35
35
|
radioButtonFillColor: string;
|
|
36
36
|
radioButtonHoverColor?: string;
|
|
37
37
|
radioButtonUncheckedBorderColor?: string;
|
|
38
|
+
filterCloseIconVariant: CloseIconVariant;
|
|
38
39
|
};
|
|
39
40
|
//#endregion
|
|
40
41
|
//#region src/components/SearchFilter/SearchFilter.d.ts
|
|
41
42
|
declare const SearchFilter: ({
|
|
42
|
-
isOpen,
|
|
43
|
-
setIsOpen,
|
|
44
43
|
filters,
|
|
44
|
+
productCount,
|
|
45
45
|
selectFilterItem,
|
|
46
46
|
clearAllFilters,
|
|
47
|
-
|
|
47
|
+
isOpen,
|
|
48
|
+
setIsOpen,
|
|
49
|
+
applyFiltersUnchangedClasses,
|
|
50
|
+
applyFiltersChangedClasses,
|
|
51
|
+
headerContent,
|
|
52
|
+
footerContent,
|
|
53
|
+
headerClassName,
|
|
48
54
|
radioButtonFillColor,
|
|
49
55
|
radioButtonHoverColor,
|
|
50
56
|
radioButtonUncheckedBorderColor,
|
|
51
|
-
|
|
52
|
-
}: SearchFilterProps) =>
|
|
57
|
+
filterCloseIconVariant
|
|
58
|
+
}: SearchFilterProps) => react_jsx_runtime16.JSX.Element;
|
|
53
59
|
//#endregion
|
|
54
60
|
//#region src/components/SearchFilter/SearchFilterHeader.d.ts
|
|
55
61
|
declare const SearchFilterHeader: ({
|
|
@@ -57,7 +63,7 @@ declare const SearchFilterHeader: ({
|
|
|
57
63
|
productCount,
|
|
58
64
|
headerClassName,
|
|
59
65
|
filterCloseIconVariant
|
|
60
|
-
}: SearchFilterHeaderProps) =>
|
|
66
|
+
}: SearchFilterHeaderProps) => react_jsx_runtime16.JSX.Element;
|
|
61
67
|
//#endregion
|
|
62
68
|
//#region src/components/SearchFilter/SearchFilterItem.d.ts
|
|
63
69
|
declare const SearchFilterItem: ({
|
|
@@ -66,6 +72,6 @@ declare const SearchFilterItem: ({
|
|
|
66
72
|
radioButtonFillColor,
|
|
67
73
|
radioButtonHoverColor,
|
|
68
74
|
radioButtonUncheckedBorderColor
|
|
69
|
-
}: SearchFilterItemProps) =>
|
|
75
|
+
}: SearchFilterItemProps) => react_jsx_runtime16.JSX.Element;
|
|
70
76
|
//#endregion
|
|
71
77
|
export { SearchFilter, SearchFilterHeader, SearchFilterItem };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { SearchFilterDatum, SearchFilterItemDatum, SelectFilterItem } from "@envive-ai/react-hooks/types";
|
|
1
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
2
|
+
import { CloseIconVariant, SearchFilterDatum, SearchFilterItemDatum, SelectFilterItem } from "@envive-ai/react-hooks/types";
|
|
3
3
|
|
|
4
4
|
//#region src/components/SearchFilter/types.d.ts
|
|
5
5
|
interface SearchFilterItem$1 extends SearchFilterItemDatum {
|
|
@@ -35,21 +35,27 @@ type SearchFilterProps = {
|
|
|
35
35
|
radioButtonFillColor: string;
|
|
36
36
|
radioButtonHoverColor?: string;
|
|
37
37
|
radioButtonUncheckedBorderColor?: string;
|
|
38
|
+
filterCloseIconVariant: CloseIconVariant;
|
|
38
39
|
};
|
|
39
40
|
//#endregion
|
|
40
41
|
//#region src/components/SearchFilter/SearchFilter.d.ts
|
|
41
42
|
declare const SearchFilter: ({
|
|
42
|
-
isOpen,
|
|
43
|
-
setIsOpen,
|
|
44
43
|
filters,
|
|
44
|
+
productCount,
|
|
45
45
|
selectFilterItem,
|
|
46
46
|
clearAllFilters,
|
|
47
|
-
|
|
47
|
+
isOpen,
|
|
48
|
+
setIsOpen,
|
|
49
|
+
applyFiltersUnchangedClasses,
|
|
50
|
+
applyFiltersChangedClasses,
|
|
51
|
+
headerContent,
|
|
52
|
+
footerContent,
|
|
53
|
+
headerClassName,
|
|
48
54
|
radioButtonFillColor,
|
|
49
55
|
radioButtonHoverColor,
|
|
50
56
|
radioButtonUncheckedBorderColor,
|
|
51
|
-
|
|
52
|
-
}: SearchFilterProps) =>
|
|
57
|
+
filterCloseIconVariant
|
|
58
|
+
}: SearchFilterProps) => react_jsx_runtime12.JSX.Element;
|
|
53
59
|
//#endregion
|
|
54
60
|
//#region src/components/SearchFilter/SearchFilterHeader.d.ts
|
|
55
61
|
declare const SearchFilterHeader: ({
|
|
@@ -57,7 +63,7 @@ declare const SearchFilterHeader: ({
|
|
|
57
63
|
productCount,
|
|
58
64
|
headerClassName,
|
|
59
65
|
filterCloseIconVariant
|
|
60
|
-
}: SearchFilterHeaderProps) =>
|
|
66
|
+
}: SearchFilterHeaderProps) => react_jsx_runtime12.JSX.Element;
|
|
61
67
|
//#endregion
|
|
62
68
|
//#region src/components/SearchFilter/SearchFilterItem.d.ts
|
|
63
69
|
declare const SearchFilterItem: ({
|
|
@@ -66,6 +72,6 @@ declare const SearchFilterItem: ({
|
|
|
66
72
|
radioButtonFillColor,
|
|
67
73
|
radioButtonHoverColor,
|
|
68
74
|
radioButtonUncheckedBorderColor
|
|
69
|
-
}: SearchFilterItemProps) =>
|
|
75
|
+
}: SearchFilterItemProps) => react_jsx_runtime12.JSX.Element;
|
|
70
76
|
//#endregion
|
|
71
77
|
export { SearchFilter, SearchFilterHeader, SearchFilterItem };
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import "../textVariantClasses-D77TGEy1.js";
|
|
2
2
|
import "../Text-Bod4OMPk.js";
|
|
3
|
-
import "../
|
|
4
|
-
import
|
|
3
|
+
import "../Text-BMsncrpY.js";
|
|
4
|
+
import "../Accordion-Cp3Hx2zm.js";
|
|
5
|
+
import "../ButtonBase-BAf-nlCm.js";
|
|
6
|
+
import "../ButtonBase-0NN6wmX-.js";
|
|
7
|
+
import "../ModalSheet-01pxpy_K.js";
|
|
8
|
+
import "../RadioButton-Bf68dZl7.js";
|
|
9
|
+
import "../RadioButtonGroup-8k7hkJYB.js";
|
|
10
|
+
import { SearchFilter, SearchFilterHeader, SearchFilterItem } from "../SearchFilter-DvqBIXa1.js";
|
|
11
|
+
import "../ToggleButton-GIVd2-Z4.js";
|
|
5
12
|
|
|
6
13
|
export { SearchFilter, SearchFilterHeader, SearchFilterItem };
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const require_Text = require('./Text-MQjxqgZZ.cjs');
|
|
3
|
+
const require_Accordion = require('./Accordion-DBZpiQe7.cjs');
|
|
4
|
+
const require_ButtonBase = require('./ButtonBase-Do88ndKa.cjs');
|
|
5
|
+
const require_ModalSheet = require('./ModalSheet-Csz8HIxs.cjs');
|
|
6
|
+
const require_RadioButtonGroup = require('./RadioButtonGroup-Dc_n5amh.cjs');
|
|
7
|
+
const require_ToggleButton = require('./ToggleButton-CK_vkMvt.cjs');
|
|
8
|
+
let react = require("react");
|
|
9
|
+
react = require_chunk.__toESM(react);
|
|
10
|
+
let classnames = require("classnames");
|
|
11
|
+
classnames = require_chunk.__toESM(classnames);
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
|
+
react_jsx_runtime = require_chunk.__toESM(react_jsx_runtime);
|
|
14
|
+
|
|
15
|
+
//#region src/components/SearchFilter/SearchFilterHeader.tsx
|
|
16
|
+
const SearchFilterHeader = ({ closeModal, productCount, headerClassName, filterCloseIconVariant }) => {
|
|
17
|
+
const closeIconColor = filterCloseIconVariant === "dark" ? "var(--spiffy-colors-text-primary)" : "var(--spiffy-colors-text-light)";
|
|
18
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
19
|
+
className: (0, classnames.default)("spiffy-tw-flex spiffy-tw-items-center spiffy-tw-justify-between spiffy-tw-px-4 spiffy-tw-py-3", headerClassName),
|
|
20
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Text.Text, {
|
|
21
|
+
variant: "body2",
|
|
22
|
+
className: "spiffy-tw-font-medium",
|
|
23
|
+
children: [
|
|
24
|
+
"Filters (",
|
|
25
|
+
productCount,
|
|
26
|
+
")"
|
|
27
|
+
]
|
|
28
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
29
|
+
onClick: closeModal,
|
|
30
|
+
className: "spiffy-tw-p-2",
|
|
31
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
32
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
33
|
+
width: "14",
|
|
34
|
+
height: "14",
|
|
35
|
+
viewBox: "0 0 14 14",
|
|
36
|
+
fill: "none",
|
|
37
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
38
|
+
d: "M13.7071 1.70711C14.0976 1.31658 14.0976 0.683417 13.7071 0.292893C13.3166 -0.0976311 12.6834 -0.0976311 12.2929 0.292893L7 5.58579L1.70711 0.292893C1.31658 -0.0976311 0.683417 -0.0976311 0.292893 0.292893C-0.0976311 0.683417 -0.0976311 1.31658 0.292893 1.70711L5.58579 7L0.292893 12.2929C-0.0976311 12.6834 -0.0976311 13.3166 0.292893 13.7071C0.683417 14.0976 1.31658 14.0976 1.70711 13.7071L7 8.41421L12.2929 13.7071C12.6834 14.0976 13.3166 14.0976 13.7071 13.7071C14.0976 13.3166 14.0976 12.6834 13.7071 12.2929L8.41421 7L13.7071 1.70711Z",
|
|
39
|
+
fill: closeIconColor
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/components/SearchFilter/useHasFilterStateChanged.tsx
|
|
48
|
+
const useHasFilterStateChanged = (filters, isOpen) => {
|
|
49
|
+
const [initialFilterStates, setInitialFilterStates] = (0, react.useState)({});
|
|
50
|
+
const currentFilterStates = (0, react.useMemo)(() => {
|
|
51
|
+
const states = {};
|
|
52
|
+
filters.forEach((filter) => {
|
|
53
|
+
filter.items.forEach((item) => {
|
|
54
|
+
states[`${filter.filterId}-${item.filterItemId}`] = item.isSelected;
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
return states;
|
|
58
|
+
}, [filters]);
|
|
59
|
+
const hasFiltersChanged = (0, react.useMemo)(() => {
|
|
60
|
+
if (Object.keys(initialFilterStates).length === 0) return false;
|
|
61
|
+
return Object.keys(currentFilterStates).some((key) => currentFilterStates[key] !== initialFilterStates[key]);
|
|
62
|
+
}, [currentFilterStates, initialFilterStates]);
|
|
63
|
+
(0, react.useEffect)(() => {
|
|
64
|
+
if (isOpen) setInitialFilterStates(currentFilterStates);
|
|
65
|
+
}, [isOpen]);
|
|
66
|
+
return hasFiltersChanged;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/components/SearchFilter/utils.ts
|
|
71
|
+
const getSelectedFilterItemsCount = (filter) => {
|
|
72
|
+
return filter.items.filter((item) => item.isSelected).length;
|
|
73
|
+
};
|
|
74
|
+
const getTotalSelectedFilterItemsCount = (filters) => {
|
|
75
|
+
return filters.reduce((acc, filter) => {
|
|
76
|
+
if (filter.filterId === "sort") return acc;
|
|
77
|
+
return acc + getSelectedFilterItemsCount(filter);
|
|
78
|
+
}, 0);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/components/SearchFilter/SearchFilterFooter.tsx
|
|
83
|
+
const SearchFilterFooter = ({ closeModal, clearAllFilters, filterCount, applyFiltersUnchangedClasses, applyFiltersChangedClasses, hasFiltersChanged }) => {
|
|
84
|
+
const clearAllButtonEnabled = filterCount > 0;
|
|
85
|
+
const footerWrapperClassName = (0, classnames.default)({
|
|
86
|
+
"spiffy-tw-flex": true,
|
|
87
|
+
"spiffy-tw-flex-col": true,
|
|
88
|
+
"spiffy-tw-items-center": true,
|
|
89
|
+
"spiffy-tw-justify-between": true,
|
|
90
|
+
"spiffy-tw-w-full": true,
|
|
91
|
+
"spiffy-tw-border-t": true,
|
|
92
|
+
"spiffy-tw-border-t-[--spiffy-colors-border-light]": true,
|
|
93
|
+
"spiffy-tw-p-[16px]": true,
|
|
94
|
+
"spiffy-tw-gap-[16px]": true
|
|
95
|
+
});
|
|
96
|
+
const applyFilterButtonClassName = (0, classnames.default)("spiffy-tw-flex spiffy-tw-flex-row spiffy-tw-justify-center spiffy-tw-rounded-[8px] spiffy-tw-w-full", hasFiltersChanged ? applyFiltersChangedClasses : applyFiltersUnchangedClasses);
|
|
97
|
+
const clearAllButtonClassName = (0, classnames.default)({
|
|
98
|
+
"spiffy-tw-flex": true,
|
|
99
|
+
"spiffy-tw-flex-row": true,
|
|
100
|
+
"spiffy-tw-justify-center": true,
|
|
101
|
+
"spiffy-tw-w-full": true,
|
|
102
|
+
"spiffy-tw-text-[--spiffy-colors-text-primary]": clearAllButtonEnabled,
|
|
103
|
+
"spiffy-tw-text-[--spiffy-colors-text-secondary]": !clearAllButtonEnabled
|
|
104
|
+
});
|
|
105
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
106
|
+
className: footerWrapperClassName,
|
|
107
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ButtonBase.ButtonBase, {
|
|
108
|
+
isDisabled: !hasFiltersChanged,
|
|
109
|
+
buttonClass: applyFilterButtonClassName,
|
|
110
|
+
text: "Apply Filters",
|
|
111
|
+
onClick: closeModal
|
|
112
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ButtonBase.ButtonBase, {
|
|
113
|
+
isDisabled: !clearAllButtonEnabled,
|
|
114
|
+
buttonClass: clearAllButtonClassName,
|
|
115
|
+
text: "Clear All",
|
|
116
|
+
onClick: clearAllFilters
|
|
117
|
+
})]
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/components/SearchFilter/SearchFilter.tsx
|
|
123
|
+
const SortFilter = ({ filter, selectFilterItem, radioButtonFillColor, radioButtonHoverColor, radioButtonUncheckedBorderColor }) => {
|
|
124
|
+
const filterTitle = filter.displayName;
|
|
125
|
+
const options = filter.items.map((item) => ({
|
|
126
|
+
label: item.displayName,
|
|
127
|
+
value: item.filterItemId,
|
|
128
|
+
isSelected: item.isSelected
|
|
129
|
+
}));
|
|
130
|
+
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_RadioButtonGroup.RadioButtonGroup, {
|
|
131
|
+
options,
|
|
132
|
+
name: filterTitle,
|
|
133
|
+
onChange: (value) => {
|
|
134
|
+
const selectedItem = filter.items.find((item) => item.filterItemId === value);
|
|
135
|
+
selectFilterItem({
|
|
136
|
+
filterId: filter.filterId,
|
|
137
|
+
filterItemId: value,
|
|
138
|
+
isSelected: true,
|
|
139
|
+
displayName: selectedItem?.displayName || value
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
gap: "large",
|
|
143
|
+
textButtonGap: "large",
|
|
144
|
+
value: filter.items.find((item) => item.isSelected)?.filterItemId,
|
|
145
|
+
fillColor: radioButtonFillColor,
|
|
146
|
+
hoverColor: radioButtonHoverColor,
|
|
147
|
+
uncheckedBorderColor: radioButtonUncheckedBorderColor
|
|
148
|
+
});
|
|
149
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Accordion.Accordion, {
|
|
150
|
+
title: filterTitle,
|
|
151
|
+
content
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
const FilterItem = ({ filterId, filterItem, selectFilterItem }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ToggleButton.ToggleButton, {
|
|
155
|
+
label: filterItem.displayName,
|
|
156
|
+
secondaryLabel: `(${filterItem.productCount})`,
|
|
157
|
+
isSelected: filterItem.isSelected,
|
|
158
|
+
onClick: () => selectFilterItem({
|
|
159
|
+
filterId,
|
|
160
|
+
filterItemId: filterItem.filterItemId,
|
|
161
|
+
isSelected: !filterItem.isSelected,
|
|
162
|
+
displayName: filterItem.displayName
|
|
163
|
+
}),
|
|
164
|
+
variant: "default"
|
|
165
|
+
});
|
|
166
|
+
const Filter = ({ filter, selectFilterItem }) => {
|
|
167
|
+
const filterContentClassName = (0, classnames.default)({
|
|
168
|
+
"spiffy-tw-flex": true,
|
|
169
|
+
"spiffy-tw-flex-wrap": true,
|
|
170
|
+
"spiffy-tw-gap-[8px]": true,
|
|
171
|
+
"spiffy-tw-pb-[1px]": true
|
|
172
|
+
});
|
|
173
|
+
const selectedFilterItems = getSelectedFilterItemsCount(filter);
|
|
174
|
+
const filterTitle = selectedFilterItems > 0 ? `${filter.displayName} (${selectedFilterItems})` : filter.displayName;
|
|
175
|
+
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
176
|
+
className: filterContentClassName,
|
|
177
|
+
children: filter.items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilterItem, {
|
|
178
|
+
filterId: filter.filterId,
|
|
179
|
+
filterItem: item,
|
|
180
|
+
selectFilterItem
|
|
181
|
+
}, item.filterItemId))
|
|
182
|
+
});
|
|
183
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Accordion.Accordion, {
|
|
184
|
+
title: filterTitle,
|
|
185
|
+
content
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
const SearchFilter = ({ filters, productCount, selectFilterItem, clearAllFilters, isOpen, setIsOpen, applyFiltersUnchangedClasses, applyFiltersChangedClasses, headerContent, footerContent, headerClassName, radioButtonFillColor, radioButtonHoverColor, radioButtonUncheckedBorderColor, filterCloseIconVariant }) => {
|
|
189
|
+
const closeModal = (0, react.useCallback)(() => setIsOpen(false), [setIsOpen]);
|
|
190
|
+
const filterCount = getTotalSelectedFilterItemsCount(filters);
|
|
191
|
+
const hasFiltersChanged = useHasFilterStateChanged(filters, isOpen);
|
|
192
|
+
const filterWrapperClassName = (0, classnames.default)({
|
|
193
|
+
"spiffy-tw-flex": true,
|
|
194
|
+
"spiffy-tw-flex-col": true,
|
|
195
|
+
"spiffy-tw-gap-[16px]": true,
|
|
196
|
+
"spiffy-tw-px-[24px]": true,
|
|
197
|
+
"spiffy-tw-py-[16px]": true,
|
|
198
|
+
"spiffy-tw-max-h-screen": true,
|
|
199
|
+
"spiffy-tw-overflow-y-auto": true
|
|
200
|
+
});
|
|
201
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ModalSheet.ModalSheet, {
|
|
202
|
+
isOpen,
|
|
203
|
+
closeModal,
|
|
204
|
+
headerProps: {
|
|
205
|
+
headerContent: headerContent || /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchFilterHeader, {
|
|
206
|
+
closeModal,
|
|
207
|
+
productCount,
|
|
208
|
+
headerClassName: headerClassName ?? "",
|
|
209
|
+
filterCloseIconVariant
|
|
210
|
+
}),
|
|
211
|
+
chevronColor: "#000"
|
|
212
|
+
},
|
|
213
|
+
footerProps: { footerContent: footerContent || /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchFilterFooter, {
|
|
214
|
+
closeModal,
|
|
215
|
+
clearAllFilters,
|
|
216
|
+
filterCount,
|
|
217
|
+
hasFiltersChanged,
|
|
218
|
+
applyFiltersUnchangedClasses,
|
|
219
|
+
applyFiltersChangedClasses
|
|
220
|
+
}) },
|
|
221
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
222
|
+
className: filterWrapperClassName,
|
|
223
|
+
children: filters.filter((filter) => filter.displayName !== "").map((filter) => {
|
|
224
|
+
if (filter.filterId === "sort") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SortFilter, {
|
|
225
|
+
filter,
|
|
226
|
+
selectFilterItem,
|
|
227
|
+
radioButtonFillColor,
|
|
228
|
+
radioButtonHoverColor,
|
|
229
|
+
radioButtonUncheckedBorderColor
|
|
230
|
+
}, filter.filterId);
|
|
231
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Filter, {
|
|
232
|
+
filter,
|
|
233
|
+
selectFilterItem
|
|
234
|
+
}, filter.filterId);
|
|
235
|
+
})
|
|
236
|
+
})
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/components/SearchFilter/SearchFilterItem.tsx
|
|
242
|
+
const SearchFilterItem = ({ filterItem, onSelectFilterItem, radioButtonFillColor, radioButtonHoverColor, radioButtonUncheckedBorderColor }) => {
|
|
243
|
+
const { displayName, isSelected } = filterItem;
|
|
244
|
+
const radioClasses = (0, classnames.default)("spiffy-tw-w-4 spiffy-tw-h-4 spiffy-tw-rounded-full spiffy-tw-border-2", "spiffy-tw-flex spiffy-tw-items-center spiffy-tw-justify-center", radioButtonUncheckedBorderColor, radioButtonHoverColor, { [radioButtonFillColor]: isSelected });
|
|
245
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
246
|
+
className: "spiffy-tw-flex spiffy-tw-items-center spiffy-tw-justify-between spiffy-tw-py-2 spiffy-tw-cursor-pointer",
|
|
247
|
+
onClick: () => onSelectFilterItem(filterItem),
|
|
248
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
|
|
249
|
+
variant: "body3",
|
|
250
|
+
children: displayName
|
|
251
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
252
|
+
className: radioClasses,
|
|
253
|
+
children: isSelected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, classnames.default)("spiffy-tw-w-2 spiffy-tw-h-2 spiffy-tw-rounded-full", {
|
|
254
|
+
"spiffy-tw-bg-white": radioButtonFillColor.includes("spiffy-tw-bg-"),
|
|
255
|
+
"spiffy-tw-bg-black": radioButtonFillColor.includes("spiffy-tw-bg-white")
|
|
256
|
+
}) })
|
|
257
|
+
})]
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
//#endregion
|
|
262
|
+
Object.defineProperty(exports, 'SearchFilter', {
|
|
263
|
+
enumerable: true,
|
|
264
|
+
get: function () {
|
|
265
|
+
return SearchFilter;
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
Object.defineProperty(exports, 'SearchFilterHeader', {
|
|
269
|
+
enumerable: true,
|
|
270
|
+
get: function () {
|
|
271
|
+
return SearchFilterHeader;
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
Object.defineProperty(exports, 'SearchFilterItem', {
|
|
275
|
+
enumerable: true,
|
|
276
|
+
get: function () {
|
|
277
|
+
return SearchFilterItem;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { Text } from "./Text-Bod4OMPk.js";
|
|
2
|
+
import { Accordion } from "./Accordion-Cp3Hx2zm.js";
|
|
3
|
+
import { ButtonBase } from "./ButtonBase-BAf-nlCm.js";
|
|
4
|
+
import { ModalSheet } from "./ModalSheet-01pxpy_K.js";
|
|
5
|
+
import { RadioButtonGroup } from "./RadioButtonGroup-8k7hkJYB.js";
|
|
6
|
+
import { ToggleButton } from "./ToggleButton-GIVd2-Z4.js";
|
|
7
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
8
|
+
import classNames from "classnames";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
|
|
11
|
+
//#region src/components/SearchFilter/SearchFilterHeader.tsx
|
|
12
|
+
const SearchFilterHeader = ({ closeModal, productCount, headerClassName, filterCloseIconVariant }) => {
|
|
13
|
+
const closeIconColor = filterCloseIconVariant === "dark" ? "var(--spiffy-colors-text-primary)" : "var(--spiffy-colors-text-light)";
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
15
|
+
className: classNames("spiffy-tw-flex spiffy-tw-items-center spiffy-tw-justify-between spiffy-tw-px-4 spiffy-tw-py-3", headerClassName),
|
|
16
|
+
children: [/* @__PURE__ */ jsxs(Text, {
|
|
17
|
+
variant: "body2",
|
|
18
|
+
className: "spiffy-tw-font-medium",
|
|
19
|
+
children: [
|
|
20
|
+
"Filters (",
|
|
21
|
+
productCount,
|
|
22
|
+
")"
|
|
23
|
+
]
|
|
24
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
25
|
+
onClick: closeModal,
|
|
26
|
+
className: "spiffy-tw-p-2",
|
|
27
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
28
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
29
|
+
width: "14",
|
|
30
|
+
height: "14",
|
|
31
|
+
viewBox: "0 0 14 14",
|
|
32
|
+
fill: "none",
|
|
33
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
34
|
+
d: "M13.7071 1.70711C14.0976 1.31658 14.0976 0.683417 13.7071 0.292893C13.3166 -0.0976311 12.6834 -0.0976311 12.2929 0.292893L7 5.58579L1.70711 0.292893C1.31658 -0.0976311 0.683417 -0.0976311 0.292893 0.292893C-0.0976311 0.683417 -0.0976311 1.31658 0.292893 1.70711L5.58579 7L0.292893 12.2929C-0.0976311 12.6834 -0.0976311 13.3166 0.292893 13.7071C0.683417 14.0976 1.31658 14.0976 1.70711 13.7071L7 8.41421L12.2929 13.7071C12.6834 14.0976 13.3166 14.0976 13.7071 13.7071C14.0976 13.3166 14.0976 12.6834 13.7071 12.2929L8.41421 7L13.7071 1.70711Z",
|
|
35
|
+
fill: closeIconColor
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
})]
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/components/SearchFilter/useHasFilterStateChanged.tsx
|
|
44
|
+
const useHasFilterStateChanged = (filters, isOpen) => {
|
|
45
|
+
const [initialFilterStates, setInitialFilterStates] = useState({});
|
|
46
|
+
const currentFilterStates = useMemo(() => {
|
|
47
|
+
const states = {};
|
|
48
|
+
filters.forEach((filter) => {
|
|
49
|
+
filter.items.forEach((item) => {
|
|
50
|
+
states[`${filter.filterId}-${item.filterItemId}`] = item.isSelected;
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return states;
|
|
54
|
+
}, [filters]);
|
|
55
|
+
const hasFiltersChanged = useMemo(() => {
|
|
56
|
+
if (Object.keys(initialFilterStates).length === 0) return false;
|
|
57
|
+
return Object.keys(currentFilterStates).some((key) => currentFilterStates[key] !== initialFilterStates[key]);
|
|
58
|
+
}, [currentFilterStates, initialFilterStates]);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (isOpen) setInitialFilterStates(currentFilterStates);
|
|
61
|
+
}, [isOpen]);
|
|
62
|
+
return hasFiltersChanged;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/components/SearchFilter/utils.ts
|
|
67
|
+
const getSelectedFilterItemsCount = (filter) => {
|
|
68
|
+
return filter.items.filter((item) => item.isSelected).length;
|
|
69
|
+
};
|
|
70
|
+
const getTotalSelectedFilterItemsCount = (filters) => {
|
|
71
|
+
return filters.reduce((acc, filter) => {
|
|
72
|
+
if (filter.filterId === "sort") return acc;
|
|
73
|
+
return acc + getSelectedFilterItemsCount(filter);
|
|
74
|
+
}, 0);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/components/SearchFilter/SearchFilterFooter.tsx
|
|
79
|
+
const SearchFilterFooter = ({ closeModal, clearAllFilters, filterCount, applyFiltersUnchangedClasses, applyFiltersChangedClasses, hasFiltersChanged }) => {
|
|
80
|
+
const clearAllButtonEnabled = filterCount > 0;
|
|
81
|
+
const footerWrapperClassName = classNames({
|
|
82
|
+
"spiffy-tw-flex": true,
|
|
83
|
+
"spiffy-tw-flex-col": true,
|
|
84
|
+
"spiffy-tw-items-center": true,
|
|
85
|
+
"spiffy-tw-justify-between": true,
|
|
86
|
+
"spiffy-tw-w-full": true,
|
|
87
|
+
"spiffy-tw-border-t": true,
|
|
88
|
+
"spiffy-tw-border-t-[--spiffy-colors-border-light]": true,
|
|
89
|
+
"spiffy-tw-p-[16px]": true,
|
|
90
|
+
"spiffy-tw-gap-[16px]": true
|
|
91
|
+
});
|
|
92
|
+
const applyFilterButtonClassName = classNames("spiffy-tw-flex spiffy-tw-flex-row spiffy-tw-justify-center spiffy-tw-rounded-[8px] spiffy-tw-w-full", hasFiltersChanged ? applyFiltersChangedClasses : applyFiltersUnchangedClasses);
|
|
93
|
+
const clearAllButtonClassName = classNames({
|
|
94
|
+
"spiffy-tw-flex": true,
|
|
95
|
+
"spiffy-tw-flex-row": true,
|
|
96
|
+
"spiffy-tw-justify-center": true,
|
|
97
|
+
"spiffy-tw-w-full": true,
|
|
98
|
+
"spiffy-tw-text-[--spiffy-colors-text-primary]": clearAllButtonEnabled,
|
|
99
|
+
"spiffy-tw-text-[--spiffy-colors-text-secondary]": !clearAllButtonEnabled
|
|
100
|
+
});
|
|
101
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
102
|
+
className: footerWrapperClassName,
|
|
103
|
+
children: [/* @__PURE__ */ jsx(ButtonBase, {
|
|
104
|
+
isDisabled: !hasFiltersChanged,
|
|
105
|
+
buttonClass: applyFilterButtonClassName,
|
|
106
|
+
text: "Apply Filters",
|
|
107
|
+
onClick: closeModal
|
|
108
|
+
}), /* @__PURE__ */ jsx(ButtonBase, {
|
|
109
|
+
isDisabled: !clearAllButtonEnabled,
|
|
110
|
+
buttonClass: clearAllButtonClassName,
|
|
111
|
+
text: "Clear All",
|
|
112
|
+
onClick: clearAllFilters
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/components/SearchFilter/SearchFilter.tsx
|
|
119
|
+
const SortFilter = ({ filter, selectFilterItem, radioButtonFillColor, radioButtonHoverColor, radioButtonUncheckedBorderColor }) => {
|
|
120
|
+
const filterTitle = filter.displayName;
|
|
121
|
+
const options = filter.items.map((item) => ({
|
|
122
|
+
label: item.displayName,
|
|
123
|
+
value: item.filterItemId,
|
|
124
|
+
isSelected: item.isSelected
|
|
125
|
+
}));
|
|
126
|
+
const content = /* @__PURE__ */ jsx(RadioButtonGroup, {
|
|
127
|
+
options,
|
|
128
|
+
name: filterTitle,
|
|
129
|
+
onChange: (value) => {
|
|
130
|
+
const selectedItem = filter.items.find((item) => item.filterItemId === value);
|
|
131
|
+
selectFilterItem({
|
|
132
|
+
filterId: filter.filterId,
|
|
133
|
+
filterItemId: value,
|
|
134
|
+
isSelected: true,
|
|
135
|
+
displayName: selectedItem?.displayName || value
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
gap: "large",
|
|
139
|
+
textButtonGap: "large",
|
|
140
|
+
value: filter.items.find((item) => item.isSelected)?.filterItemId,
|
|
141
|
+
fillColor: radioButtonFillColor,
|
|
142
|
+
hoverColor: radioButtonHoverColor,
|
|
143
|
+
uncheckedBorderColor: radioButtonUncheckedBorderColor
|
|
144
|
+
});
|
|
145
|
+
return /* @__PURE__ */ jsx(Accordion, {
|
|
146
|
+
title: filterTitle,
|
|
147
|
+
content
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
const FilterItem = ({ filterId, filterItem, selectFilterItem }) => /* @__PURE__ */ jsx(ToggleButton, {
|
|
151
|
+
label: filterItem.displayName,
|
|
152
|
+
secondaryLabel: `(${filterItem.productCount})`,
|
|
153
|
+
isSelected: filterItem.isSelected,
|
|
154
|
+
onClick: () => selectFilterItem({
|
|
155
|
+
filterId,
|
|
156
|
+
filterItemId: filterItem.filterItemId,
|
|
157
|
+
isSelected: !filterItem.isSelected,
|
|
158
|
+
displayName: filterItem.displayName
|
|
159
|
+
}),
|
|
160
|
+
variant: "default"
|
|
161
|
+
});
|
|
162
|
+
const Filter = ({ filter, selectFilterItem }) => {
|
|
163
|
+
const filterContentClassName = classNames({
|
|
164
|
+
"spiffy-tw-flex": true,
|
|
165
|
+
"spiffy-tw-flex-wrap": true,
|
|
166
|
+
"spiffy-tw-gap-[8px]": true,
|
|
167
|
+
"spiffy-tw-pb-[1px]": true
|
|
168
|
+
});
|
|
169
|
+
const selectedFilterItems = getSelectedFilterItemsCount(filter);
|
|
170
|
+
const filterTitle = selectedFilterItems > 0 ? `${filter.displayName} (${selectedFilterItems})` : filter.displayName;
|
|
171
|
+
const content = /* @__PURE__ */ jsx("div", {
|
|
172
|
+
className: filterContentClassName,
|
|
173
|
+
children: filter.items.map((item) => /* @__PURE__ */ jsx(FilterItem, {
|
|
174
|
+
filterId: filter.filterId,
|
|
175
|
+
filterItem: item,
|
|
176
|
+
selectFilterItem
|
|
177
|
+
}, item.filterItemId))
|
|
178
|
+
});
|
|
179
|
+
return /* @__PURE__ */ jsx(Accordion, {
|
|
180
|
+
title: filterTitle,
|
|
181
|
+
content
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
const SearchFilter = ({ filters, productCount, selectFilterItem, clearAllFilters, isOpen, setIsOpen, applyFiltersUnchangedClasses, applyFiltersChangedClasses, headerContent, footerContent, headerClassName, radioButtonFillColor, radioButtonHoverColor, radioButtonUncheckedBorderColor, filterCloseIconVariant }) => {
|
|
185
|
+
const closeModal = useCallback(() => setIsOpen(false), [setIsOpen]);
|
|
186
|
+
const filterCount = getTotalSelectedFilterItemsCount(filters);
|
|
187
|
+
const hasFiltersChanged = useHasFilterStateChanged(filters, isOpen);
|
|
188
|
+
const filterWrapperClassName = classNames({
|
|
189
|
+
"spiffy-tw-flex": true,
|
|
190
|
+
"spiffy-tw-flex-col": true,
|
|
191
|
+
"spiffy-tw-gap-[16px]": true,
|
|
192
|
+
"spiffy-tw-px-[24px]": true,
|
|
193
|
+
"spiffy-tw-py-[16px]": true,
|
|
194
|
+
"spiffy-tw-max-h-screen": true,
|
|
195
|
+
"spiffy-tw-overflow-y-auto": true
|
|
196
|
+
});
|
|
197
|
+
return /* @__PURE__ */ jsx(ModalSheet, {
|
|
198
|
+
isOpen,
|
|
199
|
+
closeModal,
|
|
200
|
+
headerProps: {
|
|
201
|
+
headerContent: headerContent || /* @__PURE__ */ jsx(SearchFilterHeader, {
|
|
202
|
+
closeModal,
|
|
203
|
+
productCount,
|
|
204
|
+
headerClassName: headerClassName ?? "",
|
|
205
|
+
filterCloseIconVariant
|
|
206
|
+
}),
|
|
207
|
+
chevronColor: "#000"
|
|
208
|
+
},
|
|
209
|
+
footerProps: { footerContent: footerContent || /* @__PURE__ */ jsx(SearchFilterFooter, {
|
|
210
|
+
closeModal,
|
|
211
|
+
clearAllFilters,
|
|
212
|
+
filterCount,
|
|
213
|
+
hasFiltersChanged,
|
|
214
|
+
applyFiltersUnchangedClasses,
|
|
215
|
+
applyFiltersChangedClasses
|
|
216
|
+
}) },
|
|
217
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
218
|
+
className: filterWrapperClassName,
|
|
219
|
+
children: filters.filter((filter) => filter.displayName !== "").map((filter) => {
|
|
220
|
+
if (filter.filterId === "sort") return /* @__PURE__ */ jsx(SortFilter, {
|
|
221
|
+
filter,
|
|
222
|
+
selectFilterItem,
|
|
223
|
+
radioButtonFillColor,
|
|
224
|
+
radioButtonHoverColor,
|
|
225
|
+
radioButtonUncheckedBorderColor
|
|
226
|
+
}, filter.filterId);
|
|
227
|
+
return /* @__PURE__ */ jsx(Filter, {
|
|
228
|
+
filter,
|
|
229
|
+
selectFilterItem
|
|
230
|
+
}, filter.filterId);
|
|
231
|
+
})
|
|
232
|
+
})
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/components/SearchFilter/SearchFilterItem.tsx
|
|
238
|
+
const SearchFilterItem = ({ filterItem, onSelectFilterItem, radioButtonFillColor, radioButtonHoverColor, radioButtonUncheckedBorderColor }) => {
|
|
239
|
+
const { displayName, isSelected } = filterItem;
|
|
240
|
+
const radioClasses = classNames("spiffy-tw-w-4 spiffy-tw-h-4 spiffy-tw-rounded-full spiffy-tw-border-2", "spiffy-tw-flex spiffy-tw-items-center spiffy-tw-justify-center", radioButtonUncheckedBorderColor, radioButtonHoverColor, { [radioButtonFillColor]: isSelected });
|
|
241
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
242
|
+
className: "spiffy-tw-flex spiffy-tw-items-center spiffy-tw-justify-between spiffy-tw-py-2 spiffy-tw-cursor-pointer",
|
|
243
|
+
onClick: () => onSelectFilterItem(filterItem),
|
|
244
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
245
|
+
variant: "body3",
|
|
246
|
+
children: displayName
|
|
247
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
248
|
+
className: radioClasses,
|
|
249
|
+
children: isSelected && /* @__PURE__ */ jsx("div", { className: classNames("spiffy-tw-w-2 spiffy-tw-h-2 spiffy-tw-rounded-full", {
|
|
250
|
+
"spiffy-tw-bg-white": radioButtonFillColor.includes("spiffy-tw-bg-"),
|
|
251
|
+
"spiffy-tw-bg-black": radioButtonFillColor.includes("spiffy-tw-bg-white")
|
|
252
|
+
}) })
|
|
253
|
+
})]
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
//#endregion
|
|
258
|
+
export { SearchFilter, SearchFilterHeader, SearchFilterItem };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../textVariantClasses-Dgz7Zaql.cjs');
|
|
2
|
-
require('../
|
|
3
|
-
require('../
|
|
4
|
-
const require_SearchInput = require('../SearchInput-
|
|
2
|
+
require('../colorsConfig-D-MZuBvt.cjs');
|
|
3
|
+
require('../TextInput-B3dTeD3q.cjs');
|
|
4
|
+
const require_SearchInput = require('../SearchInput-vJMWoLzS.cjs');
|
|
5
5
|
|
|
6
6
|
exports.SearchInput = require_SearchInput.SearchInput;
|
|
7
7
|
exports.searchInputVariantClasses = require_SearchInput.searchInputVariantClasses;
|