Open rafarubim opened 8 months ago
I agree with the suggestion for the children! Regarding numbers, I don't. I think that is better to stick with string, which is the standard for inputs in HTML, and convert to a number if you need to.
@matheusps can you update the issue title with a definition of what should be done?
Support or Feedback
Context
Shoreline's component
FilterItem
receives avalue
and achildren
prop (it works like the<select>
/<option>
HTML tags).The
children
text is presented at each of theFilter
popover options. But after an option is "selected" then "applied", thevalue
prop is what is actually shown by theFilter
button (in the following image, look at theRoles: 123
text):Suggestion
My suggestion is to change this behavior, to show the
children
prop text instead:This would make the
<Filter>
/<FilterOption>
behavior work more like HTML's<select>
/<option>
tags, making thechildren
prop related to the visuals and thevalue
prop related to React's controlled state. This would allow us to useID
strings in thevalue
prop without harming UI visuals - and without constantly convertingID
s<=>string
s within controlled filters.Additional Suggestion
If the previous suggestion is accepted, I would also suggest accepting the type
number
in thevalue
prop, so there's no need for constant conversion from/to numericID
s (id.toString()
/Number.parseInt(value, 10)
).``