@diwauhris/ui 1.7.30 → 1.7.32
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/lib/index.cjs +21 -18
- package/lib/index.mjs +22 -19
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -1229,30 +1229,33 @@ function Combobox({ value: controlledValue, defaultValue = "", onChange, options
|
|
|
1229
1229
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1230
1230
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1231
1231
|
}, []);
|
|
1232
|
-
(0, react.useLayoutEffect)(() => {
|
|
1233
|
-
if (!isOpen || !wrapperRef.current) return;
|
|
1234
|
-
const rect = wrapperRef.current.getBoundingClientRect();
|
|
1235
|
-
setPanelStyle({
|
|
1236
|
-
position: "fixed",
|
|
1237
|
-
top: rect.bottom + 4,
|
|
1238
|
-
left: rect.left,
|
|
1239
|
-
zIndex: 9999,
|
|
1240
|
-
width: rect.width,
|
|
1241
|
-
pointerEvents: "auto",
|
|
1242
|
-
overscrollBehavior: "contain"
|
|
1243
|
-
});
|
|
1244
|
-
}, [isOpen]);
|
|
1245
1232
|
(0, react.useEffect)(() => {
|
|
1246
1233
|
if (!isOpen) return;
|
|
1247
|
-
const
|
|
1248
|
-
|
|
1234
|
+
const updatePosition = () => {
|
|
1235
|
+
if (!wrapperRef.current) return;
|
|
1236
|
+
const rect = wrapperRef.current.getBoundingClientRect();
|
|
1237
|
+
const dropUp = window.innerHeight - rect.bottom < 240 && rect.top > 240;
|
|
1238
|
+
setPanelStyle({
|
|
1239
|
+
position: "fixed",
|
|
1240
|
+
top: dropUp ? void 0 : rect.bottom + 4,
|
|
1241
|
+
bottom: dropUp ? window.innerHeight - rect.top + 4 : void 0,
|
|
1242
|
+
left: rect.left,
|
|
1243
|
+
zIndex: 9999,
|
|
1244
|
+
width: rect.width,
|
|
1245
|
+
pointerEvents: "auto",
|
|
1246
|
+
overscrollBehavior: "contain"
|
|
1247
|
+
});
|
|
1248
|
+
};
|
|
1249
|
+
const raf = requestAnimationFrame(updatePosition);
|
|
1250
|
+
window.addEventListener("scroll", updatePosition, {
|
|
1249
1251
|
capture: true,
|
|
1250
1252
|
passive: true
|
|
1251
1253
|
});
|
|
1252
|
-
window.addEventListener("resize",
|
|
1254
|
+
window.addEventListener("resize", updatePosition);
|
|
1253
1255
|
return () => {
|
|
1254
|
-
|
|
1255
|
-
window.removeEventListener("
|
|
1256
|
+
cancelAnimationFrame(raf);
|
|
1257
|
+
window.removeEventListener("scroll", updatePosition, { capture: true });
|
|
1258
|
+
window.removeEventListener("resize", updatePosition);
|
|
1256
1259
|
};
|
|
1257
1260
|
}, [isOpen]);
|
|
1258
1261
|
(0, react.useEffect)(() => {
|
package/lib/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { clsx } from "clsx";
|
|
2
2
|
import { twMerge } from "tailwind-merge";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
|
-
import React, { cloneElement, createContext, createElement, isValidElement, use, useCallback, useContext, useEffect, useId,
|
|
4
|
+
import React, { cloneElement, createContext, createElement, isValidElement, use, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
7
|
import { AlertCircle, AlertTriangle, Archive, ArchiveRestore, ArrowDown, Ban, CalendarDays, Check, CheckCircle2, ChevronDown, ChevronLeft, ChevronRight, Clock, Command, File, Home, Info, Minus, RotateCcw, Search as Search$1, ShieldCheck, TrendingDown, TrendingUp, UploadCloud, X, ZoomIn, ZoomOut } from "lucide-react";
|
|
@@ -1205,30 +1205,33 @@ function Combobox({ value: controlledValue, defaultValue = "", onChange, options
|
|
|
1205
1205
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1206
1206
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1207
1207
|
}, []);
|
|
1208
|
-
useLayoutEffect(() => {
|
|
1209
|
-
if (!isOpen || !wrapperRef.current) return;
|
|
1210
|
-
const rect = wrapperRef.current.getBoundingClientRect();
|
|
1211
|
-
setPanelStyle({
|
|
1212
|
-
position: "fixed",
|
|
1213
|
-
top: rect.bottom + 4,
|
|
1214
|
-
left: rect.left,
|
|
1215
|
-
zIndex: 9999,
|
|
1216
|
-
width: rect.width,
|
|
1217
|
-
pointerEvents: "auto",
|
|
1218
|
-
overscrollBehavior: "contain"
|
|
1219
|
-
});
|
|
1220
|
-
}, [isOpen]);
|
|
1221
1208
|
useEffect(() => {
|
|
1222
1209
|
if (!isOpen) return;
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1210
|
+
const updatePosition = () => {
|
|
1211
|
+
if (!wrapperRef.current) return;
|
|
1212
|
+
const rect = wrapperRef.current.getBoundingClientRect();
|
|
1213
|
+
const dropUp = window.innerHeight - rect.bottom < 240 && rect.top > 240;
|
|
1214
|
+
setPanelStyle({
|
|
1215
|
+
position: "fixed",
|
|
1216
|
+
top: dropUp ? void 0 : rect.bottom + 4,
|
|
1217
|
+
bottom: dropUp ? window.innerHeight - rect.top + 4 : void 0,
|
|
1218
|
+
left: rect.left,
|
|
1219
|
+
zIndex: 9999,
|
|
1220
|
+
width: rect.width,
|
|
1221
|
+
pointerEvents: "auto",
|
|
1222
|
+
overscrollBehavior: "contain"
|
|
1223
|
+
});
|
|
1224
|
+
};
|
|
1225
|
+
const raf = requestAnimationFrame(updatePosition);
|
|
1226
|
+
window.addEventListener("scroll", updatePosition, {
|
|
1225
1227
|
capture: true,
|
|
1226
1228
|
passive: true
|
|
1227
1229
|
});
|
|
1228
|
-
window.addEventListener("resize",
|
|
1230
|
+
window.addEventListener("resize", updatePosition);
|
|
1229
1231
|
return () => {
|
|
1230
|
-
|
|
1231
|
-
window.removeEventListener("
|
|
1232
|
+
cancelAnimationFrame(raf);
|
|
1233
|
+
window.removeEventListener("scroll", updatePosition, { capture: true });
|
|
1234
|
+
window.removeEventListener("resize", updatePosition);
|
|
1232
1235
|
};
|
|
1233
1236
|
}, [isOpen]);
|
|
1234
1237
|
useEffect(() => {
|