Comparing version 1.3.2 to 1.4.0
@@ -39,3 +39,3 @@ var _excluded = ["invertAxis", "invertSecondaryAxis"]; | ||
import detectElementOverflow from 'detect-element-overflow'; | ||
import { warnOnDev } from './shared/utils'; | ||
import warning from 'tiny-warning'; | ||
var isBrowser = typeof window !== 'undefined'; | ||
@@ -141,8 +141,5 @@ var isDisplayContentsSupported = isBrowser && 'CSS' in window && 'supports' in window.CSS && CSS.supports('display', 'contents'); | ||
function shrinkToSize(size) { | ||
if (minSize && size < minSize) { | ||
warnOnDev("<Fit />'s child will not fit anywhere with its current ".concat(minSizeProperty, " of ").concat(minSize, "px.")); | ||
} | ||
warning(!minSize || size >= minSize, "<Fit />'s child will not fit anywhere with its current ".concat(minSizeProperty, " of ").concat(minSize, "px.")); | ||
var newSize = Math.max(size, minSize || 0); | ||
warnOnDev("<Fit />'s child needed to have its ".concat(sizeProperty, " decreased to ").concat(newSize, "px.")); | ||
warning(false, "<Fit />'s child needed to have its ".concat(sizeProperty, " decreased to ").concat(newSize, "px.")); | ||
element.style[sizeProperty] = "".concat(newSize, "px"); | ||
@@ -254,3 +251,3 @@ } | ||
if (position !== 'absolute') { | ||
warnOnDev('<Fit />\'s child does not have absolute position. You should apply `position: absolute` to it.'); | ||
warning(false, '<Fit />\'s child does not have absolute position. You should apply `position: absolute` to it.'); | ||
element.style.position = 'absolute'; | ||
@@ -268,3 +265,3 @@ } | ||
if (parentPosition !== 'relative' && parentPosition !== 'absolute') { | ||
warnOnDev('<Fit />\'s parent does not have relative position. You should apply `position: relative` to it.'); | ||
warning(false, '<Fit />\'s parent does not have relative position. You should apply `position: relative` to it.'); | ||
parent.style.position = 'relative'; | ||
@@ -271,0 +268,0 @@ } |
@@ -16,3 +16,3 @@ "use strict"; | ||
var _utils = require("./shared/utils"); | ||
var _tinyWarning = _interopRequireDefault(require("tiny-warning")); | ||
@@ -159,8 +159,5 @@ var _excluded = ["invertAxis", "invertSecondaryAxis"]; | ||
function shrinkToSize(size) { | ||
if (minSize && size < minSize) { | ||
(0, _utils.warnOnDev)("<Fit />'s child will not fit anywhere with its current ".concat(minSizeProperty, " of ").concat(minSize, "px.")); | ||
} | ||
(0, _tinyWarning["default"])(!minSize || size >= minSize, "<Fit />'s child will not fit anywhere with its current ".concat(minSizeProperty, " of ").concat(minSize, "px.")); | ||
var newSize = Math.max(size, minSize || 0); | ||
(0, _utils.warnOnDev)("<Fit />'s child needed to have its ".concat(sizeProperty, " decreased to ").concat(newSize, "px.")); | ||
(0, _tinyWarning["default"])(false, "<Fit />'s child needed to have its ".concat(sizeProperty, " decreased to ").concat(newSize, "px.")); | ||
element.style[sizeProperty] = "".concat(newSize, "px"); | ||
@@ -272,3 +269,3 @@ } | ||
if (position !== 'absolute') { | ||
(0, _utils.warnOnDev)('<Fit />\'s child does not have absolute position. You should apply `position: absolute` to it.'); | ||
(0, _tinyWarning["default"])(false, '<Fit />\'s child does not have absolute position. You should apply `position: absolute` to it.'); | ||
element.style.position = 'absolute'; | ||
@@ -286,3 +283,3 @@ } | ||
if (parentPosition !== 'relative' && parentPosition !== 'absolute') { | ||
(0, _utils.warnOnDev)('<Fit />\'s parent does not have relative position. You should apply `position: relative` to it.'); | ||
(0, _tinyWarning["default"])(false, '<Fit />\'s parent does not have relative position. You should apply `position: relative` to it.'); | ||
parent.style.position = 'relative'; | ||
@@ -289,0 +286,0 @@ } |
{ | ||
"name": "react-fit", | ||
"version": "1.3.2", | ||
"version": "1.4.0", | ||
"description": "Fit a popover element on the screen.", | ||
@@ -31,3 +31,4 @@ "main": "dist/umd/Fit.js", | ||
"detect-element-overflow": "^1.2.0", | ||
"prop-types": "^15.6.0" | ||
"prop-types": "^15.6.0", | ||
"tiny-warning": "^1.0.0" | ||
}, | ||
@@ -47,4 +48,4 @@ "devDependencies": { | ||
"peerDependencies": { | ||
"react": "^15.5.0 || ^16.0.0 || ^17.0.0-0", | ||
"react-dom": "^15.5.0 || ^16.0.0 || ^17.0.0-0" | ||
"react": "^15.5.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", | ||
"react-dom": "^15.5.0 || ^16.0.0 || ^17.0.0 || ^18.0.0" | ||
}, | ||
@@ -55,6 +56,4 @@ "resolutions": { | ||
"files": [ | ||
"LICENSE", | ||
"README.md", | ||
"dist/", | ||
"src/" | ||
"dist", | ||
"src" | ||
], | ||
@@ -65,3 +64,4 @@ "repository": { | ||
}, | ||
"funding": "https://github.com/wojtekmaj/react-fit?sponsor=1" | ||
"funding": "https://github.com/wojtekmaj/react-fit?sponsor=1", | ||
"packageManager": "yarn@3.1.0" | ||
} |
@@ -5,5 +5,4 @@ import React, { Component } from 'react'; | ||
import detectElementOverflow from 'detect-element-overflow'; | ||
import warning from 'tiny-warning'; | ||
import { warnOnDev } from './shared/utils'; | ||
const isBrowser = typeof window !== 'undefined'; | ||
@@ -130,8 +129,12 @@ | ||
function shrinkToSize(size) { | ||
if (minSize && size < minSize) { | ||
warnOnDev(`<Fit />'s child will not fit anywhere with its current ${minSizeProperty} of ${minSize}px.`); | ||
} | ||
warning( | ||
!minSize || size >= minSize, | ||
`<Fit />'s child will not fit anywhere with its current ${minSizeProperty} of ${minSize}px.`, | ||
); | ||
const newSize = Math.max(size, minSize || 0); | ||
warnOnDev(`<Fit />'s child needed to have its ${sizeProperty} decreased to ${newSize}px.`); | ||
warning( | ||
false, | ||
`<Fit />'s child needed to have its ${sizeProperty} decreased to ${newSize}px.`, | ||
); | ||
element.style[sizeProperty] = `${newSize}px`; | ||
@@ -249,3 +252,3 @@ } | ||
if (position !== 'absolute') { | ||
warnOnDev('<Fit />\'s child does not have absolute position. You should apply `position: absolute` to it.'); | ||
warning(false, '<Fit />\'s child does not have absolute position. You should apply `position: absolute` to it.'); | ||
element.style.position = 'absolute'; | ||
@@ -262,3 +265,3 @@ } | ||
if (parentPosition !== 'relative' && parentPosition !== 'absolute') { | ||
warnOnDev('<Fit />\'s parent does not have relative position. You should apply `position: relative` to it.'); | ||
warning(false, '<Fit />\'s parent does not have relative position. You should apply `position: relative` to it.'); | ||
parent.style.position = 'relative'; | ||
@@ -265,0 +268,0 @@ } |
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
49027
5
6
850
+ Addedtiny-warning@^1.0.0
+ Addedreact@18.3.1(transitive)
+ Addedreact-dom@18.3.1(transitive)
+ Addedscheduler@0.23.2(transitive)
+ Addedtiny-warning@1.0.3(transitive)
- Removedreact@17.0.2(transitive)
- Removedreact-dom@17.0.2(transitive)
- Removedscheduler@0.20.2(transitive)