{"version":3,"sources":["../src/portal.tsx"],"sourcesContent":["import type { ReactNode, RefObject } from \"react\"\nimport { ContainerPortal } from \"./container-portal\"\nimport { DefaultPortal } from \"./default-portal\"\n\nexport interface PortalProps {\n  children: ReactNode\n  /**\n   * If `true`, the portal will check if it is within a parent portal\n   * and append itself to the parent's portal node.\n   * This provides nesting for portals.\n   *\n   * If `false`, the portal will always append to `document.body`\n   * regardless of nesting. It is used to opt out of portal nesting.\n   *\n   * @default true\n   */\n  appendToParentPortal?: boolean\n  /**\n   * The `ref` to the component where the portal will be attached to.\n   */\n  containerRef?: RefObject<HTMLElement | null>\n  /**\n   * If `true`, the forwarding will be disabled.\n   */\n  disabled?: boolean\n  /**\n   * If `true`, the forwarding will be disabled.\n   *\n   * @deprecated Use `disabled` instead.\n   */\n  isDisabled?: boolean\n}\n\n/**\n * `Portal` is a component that renders elements outside of the current `DOM` hierarchy.\n *\n * @see Docs https://yamada-ui.com/components/other/portal\n */\nexport const Portal = ({\n  appendToParentPortal = true,\n  children,\n  containerRef,\n  isDisabled,\n  disabled = isDisabled,\n}: PortalProps) => {\n  if (disabled) return children\n\n  return containerRef ? (\n    <ContainerPortal\n      containerRef={containerRef}\n      {...{ appendToParentPortal, children }}\n    />\n  ) : (\n    <DefaultPortal {...{ appendToParentPortal, children }} />\n  )\n}\n\nPortal.displayName = \"Portal\"\nPortal.__ui__ = \"Portal\"\n"],"mappings":";;;;;;;;;AAgDI;AAVG,IAAM,SAAS,CAAC;AAAA,EACrB,uBAAuB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,MAAmB;AACjB,MAAI,SAAU,QAAO;AAErB,SAAO,eACL;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACC,GAAG,EAAE,sBAAsB,SAAS;AAAA;AAAA,EACvC,IAEA,oBAAC,iBAAe,GAAG,EAAE,sBAAsB,SAAS,GAAG;AAE3D;AAEA,OAAO,cAAc;AACrB,OAAO,SAAS;","names":[]}