-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🚀 - Email
mask (recipe or kit)
#200
Comments
Possible feature - drop |
Hi! How can I use a Let`s imagine I have a simple valid mask, i.e.
(simplified deliberately) Maskito doesn`t work with such a regex. It disallows to input nothing into the field. |
@pinetree Hi!
Your mask should work with any of intermediate states, not just the final value. Learn more: https://maskito.dev/core-concepts/mask-expression |
So, as I understand there is no chances to implement "email mask" with just one "common" regex? Yes, I can use a "common", not very strict regex and treat exceptions in a validation step. But maybe it`s possible) Maybe the solution is to use "Dynamic mask expression"? |
Hi taiga family! I'm too struggling to use the library to mask emails and I'm well aware you guys backlogged the recipe. In the meantime, is it that you guys can offer an example on how to implement Dynamic mask expression for emails as its such a common use case.. Thanks in advance |
I think you are conflating masking and validation. The point of mask library is to guide user input into a specific format. Validation is a separate concern. What I can suggest is make a loose mask with regex, use processors to disallow entering second Maybe you also should be using |
Hi @waterplea, thanks for such answer. I'll be exploring more into processors. You're completely right in terms of what masks do, they're a guide after all. I don't intend to conflate both mask and validation, but yet I couldn't find much about |
@nsbarsukov do you have a good example for dynamic mask expression from which people can draw inspiration in this case? |
I've create oversimplified example for Google emails.
__ I can't give guarantees that my draft is bug-free solution! |
@nsbarsukov Here you are using processors, but what about dynamic form expression example? |
I've tried to use Dynamic mask expression to build draft of email mask. Hovewer, I think the previous solution is better and more robust. |
Right. Anyway, the point of dynamic mask expression is instead of a static mask you have a function that takes ElementState as an argument each time a value is changed so you can return the correct expression for your particular state. I think email mask is not a good case for dynamic expression. Probably an IP mask is a good one: #252 It's pretty predictable and has a strict format, for example if you have first letter as 3-9 you are sure that the first block is a two digit number since the max is 255, therefore you can alter the mask accordingly. If you entered 35 you can auto insert a |
Which package(s) are relevant/related to the feature request?
Don't known / other
Description
TODO: create a good spec for this task
Possible solutions:
Email
insideRecipes
section.@maskito/kit
(if it becomes rather complex one).The text was updated successfully, but these errors were encountered: