Skip to content

Commit

Permalink
fix(react-popover): removes exposing of internal type FluentTriggerCo…
Browse files Browse the repository at this point in the history
…mponent
  • Loading branch information
bsunderhus committed Oct 27, 2022
1 parent 2a21055 commit 3f9ca1d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "removes exposing of internal type FluentTriggerComponent",
"packageName": "@fluentui/react-popover",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type { ComponentProps } from '@fluentui/react-utilities';
import type { ComponentState } from '@fluentui/react-utilities';
import type { ContextSelector } from '@fluentui/react-context-selector';
import { FC } from 'react';
import type { FluentTriggerComponent } from '@fluentui/react-utilities';
import type { ForwardRefComponent } from '@fluentui/react-utilities';
import { JSXElementConstructor } from 'react';
import type { PortalProps } from '@fluentui/react-portal';
Expand All @@ -20,11 +19,11 @@ import { Provider } from 'react';
import { ProviderProps } from 'react';
import * as React_2 from 'react';
import { ReactElement } from 'react';
import type { SetVirtualMouseTarget } from '@fluentui/react-positioning';
import type { Slot } from '@fluentui/react-utilities';
import type { SlotClassNames } from '@fluentui/react-utilities';
import type { TriggerProps } from '@fluentui/react-utilities';
import type { UseModalAttributesOptions } from '@fluentui/react-tabster';
import type { usePositioningMouseTarget } from '@fluentui/react-positioning';

// @public (undocumented)
export const arrowHeights: Record<PopoverSize, number>;
Expand Down Expand Up @@ -75,7 +74,7 @@ export type PopoverState = Pick<PopoverProps, 'appearance' | 'mountNode' | 'onOp
contextTarget: PositioningVirtualElement | undefined;
popoverSurface: React_2.ReactElement | undefined;
popoverTrigger: React_2.ReactElement | undefined;
setContextTarget: ReturnType<typeof usePositioningMouseTarget>[1];
setContextTarget: SetVirtualMouseTarget;
setOpen: (e: OpenPopoverEvents, open: boolean) => void;
size: NonNullable<PopoverProps['size']>;
toggleOpen: (e: OpenPopoverEvents) => void;
Expand All @@ -102,7 +101,7 @@ export type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<Pop
};

// @public
export const PopoverTrigger: React_2.FC<PopoverTriggerProps> & FluentTriggerComponent;
export const PopoverTrigger: React_2.FC<PopoverTriggerProps>;

// @public
export type PopoverTriggerChildProps<Type extends ARIAButtonType = ARIAButtonType, Props = {}> = ARIAButtonResultProps<Type, Props & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import type {
PositioningVirtualElement,
PositioningShorthand,
usePositioningMouseTarget,
SetVirtualMouseTarget,
} from '@fluentui/react-positioning';
import type { PortalProps } from '@fluentui/react-portal';
import type { UseModalAttributesOptions } from '@fluentui/react-tabster';
Expand Down Expand Up @@ -157,7 +157,7 @@ export type PopoverState = Pick<
/**
* A callback to set the target of the popper to the mouse click for context events
*/
setContextTarget: ReturnType<typeof usePositioningMouseTarget>[1];
setContextTarget: SetVirtualMouseTarget;

/**
* Callback to open/close the Popover
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import type { PopoverTriggerProps } from './PopoverTrigger.types';
/**
* Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
*/
export const PopoverTrigger: React.FC<PopoverTriggerProps> & FluentTriggerComponent = props => {
export const PopoverTrigger: React.FC<PopoverTriggerProps> = props => {
const state = usePopoverTrigger_unstable(props);

return renderPopoverTrigger_unstable(state);
};

PopoverTrigger.displayName = 'PopoverTrigger';
PopoverTrigger.isFluentTriggerComponent = true;
// type casting here is required to ensure internal type FluentTriggerComponent is not leaked
(PopoverTrigger as FluentTriggerComponent).isFluentTriggerComponent = true;

0 comments on commit 3f9ca1d

Please sign in to comment.