/// import { ARIAButtonResultProps } from '@fluentui/react-aria'; import { ARIAButtonType } from '@fluentui/react-aria'; import { BackgroundAppearanceContextValue } from '@fluentui/react-shared-contexts'; import type { ComponentProps } from '@fluentui/react-utilities'; import type { ComponentState } from '@fluentui/react-utilities'; import type { ForwardRefComponent } from '@fluentui/react-utilities'; import { JSXElementConstructor } from 'react'; import type { PortalProps } from '@fluentui/react-portal'; import * as React_2 from 'react'; import { ReactElement } from 'react'; import type { Slot } from '@fluentui/react-utilities'; import type { SlotClassNames } from '@fluentui/react-utilities'; import type { TriggerProps } from '@fluentui/react-utilities'; declare type Announce = (message: string, options: AnnounceOptions) => void; declare type AnnounceOptions = { politeness: AriaLivePoliteness; }; declare type AriaLivePoliteness = 'polite' | 'assertive'; /** * AriaLive Props */ declare type AriaLiveProps = ComponentProps> & { announceRef: React_2.Ref; }; declare type AriaLiveSlots = { assertive: NonNullable>; polite: NonNullable>; }; declare interface CommonToastDetail { toasterId?: ToasterId; } declare interface DispatchToastOptions extends Partial> { root?: RootSlot; } /** * Render the final JSX of Toast */ export declare const renderToast_unstable: (state: ToastState, contextValues: ToastContextValues) => JSX.Element; /** * Render the final JSX of ToastBody */ export declare const renderToastBody_unstable: (state: ToastBodyState) => JSX.Element; /** * Render the final JSX of Toaster */ export declare const renderToaster_unstable: (state: ToasterState) => JSX.Element; /** * Render the final JSX of ToastFooter */ export declare const renderToastFooter_unstable: (state: ToastFooterState) => JSX.Element; /** * Render the final JSX of ToastTitle */ export declare const renderToastTitle_unstable: (state: ToastTitleState) => JSX.Element; /** * Render the final JSX of MenuTrigger * * Only renders children */ export declare const renderToastTrigger_unstable: (state: ToastTriggerState) => ReactElement> | null; declare type RootSlot = Slot<'div'>; /** * Toast component */ export declare const Toast: ForwardRefComponent; declare interface Toast_2 extends ToastOptions { /** * Determines the visiblity of a toast */ close: () => void; /** * Removes a toast completely */ remove: () => void; /** * A number used to track updates immutably */ updateId: number; /** * Used to determine default priority when the user does not set one * Simple counter of toasts dispatched. */ order: number; imperativeRef: React_2.RefObject; } /** * ToastBody component */ export declare const ToastBody: ForwardRefComponent; export declare const toastBodyClassNames: SlotClassNames; /** * ToastBody Props */ export declare type ToastBodyProps = ComponentProps & {}; export declare type ToastBodySlots = { root: Slot<'div'>; subtitle?: Slot<'div'>; }; /** * State used in rendering ToastBody */ export declare type ToastBodyState = ComponentState & { backgroundAppearance: BackgroundAppearanceContextValue; }; declare interface ToastChangeData extends ToastOptions, Pick { status: ToastStatus; } declare type ToastChangeHandler = (event: null, data: ToastChangeData) => void; export declare const toastClassNames: SlotClassNames; declare type ToastContainerContextValue = { close: () => void; intent: ToastIntent | undefined; bodyId: string; titleId: string; }; declare type ToastContextValues = { backgroundAppearance: BackgroundAppearanceContextValue; }; /** * Toaster component - renders a collection of toasts dispatched imperatively */ export declare const Toaster: React_2.FC; export declare const toasterClassNames: SlotClassNames; declare type ToasterId = string; declare interface ToasterOptions extends Pick { offset?: ToastOffset; toasterId?: ToasterId; limit?: number; shortcuts?: ToasterShortcuts; } /** * Toaster Props */ export declare type ToasterProps = Omit, 'children'> & Partial & Pick & { /** * User override API for aria-live narration for toasts */ announce?: Announce; inline?: boolean; }; declare interface ToasterShortcuts { focus: (e: KeyboardEvent) => boolean; } export declare type ToasterSlots = { /** * NOTE: This root slot maps in exactly the same way to the containers rendered for each toast position * There is no intention (currently) to let users customize the div for each toast position. */ root: Slot<'div'>; }; declare type ToasterSlotsInternal = ToasterSlots & { bottomEnd?: Slot<'div'>; bottomStart?: Slot<'div'>; topEnd?: Slot<'div'>; topStart?: Slot<'div'>; top?: Slot<'div'>; bottom?: Slot<'div'>; }; /** * State used in rendering Toaster */ export declare type ToasterState = ComponentState & Pick & Pick & Pick, 'announce' | 'inline'> & { offset: ToasterOptions['offset'] | undefined; renderAriaLive: boolean; dir: 'rtl' | 'ltr'; }; /** * ToastFooter component */ export declare const ToastFooter: ForwardRefComponent; export declare const toastFooterClassNames: SlotClassNames; /** * ToastFooter Props */ export declare type ToastFooterProps = ComponentProps & {}; export declare type ToastFooterSlots = { root: Slot<'div'>; }; /** * State used in rendering ToastFooter */ export declare type ToastFooterState = ComponentState; export declare type ToastId = string; declare type ToastImperativeRef = { /** * Focuses the Toast. * If there are no focusable elements in the Toast, the Toast itself is focused. */ focus: () => void; /** * Resumes the timeout of a paused toast */ play: () => void; /** * Pauses the timeout of a toast */ pause: () => void; }; export declare type ToastIntent = 'info' | 'success' | 'error' | 'warning'; export declare type ToastOffset = Partial> | ToastOffsetObject; declare interface ToastOffsetObject { horizontal?: number; vertical?: number; } declare interface ToastOptions { /** * Uniquely identifies a toast, used for update and dismiss operations */ toastId: ToastId; /** * The position the toast should render to */ position: ToastPosition; /** * Toast content */ content: unknown; /** * Auto dismiss timeout in milliseconds * @default 3000 */ timeout: number; /** * Toast timeout pauses while focus is on another window * @default false */ pauseOnWindowBlur: boolean; /** * Toast timeout pauses while user cursor is on the toast * @default false */ pauseOnHover: boolean; /** * Toast belongs to a specific toaster */ toasterId: ToasterId | undefined; /** * Higher priority toasts will be rendered before lower priority toasts */ priority: number; /** * Used to determine [aria-live](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) narration * This will override the intent prop */ politeness?: ToastPoliteness; /** * Default toast types that determine the urgency or [aria-live](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) narration * The UI layer may use these intents to apply specific styling. * @default info */ intent?: ToastIntent; /** * Additional data that needs to be passed to the toast */ data: TData; /** * Reports changes to the Toast lifecycle */ onStatusChange: ToastChangeHandler | undefined; } export declare type ToastPoliteness = 'assertive' | 'polite'; export declare type ToastPosition = 'top-end' | 'top-start' | 'bottom-end' | 'bottom-start' | 'top' | 'bottom'; /** * Toast Props */ export declare type ToastProps = ComponentProps & { appearance?: BackgroundAppearanceContextValue; }; export declare type ToastSlots = { root: Slot<'div'>; }; /** * State used in rendering Toast */ export declare type ToastState = ComponentState & { backgroundAppearance: BackgroundAppearanceContextValue; }; export declare type ToastStatus = 'queued' | 'visible' | 'dismissed' | 'unmounted'; /** * ToastTitle component */ export declare const ToastTitle: ForwardRefComponent; export declare const toastTitleClassNames: SlotClassNames; /** * ToastTitle Props */ export declare type ToastTitleProps = ComponentProps & {}; export declare type ToastTitleSlots = { root: NonNullable>; media?: Slot<'div'>; action?: Slot<'div'>; }; /** * State used in rendering ToastTitle */ export declare type ToastTitleState = ComponentState & Pick & { backgroundAppearance: BackgroundAppearanceContextValue; }; /** * ToastTrigger component */ export declare const ToastTrigger: React_2.FC; /** * Props that are passed to the child of the ToastTrigger when cloned to ensure correct behaviour for the Toast */ export declare type ToastTriggerChildProps = ARIAButtonResultProps; export declare type ToastTriggerProps = TriggerProps & { /** * Disables internal trigger mechanism that ensures a child provided will be a compliant ARIA button. * @default false */ disableButtonEnhancement?: boolean; }; export declare type ToastTriggerState = { children: React_2.ReactElement | null; }; declare interface UpdateToastEventDetail extends Partial, CommonToastDetail { toastId: ToastId; } declare interface UpdateToastOptions extends UpdateToastEventDetail { root?: RootSlot; } /** * Create the state required to render Toast. * * The returned state can be modified with hooks such as useToastStyles_unstable, * before being passed to renderToast_unstable. * * @param props - props from this instance of Toast * @param ref - reference to root HTMLElement of Toast */ export declare const useToast_unstable: (props: ToastProps, ref: React_2.Ref) => ToastState; /** * Create the state required to render ToastBody. * * The returned state can be modified with hooks such as useToastBodyStyles_unstable, * before being passed to renderToastBody_unstable. * * @param props - props from this instance of ToastBody * @param ref - reference to root HTMLElement of ToastBody */ export declare const useToastBody_unstable: (props: ToastBodyProps, ref: React_2.Ref) => ToastBodyState; /** * Apply styling to the ToastBody slots based on the state */ export declare const useToastBodyStyles_unstable: (state: ToastBodyState) => ToastBodyState; /** * @param toasterId - If an id is provided all imperative methods control that specific toaster * @returns Imperative methods to control toasts */ export declare function useToastController(toasterId?: ToasterId): { dispatchToast: (content: React_2.ReactNode, options?: DispatchToastOptions) => void; dismissToast: (toastId: ToastId) => void; dismissAllToasts: () => void; updateToast: (options: UpdateToastOptions) => void; pauseToast: (toastId: ToastId) => void; playToast: (toastId: ToastId) => void; }; /** * Create the state required to render Toaster. * * @param props - props from this instance of Toaster */ export declare const useToaster_unstable: (props: ToasterProps) => ToasterState; /** * Apply styling to the Toaster slots based on the state */ export declare const useToasterStyles_unstable: (state: ToasterState) => ToasterState; /** * Create the state required to render ToastFooter. * * The returned state can be modified with hooks such as useToastFooterStyles_unstable, * before being passed to renderToastFooter_unstable. * * @param props - props from this instance of ToastFooter * @param ref - reference to root HTMLElement of ToastFooter */ export declare const useToastFooter_unstable: (props: ToastFooterProps, ref: React_2.Ref) => ToastFooterState; /** * Apply styling to the ToastFooter slots based on the state */ export declare const useToastFooterStyles_unstable: (state: ToastFooterState) => ToastFooterState; /** * Apply styling to the Toast slots based on the state */ export declare const useToastStyles_unstable: (state: ToastState) => ToastState; /** * Create the state required to render ToastTitle. * * The returned state can be modified with hooks such as useToastTitleStyles_unstable, * before being passed to renderToastTitle_unstable. * * @param props - props from this instance of ToastTitle * @param ref - reference to root HTMLElement of ToastTitle */ export declare const useToastTitle_unstable: (props: ToastTitleProps, ref: React_2.Ref) => ToastTitleState; /** * Apply styling to the ToastTitle slots based on the state */ export declare const useToastTitleStyles_unstable: (state: ToastTitleState) => ToastTitleState; /** * A non-visual component that wraps its child * and configures them to be the trigger that will close a `Toast`. * This component should only accept one child. * * This component sole purpose is to avoid opting out of the internal controlled open state of a `Toast` * Besides being a trigger that closes a toast through context this component doesn't do much, * making it basically unnecessary in cases where the trigger is outside of a toast. */ export declare const useToastTrigger_unstable: (props: ToastTriggerProps) => ToastTriggerState; export { }