Blame view

天文台pc/tianwentai-ui/node_modules/@radix-ui/react-portal/dist/index.mjs 869 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  "use client";
  
  // packages/react/portal/src/portal.tsx
  import * as React from "react";
  import ReactDOM from "react-dom";
  import { Primitive } from "@radix-ui/react-primitive";
  import { useLayoutEffect } from "@radix-ui/react-use-layout-effect";
  import { jsx } from "react/jsx-runtime";
  var PORTAL_NAME = "Portal";
  var Portal = React.forwardRef((props, forwardedRef) => {
    const { container: containerProp, ...portalProps } = props;
    const [mounted, setMounted] = React.useState(false);
    useLayoutEffect(() => setMounted(true), []);
    const container = containerProp || mounted && globalThis?.document?.body;
    return container ? ReactDOM.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
  });
  Portal.displayName = PORTAL_NAME;
  var Root = Portal;
  export {
    Portal,
    Root
  };
  //# sourceMappingURL=index.mjs.map