@seeqdev/qomponents 0.0.130 → 0.0.131
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.esm.js +12 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14755,11 +14755,18 @@ const borderStyles$2 = [
|
|
|
14755
14755
|
const disabledClasses$2 = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
14756
14756
|
const ButtonWithPopover = ({ children, trigger, id, hasArrow, extraTriggerClassNames, extraPopoverClassNames, containerTestId, onInteractOutside, onPointerDownOutside, isTriggerAsChild = false, shouldTriggerFullWidth = false, disabled = false, align = 'end', alignOffset = -35, placement = 'bottom', placementOffset = 2, isHoverEnabled = false, hoverOpenDelay = 300, onOpenChange, isOpen, isCloseOnContentClick = false, isPortal = false, ...tooltipProps }) => {
|
|
14757
14757
|
const tooltipData = getQTipData(tooltipProps);
|
|
14758
|
-
|
|
14758
|
+
const timeout = React.useRef(null);
|
|
14759
14759
|
const [isHoveredOpen, setIsHoveredOpen] = React__namespace.useState(false);
|
|
14760
|
+
const clearHoverTimeout = () => {
|
|
14761
|
+
if (timeout.current) {
|
|
14762
|
+
clearTimeout(timeout.current);
|
|
14763
|
+
timeout.current = null;
|
|
14764
|
+
}
|
|
14765
|
+
};
|
|
14760
14766
|
const onHoverStart = () => {
|
|
14761
14767
|
if (isHoverEnabled) {
|
|
14762
|
-
|
|
14768
|
+
clearHoverTimeout();
|
|
14769
|
+
timeout.current = setTimeout(() => {
|
|
14763
14770
|
setIsHoveredOpen(true);
|
|
14764
14771
|
onOpenChange && onOpenChange(true);
|
|
14765
14772
|
}, hoverOpenDelay);
|
|
@@ -14767,13 +14774,14 @@ const ButtonWithPopover = ({ children, trigger, id, hasArrow, extraTriggerClassN
|
|
|
14767
14774
|
};
|
|
14768
14775
|
const onHoverEnd = () => {
|
|
14769
14776
|
if (isHoverEnabled) {
|
|
14770
|
-
|
|
14777
|
+
clearHoverTimeout();
|
|
14778
|
+
timeout.current = setTimeout(() => {
|
|
14771
14779
|
setIsHoveredOpen(false);
|
|
14772
14780
|
onOpenChange && onOpenChange(false);
|
|
14773
14781
|
}, 200);
|
|
14774
14782
|
}
|
|
14775
14783
|
};
|
|
14776
|
-
React__namespace.useEffect(() =>
|
|
14784
|
+
React__namespace.useEffect(() => clearHoverTimeout, []);
|
|
14777
14785
|
const renderContent = () => {
|
|
14778
14786
|
return (React__namespace.createElement($cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, { sideOffset: placementOffset, align: align, side: placement, onInteractOutside: onInteractOutside, onPointerDownOutside: onPointerDownOutside, alignOffset: isHoverEnabled ? -10 : alignOffset, asChild: true, onClick: () => isCloseOnContentClick && onOpenChange && onOpenChange(false), className: "focus-visible:tw-outline-none tw-outline-none tw-w-full tw-h-full" },
|
|
14779
14787
|
React__namespace.createElement("div", { "data-testid": containerTestId, className: `${bgStyles$2} ${borderStyles$2} tw-relative tw-z-[1200] tw-min-w-6 focus-visible:tw-outline-none tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out
|