f3oall / awesome-notifications

Lightweight JavaScript Notifications Library
https://f3oall.github.io/awesome-notifications/
MIT License
286 stars 40 forks source link

Ability to confirm via string comparison #20

Open andreasvirkus opened 5 years ago

andreasvirkus commented 5 years ago

Is your feature request related to a problem? Please describe. I wish to improve the UX of my app for my users. We really like the pattern that GitHub and many others have adopted - have the user type in the name of the object/item they are about to delete.

Describe the solution you'd like We could call a new method for AWN (or pass in an additional argument to .confirm()), which would take in a String and the Confirm button would only be enabled once the user has typed the exact match of that string. So if I call the method with 'bees-knees', then the positive action button would not be enabled before the user has typed in 'bees-knees' into the prompt.

Additional context Ideally (since we're using the Vue plugin) we'd love to also maybe either pass in a custom slot for the input field or to be able to easily style the input (e.g. please keep the styles to flat selectors).

type-to-confirm

All the best, a

f3oall commented 5 years ago

Hey @andreasvirkus,

The behavior you have requested is commonly named "prompt". I had plans to implement it in simple way (just one predefined input). So you can expect it soon. I don't want to add any complex behaviour for prompt windows to keep library light and simple. However, I will try to consider opportunities to provide a way to customize this behaviour.

Concerning your suggestion about slots in Vue plugin, I can't implement it, because plugin functionality is just a wrapper (syntax sugar) for Vue. It doesn't use any Vue features. Probablly this year, I will publish set of dedicated Vue components which use all power of Vue. So stay tuned.

andreasvirkus commented 4 years ago

Hi, is there any progress on this prompt/confirmation feature? 🙏