@bikiran/utils 2.1.2 → 2.1.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.
@@ -4,10 +4,10 @@ type TProps = {
4
4
  onSearch: (search: string) => void;
5
5
  resetClick?: () => void;
6
6
  children: React.ReactNode;
7
- placeholder: string;
7
+ placeholder?: string;
8
8
  disabled?: boolean;
9
9
  className?: string;
10
- outsideClick: boolean;
10
+ outsideClick?: boolean;
11
11
  };
12
12
  declare const FilterBarWrapper: FC<TProps>;
13
13
  export default FilterBarWrapper;
@@ -47,7 +47,9 @@ const FilterBarWrapper = ({ children, formData, disabled, placeholder = "Search
47
47
  }, [window.location.search]);
48
48
  // outside click
49
49
  useEffect(() => {
50
- if (outsideClick) {
50
+ // outsideClick defaults to true if undefined
51
+ const enableOutsideClick = outsideClick !== false;
52
+ if (enableOutsideClick) {
51
53
  const handleClickOutside = (e) => {
52
54
  var _a, _b;
53
55
  const isSelectClick = ((_a = e.target) === null || _a === void 0 ? void 0 : _a.closest('[role="combobox"]')) ||
@@ -64,7 +66,7 @@ const FilterBarWrapper = ({ children, formData, disabled, placeholder = "Search
64
66
  document.removeEventListener("mousedown", handleClickOutside);
65
67
  };
66
68
  }
67
- }, [ref]);
69
+ }, [outsideClick, ref]);
68
70
  const isOpen = isFilterOpen || isFocus;
69
71
  const handleSearch = () => {
70
72
  // Build the query string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikiran/utils",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [