-
Notifications
You must be signed in to change notification settings - Fork 861
EuiDualRange: Add possibility to set input properties for min and max inputs #2738
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
EuiDualRange: Add possibility to set input properties for min and max inputs #2738
Conversation
|
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
|
Not sure if this is the best API for this... Maybe we can do something like having a prop that takes an object and that whole object will be merged into the input? I'm looking towards something more flexible because it's likely we'll want to be able to add other aria attributes to these inputs (such as |
Do you mean instead of having an EuiDualRange.propTypes = {
...
aria: PropTypes.arrayOf(
PropTypes.shape({
'aria-label': PropTypes.string,
'aria-labelledby': PropTypes.string,
'aria-describedby': PropTypes.string,
})
),
};Then: const minInputAria = aria && aria[0] ? aria[0] : null;
const maxInputAria = aria && aria[1] ? aria[1] : null;And finally: <EuiRangeInput
...
{...minInputAria}
/>
<EuiRangeInput
...
{...maxInputAria}
/>(I'm not sure if this works or not, I'm just thinking out loud for now...) |
|
That's the direction I'm thinking but I would go even broader and not specify a shape. Something like: EuiDualRange.propTypes = {
...
minInputProps: PropTypes.object,
maxInputProps: PropTypes.object
};<EuiRangeInput
...
{...minInputProps}
/>
<EuiRangeInput
...
{...maxInputProps}
/>This lets implementing devs pass in whatever props they need without EUI having to whitelist individual things. |
|
I agree with @myasonik that it should just be a generic |
|
@ffknob Looks like you've got quite a few conflicts. Can you resolve those? |
|
Sorry about the conflicts, @ffknob. I had a PR to convert these components to TypeScript that merged this morning; I didn't see your work here. Let me know if you want/need a hand with resolving the changes. |
No worries @thompsongl ...but it gave me a lot of Typescript type errors with the I then solved this by creating the |
|
@ffknob The interface to be used is minInputProps?: Partial<EuiRangeInputProps>;
maxInputProps?: Partial<EuiRangeInputProps>;
To the point made by @cchaos, this would allow consumers to clobber a lot of the props already being set (e.g., |
cchaos
left a comment
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.
…ls/cchaos Helping with dual range input props
|
@cchaos thanks for leaving comments for each change, I always learn a lot with you guys |
cchaos
left a comment
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.
LGTM once the CL conflict is resolved.
|
jenkins test this |
Summary
Closes #2737
Added possibility to set the input properties for the
minandmaxinputs ofEuiDualRange.Checklist