123456789101112131415161718192021222324252627282930313233343536 |
- var $dJwbH$react = require("react");
- function $parcel$export(e, n, v, s) {
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
- }
- $parcel$export(module.exports, "composeRefs", () => $9c2aaba23466b352$export$43e446d32b3d21af);
- $parcel$export(module.exports, "useComposedRefs", () => $9c2aaba23466b352$export$c7b2cbe3552a0d05);
- /**
- * Set a given ref to a given value
- * This utility takes care of different types of refs: callback refs and RefObject(s)
- */ function $9c2aaba23466b352$var$setRef(ref, value) {
- if (typeof ref === 'function') ref(value);
- else if (ref !== null && ref !== undefined) ref.current = value;
- }
- /**
- * A utility to compose multiple refs together
- * Accepts callback refs and RefObject(s)
- */ function $9c2aaba23466b352$export$43e446d32b3d21af(...refs) {
- return (node)=>refs.forEach((ref)=>$9c2aaba23466b352$var$setRef(ref, node)
- )
- ;
- }
- /**
- * A custom hook that composes multiple refs
- * Accepts callback refs and RefObject(s)
- */ function $9c2aaba23466b352$export$c7b2cbe3552a0d05(...refs) {
- // eslint-disable-next-line react-hooks/exhaustive-deps
- return $dJwbH$react.useCallback($9c2aaba23466b352$export$43e446d32b3d21af(...refs), refs);
- }
- //# sourceMappingURL=index.js.map
|