planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

3
node_modules/use-composed-ref/README.md generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# use-composed-ref
React hook which creates a ref function from given refs. Useful when using forwardRef.

View File

@@ -0,0 +1,34 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var React = require('react');
var updateRef = function updateRef(ref, value) {
if (typeof ref === 'function') {
ref(value);
return;
}
ref.current = value;
};
var useComposedRef = function useComposedRef(libRef, userRef) {
var prevUserRef = React.useRef();
return React.useCallback(function (instance) {
libRef.current = instance;
if (prevUserRef.current) {
updateRef(prevUserRef.current, null);
}
prevUserRef.current = userRef;
if (!userRef) {
return;
}
updateRef(userRef, instance);
}, [userRef]);
};
exports.default = useComposedRef;

View File

@@ -0,0 +1,30 @@
import { useRef, useCallback } from 'react';
var updateRef = function updateRef(ref, value) {
if (typeof ref === 'function') {
ref(value);
return;
}
ref.current = value;
};
var useComposedRef = function useComposedRef(libRef, userRef) {
var prevUserRef = useRef();
return useCallback(function (instance) {
libRef.current = instance;
if (prevUserRef.current) {
updateRef(prevUserRef.current, null);
}
prevUserRef.current = userRef;
if (!userRef) {
return;
}
updateRef(userRef, instance);
}, [userRef]);
};
export default useComposedRef;

47
node_modules/use-composed-ref/package.json generated vendored Normal file
View File

@@ -0,0 +1,47 @@
{
"name": "use-composed-ref",
"version": "1.3.0",
"description": "React hook which creates a ref function from given refs. Useful when using forwardRef.",
"main": "./dist/use-composed-ref.cjs.js",
"module": "./dist/use-composed-ref.esm.js",
"types": "./types/index.d.ts",
"files": [
"dist",
"types"
],
"scripts": {
"test": "echo \"Warning: no test specified\" || jest --env=node",
"prebuild": "rimraf dist types",
"build": "rollup -c && tsc",
"preversion": "npm test",
"prepare": "npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Andarist/use-composed-ref.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/Andarist/use-composed-ref/issues"
},
"homepage": "https://github.com/Andarist/use-composed-ref#readme",
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/plugin-transform-modules-commonjs": "^7.2.0",
"@babel/preset-env": "^7.3.4",
"@babel/preset-typescript": "^7.3.3",
"@types/react": "^16.8.8",
"husky": "^1.3.1",
"jest": "^24.5.0",
"lint-staged": "^8.1.5",
"prettier": "^1.16.4",
"react": "^16.8.4",
"rimraf": "^2.6.3",
"rollup": "^1.6.0",
"rollup-plugin-babel": "^4.3.2",
"typescript": "^4.5.4"
}
}

4
node_modules/use-composed-ref/types/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import * as React from 'react';
declare type UserRef<T> = ((instance: T | null) => void) | React.RefObject<T> | null | undefined;
declare const useComposedRef: <T extends HTMLElement>(libRef: React.MutableRefObject<T | null>, userRef: UserRef<T>) => (instance: T | null) => void;
export default useComposedRef;