laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
91 lines (90 loc) • 2.42 kB
JavaScript
"use client";
import { jsx as r, jsxs as s } from "react/jsx-runtime";
import { Root as l, Portal as c, Content as p, Arrow as m, Provider as f, Trigger as g } from "../../node_modules/@radix-ui/react-tooltip/dist/index.js";
import { cva as e } from "../../node_modules/class-variance-authority/dist/index.js";
import { cn as d } from "../../lib/utils.js";
const u = e(
"animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
{
variants: {
variant: {
primary: "bg-d-primary text-d-primary-foreground",
secondary: "bg-d-secondary text-d-secondary-foreground border-d-border border shadow-lg",
card: "bg-d-card text-d-card-foreground border border-d-border shadow-xl"
}
},
defaultVariants: {
variant: "secondary"
}
}
), y = e(
"size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]",
{
variants: {
variant: {
primary: "bg-d-primary fill-d-primary",
secondary: "bg-d-secondary fill-d-secondary",
card: "bg-d-card fill-d-card"
}
},
defaultVariants: {
variant: "secondary"
}
}
);
function b({
delayDuration: t = 0,
...o
}) {
return /* @__PURE__ */ r(
f,
{
"data-slot": "tooltip-provider",
delayDuration: t,
...o
}
);
}
function T({
...t
}) {
return /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(l, { "data-slot": "tooltip", ...t }) });
}
function z({
...t
}) {
return /* @__PURE__ */ r(g, { "data-slot": "tooltip-trigger", ...t });
}
function V({
className: t,
sideOffset: o = 0,
variant: a,
children: i,
...n
}) {
return /* @__PURE__ */ r(c, { children: /* @__PURE__ */ s(
p,
{
"data-slot": "tooltip-content",
sideOffset: o,
className: d(u({ variant: a }), t),
...n,
children: [
i,
/* @__PURE__ */ r(
m,
{
className: d(y({ variant: a }))
}
)
]
}
) });
}
export {
T as Tooltip,
V as TooltipContent,
b as TooltipProvider,
z as TooltipTrigger,
u as tooltipVariants
};