xnimorz / svelte-input-mask

Input masking component for Svelte with simple API and rich customization
https://codesandbox.io/s/svelte-input-mask-demo-xurgr
102 stars 10 forks source link

Alphabets masking #23

Closed pravnkay closed 8 months ago

pravnkay commented 9 months ago

Hi, new to svelte and found this awesome package. Firstly, It works wonderfully and thanks for that.

My need is that, I don't see any ways to mask alphabets input in a string.

For ex: I have a string in the format, XXXX-XX-00-0000 where X - Alphabets 0 - Numerals

Can this be added to the package ? or am I missing something ?

xnimorz commented 8 months ago

Hey @pravnkay

Please, see https://codesandbox.io/p/sandbox/svelte-mask-input-demo-xurgr?file=%2FMixed.svelte example with Mixed format

It can be done by using https://github.com/xnimorz/svelte-input-mask?tab=readme-ov-file#which-props-it-has maskFormat property which by default supports alphabetic symbols and numbers: https://github.com/xnimorz/masked-input/blob/master/packages/input-core/src/index.ts#L16-L28

You also can define your own symbols