laravel / prompts

Beautiful and user-friendly forms for your command-line PHP applications.
https://laravel.com/docs/prompts
MIT License
533 stars 94 forks source link

Prompt `hint` #44

Closed devajmeireles closed 1 year ago

devajmeireles commented 1 year ago

Considering the stylization of the prompt that reminds us of the idea we have in HTML where the typed value is inserted in an input, this PR aims to add hits to the inputs: small blocks of text that allow us to give hints, similar to what we do in HTML:

CleanShot 2023-08-08 at 8 28 16

Notes:

jessarcher commented 1 year ago

Thank you! I've been wanting to add this, and I prefer your naming of hint :grin:

I'm going to mark this as draft until I've done a review for Taylor.

jessarcher commented 1 year ago

I've made a small tweak to prevent reserving an extra line for errors when a hint is provided because the errors will use that same line.

I've also made the hint appear while searching otherwise it flashes away briefly when the search callback isn't instantaneous.

The only other thing I'm considering is whether to hide the hint when the search/suggest dropdown is visible rather than the hint jumping down the screen. This would feel a bit more like the web, where a <select> dropdown appears in front of the other content on the page, but with the downside that the hint isn't always visible.

devajmeireles commented 1 year ago

I've made a small tweak to prevent reserving an extra line for errors when a hint is provided because the errors will use that same line.

I've also made the hint appear while searching otherwise it flashes away briefly when the search callback isn't instantaneous.

The only other thing I'm considering is whether to hide the hint when the search/suggest dropdown is visible rather than the hint jumping down the screen. This would feel a bit more like the web, where a <select> dropdown appears in front of the other content on the page, but with the downside that the hint isn't always visible.

For me, it looks fantastic! I believe so, it will be better to hide the tooltip when search/select is opened. Do you want me to do this? Let me know if I can help.

devajmeireles commented 1 year ago

I've made a small tweak to prevent reserving an extra line for errors when a hint is provided because the errors will use that same line. I've also made the hint appear while searching otherwise it flashes away briefly when the search callback isn't instantaneous. The only other thing I'm considering is whether to hide the hint when the search/suggest dropdown is visible rather than the hint jumping down the screen. This would feel a bit more like the web, where a <select> dropdown appears in front of the other content on the page, but with the downside that the hint isn't always visible.

For me, it looks fantastic! I believe so, it will be better to hide the tooltip when search/select is opened. Do you want me to do this? Let me know if I can help.

On second thought, I also have no problem keeping the hint for search/select. Seems to work fine in my tests.

devajmeireles commented 1 year ago

@jessarcher , Can I mark the PR as ready for review? I don't know when to do this. Let me know if I can help with anything else.

jessarcher commented 1 year ago

On second thought, I also have no problem keeping the hint for search/select. Seems to work fine in my tests.

Agreed - I just tried hiding it when the search/suggest menu is visible and I think I prefer it how it is.