laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
88 lines (87 loc) • 2.25 kB
JavaScript
"use client";
import { jsx as r, jsxs as s } from "react/jsx-runtime";
import { Root as l, Portal as p, Content as m, Arrow as c, Provider as f, Trigger as u } 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 i } from "../../lib/utils.js";
const g = 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",
card: "bg-d-card text-d-card-foreground border border-d-border shadow-xl"
}
},
defaultVariants: {
variant: "primary"
}
}
), x = e(
"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]",
{
variants: {
variant: {
primary: "bg-d-primary fill-d-primary",
card: "bg-d-card fill-d-card"
}
},
defaultVariants: {
variant: "primary"
}
}
);
function b({
delayDuration: t = 0,
...o
}) {
return /* @__PURE__ */ r(
f,
{
"data-slot": "tooltip-provider",
delayDuration: t,
...o
}
);
}
function w({
...t
}) {
return /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(l, { "data-slot": "tooltip", ...t }) });
}
function z({
...t
}) {
return /* @__PURE__ */ r(u, { "data-slot": "tooltip-trigger", ...t });
}
function V({
className: t,
sideOffset: o = 0,
variant: a,
children: d,
...n
}) {
return /* @__PURE__ */ r(p, { children: /* @__PURE__ */ s(
m,
{
"data-slot": "tooltip-content",
sideOffset: o,
className: i(g({ variant: a }), t),
...n,
children: [
d,
/* @__PURE__ */ r(
c,
{
className: i(x({ variant: a }))
}
)
]
}
) });
}
export {
w as Tooltip,
V as TooltipContent,
b as TooltipProvider,
z as TooltipTrigger
};