index.mjs 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import {useCallback as $3vqmr$useCallback} from "react";
  2. /**
  3. * Set a given ref to a given value
  4. * This utility takes care of different types of refs: callback refs and RefObject(s)
  5. */ function $6ed0406888f73fc4$var$setRef(ref, value) {
  6. if (typeof ref === 'function') ref(value);
  7. else if (ref !== null && ref !== undefined) ref.current = value;
  8. }
  9. /**
  10. * A utility to compose multiple refs together
  11. * Accepts callback refs and RefObject(s)
  12. */ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
  13. return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)
  14. )
  15. ;
  16. }
  17. /**
  18. * A custom hook that composes multiple refs
  19. * Accepts callback refs and RefObject(s)
  20. */ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
  21. // eslint-disable-next-line react-hooks/exhaustive-deps
  22. return $3vqmr$useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
  23. }
  24. export {$6ed0406888f73fc4$export$43e446d32b3d21af as composeRefs, $6ed0406888f73fc4$export$c7b2cbe3552a0d05 as useComposedRefs};
  25. //# sourceMappingURL=index.mjs.map