@reach/rect
Advanced tools
Comparing version 0.14.0 to 0.15.0
@@ -8,3 +8,5 @@ 'use strict'; | ||
var observeRect = require('@reach/observe-rect'); | ||
var utils = require('@reach/utils'); | ||
var useIsomorphicLayoutEffect = require('@reach/utils/use-isomorphic-layout-effect'); | ||
var typeCheck = require('@reach/utils/type-check'); | ||
var warning = require('tiny-warning'); | ||
@@ -15,2 +17,3 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } | ||
var observeRect__default = /*#__PURE__*/_interopDefault(observeRect); | ||
var warning__default = /*#__PURE__*/_interopDefault(warning); | ||
@@ -74,3 +77,3 @@ /** | ||
if (utils.isBoolean(observeOrOptions)) { | ||
if (typeCheck.isBoolean(observeOrOptions)) { | ||
observe = observeOrOptions; | ||
@@ -84,3 +87,3 @@ } else { | ||
if (utils.isFunction(deprecated_onChange)) { | ||
if (typeCheck.isFunction(deprecated_onChange)) { | ||
onChange = deprecated_onChange; | ||
@@ -92,7 +95,7 @@ } | ||
React.useEffect(function () { | ||
process.env.NODE_ENV !== "production" ? utils.warning(!utils.isBoolean(observeOrOptions), "Passing `observe` as the second argument to `useRect` is deprecated and will be removed in a future version of Reach UI. Instead, you can pass an object of options with an `observe` property as the second argument (`useRect(ref, { observe })`).\n" + "See https://reach.tech/rect#userect-observe") : void 0; | ||
process.env.NODE_ENV !== "production" ? warning__default['default'](!typeCheck.isBoolean(observeOrOptions), "Passing `observe` as the second argument to `useRect` is deprecated and will be removed in a future version of Reach UI. Instead, you can pass an object of options with an `observe` property as the second argument (`useRect(ref, { observe })`).\n" + "See https://reach.tech/rect#userect-observe") : void 0; | ||
}, [observeOrOptions]); // eslint-disable-next-line react-hooks/rules-of-hooks | ||
React.useEffect(function () { | ||
process.env.NODE_ENV !== "production" ? utils.warning(!utils.isFunction(deprecated_onChange), "Passing `onChange` as the third argument to `useRect` is deprecated and will be removed in a future version of Reach UI. Instead, you can pass an object of options with an `onChange` property as the second argument (`useRect(ref, { onChange })`).\n" + "See https://reach.tech/rect#userect-onchange") : void 0; | ||
process.env.NODE_ENV !== "production" ? warning__default['default'](!typeCheck.isFunction(deprecated_onChange), "Passing `onChange` as the third argument to `useRect` is deprecated and will be removed in a future version of Reach UI. Instead, you can pass an object of options with an `onChange` property as the second argument (`useRect(ref, { onChange })`).\n" + "See https://reach.tech/rect#userect-onchange") : void 0; | ||
}, [deprecated_onChange]); | ||
@@ -117,3 +120,3 @@ } | ||
utils.useIsomorphicLayoutEffect(function () { | ||
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(function () { | ||
onChangeRef.current = onChange; | ||
@@ -125,3 +128,3 @@ | ||
}); | ||
utils.useIsomorphicLayoutEffect(function () { | ||
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(function () { | ||
if (element && !initialRectIsSet.current) { | ||
@@ -132,3 +135,3 @@ initialRectIsSet.current = true; | ||
}, [element]); | ||
utils.useIsomorphicLayoutEffect(function () { | ||
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(function () { | ||
var observer; | ||
@@ -135,0 +138,0 @@ var elem = element; // State initializes before refs are placed, meaning the element state will |
@@ -8,3 +8,5 @@ 'use strict'; | ||
var observeRect = require('@reach/observe-rect'); | ||
var utils = require('@reach/utils'); | ||
var useIsomorphicLayoutEffect = require('@reach/utils/use-isomorphic-layout-effect'); | ||
var typeCheck = require('@reach/utils/type-check'); | ||
require('tiny-warning'); | ||
@@ -59,3 +61,3 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } | ||
if (utils.isBoolean(observeOrOptions)) { | ||
if (typeCheck.isBoolean(observeOrOptions)) { | ||
observe = observeOrOptions; | ||
@@ -69,3 +71,3 @@ } else { | ||
if (utils.isFunction(deprecated_onChange)) { | ||
if (typeCheck.isFunction(deprecated_onChange)) { | ||
onChange = deprecated_onChange; | ||
@@ -90,3 +92,3 @@ } | ||
utils.useIsomorphicLayoutEffect(function () { | ||
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(function () { | ||
onChangeRef.current = onChange; | ||
@@ -98,3 +100,3 @@ | ||
}); | ||
utils.useIsomorphicLayoutEffect(function () { | ||
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(function () { | ||
if (element && !initialRectIsSet.current) { | ||
@@ -105,3 +107,3 @@ initialRectIsSet.current = true; | ||
}, [element]); | ||
utils.useIsomorphicLayoutEffect(function () { | ||
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(function () { | ||
var observer; | ||
@@ -108,0 +110,0 @@ var elem = element; // State initializes before refs are placed, meaning the element state will |
import { useRef, useEffect, useState, useCallback } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import observeRect from '@reach/observe-rect'; | ||
import { isBoolean, isFunction, warning, useIsomorphicLayoutEffect } from '@reach/utils'; | ||
import { useIsomorphicLayoutEffect } from '@reach/utils/use-isomorphic-layout-effect'; | ||
import { isBoolean, isFunction } from '@reach/utils/type-check'; | ||
import warning from 'tiny-warning'; | ||
@@ -6,0 +8,0 @@ /** |
{ | ||
"name": "@reach/rect", | ||
"version": "0.14.0", | ||
"version": "0.15.0", | ||
"description": "Measure React elements position in the DOM", | ||
"author": "React Training <hello@reacttraining.com>", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"sideEffects": [ | ||
"*.css" | ||
], | ||
"repository": { | ||
@@ -15,9 +17,10 @@ "type": "git", | ||
"@reach/observe-rect": "1.2.0", | ||
"@reach/utils": "0.14.0", | ||
"@reach/utils": "0.15.0", | ||
"prop-types": "^15.7.2", | ||
"tiny-warning": "^1.0.3", | ||
"tslib": "^2.1.0" | ||
}, | ||
"devDependencies": { | ||
"react": "^17.0.1", | ||
"react-dom": "^17.0.1" | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
}, | ||
@@ -39,3 +42,3 @@ "peerDependencies": { | ||
], | ||
"gitHead": "80f6ca5f8d25a10887e2bd34d60094402b9bc0a7" | ||
"gitHead": "1449650359c119c1afe25973aa7584e09e2c88bc" | ||
} |
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
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
20174
462
7
+ Addedtiny-warning@^1.0.3
+ Added@reach/utils@0.15.0(transitive)
+ Addedtiny-warning@1.0.3(transitive)
- Removed@reach/utils@0.14.0(transitive)
- Removed@types/warning@3.0.3(transitive)
- Removedwarning@4.0.3(transitive)
Updated@reach/utils@0.15.0