import React from 'react'; import PropTypes from 'prop-types'; /** @public */ type NavigationProviderClickHandler = (event: React.MouseEvent, data: { openInNewContext?: boolean; to: string; originalTo: string; label?: string; }) => void; type NavigationProviderTransformUrl = (url: string, data: { isInternal?: boolean; isRootRelative?: boolean; }) => string; interface NavigationProviderProps { children?: React.ReactNode; /** * An `onClick` handler to use when a link is clicked if no other `onClick` handler is supplied. * The function takes the event and an options argument with `to` and `openInNewContext` */ onClick?: NavigationProviderClickHandler; /** * Triggers when a link is clicked, even if the link has its own `onClick` handler. * The function takes the event and an options argument with `to` and `openInNewContext` */ onLinkClick?: NavigationProviderClickHandler; /** * If set, all links that use the NavigationProvider's context will be transformed using this function. */ transformUrl?: NavigationProviderTransformUrl; } type NavigationContextValue = { onClick?: NavigationProviderClickHandler; onLinkClick?: NavigationProviderClickHandler; transformUrl?: NavigationProviderTransformUrl; }; declare const NavigationContext: React.Context; /** * Used to provide an override for the `onClick` for links for single page applications so that * internal links can navigate without a page reload. */ declare function NavigationProvider({ children, onClick, onLinkClick, transformUrl, }: NavigationProviderProps): React.JSX.Element; declare namespace NavigationProvider { var propTypes: { children: PropTypes.Requireable; onClick: PropTypes.Requireable<(...args: any[]) => any>; onLinkClick: PropTypes.Requireable<(...args: any[]) => any>; transformUrl: PropTypes.Requireable<(...args: any[]) => any>; }; } export { NavigationContext, NavigationProvider, NavigationProviderClickHandler, NavigationProviderTransformUrl, };