UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

2 lines (1 loc) 683 B
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),_=require("react"),r=require("./top-modal.context.js");const t=({children:t})=>{const[o,T]=_.useState(null),u=_.useRef(!0);return u.current&&(window.__CARBON_INTERNALS_MODAL_SETTER_LIST||(window.__CARBON_INTERNALS_MODAL_SETTER_LIST=[]),window.__CARBON_INTERNALS_MODAL_SETTER_LIST.push(T),u.current=!1),_.useEffect((()=>()=>{var e;window.__CARBON_INTERNALS_MODAL_SETTER_LIST=null===(e=window.__CARBON_INTERNALS_MODAL_SETTER_LIST)||void 0===e?void 0:e.filter((e=>e!==T))}),[]),e.jsx(r.default.Provider,{value:{topModal:o},children:t})};exports.TopModalProvider=t,exports.default=t;