-
Notifications
You must be signed in to change notification settings - Fork 842
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
[EuiSuperSelect] Add popoverProps prop #5214
Merged
cee-chen
merged 13 commits into
elastic:master
from
cee-chen:super-select-popoverClassName
Sep 28, 2021
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
611f6ea
[EuiSuperSelect] Add `popoverPanelClassName` prop
cee-chen 79a6ca9
Add unit test
cee-chen 0a7869a
Add changelog entry
cee-chen eb406ac
[REVERT ME] Add documentation test example
cee-chen 7a096b0
[PR feedback] Add popoverProps obj
cee-chen d8f56e2
Merge branch 'master' into super-select-popoverClassName
cee-chen 131ec53
[REVERT ME] update example with popoverProps
cee-chen a4a266b
Fix bug in popover.className override
cee-chen 541a548
Better documentation
cee-chen 6edbf98
[PR feedback] Remove `isOpen` prop from being
cee-chen 6ed81de
Revert documentation example
cee-chen f56dc24
[PR feedback] Changelog copy
constancecchen e4b7904
Merge branch 'master' into super-select-popoverClassName
constancecchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ import { | |
EuiSuperSelectControlProps, | ||
EuiSuperSelectOption, | ||
} from './super_select_control'; | ||
import { EuiInputPopover } from '../../popover'; | ||
import { EuiInputPopover, EuiPopoverProps } from '../../popover'; | ||
import { | ||
EuiContextMenuItem, | ||
EuiContextMenuItemLayoutAlignment, | ||
|
@@ -69,20 +69,34 @@ export type EuiSuperSelectProps<T extends string> = CommonProps & | |
itemLayoutAlign?: EuiContextMenuItemLayoutAlignment; | ||
|
||
/** | ||
* Applied to the outermost wrapper (popover) | ||
* Controls whether the options are shown. Default: false | ||
*/ | ||
popoverClassName?: string; | ||
isOpen?: boolean; | ||
|
||
/** | ||
* Controls whether the options are shown. Default: false | ||
* Optional props to pass to the underlying [EuiPopover](/#/layout/popover). | ||
* Allows fine-grained control of the popover dropdown menu, including | ||
* `repositionOnScroll` for EuiSuperSelects used within scrollable containers, | ||
* and customizing popover panel styling. | ||
* | ||
* Does not accept a nested `popoverProps.isOpen` property - use the top level | ||
* `isOpen` API instead. | ||
*/ | ||
isOpen?: boolean; | ||
popoverProps?: Partial<CommonProps & Omit<EuiPopoverProps, 'isOpen'>>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
/** | ||
* Applied to the outermost wrapper (popover) | ||
* | ||
* **DEPRECATED: Use `popoverProps.className` instead (will take precedence over this prop if set).** | ||
*/ | ||
popoverClassName?: string; | ||
|
||
/** | ||
* When `true`, the popover's position is re-calculated when the user | ||
* scrolls, this supports having fixed-position popover anchors. This value is passed | ||
* to the EuiInputPopover component. When nesting an `EuiSuperSelect` in a scrollable container, | ||
* scrolls. When nesting an `EuiSuperSelect` in a scrollable container, | ||
* `repositionOnScroll` should be `true` | ||
* | ||
* **DEPRECATED: Use `popoverProps.repositionOnScroll` instead (will take precedence over this prop if set).** | ||
*/ | ||
repositionOnScroll?: boolean; | ||
}; | ||
|
@@ -259,12 +273,16 @@ export class EuiSuperSelect<T extends string> extends Component< | |
itemLayoutAlign, | ||
fullWidth, | ||
popoverClassName, | ||
popoverProps, | ||
compressed, | ||
repositionOnScroll, | ||
...rest | ||
} = this.props; | ||
|
||
const popoverClasses = classNames('euiSuperSelect', popoverClassName); | ||
const popoverClasses = classNames( | ||
'euiSuperSelect', | ||
popoverProps?.className ?? popoverClassName | ||
); | ||
|
||
const buttonClasses = classNames( | ||
{ | ||
|
@@ -321,13 +339,14 @@ export class EuiSuperSelect<T extends string> extends Component< | |
|
||
return ( | ||
<EuiInputPopover | ||
className={popoverClasses} | ||
input={button} | ||
isOpen={isOpen || this.state.isPopoverOpen} | ||
closePopover={this.closePopover} | ||
panelPaddingSize="none" | ||
fullWidth={fullWidth} | ||
repositionOnScroll={repositionOnScroll} | ||
{...popoverProps} | ||
className={popoverClasses} | ||
isOpen={isOpen || this.state.isPopoverOpen} | ||
input={button} | ||
fullWidth={fullWidth} | ||
> | ||
<EuiScreenReaderOnly> | ||
<p role="alert"> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Yay for MD renderer!! 🎉