@underverse-ui/underverse 0.2.28 → 0.2.30
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 +86 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +94 -64
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1277,9 +1277,21 @@ var TagInput = (0, import_react4.forwardRef)(
|
|
|
1277
1277
|
e.preventDefault();
|
|
1278
1278
|
if (e.ctrlKey || e.metaKey) {
|
|
1279
1279
|
triggerSearch();
|
|
1280
|
-
|
|
1281
|
-
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
if (e.shiftKey) {
|
|
1283
|
+
const tagsToAdd = inputValue.split(/\s+/).map((t) => t.trim()).filter((t) => t.length > 0 && !value.includes(t));
|
|
1284
|
+
if (tagsToAdd.length > 0) {
|
|
1285
|
+
const availableSlots = maxTags !== void 0 ? maxTags - value.length : Infinity;
|
|
1286
|
+
if (availableSlots > 0) {
|
|
1287
|
+
const tagsToInsert = tagsToAdd.slice(0, availableSlots);
|
|
1288
|
+
onChange([...value, ...tagsToInsert]);
|
|
1289
|
+
setInputValue("");
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
return;
|
|
1282
1293
|
}
|
|
1294
|
+
addTag(inputValue);
|
|
1283
1295
|
} else if (e.key === "Backspace" && inputValue === "" && value.length > 0) {
|
|
1284
1296
|
removeTag(value.length - 1);
|
|
1285
1297
|
}
|
|
@@ -2527,6 +2539,8 @@ var Modal = ({
|
|
|
2527
2539
|
const [isMounted, setIsMounted] = React10.useState(false);
|
|
2528
2540
|
const [isVisible, setIsVisible] = React10.useState(false);
|
|
2529
2541
|
const [isAnimating, setIsAnimating] = React10.useState(true);
|
|
2542
|
+
const mouseDownTarget = React10.useRef(null);
|
|
2543
|
+
const modalContentRef = React10.useRef(null);
|
|
2530
2544
|
React10.useEffect(() => {
|
|
2531
2545
|
setIsMounted(true);
|
|
2532
2546
|
return () => setIsMounted(false);
|
|
@@ -2566,68 +2580,84 @@ var Modal = ({
|
|
|
2566
2580
|
document.body.style.overflow = "unset";
|
|
2567
2581
|
};
|
|
2568
2582
|
}, [isOpen]);
|
|
2569
|
-
const
|
|
2570
|
-
|
|
2583
|
+
const handleOverlayMouseDown = (event) => {
|
|
2584
|
+
mouseDownTarget.current = event.target;
|
|
2585
|
+
};
|
|
2586
|
+
const handleOverlayMouseUp = (event) => {
|
|
2587
|
+
const modalContent2 = modalContentRef.current;
|
|
2588
|
+
const mouseDownOutside = modalContent2 && !modalContent2.contains(mouseDownTarget.current);
|
|
2589
|
+
const mouseUpOutside = modalContent2 && !modalContent2.contains(event.target);
|
|
2590
|
+
if (closeOnOverlayClick && mouseDownOutside && mouseUpOutside) {
|
|
2571
2591
|
onClose();
|
|
2572
2592
|
}
|
|
2593
|
+
mouseDownTarget.current = null;
|
|
2573
2594
|
};
|
|
2574
2595
|
if (!isMounted || !isOpen && !isVisible) {
|
|
2575
2596
|
return null;
|
|
2576
2597
|
}
|
|
2577
2598
|
const maxWidthClass = width ? "max-w-none" : fullWidth ? "max-w-full" : sizeStyles3[size];
|
|
2578
|
-
const modalContent = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
"transition-all duration-200 ease-out",
|
|
2594
|
-
maxWidthClass,
|
|
2595
|
-
fullWidth && "mx-0",
|
|
2596
|
-
className
|
|
2599
|
+
const modalContent = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2600
|
+
"div",
|
|
2601
|
+
{
|
|
2602
|
+
className: cn("fixed inset-0 z-9999 flex items-center justify-center", overlayClassName),
|
|
2603
|
+
onMouseDown: handleOverlayMouseDown,
|
|
2604
|
+
onMouseUp: handleOverlayMouseUp,
|
|
2605
|
+
children: [
|
|
2606
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2607
|
+
"div",
|
|
2608
|
+
{
|
|
2609
|
+
className: "absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out",
|
|
2610
|
+
style: {
|
|
2611
|
+
opacity: isOpen && !isAnimating ? 1 : 0
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2597
2614
|
),
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2615
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2616
|
+
"div",
|
|
2617
|
+
{
|
|
2618
|
+
ref: modalContentRef,
|
|
2619
|
+
className: cn(
|
|
2620
|
+
"relative w-full rounded-lg bg-card text-card-foreground shadow-xl",
|
|
2621
|
+
"transition-all duration-200 ease-out",
|
|
2622
|
+
maxWidthClass,
|
|
2623
|
+
fullWidth && "mx-0",
|
|
2624
|
+
className
|
|
2625
|
+
),
|
|
2626
|
+
style: {
|
|
2627
|
+
opacity: isOpen && !isAnimating ? 1 : 0,
|
|
2628
|
+
transform: isOpen && !isAnimating ? "scale(1)" : "scale(0.9)",
|
|
2629
|
+
// Thêm dòng này để tạo hiệu ứng nảy
|
|
2630
|
+
transition: "all 300ms cubic-bezier(0.34, 1.76, 0.64, 1)",
|
|
2631
|
+
width,
|
|
2632
|
+
height
|
|
2633
|
+
},
|
|
2634
|
+
onClick: (e) => e.stopPropagation(),
|
|
2635
|
+
children: [
|
|
2636
|
+
(title || description || showCloseButton) && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-start justify-between p-6 pb-0", children: [
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1.5", children: [
|
|
2638
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h2", { className: "text-lg font-semibold leading-none tracking-tight", children: title }),
|
|
2639
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-sm text-muted-foreground", children: description })
|
|
2640
|
+
] }),
|
|
2641
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2642
|
+
"button",
|
|
2643
|
+
{
|
|
2644
|
+
onClick: onClose,
|
|
2645
|
+
className: cn(
|
|
2646
|
+
"rounded-sm opacity-70 ring-offset-background transition-opacity",
|
|
2647
|
+
"hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
2648
|
+
"disabled:pointer-events-none "
|
|
2649
|
+
),
|
|
2650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react6.X, { className: "h-4 w-4 cursor-pointer" })
|
|
2651
|
+
}
|
|
2652
|
+
)
|
|
2653
|
+
] }),
|
|
2654
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("p-6", noPadding && "p-0", contentClassName), children })
|
|
2655
|
+
]
|
|
2656
|
+
}
|
|
2657
|
+
)
|
|
2658
|
+
]
|
|
2659
|
+
}
|
|
2660
|
+
);
|
|
2631
2661
|
return typeof window !== "undefined" ? (0, import_react_dom.createPortal)(modalContent, document.body) : null;
|
|
2632
2662
|
};
|
|
2633
2663
|
var Modal_default = Modal;
|