UNPKG

@lanaco/lnc-react-ui

Version:

React component library

71 lines (70 loc) 2.14 kB
import { jsx as n } from "react/jsx-runtime"; import { forwardRef as c, useContext as b } from "react"; import { a as f, F as u, b as g } from "./floating-ui.react.esm-umB-tMXa.js"; import { P as a } from "./index-S5Cd7WrG.js"; import h from "./PopoverContext.js"; import { n as x } from "./emotion-styled.browser.esm-CjCaF13H.js"; import { g as y, a as P, b as v } from "./utils-DtRLzzTZ.js"; import { m as w } from "./motion-Ckekul_K.js"; import { u as C } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js"; const F = x(w.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) => y( o.theme, "Popover", o.color, "enabled", "boxShadow" )}; border-radius: ${(o) => P(o.theme, o.borderRadius)}; border-top: 1px solid rgba(0, 0, 0, 0.04); box-sizing: border-box; padding: 0.25rem; background-color: ${(o) => v(o.theme, "Popover", "default", "enabled", "bg")}; `, R = () => { const o = b(h); if (o == null) throw new Error("Popover components must be wrapped in <Popover />"); return o; }, I = c(function({ borderRadius: t = "regular", className: r = "", zIndex: s, style: l = {}, ...i }, m) { const e = R(), d = f([e.floating, m]), p = C(); return /* @__PURE__ */ n(u, { children: e.open && /* @__PURE__ */ n(g, { context: e.context, modal: e.modal, children: /* @__PURE__ */ n( "div", { ref: d, style: { position: e.strategy, top: e.y ?? 0, left: e.x ?? 0, width: "max-content", zIndex: s }, className: "lnc-ui-floating-manager", "aria-labelledby": e.labelId, "aria-describedby": e.descriptionId, ...e.getFloatingProps(i), children: /* @__PURE__ */ n( F, { theme: p, borderRadius: t, className: "lnc-ui-popover-content " + r, style: l, children: i.children } ) } ) }) }); }); I.propTypes = { className: a.string, style: a.object, zIndex: a.number }; export { I as default };