@lanaco/lnc-react-ui
Version:
React component library
34 lines (33 loc) • 887 B
JavaScript
import { jsx as a } from "react/jsx-runtime";
import { forwardRef as c, isValidElement as m, cloneElement as i, useContext as u } from "react";
import { a as P } from "./floating-ui.react.esm-B-RMCmpu.js";
import d from "./PopoverContext.js";
const g = () => {
const t = u(d);
if (t == null)
throw new Error("Popover components must be wrapped in <Popover />");
return t;
}, R = c(function({ children: e, asChild: s, ...r }, p) {
const o = g(), f = e.ref, n = P([o.reference, p, f]);
return s && m(e) ? i(
e,
o.getReferenceProps({
ref: n,
...r,
...e.props,
"data-state": o.open ? "open" : "closed"
})
) : /* @__PURE__ */ a(
"div",
{
ref: n,
"data-state": o.open ? "open" : "closed",
style: { width: "max-content" },
...o.getReferenceProps(r),
children: e
}
);
});
export {
R as default
};