@sanity/ui 2.8.9 → 2.8.10

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.
package/dist/index.js CHANGED
@@ -3444,7 +3444,7 @@ const Popover = react.memo(
3444
3444
  ), setReference = react.useCallback(
3445
3445
  (node) => {
3446
3446
  refs.setReference(node);
3447
- const childRef = childProp?.ref;
3447
+ const childRef = getElementRef(childProp);
3448
3448
  typeof childRef == "function" ? childRef(node) : childRef && (childRef.current = node);
3449
3449
  },
3450
3450
  [childProp, refs]
@@ -3504,6 +3504,10 @@ const Popover = react.memo(
3504
3504
  })
3505
3505
  );
3506
3506
  Popover.displayName = "Memo(ForwardRef(Popover))";
3507
+ function getElementRef(element) {
3508
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
3509
+ return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
3510
+ }
3507
3511
  function radioBaseStyle() {
3508
3512
  return styledComponents.css`
3509
3513
  position: relative;