@commercetools-uikit/utils
Advanced tools
Comparing version 19.11.0 to 19.12.0
@@ -10,3 +10,2 @@ 'use strict'; | ||
var isPropValid = require('@emotion/is-prop-valid'); | ||
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat'); | ||
var react = require('react'); | ||
@@ -21,3 +20,2 @@ var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim'); | ||
var isPropValid__default = /*#__PURE__*/_interopDefault(isPropValid); | ||
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty); | ||
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty); | ||
@@ -70,3 +68,2 @@ | ||
const warning = function (condition, message) { | ||
var _context; | ||
let prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Warning'; | ||
@@ -76,3 +73,3 @@ if (isProduction || condition) { | ||
} | ||
console.warn(_concatInstanceProperty__default["default"](_context = "".concat(prefix, ": ")).call(_context, message)); | ||
console.warn(`${prefix}: ${message}`); | ||
}; | ||
@@ -86,6 +83,3 @@ const useWarning = (condition, message) => { | ||
const getMessage$1 = (componentName, additionalMessage) => { | ||
var _context; | ||
return _concatInstanceProperty__default["default"](_context = "\"".concat(componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage ? ' ' + additionalMessage : ''); | ||
}; | ||
const getMessage$1 = (componentName, additionalMessage) => `"${componentName}" has been deprecated and will be removed in the next major version.${additionalMessage ? ' ' + additionalMessage : ''}`; | ||
const warnDeprecatedComponent = function (componentName) { | ||
@@ -101,5 +95,4 @@ let additionalMessage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
const getMessage = function (propName, componentName) { | ||
var _context, _context2; | ||
let additionalMessage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
return _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "\"".concat(propName, "\" property of \"")).call(_context2, componentName, "\" component has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage ? ' ' + additionalMessage : ''); | ||
return `"${propName}" property of "${componentName}" component has been deprecated and will be removed in the next major version.${additionalMessage ? ' ' + additionalMessage : ''}`; | ||
}; | ||
@@ -124,5 +117,4 @@ const warnDeprecatedProp = function (condition, propName, componentName) { | ||
return () => { | ||
var _context; | ||
id += 1; | ||
return _concatInstanceProperty__default["default"](_context = "".concat(prefix)).call(_context, id); | ||
return `${prefix}${id}`; | ||
}; | ||
@@ -162,7 +154,7 @@ } | ||
amPm = _match[5]; | ||
const parsedMinutes = Number(minutes !== null && minutes !== void 0 ? minutes : '00'); | ||
const parsedSeconds = Number(seconds !== null && seconds !== void 0 ? seconds : '00'); | ||
const parsedMinutes = Number(minutes ?? '00'); | ||
const parsedSeconds = Number(seconds ?? '00'); | ||
// Parses the number as a fraction to ensure that .5, .05 and .005 are | ||
// parsed correctily (they are 500, 50 and 5 respectively). | ||
const parsedMilliseconds = Number("0.".concat(milliseconds !== null && milliseconds !== void 0 ? milliseconds : '000')) * 1000; | ||
const parsedMilliseconds = Number(`0.${milliseconds ?? '000'}`) * 1000; | ||
// edge-case: allow 24:00, but nothing over it | ||
@@ -169,0 +161,0 @@ const parsedHours = Number(hours) === 24 && parsedMinutes === 0 && parsedSeconds === 0 && parsedMilliseconds === 0 ? 0 : Number(hours); |
@@ -10,3 +10,2 @@ 'use strict'; | ||
var isPropValid = require('@emotion/is-prop-valid'); | ||
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat'); | ||
var react = require('react'); | ||
@@ -21,3 +20,2 @@ var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim'); | ||
var isPropValid__default = /*#__PURE__*/_interopDefault(isPropValid); | ||
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty); | ||
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty); | ||
@@ -74,6 +72,2 @@ | ||
const getMessage$1 = (componentName, additionalMessage) => { | ||
var _context; | ||
return _concatInstanceProperty__default["default"](_context = "\"".concat(componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage ? ' ' + additionalMessage : ''); | ||
}; | ||
const warnDeprecatedComponent = function (componentName) { | ||
@@ -83,16 +77,9 @@ return void 0; | ||
const useWarnDeprecatedComponent = function (componentName) { | ||
let additionalMessage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
return useWarning(false, getMessage$1(componentName, additionalMessage)); | ||
return useWarning(); | ||
}; | ||
const getMessage = function (propName, componentName) { | ||
var _context, _context2; | ||
let additionalMessage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
return _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "\"".concat(propName, "\" property of \"")).call(_context2, componentName, "\" component has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage ? ' ' + additionalMessage : ''); | ||
}; | ||
const warnDeprecatedProp = function (condition, propName, componentName) { | ||
}; | ||
const useWarnDeprecatedProp = function (condition, propName, componentName) { | ||
let additionalMessage = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; | ||
useWarning(condition, getMessage(propName, componentName, additionalMessage)); | ||
useWarning(); | ||
}; | ||
@@ -109,5 +96,4 @@ | ||
return () => { | ||
var _context; | ||
id += 1; | ||
return _concatInstanceProperty__default["default"](_context = "".concat(prefix)).call(_context, id); | ||
return `${prefix}${id}`; | ||
}; | ||
@@ -147,7 +133,7 @@ } | ||
amPm = _match[5]; | ||
const parsedMinutes = Number(minutes !== null && minutes !== void 0 ? minutes : '00'); | ||
const parsedSeconds = Number(seconds !== null && seconds !== void 0 ? seconds : '00'); | ||
const parsedMinutes = Number(minutes ?? '00'); | ||
const parsedSeconds = Number(seconds ?? '00'); | ||
// Parses the number as a fraction to ensure that .5, .05 and .005 are | ||
// parsed correctily (they are 500, 50 and 5 respectively). | ||
const parsedMilliseconds = Number("0.".concat(milliseconds !== null && milliseconds !== void 0 ? milliseconds : '000')) * 1000; | ||
const parsedMilliseconds = Number(`0.${milliseconds ?? '000'}`) * 1000; | ||
// edge-case: allow 24:00, but nothing over it | ||
@@ -154,0 +140,0 @@ const parsedHours = Number(hours) === 24 && parsedMinutes === 0 && parsedSeconds === 0 && parsedMilliseconds === 0 ? 0 : Number(hours); |
@@ -6,3 +6,2 @@ import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray'; | ||
import isPropValid from '@emotion/is-prop-valid'; | ||
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat'; | ||
import { useEffect } from 'react'; | ||
@@ -56,3 +55,2 @@ import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim'; | ||
const warning = function (condition, message) { | ||
var _context; | ||
let prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Warning'; | ||
@@ -62,3 +60,3 @@ if (isProduction || condition) { | ||
} | ||
console.warn(_concatInstanceProperty(_context = "".concat(prefix, ": ")).call(_context, message)); | ||
console.warn(`${prefix}: ${message}`); | ||
}; | ||
@@ -72,6 +70,3 @@ const useWarning = (condition, message) => { | ||
const getMessage$1 = (componentName, additionalMessage) => { | ||
var _context; | ||
return _concatInstanceProperty(_context = "\"".concat(componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage ? ' ' + additionalMessage : ''); | ||
}; | ||
const getMessage$1 = (componentName, additionalMessage) => `"${componentName}" has been deprecated and will be removed in the next major version.${additionalMessage ? ' ' + additionalMessage : ''}`; | ||
const warnDeprecatedComponent = function (componentName) { | ||
@@ -87,5 +82,4 @@ let additionalMessage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
const getMessage = function (propName, componentName) { | ||
var _context, _context2; | ||
let additionalMessage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
return _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "\"".concat(propName, "\" property of \"")).call(_context2, componentName, "\" component has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage ? ' ' + additionalMessage : ''); | ||
return `"${propName}" property of "${componentName}" component has been deprecated and will be removed in the next major version.${additionalMessage ? ' ' + additionalMessage : ''}`; | ||
}; | ||
@@ -110,5 +104,4 @@ const warnDeprecatedProp = function (condition, propName, componentName) { | ||
return () => { | ||
var _context; | ||
id += 1; | ||
return _concatInstanceProperty(_context = "".concat(prefix)).call(_context, id); | ||
return `${prefix}${id}`; | ||
}; | ||
@@ -148,7 +141,7 @@ } | ||
amPm = _match[5]; | ||
const parsedMinutes = Number(minutes !== null && minutes !== void 0 ? minutes : '00'); | ||
const parsedSeconds = Number(seconds !== null && seconds !== void 0 ? seconds : '00'); | ||
const parsedMinutes = Number(minutes ?? '00'); | ||
const parsedSeconds = Number(seconds ?? '00'); | ||
// Parses the number as a fraction to ensure that .5, .05 and .005 are | ||
// parsed correctily (they are 500, 50 and 5 respectively). | ||
const parsedMilliseconds = Number("0.".concat(milliseconds !== null && milliseconds !== void 0 ? milliseconds : '000')) * 1000; | ||
const parsedMilliseconds = Number(`0.${milliseconds ?? '000'}`) * 1000; | ||
// edge-case: allow 24:00, but nothing over it | ||
@@ -155,0 +148,0 @@ const parsedHours = Number(hours) === 24 && parsedMinutes === 0 && parsedSeconds === 0 && parsedMilliseconds === 0 ? 0 : Number(hours); |
{ | ||
"name": "@commercetools-uikit/utils", | ||
"description": "A collection of utilities shared across the other packages.", | ||
"version": "19.11.0", | ||
"version": "19.12.0", | ||
"bugs": "https://github.com/commercetools/ui-kit/issues", | ||
@@ -6,0 +6,0 @@ "repository": { |
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
29338
578
20
193