UNPKG

@lanaco/lnc-react-ui

Version:

React component library

65 lines (64 loc) 2.01 kB
import { jsx as a } from "react/jsx-runtime"; import { forwardRef as c, useContext as p } from "react"; import { a as f, F as u, b } from "./floating-ui.react.esm-B-RMCmpu.js"; import g from "./PopoverContext.js"; import { s as h } from "./emotion-styled.browser.esm-DfbrHHed.js"; import { g as x, b as v, c as y } from "./utils-BUdHa0nB.js"; import { m as P } from "./motion-Ckekul_K.js"; import { u as w } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js"; const C = h(P.div)` font-family: ${(o) => { var t, r; return (r = (t = o.theme) == null ? void 0 : t.typography) == null ? void 0 : r.fontFamily; }}; animation: fadeIn 0.4s; box-shadow: ${(o) => x( o.theme, "Popover", o.color, "enabled", "boxShadow" )}; border-radius: ${(o) => v(o.theme, o.borderRadius)}; border-top: 1px solid rgba(0, 0, 0, 0.04); box-sizing: border-box; padding: 0.25rem; background-color: ${(o) => y(o.theme, "Popover", "default", "enabled", "bg")}; `, F = () => { const o = p(g); if (o == null) throw new Error("Popover components must be wrapped in <Popover />"); return o; }, k = c(function({ borderRadius: t = "regular", className: r = "", zIndex: i, style: s = {}, ...n }, l) { const e = F(), d = f([e.floating, l]), m = w(); return /* @__PURE__ */ a(u, { children: e.open && /* @__PURE__ */ a(b, { context: e.context, modal: e.modal, children: /* @__PURE__ */ a( "div", { ref: d, style: { position: e.strategy, top: e.y ?? 0, left: e.x ?? 0, width: "max-content", zIndex: i }, className: "lnc-ui-floating-manager", "aria-labelledby": e.labelId, "aria-describedby": e.descriptionId, ...e.getFloatingProps(n), children: /* @__PURE__ */ a( C, { theme: m, borderRadius: t, className: "lnc-ui-popover-content " + r, style: s, children: n.children } ) } ) }) }); }); export { k as default };