diff --git a/change/@fluentui-react-popover-a3c1e72b-5d8f-4901-bc34-7f2e9d0a1b4c.json b/change/@fluentui-react-popover-a3c1e72b-5d8f-4901-bc34-7f2e9d0a1b4c.json new file mode 100644 index 00000000000000..0b0dffc6e4e0d2 --- /dev/null +++ b/change/@fluentui-react-popover-a3c1e72b-5d8f-4901-bc34-7f2e9d0a1b4c.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "feat: expose base hooks for Popover and PopoverSurface", + "packageName": "@fluentui/react-popover", + "email": "dmytrokirpa@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/react-popover/library/etc/react-popover.api.md b/packages/react-components/react-popover/library/etc/react-popover.api.md index 03c439682bb15d..61206a1e4b26cd 100644 --- a/packages/react-components/react-popover/library/etc/react-popover.api.md +++ b/packages/react-components/react-popover/library/etc/react-popover.api.md @@ -38,6 +38,12 @@ export type OpenPopoverEvents = MouseEvent | TouchEvent | React_2.FocusEvent; +// @public (undocumented) +export type PopoverBaseProps = Omit; + +// @public (undocumented) +export type PopoverBaseState = Omit; + // @public export type PopoverContextValue = Pick; @@ -86,6 +92,12 @@ export type PopoverState = ComponentState & Pick; +// @public (undocumented) +export type PopoverSurfaceBaseProps = PopoverSurfaceProps; + +// @public (undocumented) +export type PopoverSurfaceBaseState = Omit; + // @public (undocumented) export const popoverSurfaceClassNames: SlotClassNames; @@ -128,7 +140,7 @@ export type PopoverTriggerState = { export const renderPopover_unstable: (state: PopoverState) => JSXElement; // @public -export const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSXElement; +export const renderPopoverSurface_unstable: (state: PopoverSurfaceBaseState) => JSXElement; // @public export const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => JSXElement | null; @@ -136,12 +148,18 @@ export const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => JSXE // @public export const usePopover_unstable: (props: PopoverProps) => PopoverState; +// @internal +export const usePopoverBase_unstable: (props: PopoverBaseProps) => PopoverBaseState; + // @public (undocumented) export const usePopoverContext_unstable: (selector: ContextSelector) => T; // @public export const usePopoverSurface_unstable: (props: PopoverSurfaceProps, ref: React_2.Ref) => PopoverSurfaceState; +// @internal +export const usePopoverSurfaceBase_unstable: (props: PopoverSurfaceBaseProps, ref: React_2.Ref) => PopoverSurfaceBaseState; + // @public export const usePopoverSurfaceStyles_unstable: (state: PopoverSurfaceState) => PopoverSurfaceState; diff --git a/packages/react-components/react-popover/library/src/components/PopoverSurface/renderPopoverSurface.tsx b/packages/react-components/react-popover/library/src/components/PopoverSurface/renderPopoverSurface.tsx index c6fd9e11622ce9..bd17a1dfcc3b02 100644 --- a/packages/react-components/react-popover/library/src/components/PopoverSurface/renderPopoverSurface.tsx +++ b/packages/react-components/react-popover/library/src/components/PopoverSurface/renderPopoverSurface.tsx @@ -3,12 +3,12 @@ import { assertSlots } from '@fluentui/react-utilities'; import type { JSXElement } from '@fluentui/react-utilities'; import { Portal } from '@fluentui/react-portal'; -import type { PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types'; +import type { PopoverSurfaceBaseState, PopoverSurfaceSlots } from './PopoverSurface.types'; /** * Render the final JSX of PopoverSurface */ -export const renderPopoverSurface_unstable = (state: PopoverSurfaceState): JSXElement => { +export const renderPopoverSurface_unstable = (state: PopoverSurfaceBaseState): JSXElement => { assertSlots(state); const surface = ( diff --git a/packages/react-components/react-popover/library/src/index.ts b/packages/react-components/react-popover/library/src/index.ts index 7179d31aaa7128..a37c6bbff2ba1f 100644 --- a/packages/react-components/react-popover/library/src/index.ts +++ b/packages/react-components/react-popover/library/src/index.ts @@ -1,5 +1,13 @@ -export { Popover, renderPopover_unstable, usePopover_unstable } from './Popover'; -export type { OnOpenChangeData, OpenPopoverEvents, PopoverProps, PopoverSize, PopoverState } from './Popover'; +export { Popover, renderPopover_unstable, usePopover_unstable, usePopoverBase_unstable } from './Popover'; +export type { + OnOpenChangeData, + OpenPopoverEvents, + PopoverProps, + PopoverSize, + PopoverState, + PopoverBaseProps, + PopoverBaseState, +} from './Popover'; export { PopoverSurface, arrowHeights, @@ -7,15 +15,16 @@ export { renderPopoverSurface_unstable, usePopoverSurfaceStyles_unstable, usePopoverSurface_unstable, + usePopoverSurfaceBase_unstable, +} from './PopoverSurface'; +export type { + PopoverSurfaceProps, + PopoverSurfaceSlots, + PopoverSurfaceState, + PopoverSurfaceBaseProps, + PopoverSurfaceBaseState, } from './PopoverSurface'; -export type { PopoverSurfaceProps, PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface'; export { PopoverProvider, usePopoverContext_unstable } from './popoverContext'; export type { PopoverContextValue } from './popoverContext'; export { PopoverTrigger, renderPopoverTrigger_unstable, usePopoverTrigger_unstable } from './PopoverTrigger'; export type { PopoverTriggerChildProps, PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger'; - -// Experimental APIs -// export type { PopoverBaseProps, PopoverBaseState } from './Popover'; -// export { usePopoverBase_unstable } from './Popover'; -// export type { PopoverSurfaceBaseProps, PopoverSurfaceBaseState } from './PopoverSurface'; -// export { usePopoverSurfaceBase_unstable } from './PopoverSurface';