@bikiran/utils 2.2.4 → 2.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.
|
@@ -29,9 +29,7 @@ const getStrValue = (filter) => {
|
|
|
29
29
|
}
|
|
30
30
|
return (_c = JSON === null || JSON === void 0 ? void 0 : JSON.stringify(filter)) === null || _c === void 0 ? void 0 : _c.replace(/[{},"]/g, " ");
|
|
31
31
|
};
|
|
32
|
-
const FilterBarWrapper = ({ children, formData, disabled, placeholder = "Search anything...", onSearch,
|
|
33
|
-
// resetClick,
|
|
34
|
-
className, outsideClick = true, }) => {
|
|
32
|
+
const FilterBarWrapper = ({ children, formData, disabled, placeholder = "Search anything...", onSearch, resetClick, className, outsideClick = true, }) => {
|
|
35
33
|
const [isFilterOpen, setIsFilterOpen] = useState(false);
|
|
36
34
|
// get queries
|
|
37
35
|
const urlParams = new URLSearchParams(typeof window !== "undefined" ? window.location.search : "");
|
|
@@ -84,11 +82,8 @@ className, outsideClick = true, }) => {
|
|
|
84
82
|
setIsFilterOpen(false);
|
|
85
83
|
setIsFocus(false);
|
|
86
84
|
};
|
|
87
|
-
const resetClick = () => {
|
|
88
|
-
window.location.href = window.location.pathname;
|
|
89
|
-
};
|
|
90
85
|
return (_jsxs("div", { className: cn(style.filterBarContainer, "filterBarContainer", className, disabled
|
|
91
86
|
? style.filterBarContainerDisabled
|
|
92
|
-
: "filterBarContainerDisabled"), ref: ref, children: [_jsx(SearchInput, { isOpen: isOpen, onFocus: () => setIsFocus(true), toggleFilter: () => setIsFilterOpen((prev) => !prev), searchedValue: searchedValue, placeholder: placeholder }), _jsx("div", { className: cn(style.expandSection, "expandSection", isOpen ? `${style.isExpanded} isExpanded` : ""), children: _jsxs("form", { onSubmit: onSubmit, className: cn(style.form, "form"), children: [children, _jsxs("div", { className: style.buttonContainer, children: [_jsx("button", { type: "button", onClick: resetClick, className: cn(style.resetBtn, "resetBtn group"), children: iconReset("text-secondary group-hover:text-white") }), _jsx("button", { className: cn(style.searchBtn, "searchBtn"), children: "Search" })] })] }) })] }));
|
|
87
|
+
: "filterBarContainerDisabled"), ref: ref, children: [_jsx(SearchInput, { isOpen: isOpen, onFocus: () => setIsFocus(true), toggleFilter: () => setIsFilterOpen((prev) => !prev), searchedValue: searchedValue, placeholder: placeholder }), _jsx("div", { className: cn(style.expandSection, "expandSection", isOpen ? `${style.isExpanded} isExpanded` : ""), children: _jsxs("form", { onSubmit: onSubmit, className: cn(style.form, "form"), children: [children, _jsxs("div", { className: style.buttonContainer, children: [resetClick !== undefined && (_jsx("button", { type: "button", onClick: resetClick, className: cn(style.resetBtn, "resetBtn group"), children: iconReset("text-secondary group-hover:text-white") })), _jsx("button", { className: cn(style.searchBtn, "searchBtn"), children: "Search" })] })] }) })] }));
|
|
93
88
|
};
|
|
94
89
|
export default FilterBarWrapper;
|