notchris / payload-mask-plugin

An input mask plugin for Payload
https://www.npmjs.com/package/payload-mask-plugin
MIT License
6 stars 0 forks source link

Ability to change the value as it is entered #4

Open mfilteau opened 4 months ago

mfilteau commented 4 months ago

The IMaskInput component has callbacks (prepare and prepareChars) that can be used to modify the input value while it is entered by the user.

I have an application where I want the result to have uppercase letters while not requiring the user to actually type in uppercase.

It would be nice if the prepare callback would be made available so I can do:

custom: {
  mask: 'a0a 0a0',
  prepare: (value: string) => {
    return value?.toUppercase()
  },
},
notchris commented 3 months ago

This is a great feature idea, I'll check it out today after I figure out the other issues. I have a feeling getting those sorted out will affect this.