Skip to content

Commit

Permalink
remove TippyInstance props
Browse files Browse the repository at this point in the history
  • Loading branch information
tompsota committed Oct 17, 2022
1 parent 6a457bb commit 7db2149
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const DatePickerBase = (
}
showClose={false}
isVisible={popoverOpen}
shouldClose={(_1, _2, event) => {
shouldClose={(_1, event) => {
event = event as KeyboardEvent;
if (event.key === KeyTypes.Escape && selectOpen) {
event.stopPropagation();
Expand Down
27 changes: 10 additions & 17 deletions packages/react-core/src/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { ReactElement } from 'react';
import { FocusTrap } from '../../helpers';
import { Popper, getOpacityTransition } from '../../helpers/Popper/Popper';
import { getUniqueId } from '../../helpers/util';
import { Instance as TippyInstance } from '../../helpers/Popper/DeprecatedTippyTypes';

export enum PopoverPosition {
auto = 'auto',
Expand Down Expand Up @@ -147,29 +146,24 @@ export interface PopoverProps {
minWidth?: string;
/**
* Lifecycle function invoked when the popover has fully transitioned out.
* Note: The tip argument is no longer passed and has been deprecated.
*/
onHidden?: (tip?: TippyInstance) => void;
onHidden?: () => void;
/**
* Lifecycle function invoked when the popover begins to transition out.
* Note: The tip argument is no longer passed and has been deprecated.
*/
onHide?: (tip?: TippyInstance) => void;
onHide?: () => void;
/**
* Lifecycle function invoked when the popover has been mounted to the DOM.
* Note: The tip argument is no longer passed and has been deprecated.
*/
onMount?: (tip?: TippyInstance) => void;
onMount?: () => void;
/**
* Lifecycle function invoked when the popover begins to transition in.
* Note: The tip argument is no longer passed and has been deprecated.
*/
onShow?: (tip?: TippyInstance) => void;
onShow?: () => void;
/**
* Lifecycle function invoked when the popover has fully transitioned in.
* Note: The tip argument is no longer passed and has been deprecated.
*/
onShown?: (tip?: TippyInstance) => void;
onShown?: () => void;
/**
* Popover position. Note: With the enableFlip property set to true, it will change the
* position if there is not enough space for the starting position. The behavior of where it
Expand Down Expand Up @@ -201,9 +195,8 @@ export interface PopoverProps {
/**
* Callback function that is only invoked when isVisible is also controlled. Called when the
* popover close button is clicked, the enter key was used on it, or the escape key is used.
* Note: The tip argument is no longer passed and has been deprecated.
*/
shouldClose?: (tip?: TippyInstance, hideFunction?: () => void, event?: MouseEvent | KeyboardEvent) => void;
shouldClose?: (hideFunction?: () => void, event?: MouseEvent | KeyboardEvent) => void;
/**
* Callback function that is only invoked when isVisible is also controlled. Called when the
* enter key is used on the focused trigger.
Expand Down Expand Up @@ -336,7 +329,7 @@ export const Popover: React.FunctionComponent<PopoverProps> = ({
const onDocumentKeyDown = (event: KeyboardEvent) => {
if (event.key === KeyTypes.Escape && visible) {
if (triggerManually) {
shouldClose(null, hide, event);
shouldClose(hide, event);
} else {
hide();
}
Expand All @@ -351,7 +344,7 @@ export const Popover: React.FunctionComponent<PopoverProps> = ({
return;
}
if (triggerManually) {
shouldClose(null, hide, event);
shouldClose(hide, event);
} else {
hide();
}
Expand All @@ -360,7 +353,7 @@ export const Popover: React.FunctionComponent<PopoverProps> = ({
const onTriggerClick = (event: MouseEvent) => {
if (triggerManually) {
if (visible) {
shouldClose(null, hide, event);
shouldClose(hide, event);
} else {
shouldOpen(show, event);
}
Expand All @@ -380,7 +373,7 @@ export const Popover: React.FunctionComponent<PopoverProps> = ({
const closePopover = (event: any) => {
event.stopPropagation();
if (triggerManually) {
shouldClose(null, hide, event);
shouldClose(hide, event);
} else {
hide();
}
Expand Down

0 comments on commit 7db2149

Please sign in to comment.