gbs-add-block 1.0.8 → 1.0.9

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # GBS Building Blocks 2.0 (v1.0.8)
1
+ # GBS Building Blocks 2.0 (v1.0.9)
2
2
 
3
3
  Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
4
4
 
@@ -6,7 +6,7 @@ Latest and upgraded version of GBS building blocks with headless UI and removed
6
6
 
7
7
  For detailed documentation on usage and props, Please visit: [Building Block Documentation v2.0](https://blackmax-designs.gitbook.io/building-block-v2.0)
8
8
 
9
- ## What's New 🎉 (Ver 1.0.8)
9
+ ## What's New 🎉 (Ver 1.0.9)
10
10
 
11
11
  - Uploader Enhancement
12
12
  - Select Bug Fix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gbs-add-block",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "React Component Library",
5
5
  "type": "module",
6
6
  "files": [
@@ -23,9 +23,9 @@ import { iconClass, popUp, primary } from "../globalStyle";
23
23
  import {
24
24
  useSelectState,
25
25
  useSelectData,
26
- useClickOutside,
27
26
  applyScrollbarStyles,
28
27
  useKeyboardNavigation,
28
+ useClickOutside,
29
29
  } from "@grampro/headless-helpers";
30
30
 
31
31
  // Portal Dropdown Component
@@ -43,7 +43,7 @@ const PortalDropdown = ({ targetRef, children, isVisible }: any) => {
43
43
  setPosition({
44
44
  top: rect.bottom + scrollTop + 4,
45
45
  left: rect.left + scrollLeft,
46
- width: rect.width, // Match the width of the select button
46
+ width: rect.width,
47
47
  });
48
48
  }
49
49
  }, [isVisible, targetRef]);
@@ -109,11 +109,15 @@ const Select = forwardRef<SelectHandle, SelectProps>((props, ref) => {
109
109
 
110
110
  const inputRef = useRef<HTMLInputElement>(null);
111
111
  const selectRef = useRef<HTMLDivElement>(null);
112
- const buttonRef = useRef<HTMLButtonElement>(null); // Reference for portal positioning
112
+ const buttonRef = useRef<HTMLButtonElement>(null);
113
113
 
114
- useClickOutside(selectRef as React.RefObject<HTMLElement>, () =>
115
- setShowPopover(false)
116
- );
114
+ useClickOutside(selectRef as React.RefObject<HTMLElement>, (event) => {
115
+ const portalElement = document.querySelector('[data-select-portal="true"]');
116
+ if (portalElement && portalElement.contains(event.target as Node)) {
117
+ return;
118
+ }
119
+ setShowPopover(false);
120
+ });
117
121
 
118
122
  // Update the handleSelect to accept a SelectItem
119
123
  const handleSelect = useCallback(