@primer/react 0.0.0-20260324193322 → 0.0.0-20260324195210
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/CHANGELOG.md
CHANGED
|
@@ -29,7 +29,7 @@ import type { ForwardedRef, Ref as StandardRef } from 'react';
|
|
|
29
29
|
* return <button ref={mergedRef} />
|
|
30
30
|
* }
|
|
31
31
|
*/
|
|
32
|
-
export declare function useMergedRefs<T>(refA: Ref<T | null>, refB: Ref<T | null>): (value: T | null) => () => void;
|
|
32
|
+
export declare function useMergedRefs<T>(refA: Ref<T | null>, refB: Ref<T | null>): (value: T | null) => (() => void) | undefined;
|
|
33
33
|
type CleanupFunction = () => void;
|
|
34
34
|
/**
|
|
35
35
|
* React 19 supports callback refs that can return a cleanup function. If a cleanup function is returned, the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMergedRefs.d.ts","sourceRoot":"","sources":["../../src/hooks/useMergedRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,GAAG,IAAI,WAAW,EAAmB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"useMergedRefs.d.ts","sourceRoot":"","sources":["../../src/hooks/useMergedRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,GAAG,IAAI,WAAW,EAAmB,MAAM,OAAO,CAAA;AAK7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,WAE7D,CAAC,GAAG,IAAI,8BAmBnB;AAED,KAAK,eAAe,GAAG,MAAM,IAAI,CAAA;AAEjC;;;GAGG;AAEH,KAAK,kBAAkB,CAAC,CAAC,IAAI;IAC3B,cAAc,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,GAAG,eAAe,CAAA;CACpD,CAAC,gBAAgB,CAAC,CAAA;AAEnB;;;;;;;GAOG;AACH,KAAK,GAAG,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import 'react';
|
|
2
|
+
import { version } from 'react';
|
|
3
|
+
|
|
4
|
+
var _version$split$;
|
|
5
|
+
const majorReactVersion = parseInt((_version$split$ = version.split('.')[0]) !== null && _version$split$ !== void 0 ? _version$split$ : '18', 10);
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* Combine two refs of matching type (typically an external or forwarded ref and an internal `useRef` object or
|
|
@@ -38,6 +41,9 @@ function useMergedRefs(refA, refB) {
|
|
|
38
41
|
t0 = value => {
|
|
39
42
|
const cleanupA = setRef(refA, value);
|
|
40
43
|
const cleanupB = setRef(refB, value);
|
|
44
|
+
if (majorReactVersion <= 18) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
41
47
|
return () => {
|
|
42
48
|
if (cleanupA) {
|
|
43
49
|
cleanupA();
|
package/package.json
CHANGED