Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@maskito/kit

Package Overview
Dependencies
Maintainers
4
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@maskito/kit - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

lib/constants/default-decimal-pseudo-separators.d.ts

2

index.d.ts

@@ -6,5 +6,5 @@ export { maskitoDateOptionsGenerator } from './lib/masks/date';

export { maskitoTimeOptionsGenerator } from './lib/masks/time';
export { maskitoCaretGuard, maskitoEventHandler, maskitoRejectEvent } from './lib/plugins';
export { maskitoAddOnFocusPlugin, maskitoCaretGuard, maskitoEventHandler, maskitoRejectEvent, maskitoRemoveOnBlurPlugin, } from './lib/plugins';
export { maskitoPostfixPostprocessorGenerator, maskitoPrefixPostprocessorGenerator, maskitoWithPlaceholder, } from './lib/processors';
export { MaskitoDateMode, MaskitoDateSegments, MaskitoTimeMode, MaskitoTimeSegments, } from './lib/types';
//# sourceMappingURL=index.d.ts.map
import { MASKITO_DEFAULT_OPTIONS, maskitoTransform } from '@maskito/core';
const DEFAULT_DECIMAL_PSEUDO_SEPARATORS = ['.', ',', 'б', 'ю'];
const DEFAULT_MIN_DATE = new Date('0001-01-01');

@@ -495,2 +497,20 @@ const DEFAULT_MAX_DATE = new Date('9999-12-31');

function maskitoEventHandler(name, handler, eventListenerOptions) {
return (element, maskitoOptions) => {
const listener = () => handler(element, maskitoOptions);
element.addEventListener(name, listener, eventListenerOptions);
return () => element.removeEventListener(name, listener, eventListenerOptions);
};
}
function maskitoAddOnFocusPlugin(value) {
return maskitoEventHandler('focus', element => {
if (!element.value) {
element.value = value;
element.dispatchEvent(new Event('input'));
}
});
}
function maskitoCaretGuard(guard) {

@@ -503,3 +523,5 @@ return element => {

const onPointerUp = () => isPointerDown--;
const onPointerUp = () => {
isPointerDown = Math.max(--isPointerDown, 0);
};

@@ -530,3 +552,3 @@ const listener = () => {

});
document.addEventListener('mousedown', onPointerDown, {
element.addEventListener('mousedown', onPointerDown, {
passive: true

@@ -545,11 +567,2 @@ });

function maskitoEventHandler(name, handler, eventListenerOptions) {
return (element, maskitoOptions) => {
const listener = () => handler(element, maskitoOptions);
element.addEventListener(name, listener, eventListenerOptions);
return () => element.removeEventListener(name, listener, eventListenerOptions);
};
}
function maskitoRejectEvent(element) {

@@ -573,2 +586,11 @@ const listener = () => {

function maskitoRemoveOnBlurPlugin(value) {
return maskitoEventHandler('blur', element => {
if (element.value === value) {
element.value = '';
element.dispatchEvent(new Event('input'));
}
});
}
function maskitoWithPlaceholder(placeholder, focusedOnly = false) {

@@ -1079,6 +1101,2 @@ const removePlaceholder = value => {

function getDefaultPseudoSeparators(decimalSeparator, thousandSeparator) {
return decimalSeparator === ',' || decimalSeparator === '.' ? ['.', ',', 'б', 'ю'].filter(char => char !== thousandSeparator && char !== decimalSeparator) : [];
}
function maskitoParseNumber(maskedNumber, decimalSeparator = '.') {

@@ -1110,2 +1128,10 @@ const hasNegativeSign = !!maskedNumber.match(new RegExp(`^\\D*[${CHAR_MINUS}\\${CHAR_HYPHEN}${CHAR_EN_DASH}${CHAR_EM_DASH}]`));

function validateDecimalPseudoSeparators({
decimalSeparator,
thousandSeparator,
decimalPseudoSeparators = DEFAULT_DECIMAL_PSEUDO_SEPARATORS
}) {
return decimalPseudoSeparators.filter(char => char !== thousandSeparator && char !== decimalSeparator);
}
/**

@@ -1584,3 +1610,3 @@ * If `decimalZeroPadding` is `true`, it pads decimal part with zeroes

decimalSeparator = '.',
decimalPseudoSeparators = getDefaultPseudoSeparators(decimalSeparator, thousandSeparator),
decimalPseudoSeparators,
decimalZeroPadding = false,

@@ -1591,2 +1617,7 @@ prefix = '',

const pseudoMinuses = [CHAR_HYPHEN, CHAR_EN_DASH, CHAR_EM_DASH].filter(char => char !== thousandSeparator && char !== decimalSeparator);
const validatedDecimalPseudoSeparators = validateDecimalPseudoSeparators({
decimalSeparator,
thousandSeparator,
decimalPseudoSeparators
});
return Object.assign(Object.assign({}, MASKITO_DEFAULT_OPTIONS), {

@@ -1603,5 +1634,5 @@ mask: generateMaskExpression({

decimalSeparator,
decimalPseudoSeparators,
decimalPseudoSeparators: validatedDecimalPseudoSeparators,
pseudoMinuses
}), createPseudoCharactersPreprocessor(CHAR_MINUS, pseudoMinuses), createPseudoCharactersPreprocessor(decimalSeparator, decimalPseudoSeparators), createNotEmptyIntegerPartPreprocessor({
}), createPseudoCharactersPreprocessor(CHAR_MINUS, pseudoMinuses), createPseudoCharactersPreprocessor(decimalSeparator, validatedDecimalPseudoSeparators), createNotEmptyIntegerPartPreprocessor({
decimalSeparator,

@@ -1725,2 +1756,2 @@ precision

export { maskitoCaretGuard, maskitoDateOptionsGenerator, maskitoDateRangeOptionsGenerator, maskitoDateTimeOptionsGenerator, maskitoEventHandler, maskitoNumberOptionsGenerator, maskitoParseNumber, maskitoPostfixPostprocessorGenerator, maskitoPrefixPostprocessorGenerator, maskitoRejectEvent, maskitoTimeOptionsGenerator, maskitoWithPlaceholder };
export { maskitoAddOnFocusPlugin, maskitoCaretGuard, maskitoDateOptionsGenerator, maskitoDateRangeOptionsGenerator, maskitoDateTimeOptionsGenerator, maskitoEventHandler, maskitoNumberOptionsGenerator, maskitoParseNumber, maskitoPostfixPostprocessorGenerator, maskitoPrefixPostprocessorGenerator, maskitoRejectEvent, maskitoRemoveOnBlurPlugin, maskitoTimeOptionsGenerator, maskitoWithPlaceholder };

@@ -0,1 +1,2 @@

export * from './default-decimal-pseudo-separators';
export * from './default-min-max-dates';

@@ -2,0 +3,0 @@ export * from './default-time-segment-max-values';

export * from './generate-mask-expression';
export * from './get-default-pseudo-separators';
export * from './parse-number';
export * from './stringify-number-without-exp';
export * from './validate-decimal-pseudo-separators';
//# sourceMappingURL=index.d.ts.map

@@ -0,4 +1,6 @@

export { maskitoAddOnFocusPlugin } from './add-on-focus';
export { maskitoCaretGuard } from './caret-guard';
export { maskitoEventHandler } from './event-handler';
export { maskitoRejectEvent } from './reject-event';
export { maskitoRemoveOnBlurPlugin } from './remove-on-blur';
//# sourceMappingURL=index.d.ts.map
{
"name": "@maskito/kit",
"version": "1.4.0",
"version": "1.5.0",
"description": "The optional framework-agnostic Maskito's package with ready-to-use masks",

@@ -14,7 +14,7 @@ "keywords": [

],
"homepage": "https://tinkoff.github.io/maskito",
"bugs": "https://github.com/tinkoff/maskito/issues",
"homepage": "https://maskito.dev",
"bugs": "https://github.com/taiga-family/maskito/issues",
"repository": {
"type": "git",
"url": "https://github.com/tinkoff/maskito.git"
"url": "https://github.com/taiga-family/maskito.git"
},

@@ -34,3 +34,3 @@ "license": "Apache-2.0",

"peerDependencies": {
"@maskito/core": "^1.4.0"
"@maskito/core": "^1.5.0"
},

@@ -37,0 +37,0 @@ "main": "./index.umd.js",

@@ -7,9 +7,9 @@ # @maskito/kit

<p align="center">
<img src="https://raw.githubusercontent.com/Tinkoff/maskito/main/projects/demo/src/assets/icons/maskito.svg" alt="Maskito logo" height="120px">
<img src="https://raw.githubusercontent.com/taiga-family/maskito/main/projects/demo/src/assets/icons/maskito.svg" alt="Maskito logo" height="120px">
</p>
<p align="center">
<a href="https://tinkoff.github.io/maskito">Documentation</a> •
<a href="https://github.com/Tinkoff/maskito/issues/new/choose">Submit an Issue</a> •
<a href="https://t.me/taiga_ui">Contact Us</a>
<a href="https://maskito.dev">Documentation</a> •
<a href="https://github.com/taiga-family/maskito/issues/new/choose">Submit an Issue</a> •
<a href="https://t.me/taiga_ui/10600">Contact Us</a>
</p>

@@ -16,0 +16,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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