@radix-ui/react-compose-refs 0.1.1-rc.1 → 0.1.1-rc.4

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.
@@ -1 +1 @@
1
- {"mappings":"A;AAEA,iBAAiB,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;AAc/C;A;A;GAGG;AACH,4BAAqB,CAAC,EAAE,GAAG,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,UACjC,CAAC,UAChB;AAED;A;A;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"],"sourcesContent":[null,null],"names":[],"version":3,"file":"index.d.ts.map"}
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 e,n,r=(e={},n=require("react"),Object.keys(n).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return n[r]}})})),e);function t(...e){return n=>e.forEach((e=>function(e,n){"function"==typeof e?e(n):null!=e&&(e.current=n)}(e,n)))}exports.composeRefs=t,exports.useComposedRefs=function(...e){return r.useCallback(t(...e),e)};
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":"IAYgCA,EAAMC,KAAND,KAAMC,mBACpCC,OAAOC,KAAKF,GAAQG,SAAQ,SAASC,GACvB,YAARA,GAA6B,eAARA,GAIzBH,OAAOI,eAAeN,EAAMK,EAAK,CAC/BE,YAAY,EACZC,IAAK,WACH,OAAOP,EAAOI,SAKbL,GCNT,SAASS,KAAkBC,GACzB,OAAQC,GAAYD,EAAKN,SAASQ,GAbpC,SAAmBA,EAAqBC,GACnB,mBAARD,EACTA,EAAIC,GACKD,MAAAA,IACRA,EAAkCE,QAAUD,GASLE,CAAOH,EAAKD,mDAOxD,YAA+BD,GAE7B,OAAOM,EAAMC,YAAYR,KAAeC,GAAOA","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/compose-refs/src/composeRefs.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\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":["dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","composeRefs","refs","node","ref","value","current","setRef","React","useCallback"],"version":3,"file":"index.js.map"}
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"}
@@ -1,2 +1,38 @@
1
- import*as o from"react";export function composeRefs(...o){return e=>o.forEach((o=>function(o,e){"function"==typeof o?o(e):null!=o&&(o.current=e)}(o,e)))}export function useComposedRefs(...e){return o.useCallback(composeRefs(...e),e)}
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
@@ -1 +1 @@
1
- {"mappings":"+BAoBA,SAASA,eAAkBC,GACzB,OAAQC,GAAYD,EAAKE,SAASC,GAbpC,SAAmBA,EAAqBC,GACnB,mBAARD,EACTA,EAAIC,GACKD,MAAAA,IACRA,EAAkCE,QAAUD,GASLE,CAAOH,EAAKF,YAOxD,SAASM,mBAAsBP,GAE7B,OAAOQ,EAAMC,YAAYV,eAAeC,GAAOA","sources":["./packages/react/compose-refs/src/composeRefs.tsx"],"sourcesContent":["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":["composeRefs","refs","node","forEach","ref","value","current","setRef","useComposedRefs","React","useCallback"],"version":3,"file":"index.module.js.map"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-compose-refs",
3
- "version": "0.1.1-rc.1",
3
+ "version": "0.1.1-rc.4",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",