@basic-ui/core 0.0.52 → 0.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2342,15 +2342,30 @@ const context = /*#__PURE__*/react.createContext(null);
2342
2342
  const PopperProvider = context.Provider;
2343
2343
  const usePopperContext = () => react.useContext(context);
2344
2344
 
2345
+ const PortalSelectorContext = /*#__PURE__*/react.createContext(null);
2346
+ PortalSelectorContext.displayName = 'PortalSelectorContext';
2347
+ const PortalSelectorProvider = ({
2348
+ selector,
2349
+ children
2350
+ }) => {
2351
+ return /*#__PURE__*/jsxRuntime.jsx(PortalSelectorContext.Provider, {
2352
+ value: selector,
2353
+ children: children
2354
+ });
2355
+ };
2356
+
2345
2357
  const Portal = ({
2346
2358
  children,
2347
- selector = 'body'
2359
+ selector: selectorProp
2348
2360
  }) => {
2361
+ const selectorCtx = react.useContext(PortalSelectorContext);
2362
+
2349
2363
  if (typeof window === 'undefined') {
2350
2364
  return null;
2351
2365
  }
2352
2366
 
2353
- const dom = document.querySelector(selector);
2367
+ const selector = selectorProp || selectorCtx || 'body';
2368
+ const dom = typeof selector === 'string' ? document.querySelector(selector) : selector();
2354
2369
 
2355
2370
  if (dom) {
2356
2371
  return /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -2374,7 +2389,7 @@ const Popper = /*#__PURE__*/react.memo( /*#__PURE__*/react.forwardRef(function P
2374
2389
  modifiers = emptyModifiers,
2375
2390
  usePortal = false,
2376
2391
  style = {},
2377
- portalSelector = 'body',
2392
+ portalSelector,
2378
2393
  distance = 0,
2379
2394
  skidding = 0,
2380
2395
  arrowPadding = 5,
@@ -4097,6 +4112,7 @@ exports.Popper = Popper;
4097
4112
  exports.PopperArrow = PopperArrow;
4098
4113
  exports.PopperProvider = PopperProvider;
4099
4114
  exports.Portal = Portal;
4115
+ exports.PortalSelectorProvider = PortalSelectorProvider;
4100
4116
  exports.RadioButton = RadioButton;
4101
4117
  exports.RadioGroup = RadioGroup;
4102
4118
  exports.Slider = Slider;