{"version":3,"file":"usePortalContainer-BYW2B6g7.mjs","names":[],"sources":["../src/shadow/portal/PortalContainerContext.ts","../src/shadow/portal/PortalContainerProvider.ts","../src/shadow/portal/usePortalContainer.ts"],"sourcesContent":["import { createContext } from 'react'\n\n/**\n * Holds the DOM element portalled components should render into, so portals stay\n * inside the widget's ShadowRoot (preserving style isolation).\n */\nexport const PortalContainerContext = createContext<HTMLElement | null>(null)\n","import type { ReactElement } from 'react'\nimport { createElement } from 'react'\n\nimport type { PortalContainerProviderProps } from '../../types/shadow/PortalContainerProviderProps'\nimport { PortalContainerContext } from './PortalContainerContext'\n\n/**\n * Provides the portal container element to descendants. Built with createElement\n * (no JSX) so the library has no JSX-runtime build coupling.\n * @param {PortalContainerProviderProps} props - The portal container and children.\n * @returns {ReactElement} The provider element wrapping the children.\n */\nexport const PortalContainerProvider = ({\n  portalContainer,\n  children,\n}: PortalContainerProviderProps): ReactElement =>\n  createElement(\n    PortalContainerContext.Provider,\n    { value: portalContainer },\n    children,\n  )\n","import { useContext } from 'react'\n\nimport { PortalContainerContext } from './PortalContainerContext'\n\n/**\n * Returns the portal container element used to keep portals inside the ShadowRoot.\n * @returns {HTMLElement | null} The portal container, or null when not provided.\n */\nexport const usePortalContainer = (): HTMLElement | null => {\n  return useContext(PortalContainerContext)\n}\n"],"mappings":";;AAMA,IAAa,IAAyB,EAAkC,IAAI,GCM/D,KAA2B,EACtC,oBACA,kBAEA,EACE,EAAuB,UACvB,EAAE,OAAO,EAAgB,GACzB,CACF,GCZW,UACJ,EAAW,CAAsB"}