@crossed/ui
Version:
A universal & performant styling library for React Native, Next.js & React
40 lines (39 loc) • 1.02 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import {
forwardRef,
memo,
useId
} from "react";
import { useMedia } from "../../useMedia";
import { Floating } from "../Floating";
import { localContext } from "./context";
const ModalRoot = memo(
forwardRef(
({ size = "md", children, floatingProps, adapt = true, closable = true }, ref) => {
const { md } = useMedia();
const showSheet = adapt && !md;
const id = useId();
const closeOverlayProps = typeof closable === "boolean" ? closable : closable.closeOverlayPress;
return /* @__PURE__ */ jsx(
Floating,
{
closeOverlayPress: closeOverlayProps,
...floatingProps,
ref,
children: /* @__PURE__ */ jsx(
localContext.Provider,
{
value: { size, showSheet, idRef: id, closable },
children
}
)
}
);
}
)
);
ModalRoot.displayName = "Modal";
export {
ModalRoot
};
//# sourceMappingURL=Root.js.map