@premieroctet/next-admin
Version:
Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje
41 lines (40 loc) • 1.93 kB
JavaScript
import { jsx, jsxs } from "react/jsx-runtime";
import { Arrow, Content, Portal, Provider, Root, Trigger } from "@radix-ui/react-tooltip";
import external_clsx_default from "clsx";
import { forwardRef, useState } from "react";
const TooltipProvider = Provider;
const TooltipRoot = Root;
const TooltipTrigger = Trigger;
const TooltipArrow = Arrow;
const TooltipPortal = Portal;
const TooltipContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Content, {
...props,
className: external_clsx_default("border-nextadmin-border-default dark:border-dark-nextadmin-border-strong bg-nextadmin-background-subtle dark:bg-dark-nextadmin-background-subtle text-nextadmin-content-inverted dark:text-dark-nextadmin-content-inverted rounded border text-sm shadow-xl", className),
ref: ref
}));
const SimpleTooltip = ({ children, text })=>{
const [showTooltip, setShowTooltip] = useState(false);
return /*#__PURE__*/ jsx(TooltipProvider, {
children: /*#__PURE__*/ jsxs(TooltipRoot, {
children: [
/*#__PURE__*/ jsx(TooltipTrigger, {
asChild: true,
children: /*#__PURE__*/ jsx("div", {
onMouseEnter: ()=>setShowTooltip(true),
onMouseLeave: ()=>setShowTooltip(false),
children: children
})
}),
/*#__PURE__*/ jsx(TooltipPortal, {
children: /*#__PURE__*/ jsx(TooltipContent, {
side: "bottom",
className: "z-50 px-2 py-1 text-xs",
sideOffset: 4,
children: showTooltip && text
})
})
]
})
});
};
export { SimpleTooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger };