@terra-dev/use-restricted-input
TypeScript icon, indicating that this package has built-in type declarations

0.20.1 • Public • Published

@terra-dev/use-restricted-input

Restrict text input

https://anchor-storybook.vercel.app/?path=/story/core-use-restricted-input--basic

API

index.ts

/**
 * @param availableCharacters 'abc', 'a-z', 'a-z0-9'
 */
export function useRestrictedInput(
  availableCharacters: ((character: string) => boolean) | string,
): RestrictedInputReturn {}

export function useRestrictedNumberInput({
  type = 'decimal',
  maxDecimalPoints,
  maxIntegerPoinsts,
  onChange: _onChange,
}: RestrictedNumberInputParams): RestrictedInputReturn {}

export interface RestrictedInputReturn {
  onKeyPress: (event: KeyboardEvent<HTMLInputElement>) => void;
  onPaste?: (event: ClipboardEvent<HTMLInputElement>) => void;
  onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
}

export interface RestrictedNumberInputParams {
  type?: 'decimal' | 'integer';
  maxDecimalPoints?: number;
  maxIntegerPoinsts?: number;
  onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
}

Readme

Keywords

none

Package Sidebar

Install

npm i @terra-dev/use-restricted-input

Weekly Downloads

0

Version

0.20.1

License

Apache-2.0

Unpacked Size

31.2 kB

Total Files

5

Last publish

Collaborators

  • ssen