Skip to content
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

EuiSuperDatePicker should show tooltip for the popover close event #3127

Merged
merged 13 commits into from
Mar 23, 2020
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added `isPopoverClosed` prop to `EuiSuperUpdateButton` to show tooltip only if popover is closed ([#3127](https://github.com/elastic/eui/pull/3127))
- Added `sortMatchesBy` prop for `EuiComboBox` ([#3089](https://github.com/elastic/eui/pull/3089))
- Added `prepend` and `append` ability to `EuiFieldPassword` ([#3122](https://github.com/elastic/eui/pull/3122))
- Added `Enter` key press functionality to `EuiSuperDatePicker` ([#3048](https://github.com/elastic/eui/pull/3048))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ exports[`EuiSuperDatePicker is rendered 1`] = `
data-test-subj="superDatePickerApplyTimeButton"
isDisabled={false}
isLoading={false}
isPopoverClosed={true}
needsUpdate={false}
onClick={[Function]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ export class EuiSuperDatePicker extends Component {
<EuiFlexItem grow={false}>
<EuiSuperUpdateButton
needsUpdate={this.state.hasChanged}
isPopoverClosed={
!this.state.isStartDatePopoverOpen &&
!this.state.isEndDatePopoverOpen
}
isLoading={this.props.isLoading}
isDisabled={this.props.isDisabled || this.state.isInvalid}
onClick={this.handleClickUpdateButton}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ export class EuiSuperUpdateButton extends Component {
isLoading: PropTypes.bool,
isDisabled: PropTypes.bool,
onClick: PropTypes.func.isRequired,

/**
* Passes props to `EuiToolTip`
*/
toolTipProps: PropTypes.object,

/**
* Check if the popover is closed to display toggle
*/
isPopoverClosed: PropTypes.bool,
ashikmeerankutty marked this conversation as resolved.
Show resolved Hide resolved
};

static defaultProps = {
Expand All @@ -34,7 +40,7 @@ export class EuiSuperUpdateButton extends Component {

componentDidUpdate() {
if (
this.props.needsUpdate &&
this.props.isPopoverClosed &&
!this.props.isDisabled &&
!this.props.isLoading
) {
Expand Down Expand Up @@ -69,6 +75,7 @@ export class EuiSuperUpdateButton extends Component {
isDisabled,
onClick,
toolTipProps,
isPopoverClosed,
...rest
} = this.props;

Expand Down