Files
NapCatQQ/.pnpm-store/v3/files/33/d61f7516f70f379d47a3ca5c148a5baf292d183c681fa9c0d780aa4c41c4be127500cd9958610056d3bb7f256c48f83c8e0fa5f6e5c1812022e0e3e74d62ba
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

75 lines
2.7 KiB
Plaintext

"use client";
import {
useTooltip
} from "./chunk-JXI6O2DW.mjs";
// src/tooltip.tsx
import { forwardRef } from "@heroui/system";
import { OverlayContainer } from "@react-aria/overlays";
import { AnimatePresence, m, LazyMotion } from "framer-motion";
import { TRANSITION_VARIANTS } from "@heroui/framer-utils";
import { warn } from "@heroui/shared-utils";
import { Children, cloneElement, isValidElement } from "react";
import { getTransformOrigins } from "@heroui/aria-utils";
import { mergeProps } from "@react-aria/utils";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
var domAnimation = () => import("@heroui/dom-animation").then((res) => res.default);
var Tooltip = forwardRef((props, ref) => {
const {
Component,
children,
content,
isOpen,
portalContainer,
placement,
disableAnimation,
motionProps,
getTriggerProps,
getTooltipProps,
getTooltipContentProps
} = useTooltip({
...props,
ref
});
let trigger;
try {
const childrenNum = Children.count(children);
if (childrenNum !== 1)
throw new Error();
if (!isValidElement(children)) {
trigger = /* @__PURE__ */ jsx("p", { ...getTriggerProps(), children });
} else {
const child = children;
trigger = cloneElement(child, getTriggerProps(child.props, child.ref));
}
} catch (error) {
trigger = /* @__PURE__ */ jsx("span", {});
warn("Tooltip must have only one child node. Please, check your code.");
}
const { ref: tooltipRef, id, style, ...otherTooltipProps } = getTooltipProps();
const animatedContent = /* @__PURE__ */ jsx("div", { ref: tooltipRef, id, style, children: /* @__PURE__ */ jsx(LazyMotion, { features: domAnimation, children: /* @__PURE__ */ jsx(
m.div,
{
animate: "enter",
exit: "exit",
initial: "exit",
variants: TRANSITION_VARIANTS.scaleSpring,
...mergeProps(motionProps, otherTooltipProps),
style: {
...getTransformOrigins(placement)
},
children: /* @__PURE__ */ jsx(Component, { ...getTooltipContentProps(), children: content })
}
) }) });
return /* @__PURE__ */ jsxs(Fragment, { children: [
trigger,
disableAnimation && isOpen ? /* @__PURE__ */ jsx(OverlayContainer, { portalContainer, children: /* @__PURE__ */ jsx("div", { ref: tooltipRef, id, style, ...otherTooltipProps, children: /* @__PURE__ */ jsx(Component, { ...getTooltipContentProps(), children: content }) }) }) : /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen ? /* @__PURE__ */ jsx(OverlayContainer, { portalContainer, children: animatedContent }) : null })
] });
});
Tooltip.displayName = "HeroUI.Tooltip";
var tooltip_default = Tooltip;
export {
tooltip_default
};