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

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.
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ type PossibleRef<T> = React.Ref<T> | undefined;
3
+ /**
4
+ * A utility to compose multiple refs together
5
+ * Accepts callback refs and RefObject(s)
6
+ */
7
+ export function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
8
+ /**
9
+ * A custom hook that composes multiple refs
10
+ * Accepts callback refs and RefObject(s)
11
+ */
12
+ export function useComposedRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
13
+
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
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)};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
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)}
2
+ //# sourceMappingURL=index.module.js.map
@@ -0,0 +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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-compose-refs",
3
- "version": "0.1.0-rc.1",
3
+ "version": "0.1.1-rc.1",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -13,11 +13,10 @@
13
13
  "sideEffects": false,
14
14
  "scripts": {
15
15
  "clean": "rm -rf dist",
16
- "prepublish": "yarn clean",
17
16
  "version": "yarn version"
18
17
  },
19
18
  "peerDependencies": {
20
- "react": "^16.8 || ^17.0"
19
+ "react": "^16.8 || ^17.0 || ^18.0"
21
20
  },
22
21
  "homepage": "https://radix-ui.com/primitives",
23
22
  "repository": {
@@ -30,5 +29,5 @@
30
29
  "dependencies": {
31
30
  "@babel/runtime": "^7.13.10"
32
31
  },
33
- "stableVersion": "0.0.5"
32
+ "stableVersion": "0.1.0"
34
33
  }