@bikiran/utils 2.2.2 → 2.2.4

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,7 +29,9 @@ 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, resetClick, className, outsideClick = true, }) => {
32
+ const FilterBarWrapper = ({ children, formData, disabled, placeholder = "Search anything...", onSearch,
33
+ // resetClick,
34
+ className, outsideClick = true, }) => {
33
35
  const [isFilterOpen, setIsFilterOpen] = useState(false);
34
36
  // get queries
35
37
  const urlParams = new URLSearchParams(typeof window !== "undefined" ? window.location.search : "");
@@ -82,8 +84,11 @@ const FilterBarWrapper = ({ children, formData, disabled, placeholder = "Search
82
84
  setIsFilterOpen(false);
83
85
  setIsFocus(false);
84
86
  };
87
+ const resetClick = () => {
88
+ window.location.href = window.location.pathname;
89
+ };
85
90
  return (_jsxs("div", { className: cn(style.filterBarContainer, "filterBarContainer", className, disabled
86
91
  ? style.filterBarContainerDisabled
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" })] })] }) })] }));
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" })] })] }) })] }));
88
93
  };
89
94
  export default FilterBarWrapper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikiran/utils",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [