Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/popover/popover.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class PopoverInner extends React.Component<PopoverPropsT, PopoverPrivateStateT>
isAnimating: false,
arrowOffset: { left: 0, top: 0 },
popoverOffset: { left: 0, top: 0 },
placement: props.placement,
placement: props.placement || PLACEMENT.auto,
isMounted: false,
isLayerMounted: false,
autoFocusAfterPositioning: false,
Expand Down Expand Up @@ -328,7 +328,7 @@ class PopoverInner extends React.Component<PopoverPropsT, PopoverPrivateStateT>

getSharedProps(): $Diff<SharedStylePropsArgT, { children?: React.Node }> {
const { isOpen, showArrow, popoverMargin = POPOVER_MARGIN } = this.props;
const { isAnimating, arrowOffset, popoverOffset, placement } = this.state;
const { isAnimating, arrowOffset, popoverOffset, placement = PLACEMENT.auto } = this.state;
return {
$showArrow: !!showArrow,
$arrowOffset: arrowOffset,
Expand Down
8 changes: 4 additions & 4 deletions src/popover/types.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export type BasePopoverPropsT = {
onMouseLeaveDelay?: number,
overrides?: OverridesT,
/** How to position the popover relative to the target. */
placement: TetherPlacementT,
placement?: TetherPlacementT,
/** Popper options override
* https://github.com/popperjs/popper.js/blob/v1.x/docs/_includes/popper-documentation.md
*/
Expand All @@ -101,7 +101,7 @@ export type BasePopoverPropsT = {
/** Whether or not to show the arrow pointing from the popover to the trigger. */
showArrow?: boolean,
/** Whether to toggle the popover when trigger is clicked or hovered. */
triggerType: TriggerTypeT,
triggerType?: TriggerTypeT,
/** Margin of the popover */
popoverMargin?: number,
};
Expand Down Expand Up @@ -131,9 +131,9 @@ export type StatefulPopoverPropsT = BasePopoverPropsT & {
/** Content to render within the popover when it's shown. */
content: React.Node | StatefulContentRenderPropT,
/** Whether to hide the popover when the user clicks anywhere outside the trigger/popover. */
dismissOnClickOutside: boolean,
dismissOnClickOutside?: boolean,
/** Whether to hide the popover when the user presses the escape key. */
dismissOnEsc: boolean,
dismissOnEsc?: boolean,
/** Initial state populated into the component */
initialState?: StateT,
/** Event handler when popover is hidden. */
Expand Down
8 changes: 4 additions & 4 deletions src/popover/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export type BasePopoverProps = {
onMouseLeaveDelay?: number;
overrides?: PopoverOverrides;
/** How to position the popover relative to the target. */
placement: TetherPlacement;
placement?: TetherPlacement;
/** Popper options override
* https://github.com/popperjs/popper.js/blob/v1.x/docs/_includes/popper-documentation.md
*/
Expand All @@ -96,7 +96,7 @@ export type BasePopoverProps = {
/** Whether or not to show the arrow pointing from the popover to the trigger. */
showArrow?: boolean;
/** Whether to toggle the popover when trigger is clicked or hovered. */
triggerType: TriggerType;
triggerType?: TriggerType;
/** Margin of the popover */
popoverMargin?: number;
};
Expand Down Expand Up @@ -126,9 +126,9 @@ export type StatefulPopoverProps = BasePopoverProps & {
/** Content to render within the popover when it's shown. */
content: React.ReactNode | StatefulContentRenderProp;
/** Whether to hide the popover when the user clicks anywhere outside the trigger/popover. */
dismissOnClickOutside: boolean;
dismissOnClickOutside?: boolean;
/** Whether to hide the popover when the user presses the escape key. */
dismissOnEsc: boolean;
dismissOnEsc?: boolean;
/** Initial state populated into the component */
initialState?: State;
/** Event handler when popover is hidden. */
Expand Down