@xelto.npm/xc2-lib 1.0.20 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +29 -7
- package/dist/index.esm.js +30 -8
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -56363,12 +56363,34 @@ function parseValue(value, type) {
|
|
|
56363
56363
|
return '';
|
|
56364
56364
|
}
|
|
56365
56365
|
if (type === 'number') {
|
|
56366
|
-
|
|
56367
|
-
if (isNaN(
|
|
56366
|
+
//protect from passing NaN to input
|
|
56367
|
+
if (isNaN(value)) {
|
|
56368
56368
|
return '';
|
|
56369
56369
|
}
|
|
56370
|
-
return
|
|
56370
|
+
return value;
|
|
56371
|
+
|
|
56372
|
+
//parsing as type number, removes leading zeros
|
|
56373
|
+
//issue: if user enters 0.0, decimal will be removed
|
|
56374
|
+
// if (isNaN(value)) {
|
|
56375
|
+
// return '';
|
|
56376
|
+
// }
|
|
56377
|
+
// return value.toString();
|
|
56378
|
+
|
|
56379
|
+
//parsing as type string, removes leading zeros
|
|
56380
|
+
// const stringValue = value.toString();
|
|
56381
|
+
// // Split on the decimal point
|
|
56382
|
+
// const [whole, decimal] = stringValue.split('.');
|
|
56383
|
+
// // Parse the whole number portion to remove leading zeroes (if any)
|
|
56384
|
+
// const parsedWhole = parseFloat(whole).toString();
|
|
56385
|
+
//
|
|
56386
|
+
// if (parsedWhole === 'NaN') return ''
|
|
56387
|
+
// // Return combined value
|
|
56388
|
+
// if (decimal !== undefined) {
|
|
56389
|
+
// return `${parsedWhole}.${decimal}`;
|
|
56390
|
+
// }
|
|
56391
|
+
// return parsedWhole;
|
|
56371
56392
|
}
|
|
56393
|
+
|
|
56372
56394
|
return value;
|
|
56373
56395
|
}
|
|
56374
56396
|
var TextField = function TextField(_ref2) {
|
|
@@ -56408,10 +56430,10 @@ var TextField = function TextField(_ref2) {
|
|
|
56408
56430
|
endAdornment = _ref2$endAdornment === void 0 ? '' : _ref2$endAdornment,
|
|
56409
56431
|
props = _objectWithoutProperties$1(_ref2, _excluded$b);
|
|
56410
56432
|
// const parsedValue = type === 'number' ? parseFloat(value) || 0 : value;
|
|
56411
|
-
var parsedValue =
|
|
56433
|
+
var parsedValue = React.useMemo(function () {
|
|
56412
56434
|
return parseValue(value, type);
|
|
56413
56435
|
}, [value, type]);
|
|
56414
|
-
return /*#__PURE__*/
|
|
56436
|
+
return /*#__PURE__*/React.createElement(StyledTextField, _extends$1k({}, props, {
|
|
56415
56437
|
value: parsedValue,
|
|
56416
56438
|
onChange: onChange,
|
|
56417
56439
|
onClick: onClick,
|
|
@@ -56432,9 +56454,9 @@ var TextField = function TextField(_ref2) {
|
|
|
56432
56454
|
min: min,
|
|
56433
56455
|
max: max
|
|
56434
56456
|
},
|
|
56435
|
-
endAdornment: /*#__PURE__*/
|
|
56457
|
+
endAdornment: /*#__PURE__*/React.createElement(InputAdornment$1, {
|
|
56436
56458
|
position: "end"
|
|
56437
|
-
}, endAdornment ? endAdornment : /*#__PURE__*/
|
|
56459
|
+
}, endAdornment ? endAdornment : /*#__PURE__*/React.createElement(Icon, {
|
|
56438
56460
|
iconName: icon,
|
|
56439
56461
|
color: disabled ? 'disabled' : error ? 'red' : 'red-navy',
|
|
56440
56462
|
style: {
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { useLayoutEffect, useContext, forwardRef, createElement as createElement$1, createContext, Fragment, useRef, Children, isValidElement, cloneElement, useReducer, useEffect, useState, memo, useCallback
|
|
2
|
+
import React__default, { useLayoutEffect, useContext, forwardRef, createElement as createElement$1, createContext, Fragment, useRef, Children, isValidElement, cloneElement, useReducer, useEffect, useMemo, useState, memo, useCallback } from 'react';
|
|
3
3
|
import * as ReactDOM from 'react-dom';
|
|
4
4
|
import ReactDOM__default from 'react-dom';
|
|
5
5
|
|
|
@@ -56343,12 +56343,34 @@ function parseValue(value, type) {
|
|
|
56343
56343
|
return '';
|
|
56344
56344
|
}
|
|
56345
56345
|
if (type === 'number') {
|
|
56346
|
-
|
|
56347
|
-
if (isNaN(
|
|
56346
|
+
//protect from passing NaN to input
|
|
56347
|
+
if (isNaN(value)) {
|
|
56348
56348
|
return '';
|
|
56349
56349
|
}
|
|
56350
|
-
return
|
|
56350
|
+
return value;
|
|
56351
|
+
|
|
56352
|
+
//parsing as type number, removes leading zeros
|
|
56353
|
+
//issue: if user enters 0.0, decimal will be removed
|
|
56354
|
+
// if (isNaN(value)) {
|
|
56355
|
+
// return '';
|
|
56356
|
+
// }
|
|
56357
|
+
// return value.toString();
|
|
56358
|
+
|
|
56359
|
+
//parsing as type string, removes leading zeros
|
|
56360
|
+
// const stringValue = value.toString();
|
|
56361
|
+
// // Split on the decimal point
|
|
56362
|
+
// const [whole, decimal] = stringValue.split('.');
|
|
56363
|
+
// // Parse the whole number portion to remove leading zeroes (if any)
|
|
56364
|
+
// const parsedWhole = parseFloat(whole).toString();
|
|
56365
|
+
//
|
|
56366
|
+
// if (parsedWhole === 'NaN') return ''
|
|
56367
|
+
// // Return combined value
|
|
56368
|
+
// if (decimal !== undefined) {
|
|
56369
|
+
// return `${parsedWhole}.${decimal}`;
|
|
56370
|
+
// }
|
|
56371
|
+
// return parsedWhole;
|
|
56351
56372
|
}
|
|
56373
|
+
|
|
56352
56374
|
return value;
|
|
56353
56375
|
}
|
|
56354
56376
|
var TextField = function TextField(_ref2) {
|
|
@@ -56388,10 +56410,10 @@ var TextField = function TextField(_ref2) {
|
|
|
56388
56410
|
endAdornment = _ref2$endAdornment === void 0 ? '' : _ref2$endAdornment,
|
|
56389
56411
|
props = _objectWithoutProperties$1(_ref2, _excluded$b);
|
|
56390
56412
|
// const parsedValue = type === 'number' ? parseFloat(value) || 0 : value;
|
|
56391
|
-
var parsedValue =
|
|
56413
|
+
var parsedValue = useMemo(function () {
|
|
56392
56414
|
return parseValue(value, type);
|
|
56393
56415
|
}, [value, type]);
|
|
56394
|
-
return /*#__PURE__*/
|
|
56416
|
+
return /*#__PURE__*/React__default.createElement(StyledTextField, _extends$1k({}, props, {
|
|
56395
56417
|
value: parsedValue,
|
|
56396
56418
|
onChange: onChange,
|
|
56397
56419
|
onClick: onClick,
|
|
@@ -56412,9 +56434,9 @@ var TextField = function TextField(_ref2) {
|
|
|
56412
56434
|
min: min,
|
|
56413
56435
|
max: max
|
|
56414
56436
|
},
|
|
56415
|
-
endAdornment: /*#__PURE__*/
|
|
56437
|
+
endAdornment: /*#__PURE__*/React__default.createElement(InputAdornment$1, {
|
|
56416
56438
|
position: "end"
|
|
56417
|
-
}, endAdornment ? endAdornment : /*#__PURE__*/
|
|
56439
|
+
}, endAdornment ? endAdornment : /*#__PURE__*/React__default.createElement(Icon, {
|
|
56418
56440
|
iconName: icon,
|
|
56419
56441
|
color: disabled ? 'disabled' : error ? 'red' : 'red-navy',
|
|
56420
56442
|
style: {
|