@juv/codego-react-ui 1.1.7 → 2.0.0

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/dist/index.cjs CHANGED
@@ -5560,6 +5560,7 @@ function Select({
5560
5560
  const [isSearching, setIsSearching] = React25.useState(false);
5561
5561
  const containerRef = React25.useRef(null);
5562
5562
  const triggerRef = React25.useRef(null);
5563
+ const portalRef = React25.useRef(null);
5563
5564
  const [dropStyle, setDropStyle] = React25.useState({});
5564
5565
  const getKey = React25.useCallback((opt) => String(Object.keys(opt)[0]), []);
5565
5566
  const getLabel = React25.useCallback((opt) => Object.values(opt)[0], []);
@@ -5590,9 +5591,9 @@ function Select({
5590
5591
  };
5591
5592
  React25.useEffect(() => {
5592
5593
  const handler = (e) => {
5593
- if (containerRef.current && !containerRef.current.contains(e.target)) {
5594
- setIsOpen(false);
5595
- }
5594
+ const target = e.target;
5595
+ if (containerRef.current?.contains(target) || portalRef.current?.contains(target)) return;
5596
+ setIsOpen(false);
5596
5597
  };
5597
5598
  document.addEventListener("mousedown", handler);
5598
5599
  return () => document.removeEventListener("mousedown", handler);
@@ -5735,6 +5736,7 @@ function Select({
5735
5736
  isOpen && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5736
5737
  "div",
5737
5738
  {
5739
+ ref: portalRef,
5738
5740
  className: "max-h-60 overflow-auto rounded-md border border-white/10 bg-background/80 backdrop-blur-xl text-popover-foreground shadow-lg animate-in fade-in-80",
5739
5741
  style: dropStyle,
5740
5742
  children: [
@@ -47220,6 +47220,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
47220
47220
  const [isSearching, setIsSearching] = React27.useState(false);
47221
47221
  const containerRef = React27.useRef(null);
47222
47222
  const triggerRef = React27.useRef(null);
47223
+ const portalRef = React27.useRef(null);
47223
47224
  const [dropStyle, setDropStyle] = React27.useState({});
47224
47225
  const getKey = React27.useCallback((opt) => String(Object.keys(opt)[0]), []);
47225
47226
  const getLabel = React27.useCallback((opt) => Object.values(opt)[0], []);
@@ -47250,9 +47251,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
47250
47251
  };
47251
47252
  React27.useEffect(() => {
47252
47253
  const handler = (e) => {
47253
- if (containerRef.current && !containerRef.current.contains(e.target)) {
47254
- setIsOpen(false);
47255
- }
47254
+ const target = e.target;
47255
+ if (containerRef.current?.contains(target) || portalRef.current?.contains(target)) return;
47256
+ setIsOpen(false);
47256
47257
  };
47257
47258
  document.addEventListener("mousedown", handler);
47258
47259
  return () => document.removeEventListener("mousedown", handler);
@@ -47395,6 +47396,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
47395
47396
  isOpen && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
47396
47397
  "div",
47397
47398
  {
47399
+ ref: portalRef,
47398
47400
  className: "max-h-60 overflow-auto rounded-md border border-white/10 bg-background/80 backdrop-blur-xl text-popover-foreground shadow-lg animate-in fade-in-80",
47399
47401
  style: dropStyle,
47400
47402
  children: [
package/dist/index.js CHANGED
@@ -5453,6 +5453,7 @@ function Select({
5453
5453
  const [isSearching, setIsSearching] = React25.useState(false);
5454
5454
  const containerRef = React25.useRef(null);
5455
5455
  const triggerRef = React25.useRef(null);
5456
+ const portalRef = React25.useRef(null);
5456
5457
  const [dropStyle, setDropStyle] = React25.useState({});
5457
5458
  const getKey = React25.useCallback((opt) => String(Object.keys(opt)[0]), []);
5458
5459
  const getLabel = React25.useCallback((opt) => Object.values(opt)[0], []);
@@ -5483,9 +5484,9 @@ function Select({
5483
5484
  };
5484
5485
  React25.useEffect(() => {
5485
5486
  const handler = (e) => {
5486
- if (containerRef.current && !containerRef.current.contains(e.target)) {
5487
- setIsOpen(false);
5488
- }
5487
+ const target = e.target;
5488
+ if (containerRef.current?.contains(target) || portalRef.current?.contains(target)) return;
5489
+ setIsOpen(false);
5489
5490
  };
5490
5491
  document.addEventListener("mousedown", handler);
5491
5492
  return () => document.removeEventListener("mousedown", handler);
@@ -5628,6 +5629,7 @@ function Select({
5628
5629
  isOpen && /* @__PURE__ */ jsx30(FloatingPortal, { children: /* @__PURE__ */ jsxs26(
5629
5630
  "div",
5630
5631
  {
5632
+ ref: portalRef,
5631
5633
  className: "max-h-60 overflow-auto rounded-md border border-white/10 bg-background/80 backdrop-blur-xl text-popover-foreground shadow-lg animate-in fade-in-80",
5632
5634
  style: dropStyle,
5633
5635
  children: [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@juv/codego-react-ui",
3
3
  "private": false,
4
- "version": "1.1.7",
4
+ "version": "2.0.0",
5
5
  "description": "Reusable React UI components",
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",