@bikiran/utils 2.2.1 → 2.2.3

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.
@@ -27,6 +27,6 @@ const Option = ({ path, fullPath, icon, title, notifCount, className, LinkCompon
27
27
  return (_jsxs(LinkComponent, { href: href, target: "_blank", className: cn("optionLink group", className, style.optionLink), children: [_jsx("span", { className: cn("optionIcon", style.optionIcon), children: icon }), _jsx("span", { className: cn("optionTitle", style.optionTitle), children: title }), notifCount !== undefined && (_jsx("div", { className: cn("badge", style.badge), children: _jsx("span", { className: cn("badgeSpan", style.badgeSpan), children: "15" }) }))] }));
28
28
  };
29
29
  const ProfileMenuList = ({ LinkComponent }) => {
30
- return (_jsxs("div", { className: cn("menuSection", style.menuSection), children: [_jsx(Option, { path: "user/activities", icon: _jsx(ActivityHistoryIcon, {}), title: "Activity History", className: cn("firstOption", style.firstOption), LinkComponent: LinkComponent }), _jsx(Option, { path: "user/notifications", icon: _jsx(NotificationIcon, {}), title: "Notifications", className: cn("secondOption", style.secondOption), LinkComponent: LinkComponent }), _jsx(Option, { fullPath: "user/projects", icon: _jsx(ManageProjectIcon, {}), title: "Manage Project", className: cn("secondOption", style.secondOption), LinkComponent: LinkComponent }), _jsx(OptionBilling, { LinkComponent: LinkComponent }), _jsx(Option, { fullPath: getSupportUrl(), icon: _jsx(ContactSupportIcon, {}), title: "Contact Support", className: cn("lastOption", style.lastOption), LinkComponent: LinkComponent }), " "] }));
30
+ return (_jsxs("div", { className: cn("menuSection", style.menuSection), children: [_jsx(Option, { path: "user/activities", icon: _jsx(ActivityHistoryIcon, {}), title: "Activity History", className: cn("firstOption", style.firstOption), LinkComponent: LinkComponent }), _jsx(Option, { path: "user/notifications", icon: _jsx(NotificationIcon, {}), title: "Notifications", className: cn("secondOption", style.secondOption), LinkComponent: LinkComponent }), _jsx(Option, { path: "user/projects", icon: _jsx(ManageProjectIcon, {}), title: "Manage Project", className: cn("secondOption", style.secondOption), LinkComponent: LinkComponent }), _jsx(OptionBilling, { LinkComponent: LinkComponent }), _jsx(Option, { fullPath: getSupportUrl(), icon: _jsx(ContactSupportIcon, {}), title: "Contact Support", className: cn("lastOption", style.lastOption), LinkComponent: LinkComponent }), " "] }));
31
31
  };
32
32
  export default ProfileMenuList;
@@ -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,13 @@ const FilterBarWrapper = ({ children, formData, disabled, placeholder = "Search
82
84
  setIsFilterOpen(false);
83
85
  setIsFocus(false);
84
86
  };
87
+ const resetClick = () => {
88
+ //reset all the fields
89
+ setFilters(Object.fromEntries(Object.keys(formData).map((key) => [key, ""])) || {});
90
+ onSearch("");
91
+ };
85
92
  return (_jsxs("div", { className: cn(style.filterBarContainer, "filterBarContainer", className, disabled
86
93
  ? 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" })] })] }) })] }));
94
+ : "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
95
  };
89
96
  export default FilterBarWrapper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikiran/utils",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [