Skip to content

Commit

Permalink
fix(masked-input): inline module types (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
reme3d2y committed Jun 8, 2021
1 parent e98db92 commit 004e60a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/masked-input/src/Component.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
import React, { useEffect, useRef, useCallback, ChangeEvent, useState, MouseEvent } from 'react';
import cn from 'classnames';
import mergeRefs from 'react-merge-refs';
import { createTextMaskInputElement, TextMaskConfig, TextMaskInputElement } from 'text-mask-core';
import { createTextMaskInputElement, TextMaskInputElement } from 'text-mask-core';
import { Input, InputProps } from '@alfalab/core-components-input';

import styles from './index.module.css';

// TODO: заставить rollup добавлять кастомные декларации в сборку
type Mask = Array<string | RegExp>;
type TextMaskConfig = {
currentCaretPosition: number;
rawValue: string;
previousConformedValue: string;
mask?: Mask | ((rawValue: string) => Mask);
guide?: boolean;
showMask?: boolean;
placeholderChar?: string;
keepCharPositions?: boolean;
pipe?: (
conformedValue: string,
config: TextMaskConfig,
) => false | string | { value: string; indexesOfPipedChars: number[] };
};

export type MaskedInputProps = InputProps & {
/**
* Маска для поля ввода
Expand Down

0 comments on commit 004e60a

Please sign in to comment.