-
Notifications
You must be signed in to change notification settings - Fork 840
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
[EuiPopover] Added panelProps prop #4573
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? |
Hey @akashgp09! Thanks for this PR but I think there was some confusion in the issue - I'll try to explain at a high level what we're looking for here and hopefull that clears it up! So, in And then instead of passing passing in |
@myasonik thanks for the review, now it's clear to me ^_^. I will make the changes soon . |
jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4573/ |
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.
This LGTM!
Will let an EUI team member review/merge.
src/components/panel/panel.tsx
Outdated
@@ -143,7 +143,6 @@ export const EuiPanel: FunctionComponent<EuiPanelProps> = ({ | |||
// Shadows are only allowed when there's a white background (plain) | |||
const canHaveShadow = color === 'plain'; | |||
const canHaveBorder = color === 'plain' || color === 'transparent'; | |||
|
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.
Can you just revert all changes to this file?
src/components/popover/popover.tsx
Outdated
style={this.state.popoverStyles} | ||
{...panelProps}> |
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.
The only thing about putting this prop at the bottom is that now the user can override any of the props including ones that are absolutely necessary for it display or behave well with a11y. Instead this prop should live at the top of this list and then in the state.popoverStyles
account for any possible panelProps?.style
and in the panelClasses
, add panelProps?.className
since these are allowed to be extended but we don't want the user completely overriding the internals.
src/components/popover/popover.tsx
Outdated
@@ -767,7 +774,7 @@ export class EuiPopover extends Component<Props, State> { | |||
aria-labelledby={ariaLabelledBy} | |||
aria-modal="true" | |||
aria-describedby={ariaDescribedby} | |||
style={this.state.popoverStyles}> | |||
style={panelProps?.style || this.state.popoverStyles}> |
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.
Sorry this one isn't an or
situation. Wherever the state.popoverStyles
is being set, you'll need to also add panelProps?.style
.
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.
got it 👍
Jenkins, test this |
Looks like a type error - not sure how to resolve it from the top of my head
|
src/components/popover/popover.tsx
Outdated
@@ -756,6 +762,7 @@ export class EuiPopover extends Component<Props, State> { | |||
!ownFocus || !this.state.isOpenStable || this.state.isClosing | |||
}> | |||
<EuiPanel | |||
{...panelProps} |
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.
Passing {...(panelProps as EuiPanelProps)}
here will resolve the TypeScript issue mentioned in #4573 (comment) - somewhere between accepting panelProps
and forwarding it here TS forgets the value has been validated and appears to intersect the div & button props.
@cchaos @chandlerprall i have made the changes as suggested. Please let me know if there are any changes required. |
Jenkins, test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4573/ |
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.
👍 Changes look good to me. @chandlerprall Let us know if you're good with the panelProps.style
handling.
I'm gonna get this merged in. We can consider deprecating those other props later, but I know they're widely used so this new prop is mostly a Jenkins, test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4573/ |
Summary
This PR Fixes: #4293
Added panelProps prop to EuiPopover
Checklist
- [ ] Added documentation- [ ] Checked Code Sandbox works for the any docs examples- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes