@vela-ui/react
Version:
Vela UI React components
81 lines (79 loc) • 3.2 kB
JavaScript
;
"use client";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/components/tooltip.tsx
var tooltip_exports = {};
__export(tooltip_exports, {
Tooltip: () => Tooltip,
TooltipTrigger: () => TooltipTrigger
});
module.exports = __toCommonJS(tooltip_exports);
var import_react_aria_components = require("react-aria-components");
var import_tailwind_variants = require("tailwind-variants");
var import_jsx_runtime = require("react/jsx-runtime");
var tooltipVariants = (0, import_tailwind_variants.tv)({
base: "bg-primary text-primary-foreground z-50 w-fit rounded-md px-3 py-1.5 text-xs text-balance",
variants: {
isEntering: {
true: [
"animate-in fade-in-0 zoom-in-95",
"data-[placement=left]:slide-in-from-right-2 data-[placement=right]:slide-in-from-left-2 data-[placement=top]:slide-in-from-bottom-2 data-[placement=bottom]:slide-in-from-top-2"
]
},
isExiting: {
true: "animate-out fade-out-0 zoom-out-95"
}
}
});
var TooltipTrigger = import_react_aria_components.TooltipTrigger;
function Tooltip({ className, showArrow, offset = 10, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_aria_components.Tooltip,
{
"data-slot": "tooltip",
offset,
className: (0, import_react_aria_components.composeRenderProps)(
className,
(className2, renderProps) => tooltipVariants({
...renderProps,
className: className2
})
),
...props,
children: (0, import_react_aria_components.composeRenderProps)(props.children, (children) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
showArrow && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_aria_components.OverlayArrow, { className: "group", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"svg",
{
width: 12,
height: 12,
viewBox: "0 0 12 12",
className: "fill-primary stroke-border block stroke-1 group-data-[placement=bottom]:rotate-180 group-data-[placement=left]:-rotate-90 group-data-[placement=right]:rotate-90",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M0 0 L6 6 L12 0" })
}
) }),
children
] }))
}
);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Tooltip,
TooltipTrigger
});