UNPKG

@adyen/adyen-platform-experience-web

Version:

![Platform Experience header](https://github.com/Adyen/adyen-platform-experience-web/assets/7926613/18094965-9e01-450e-8dc9-ea84e6b22c2b)

42 lines (41 loc) 1.76 kB
import { jsx as r } from "../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js"; import _ from "../Popover/Popover.js"; import { PopoverContainerVariant as T } from "../Popover/types.js"; import { useTooltipListeners as b } from "./useTooltipListeners.js"; import { TypographyVariant as v } from "../Typography/types.js"; import P from "../Typography/Typography.js"; import x from "../../../hooks/element/useUniqueIdentifier.js"; import n from "classnames"; import { cloneElement as I, Fragment as g } from "../../../external/preact/dist/preact.module.js"; /* empty css */ const N = (o) => typeof o == "string", F = ({ content: o, children: t, triggerRef: u, showTooltip: p, position: y, isContainerHovered: a = !1 }) => { var m, i, f; const e = x(), { isVisible: s, listeners: l } = b(); return /* @__PURE__ */ r(g, { children: [ t ? I(t, { ...t == null ? void 0 : t.props, role: "button", tabIndex: -1, ref: e, className: (m = t == null ? void 0 : t.props) != null && m.className ? n(`${(i = t == null ? void 0 : t.props) == null ? void 0 : i.className} adyen-pe__tooltip-target`, { " adyen-pe__tooltip-target--hovered": a }) : n("adyen-pe__tooltip-target", { "adyen-pe__tooltip-target--hovered": a }), ...l, "aria-describedby": `tooltip-${(f = e.current) == null ? void 0 : f.id}` }) : null, (s || p) && /* @__PURE__ */ r( _, { fitPosition: !0, variant: T.TOOLTIP, targetElement: u ?? e, position: y, open: s || p, children: /* @__PURE__ */ r(g, { children: o && N(o) ? /* @__PURE__ */ r(P, { variant: v.CAPTION, children: o }) : { content: o } }) } ) ] }); }; export { F as Tooltip };