New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@alfalab/core-components-amount-input

Package Overview
Dependencies
Maintainers
14
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alfalab/core-components-amount-input - npm Package Compare versions

Comparing version 7.5.1 to 7.5.2

23

Component.js

@@ -18,9 +18,9 @@ 'use strict';

var defaultColors = {"minorPartAndCurrency":"amount-input__minorPartAndCurrency_1yk0m"};
var defaultColors = {"minorPartAndCurrency":"amount-input__minorPartAndCurrency_1h8ij"};
require('./default.css')
var styles = {"container":"amount-input__container_ft3mh","bold":"amount-input__bold_ft3mh","input":"amount-input__input_ft3mh","suffixContainer":"amount-input__suffixContainer_ft3mh","filled":"amount-input__filled_ft3mh"};
var styles = {"container":"amount-input__container_1mkez","bold":"amount-input__bold_1mkez","input":"amount-input__input_1mkez","suffixContainer":"amount-input__suffixContainer_1mkez","filled":"amount-input__filled_1mkez"};
require('./index.css')
var invertedColors = {"minorPartAndCurrency":"amount-input__minorPartAndCurrency_1qj1b"};
var invertedColors = {"minorPartAndCurrency":"amount-input__minorPartAndCurrency_197j8"};
require('./inverted.css')

@@ -41,3 +41,3 @@

var _b;
var _c = _a.view, view = _c === void 0 ? 'default' : _c, _d = _a.value, value = _d === void 0 ? null : _d, _e = _a.integerLength, integerLengthProp = _e === void 0 ? 9 : _e, _f = _a.minority, minority = _f === void 0 ? 100 : _f, _g = _a.currency, currency = _g === void 0 ? 'RUR' : _g, _h = _a.suffix, suffix = _h === void 0 ? currency : _h, _j = _a.placeholder, placeholder = _j === void 0 ? "0\u2009".concat(suffix === currency ? utils.getCurrencySymbol(currency) || '' : suffix) : _j, _k = _a.integersOnly, integersOnly = _k === void 0 ? false : _k, _l = _a.positiveOnly, positiveOnly = _l === void 0 ? true : _l, _m = _a.bold, bold = _m === void 0 ? true : _m, _o = _a.colors, colors = _o === void 0 ? 'default' : _o, className = _a.className, focusedClassName = _a.focusedClassName, dataTestId = _a.dataTestId, _p = _a.clear, clear = _p === void 0 ? false : _p, onChange = _a.onChange, onClear = _a.onClear, onBlur = _a.onBlur, _q = _a.breakpoint, breakpoint = _q === void 0 ? 1024 : _q, restProps = tslib.__rest(_a, ["view", "value", "integerLength", "minority", "currency", "suffix", "placeholder", "integersOnly", "positiveOnly", "bold", "colors", "className", "focusedClassName", "dataTestId", "clear", "onChange", "onClear", "onBlur", "breakpoint"]);
var _c = _a.view, view = _c === void 0 ? 'default' : _c, _d = _a.value, value = _d === void 0 ? null : _d, _e = _a.integerLength, integerLengthProp = _e === void 0 ? 9 : _e, _f = _a.minority, minority = _f === void 0 ? 100 : _f, _g = _a.currency, currency = _g === void 0 ? 'RUR' : _g, _h = _a.suffix, suffix = _h === void 0 ? currency : _h, _j = _a.placeholder, placeholder = _j === void 0 ? "0\u2009".concat(suffix === currency ? utils.getCurrencySymbol(currency) || '' : suffix) : _j, _k = _a.integersOnly, integersOnly = _k === void 0 ? false : _k, _l = _a.positiveOnly, positiveOnly = _l === void 0 ? true : _l, _m = _a.bold, bold = _m === void 0 ? true : _m, _o = _a.colors, colors = _o === void 0 ? 'default' : _o, className = _a.className, focusedClassName = _a.focusedClassName, dataTestId = _a.dataTestId, _p = _a.clear, clear = _p === void 0 ? false : _p, onChange = _a.onChange, onClear = _a.onClear, onBlur = _a.onBlur, _q = _a.breakpoint, breakpoint = _q === void 0 ? 1024 : _q, onKeyDown = _a.onKeyDown, restProps = tslib.__rest(_a, ["view", "value", "integerLength", "minority", "currency", "suffix", "placeholder", "integersOnly", "positiveOnly", "bold", "colors", "className", "focusedClassName", "dataTestId", "clear", "onChange", "onClear", "onBlur", "breakpoint", "onKeyDown"]);
var integerLength = Math.min(integerLengthProp, 15);

@@ -67,3 +67,6 @@ var getFormattedAmount = React.useCallback(function (val) {

var input = e.target;
var enteredValue = input.value.replace(/\s/g, '').replace('.', ',');
var enteredValue = input.value
.replace(/\s/g, '')
.replace('.', ',')
.replace(/[^0-9,-]/g, '');
if (integersOnly) {

@@ -118,2 +121,10 @@ enteredValue = enteredValue.split(',')[0];

};
var handleKeyDown = function (event) {
var isModifierKeys = event.ctrlKey || event.altKey || event.metaKey || event.shiftKey;
// Не двигаем каретку когда вводится невалидный символ
if (!isModifierKeys && event.key.length === 1 && /[^0-9,.-]/.test(event.key)) {
event.preventDefault();
}
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
};
var handleClear = React.useCallback(function (event) {

@@ -150,5 +161,5 @@ setInputValue('');

utils.THINSP,
suffix === currency ? currencySymbol : suffix)), suffixContainerClassName: styles.suffixContainer, clear: clear, placeholder: placeholder, value: inputValue, colors: colors, className: cn__default.default(styles.component, className), focusedClassName: focusedClassName, inputClassName: styles.input, onChange: handleChange, onClear: handleClear, onBlur: handleBlur, inputMode: 'decimal', pattern: "[".concat(positiveOnly ? '' : '-', "0-9\\s\\.,]*"), dataTestId: dataTestId, ref: ref, breakpoint: breakpoint }))));
suffix === currency ? currencySymbol : suffix)), suffixContainerClassName: styles.suffixContainer, clear: clear, placeholder: placeholder, value: inputValue, colors: colors, className: cn__default.default(styles.component, className), focusedClassName: focusedClassName, inputClassName: styles.input, onChange: handleChange, onClear: handleClear, onBlur: handleBlur, onKeyDown: handleKeyDown, inputMode: 'decimal', pattern: "[".concat(positiveOnly ? '' : '-', "0-9\\s\\.,]*"), dataTestId: dataTestId, ref: ref, breakpoint: breakpoint }))));
});
exports.AmountInput = AmountInput;

@@ -37,3 +37,3 @@ 'use strict';

var _b;
var _c = _a.view, view = _c === void 0 ? 'default' : _c, _d = _a.value, value = _d === void 0 ? null : _d, _e = _a.integerLength, integerLengthProp = _e === void 0 ? 9 : _e, _f = _a.minority, minority = _f === void 0 ? 100 : _f, _g = _a.currency, currency = _g === void 0 ? 'RUR' : _g, _h = _a.suffix, suffix = _h === void 0 ? currency : _h, _j = _a.placeholder, placeholder = _j === void 0 ? "0\u2009".concat(suffix === currency ? utils.getCurrencySymbol(currency) || '' : suffix) : _j, _k = _a.integersOnly, integersOnly = _k === void 0 ? false : _k, _l = _a.positiveOnly, positiveOnly = _l === void 0 ? true : _l, _m = _a.bold, bold = _m === void 0 ? true : _m, _o = _a.colors, colors = _o === void 0 ? 'default' : _o, className = _a.className, focusedClassName = _a.focusedClassName, dataTestId = _a.dataTestId, _p = _a.clear, clear = _p === void 0 ? false : _p, onChange = _a.onChange, onClear = _a.onClear, onBlur = _a.onBlur, _q = _a.breakpoint, breakpoint = _q === void 0 ? 1024 : _q, restProps = tslib.__rest(_a, ["view", "value", "integerLength", "minority", "currency", "suffix", "placeholder", "integersOnly", "positiveOnly", "bold", "colors", "className", "focusedClassName", "dataTestId", "clear", "onChange", "onClear", "onBlur", "breakpoint"]);
var _c = _a.view, view = _c === void 0 ? 'default' : _c, _d = _a.value, value = _d === void 0 ? null : _d, _e = _a.integerLength, integerLengthProp = _e === void 0 ? 9 : _e, _f = _a.minority, minority = _f === void 0 ? 100 : _f, _g = _a.currency, currency = _g === void 0 ? 'RUR' : _g, _h = _a.suffix, suffix = _h === void 0 ? currency : _h, _j = _a.placeholder, placeholder = _j === void 0 ? "0\u2009".concat(suffix === currency ? utils.getCurrencySymbol(currency) || '' : suffix) : _j, _k = _a.integersOnly, integersOnly = _k === void 0 ? false : _k, _l = _a.positiveOnly, positiveOnly = _l === void 0 ? true : _l, _m = _a.bold, bold = _m === void 0 ? true : _m, _o = _a.colors, colors = _o === void 0 ? 'default' : _o, className = _a.className, focusedClassName = _a.focusedClassName, dataTestId = _a.dataTestId, _p = _a.clear, clear = _p === void 0 ? false : _p, onChange = _a.onChange, onClear = _a.onClear, onBlur = _a.onBlur, _q = _a.breakpoint, breakpoint = _q === void 0 ? 1024 : _q, onKeyDown = _a.onKeyDown, restProps = tslib.__rest(_a, ["view", "value", "integerLength", "minority", "currency", "suffix", "placeholder", "integersOnly", "positiveOnly", "bold", "colors", "className", "focusedClassName", "dataTestId", "clear", "onChange", "onClear", "onBlur", "breakpoint", "onKeyDown"]);
var integerLength = Math.min(integerLengthProp, 15);

@@ -63,3 +63,6 @@ var getFormattedAmount = React.useCallback(function (val) {

var input = e.target;
var enteredValue = input.value.replace(/\s/g, '').replace('.', ',');
var enteredValue = input.value
.replace(/\s/g, '')
.replace('.', ',')
.replace(/[^0-9,-]/g, '');
if (integersOnly) {

@@ -114,2 +117,10 @@ enteredValue = enteredValue.split(',')[0];

};
var handleKeyDown = function (event) {
var isModifierKeys = event.ctrlKey || event.altKey || event.metaKey || event.shiftKey;
// Не двигаем каретку когда вводится невалидный символ
if (!isModifierKeys && event.key.length === 1 && /[^0-9,.-]/.test(event.key)) {
event.preventDefault();
}
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
};
var handleClear = React.useCallback(function (event) {

@@ -146,5 +157,5 @@ setInputValue('');

utils.THINSP,
suffix === currency ? currencySymbol : suffix)), suffixContainerClassName: styles__default.default.suffixContainer, clear: clear, placeholder: placeholder, value: inputValue, colors: colors, className: cn__default.default(styles__default.default.component, className), focusedClassName: focusedClassName, inputClassName: styles__default.default.input, onChange: handleChange, onClear: handleClear, onBlur: handleBlur, inputMode: 'decimal', pattern: "[".concat(positiveOnly ? '' : '-', "0-9\\s\\.,]*"), dataTestId: dataTestId, ref: ref, breakpoint: breakpoint }))));
suffix === currency ? currencySymbol : suffix)), suffixContainerClassName: styles__default.default.suffixContainer, clear: clear, placeholder: placeholder, value: inputValue, colors: colors, className: cn__default.default(styles__default.default.component, className), focusedClassName: focusedClassName, inputClassName: styles__default.default.input, onChange: handleChange, onClear: handleClear, onBlur: handleBlur, onKeyDown: handleKeyDown, inputMode: 'decimal', pattern: "[".concat(positiveOnly ? '' : '-', "0-9\\s\\.,]*"), dataTestId: dataTestId, ref: ref, breakpoint: breakpoint }))));
});
exports.AmountInput = AmountInput;

@@ -9,9 +9,9 @@ import { __rest, __assign } from 'tslib';

var defaultColors = {"minorPartAndCurrency":"amount-input__minorPartAndCurrency_1yk0m"};
var defaultColors = {"minorPartAndCurrency":"amount-input__minorPartAndCurrency_1h8ij"};
require('./default.css')
var styles = {"container":"amount-input__container_ft3mh","bold":"amount-input__bold_ft3mh","input":"amount-input__input_ft3mh","suffixContainer":"amount-input__suffixContainer_ft3mh","filled":"amount-input__filled_ft3mh"};
var styles = {"container":"amount-input__container_1mkez","bold":"amount-input__bold_1mkez","input":"amount-input__input_1mkez","suffixContainer":"amount-input__suffixContainer_1mkez","filled":"amount-input__filled_1mkez"};
require('./index.css')
var invertedColors = {"minorPartAndCurrency":"amount-input__minorPartAndCurrency_1qj1b"};
var invertedColors = {"minorPartAndCurrency":"amount-input__minorPartAndCurrency_197j8"};
require('./inverted.css')

@@ -32,3 +32,3 @@

var _b;
var _c = _a.view, view = _c === void 0 ? 'default' : _c, _d = _a.value, value = _d === void 0 ? null : _d, _e = _a.integerLength, integerLengthProp = _e === void 0 ? 9 : _e, _f = _a.minority, minority = _f === void 0 ? 100 : _f, _g = _a.currency, currency = _g === void 0 ? 'RUR' : _g, _h = _a.suffix, suffix = _h === void 0 ? currency : _h, _j = _a.placeholder, placeholder = _j === void 0 ? "0\u2009".concat(suffix === currency ? getCurrencySymbol(currency) || '' : suffix) : _j, _k = _a.integersOnly, integersOnly = _k === void 0 ? false : _k, _l = _a.positiveOnly, positiveOnly = _l === void 0 ? true : _l, _m = _a.bold, bold = _m === void 0 ? true : _m, _o = _a.colors, colors = _o === void 0 ? 'default' : _o, className = _a.className, focusedClassName = _a.focusedClassName, dataTestId = _a.dataTestId, _p = _a.clear, clear = _p === void 0 ? false : _p, onChange = _a.onChange, onClear = _a.onClear, onBlur = _a.onBlur, _q = _a.breakpoint, breakpoint = _q === void 0 ? 1024 : _q, restProps = __rest(_a, ["view", "value", "integerLength", "minority", "currency", "suffix", "placeholder", "integersOnly", "positiveOnly", "bold", "colors", "className", "focusedClassName", "dataTestId", "clear", "onChange", "onClear", "onBlur", "breakpoint"]);
var _c = _a.view, view = _c === void 0 ? 'default' : _c, _d = _a.value, value = _d === void 0 ? null : _d, _e = _a.integerLength, integerLengthProp = _e === void 0 ? 9 : _e, _f = _a.minority, minority = _f === void 0 ? 100 : _f, _g = _a.currency, currency = _g === void 0 ? 'RUR' : _g, _h = _a.suffix, suffix = _h === void 0 ? currency : _h, _j = _a.placeholder, placeholder = _j === void 0 ? "0\u2009".concat(suffix === currency ? getCurrencySymbol(currency) || '' : suffix) : _j, _k = _a.integersOnly, integersOnly = _k === void 0 ? false : _k, _l = _a.positiveOnly, positiveOnly = _l === void 0 ? true : _l, _m = _a.bold, bold = _m === void 0 ? true : _m, _o = _a.colors, colors = _o === void 0 ? 'default' : _o, className = _a.className, focusedClassName = _a.focusedClassName, dataTestId = _a.dataTestId, _p = _a.clear, clear = _p === void 0 ? false : _p, onChange = _a.onChange, onClear = _a.onClear, onBlur = _a.onBlur, _q = _a.breakpoint, breakpoint = _q === void 0 ? 1024 : _q, onKeyDown = _a.onKeyDown, restProps = __rest(_a, ["view", "value", "integerLength", "minority", "currency", "suffix", "placeholder", "integersOnly", "positiveOnly", "bold", "colors", "className", "focusedClassName", "dataTestId", "clear", "onChange", "onClear", "onBlur", "breakpoint", "onKeyDown"]);
var integerLength = Math.min(integerLengthProp, 15);

@@ -58,3 +58,6 @@ var getFormattedAmount = useCallback(function (val) {

var input = e.target;
var enteredValue = input.value.replace(/\s/g, '').replace('.', ',');
var enteredValue = input.value
.replace(/\s/g, '')
.replace('.', ',')
.replace(/[^0-9,-]/g, '');
if (integersOnly) {

@@ -109,2 +112,10 @@ enteredValue = enteredValue.split(',')[0];

};
var handleKeyDown = function (event) {
var isModifierKeys = event.ctrlKey || event.altKey || event.metaKey || event.shiftKey;
// Не двигаем каретку когда вводится невалидный символ
if (!isModifierKeys && event.key.length === 1 && /[^0-9,.-]/.test(event.key)) {
event.preventDefault();
}
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
};
var handleClear = useCallback(function (event) {

@@ -141,5 +152,5 @@ setInputValue('');

THINSP,
suffix === currency ? currencySymbol : suffix)), suffixContainerClassName: styles.suffixContainer, clear: clear, placeholder: placeholder, value: inputValue, colors: colors, className: cn(styles.component, className), focusedClassName: focusedClassName, inputClassName: styles.input, onChange: handleChange, onClear: handleClear, onBlur: handleBlur, inputMode: 'decimal', pattern: "[".concat(positiveOnly ? '' : '-', "0-9\\s\\.,]*"), dataTestId: dataTestId, ref: ref, breakpoint: breakpoint }))));
suffix === currency ? currencySymbol : suffix)), suffixContainerClassName: styles.suffixContainer, clear: clear, placeholder: placeholder, value: inputValue, colors: colors, className: cn(styles.component, className), focusedClassName: focusedClassName, inputClassName: styles.input, onChange: handleChange, onClear: handleClear, onBlur: handleBlur, onKeyDown: handleKeyDown, inputMode: 'decimal', pattern: "[".concat(positiveOnly ? '' : '-', "0-9\\s\\.,]*"), dataTestId: dataTestId, ref: ref, breakpoint: breakpoint }))));
});
export { AmountInput };

@@ -8,9 +8,9 @@ import React, { forwardRef, useCallback, useState, useEffect, Fragment } from 'react';

const defaultColors = {"minorPartAndCurrency":"amount-input__minorPartAndCurrency_1yk0m"};
const defaultColors = {"minorPartAndCurrency":"amount-input__minorPartAndCurrency_1h8ij"};
require('./default.css')
const styles = {"container":"amount-input__container_ft3mh","bold":"amount-input__bold_ft3mh","input":"amount-input__input_ft3mh","suffixContainer":"amount-input__suffixContainer_ft3mh","filled":"amount-input__filled_ft3mh"};
const styles = {"container":"amount-input__container_1mkez","bold":"amount-input__bold_1mkez","input":"amount-input__input_1mkez","suffixContainer":"amount-input__suffixContainer_1mkez","filled":"amount-input__filled_1mkez"};
require('./index.css')
const invertedColors = {"minorPartAndCurrency":"amount-input__minorPartAndCurrency_1qj1b"};
const invertedColors = {"minorPartAndCurrency":"amount-input__minorPartAndCurrency_197j8"};
require('./inverted.css')

@@ -29,3 +29,3 @@

*/
const AmountInput = forwardRef(({ view = 'default', value = null, integerLength: integerLengthProp = 9, minority = 100, currency = 'RUR', suffix = currency, placeholder = `0\u2009${suffix === currency ? getCurrencySymbol(currency) || '' : suffix}`, integersOnly = false, positiveOnly = true, bold = true, colors = 'default', className, focusedClassName, dataTestId, clear = false, onChange, onClear, onBlur, breakpoint = 1024, ...restProps }, ref) => {
const AmountInput = forwardRef(({ view = 'default', value = null, integerLength: integerLengthProp = 9, minority = 100, currency = 'RUR', suffix = currency, placeholder = `0\u2009${suffix === currency ? getCurrencySymbol(currency) || '' : suffix}`, integersOnly = false, positiveOnly = true, bold = true, colors = 'default', className, focusedClassName, dataTestId, clear = false, onChange, onClear, onBlur, breakpoint = 1024, onKeyDown, ...restProps }, ref) => {
const integerLength = Math.min(integerLengthProp, 15);

@@ -55,3 +55,6 @@ const getFormattedAmount = useCallback((val) => {

const input = e.target;
let enteredValue = input.value.replace(/\s/g, '').replace('.', ',');
let enteredValue = input.value
.replace(/\s/g, '')
.replace('.', ',')
.replace(/[^0-9,-]/g, '');
if (integersOnly) {

@@ -106,2 +109,10 @@ [enteredValue] = enteredValue.split(',');

};
const handleKeyDown = (event) => {
const isModifierKeys = event.ctrlKey || event.altKey || event.metaKey || event.shiftKey;
// Не двигаем каретку когда вводится невалидный символ
if (!isModifierKeys && event.key.length === 1 && /[^0-9,.-]/.test(event.key)) {
event.preventDefault();
}
onKeyDown?.(event);
};
const handleClear = useCallback((event) => {

@@ -138,5 +149,5 @@ setInputValue('');

THINSP,
suffix === currency ? currencySymbol : suffix)), suffixContainerClassName: styles.suffixContainer, clear: clear, placeholder: placeholder, value: inputValue, colors: colors, className: cn(styles.component, className), focusedClassName: focusedClassName, inputClassName: styles.input, onChange: handleChange, onClear: handleClear, onBlur: handleBlur, inputMode: 'decimal', pattern: `[${positiveOnly ? '' : '-'}0-9\\s\\.,]*`, dataTestId: dataTestId, ref: ref, breakpoint: breakpoint })));
suffix === currency ? currencySymbol : suffix)), suffixContainerClassName: styles.suffixContainer, clear: clear, placeholder: placeholder, value: inputValue, colors: colors, className: cn(styles.component, className), focusedClassName: focusedClassName, inputClassName: styles.input, onChange: handleChange, onClear: handleClear, onBlur: handleBlur, onKeyDown: handleKeyDown, inputMode: 'decimal', pattern: `[${positiveOnly ? '' : '-'}0-9\\s\\.,]*`, dataTestId: dataTestId, ref: ref, breakpoint: breakpoint })));
});
export { AmountInput };
{
"name": "@alfalab/core-components-amount-input",
"version": "7.5.1",
"version": "7.5.2",
"description": "",

@@ -17,4 +17,4 @@ "keywords": [],

"dependencies": {
"@alfalab/core-components-input": "^12.3.0",
"@alfalab/core-components-with-suffix": "^4.1.10",
"@alfalab/core-components-input": "^13.0.0",
"@alfalab/core-components-with-suffix": "^4.1.11",
"@alfalab/data": "^1.6.0",

@@ -21,0 +21,0 @@ "@alfalab/utils": "^1.14.4",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc