@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.esm.js
CHANGED
|
@@ -14735,11 +14735,18 @@ const borderStyles$2 = [
|
|
|
14735
14735
|
const disabledClasses$2 = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
14736
14736
|
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 }) => {
|
|
14737
14737
|
const tooltipData = getQTipData(tooltipProps);
|
|
14738
|
-
|
|
14738
|
+
const timeout = useRef(null);
|
|
14739
14739
|
const [isHoveredOpen, setIsHoveredOpen] = React.useState(false);
|
|
14740
|
+
const clearHoverTimeout = () => {
|
|
14741
|
+
if (timeout.current) {
|
|
14742
|
+
clearTimeout(timeout.current);
|
|
14743
|
+
timeout.current = null;
|
|
14744
|
+
}
|
|
14745
|
+
};
|
|
14740
14746
|
const onHoverStart = () => {
|
|
14741
14747
|
if (isHoverEnabled) {
|
|
14742
|
-
|
|
14748
|
+
clearHoverTimeout();
|
|
14749
|
+
timeout.current = setTimeout(() => {
|
|
14743
14750
|
setIsHoveredOpen(true);
|
|
14744
14751
|
onOpenChange && onOpenChange(true);
|
|
14745
14752
|
}, hoverOpenDelay);
|
|
@@ -14747,13 +14754,14 @@ const ButtonWithPopover = ({ children, trigger, id, hasArrow, extraTriggerClassN
|
|
|
14747
14754
|
};
|
|
14748
14755
|
const onHoverEnd = () => {
|
|
14749
14756
|
if (isHoverEnabled) {
|
|
14750
|
-
|
|
14757
|
+
clearHoverTimeout();
|
|
14758
|
+
timeout.current = setTimeout(() => {
|
|
14751
14759
|
setIsHoveredOpen(false);
|
|
14752
14760
|
onOpenChange && onOpenChange(false);
|
|
14753
14761
|
}, 200);
|
|
14754
14762
|
}
|
|
14755
14763
|
};
|
|
14756
|
-
React.useEffect(() =>
|
|
14764
|
+
React.useEffect(() => clearHoverTimeout, []);
|
|
14757
14765
|
const renderContent = () => {
|
|
14758
14766
|
return (React.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" },
|
|
14759
14767
|
React.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
|