@radix-ui/react-compose-refs 0.1.1-rc.2 → 0.1.1-rc.3
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.d.ts.map +1 -1
- package/dist/index.js +53 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +37 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";AAEA,iBAAiB,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;AAc/C;;;GAGG;AACH,4BAAqB,CAAC,EAAE,GAAG,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,UACjC,CAAC,UAChB;AAED;;;GAGG;AACH,gCAAyB,CAAC,EAAE,GAAG,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,qBAGpD","sources":["packages/react/compose-refs/src/packages/react/compose-refs/src/composeRefs.tsx","packages/react/compose-refs/src/packages/react/compose-refs/src/index.ts","packages/react/compose-refs/src/index.ts"],"sourcesContent":[null,null,"export * from './composeRefs';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,54 @@
|
|
|
1
|
-
var
|
|
1
|
+
var $dJwbH$react = require("react");
|
|
2
|
+
|
|
3
|
+
function $parcel$exportWildcard(dest, source) {
|
|
4
|
+
Object.keys(source).forEach(function(key) {
|
|
5
|
+
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(dest, key, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function get() {
|
|
12
|
+
return source[key];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return dest;
|
|
18
|
+
}
|
|
19
|
+
function $parcel$export(e, n, v, s) {
|
|
20
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
21
|
+
}
|
|
22
|
+
var $9c2aaba23466b352$exports = {};
|
|
23
|
+
|
|
24
|
+
$parcel$export($9c2aaba23466b352$exports, "composeRefs", () => $9c2aaba23466b352$export$43e446d32b3d21af);
|
|
25
|
+
$parcel$export($9c2aaba23466b352$exports, "useComposedRefs", () => $9c2aaba23466b352$export$c7b2cbe3552a0d05);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Set a given ref to a given value
|
|
29
|
+
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
30
|
+
*/ function $9c2aaba23466b352$var$setRef(ref, value) {
|
|
31
|
+
if (typeof ref === 'function') ref(value);
|
|
32
|
+
else if (ref !== null && ref !== undefined) ref.current = value;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A utility to compose multiple refs together
|
|
36
|
+
* Accepts callback refs and RefObject(s)
|
|
37
|
+
*/ function $9c2aaba23466b352$export$43e446d32b3d21af(...refs) {
|
|
38
|
+
return (node)=>refs.forEach((ref)=>$9c2aaba23466b352$var$setRef(ref, node)
|
|
39
|
+
)
|
|
40
|
+
;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A custom hook that composes multiple refs
|
|
44
|
+
* Accepts callback refs and RefObject(s)
|
|
45
|
+
*/ function $9c2aaba23466b352$export$c7b2cbe3552a0d05(...refs) {
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
return $dJwbH$react.useCallback($9c2aaba23466b352$export$43e446d32b3d21af(...refs), refs);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
$parcel$exportWildcard(module.exports, $9c2aaba23466b352$exports);
|
|
52
|
+
|
|
53
|
+
|
|
2
54
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;ACAA;AAIA;;;GAGA,CACA,SAASC,4BAAT,CAAmBC,GAAnB,EAAwCC,KAAxC,EAAkD;IAChD,IAAI,OAAOD,GAAP,KAAe,UAAnB,EACEA,GAAG,CAACC,KAAD,CAAH,CAAAD;SACK,IAAIA,GAAG,KAAK,IAAR,IAAgBA,GAAG,KAAKE,SAA5B,EACJF,GAAD,CAAmCG,OAAnC,GAA6CF,KAA7C,CAACD;CAEJ;AAED;;;GAGA,CACA,SAASI,yCAAT,CAAwB,GAAGC,IAA3B,EAAmD;IACjD,OAAQC,CAAAA,IAAD,GAAaD,IAAI,CAACE,OAAL,CAAcP,CAAAA,GAAD,GAASD,4BAAM,CAACC,GAAD,EAAMM,IAAN,CAA5B;QAAA,CAApB;IAAA,CAAA;CACD;AAED;;;GAGA,CACA,SAASE,yCAAT,CAA4B,GAAGH,IAA/B,EAAuD;IACrD,uDAAA;IACA,OAAOP,wBAAA,CAAkBM,yCAAW,IAAIC,IAAJ,CAA7B,EAAwCA,IAAxC,CAAP,CAAA;CACD;;AD/BD","sources":["packages/react/compose-refs/src/index.ts","packages/react/compose-refs/src/composeRefs.tsx"],"sourcesContent":["export * from './composeRefs';\n","import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref !== null && ref !== undefined) {\n (ref as React.MutableRefObject<T>).current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => refs.forEach((ref) => setRef(ref, node));\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n"],"names":["React","setRef","ref","value","undefined","current","composeRefs","refs","node","forEach","useComposedRefs","useCallback"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,38 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {useCallback as $3vqmr$useCallback} from "react";
|
|
2
|
+
|
|
3
|
+
function $parcel$export(e, n, v, s) {
|
|
4
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
5
|
+
}
|
|
6
|
+
var $6ed0406888f73fc4$exports = {};
|
|
7
|
+
|
|
8
|
+
$parcel$export($6ed0406888f73fc4$exports, "composeRefs", () => $6ed0406888f73fc4$export$43e446d32b3d21af);
|
|
9
|
+
$parcel$export($6ed0406888f73fc4$exports, "useComposedRefs", () => $6ed0406888f73fc4$export$c7b2cbe3552a0d05);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Set a given ref to a given value
|
|
13
|
+
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
14
|
+
*/ function $6ed0406888f73fc4$var$setRef(ref, value) {
|
|
15
|
+
if (typeof ref === 'function') ref(value);
|
|
16
|
+
else if (ref !== null && ref !== undefined) ref.current = value;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A utility to compose multiple refs together
|
|
20
|
+
* Accepts callback refs and RefObject(s)
|
|
21
|
+
*/ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
|
|
22
|
+
return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)
|
|
23
|
+
)
|
|
24
|
+
;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A custom hook that composes multiple refs
|
|
28
|
+
* Accepts callback refs and RefObject(s)
|
|
29
|
+
*/ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
|
|
30
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
|
+
return $3vqmr$useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export {$6ed0406888f73fc4$export$43e446d32b3d21af as composeRefs, $6ed0406888f73fc4$export$c7b2cbe3552a0d05 as useComposedRefs};
|
|
2
38
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;ACAA;AAIA;;;GAGA,CACA,SAASC,4BAAT,CAAmBC,GAAnB,EAAwCC,KAAxC,EAAkD;IAChD,IAAI,OAAOD,GAAP,KAAe,UAAnB,EACEA,GAAG,CAACC,KAAD,CAAH,CAAAD;SACK,IAAIA,GAAG,KAAK,IAAR,IAAgBA,GAAG,KAAKE,SAA5B,EACJF,GAAD,CAAmCG,OAAnC,GAA6CF,KAA7C,CAACD;CAEJ;AAED;;;GAGA,CACA,SAASI,yCAAT,CAAwB,GAAGC,IAA3B,EAAmD;IACjD,OAAQC,CAAAA,IAAD,GAAaD,IAAI,CAACE,OAAL,CAAcP,CAAAA,GAAD,GAASD,4BAAM,CAACC,GAAD,EAAMM,IAAN,CAA5B;QAAA,CAApB;IAAA,CAAA;CACD;AAED;;;GAGA,CACA,SAASE,yCAAT,CAA4B,GAAGH,IAA/B,EAAuD;IACrD,uDAAA;IACA,OAAOP,kBAAA,CAAkBM,yCAAW,IAAIC,IAAJ,CAA7B,EAAwCA,IAAxC,CAAP,CAAA;CACD;;AD/BD","sources":["packages/react/compose-refs/src/index.ts","packages/react/compose-refs/src/composeRefs.tsx"],"sourcesContent":["export * from './composeRefs';\n","import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref !== null && ref !== undefined) {\n (ref as React.MutableRefObject<T>).current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => refs.forEach((ref) => setRef(ref, node));\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n"],"names":["React","setRef","ref","value","undefined","current","composeRefs","refs","node","forEach","useComposedRefs","useCallback"],"version":3,"file":"index.module.js.map"}
|