@sanity/ui
Advanced tools
Comparing version 2.1.14 to 2.1.15-canary.0
@@ -2687,2 +2687,9 @@ /// <reference types="react" /> | ||
* @beta | ||
* @deprecated use `useImperativeHandle` instead | ||
* @example | ||
* ```diff | ||
* -const ref = useForwardedRef(forwardedRef) | ||
* +const ref = useRef(null) | ||
* +useImperativeHandle(forwardedRef, () => ref.current) | ||
* ``` | ||
*/ | ||
@@ -2689,0 +2696,0 @@ export declare function useForwardedRef<T>( |
{ | ||
"name": "@sanity/ui", | ||
"version": "2.1.14", | ||
"version": "2.1.15-canary.0", | ||
"keywords": [ | ||
@@ -54,28 +54,2 @@ "sanity", | ||
], | ||
"scripts": { | ||
"build": "run-s clean pkg:build pkg:check figma:pkg:build", | ||
"clean": "rimraf .workshop dist", | ||
"commit": "cz", | ||
"cypress:dev": "run-p dev cypress:open", | ||
"cypress:open": "cypress open", | ||
"cypress:run": "cypress run", | ||
"dev": "run-p storybook:dev workshop:dev", | ||
"figma:pkg:build": "cd figma && pnpm build", | ||
"format": "prettier --write --cache --ignore-unknown .", | ||
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx", | ||
"pkg:build": "pkg build --strict", | ||
"pkg:check": "pkg --strict", | ||
"prepare": "husky install", | ||
"prepublishOnly": "pnpm build", | ||
"release": "semantic-release", | ||
"storybook:build": "storybook build", | ||
"storybook:dev": "storybook dev -p 6006", | ||
"test": "jest", | ||
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'", | ||
"ts:check": "tsc", | ||
"watch": "pkg watch --strict", | ||
"workshop:build": "workshop build", | ||
"workshop:dev": "workshop dev", | ||
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist" | ||
}, | ||
"commitlint": { | ||
@@ -164,3 +138,3 @@ "extends": [ | ||
"eslint-plugin-react": "^7.34.2", | ||
"eslint-plugin-react-compiler": "0.0.0-experimental-c8b3f72-20240517", | ||
"eslint-plugin-react-compiler": "0.0.0-experimental-a97cca1-20240529", | ||
"eslint-plugin-react-hooks": "^4.6.2", | ||
@@ -198,3 +172,2 @@ "eslint-plugin-storybook": "^0.8.0", | ||
}, | ||
"packageManager": "pnpm@9.1.3", | ||
"engines": { | ||
@@ -208,3 +181,27 @@ "node": ">=14.0.0" | ||
"bundle": false | ||
}, | ||
"scripts": { | ||
"build": "run-s clean pkg:build pkg:check figma:pkg:build", | ||
"clean": "rimraf .workshop dist", | ||
"commit": "cz", | ||
"cypress:dev": "run-p dev cypress:open", | ||
"cypress:open": "cypress open", | ||
"cypress:run": "cypress run", | ||
"dev": "run-p storybook:dev workshop:dev", | ||
"figma:pkg:build": "cd figma && pnpm build", | ||
"format": "prettier --write --cache --ignore-unknown .", | ||
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx", | ||
"pkg:build": "pkg build --strict", | ||
"pkg:check": "pkg --strict", | ||
"release": "semantic-release", | ||
"storybook:build": "storybook build", | ||
"storybook:dev": "storybook dev -p 6006", | ||
"test": "jest", | ||
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'", | ||
"ts:check": "tsc", | ||
"watch": "pkg watch --strict", | ||
"workshop:build": "workshop build", | ||
"workshop:dev": "workshop dev", | ||
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist" | ||
} | ||
} | ||
} |
@@ -1,6 +0,12 @@ | ||
import {useRef} from 'react' | ||
import {useIsomorphicEffect} from './useIsomorphicEffect' | ||
import {useImperativeHandle, useRef} from 'react' | ||
/** | ||
* @beta | ||
* @deprecated use `useImperativeHandle` instead | ||
* @example | ||
* ```diff | ||
* -const ref = useForwardedRef(forwardedRef) | ||
* +const ref = useRef(null) | ||
* +useImperativeHandle(forwardedRef, () => ref.current) | ||
* ``` | ||
*/ | ||
@@ -10,13 +16,5 @@ export function useForwardedRef<T>(ref: React.ForwardedRef<T>): React.MutableRefObject<T | null> { | ||
useIsomorphicEffect(() => { | ||
if (!ref) return | ||
useImperativeHandle(ref, () => innerRef.current!) | ||
if (typeof ref === 'function') { | ||
ref(innerRef.current) | ||
} else { | ||
ref.current = innerRef.current | ||
} | ||
}) | ||
return innerRef | ||
} |
@@ -5,3 +5,4 @@ import {useEffect, useLayoutEffect} from 'react' | ||
* @beta | ||
* @deprecated use `useLayoutEffect` instead, or `useEffect` if possible | ||
*/ | ||
export const useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4495439
62729
1