From 3f9ca1d816af5eeb2ac8e542c680bbc391fedb13 Mon Sep 17 00:00:00 2001 From: Bernardo Sunderhus Date: Thu, 27 Oct 2022 12:19:20 +0000 Subject: [PATCH] fix(react-popover): removes exposing of internal type FluentTriggerComponent --- ...react-popover-4a2a3285-fde0-4d76-ae6d-aaac8c82c420.json | 7 +++++++ .../react-popover/etc/react-popover.api.md | 7 +++---- .../react-popover/src/components/Popover/Popover.types.ts | 4 ++-- .../src/components/PopoverTrigger/PopoverTrigger.tsx | 5 +++-- 4 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 change/@fluentui-react-popover-4a2a3285-fde0-4d76-ae6d-aaac8c82c420.json diff --git a/change/@fluentui-react-popover-4a2a3285-fde0-4d76-ae6d-aaac8c82c420.json b/change/@fluentui-react-popover-4a2a3285-fde0-4d76-ae6d-aaac8c82c420.json new file mode 100644 index 00000000000000..ae727229913a04 --- /dev/null +++ b/change/@fluentui-react-popover-4a2a3285-fde0-4d76-ae6d-aaac8c82c420.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "removes exposing of internal type FluentTriggerComponent", + "packageName": "@fluentui/react-popover", + "email": "bernardo.sunderhus@gmail.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/react-popover/etc/react-popover.api.md b/packages/react-components/react-popover/etc/react-popover.api.md index a6da770e029a3f..fbdc7d1aff19a3 100644 --- a/packages/react-components/react-popover/etc/react-popover.api.md +++ b/packages/react-components/react-popover/etc/react-popover.api.md @@ -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'; @@ -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; @@ -75,7 +74,7 @@ export type PopoverState = Pick[1]; + setContextTarget: SetVirtualMouseTarget; setOpen: (e: OpenPopoverEvents, open: boolean) => void; size: NonNullable; toggleOpen: (e: OpenPopoverEvents) => void; @@ -102,7 +101,7 @@ export type PopoverSurfaceState = ComponentState & Pick & FluentTriggerComponent; +export const PopoverTrigger: React_2.FC; // @public export type PopoverTriggerChildProps = ARIAButtonResultProps[1]; + setContextTarget: SetVirtualMouseTarget; /** * Callback to open/close the Popover diff --git a/packages/react-components/react-popover/src/components/PopoverTrigger/PopoverTrigger.tsx b/packages/react-components/react-popover/src/components/PopoverTrigger/PopoverTrigger.tsx index 4963f7c7540e3a..d182d1f2a07c8a 100644 --- a/packages/react-components/react-popover/src/components/PopoverTrigger/PopoverTrigger.tsx +++ b/packages/react-components/react-popover/src/components/PopoverTrigger/PopoverTrigger.tsx @@ -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 & FluentTriggerComponent = props => { +export const PopoverTrigger: React.FC = 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;