-
Notifications
You must be signed in to change notification settings - Fork 27
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
Support Range :values in catalogue #12
base: main
Are you sure you want to change the base?
Conversation
74c4a25
to
b58d5e2
Compare
|
||
cond do | ||
values == [] -> [] | ||
prop.opts[:required] -> values | ||
opts[:required] -> values | ||
true -> [{"nil", "__NIL__"} | values] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's better to just return []
if :values
is a range. This way we'll have a text input
instead of a select
. It would be weird to have a select
with all values of a large range, e.g. 1..1000
.
Another approach would be to check the number of values, something like using a select
if the number of items Is <= 10
and leaving as a text input
if it's > 10
. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its a good point @msaraiva. I had considered it but did not have a good solution, this seems like a reasonable approach. I would possibly make it 20-25 rather than 10 though. Sound good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with that. Just make sure you try it out to see if it doesn't affect usability badly. I mean, I'd rather type 16
myself than look for a 16
item in a 20-sized list :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea i'll see what the UX looks like. my thought was that 10 might be too small. Looking for that sweet spot 🍯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we could have an editable select similar to https://vue-select.org/ or use a <input>
+ <datalist>
instead of a <select>
.
I'm gonna hold off on updates to this one until we get my other PR in. |
Following surface-ui/surface#355 this PR adds support for ranges as prop
:values
. Note that I'm not sure how to test this outside of writing an example component. Suggestions are welcome :)