@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
87 lines (86 loc) • 2.75 kB
TypeScript
/**
* HTML Element
*
*/
import React from 'react';
import type { IconIcon } from '../icon/Icon';
import type { SkeletonShow } from '../skeleton/Skeleton';
import type { DynamicElement, SpacingProps } from '../../shared/types';
type ReactRouterLink = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {
to: string | {
pathname?: string;
search?: string;
has?: string;
};
};
export type AnchorProps = {
element?: DynamicElement<HTMLAnchorElement | AnchorAllProps> | React.ForwardRefExoticComponent<ReactRouterLink & React.RefAttributes<HTMLAnchorElement>>;
href?: string;
to?: string;
targetBlankTitle?: string;
target?: string;
tooltip?: React.ReactNode;
icon?: IconIcon;
iconPosition?: 'left' | 'right';
skeleton?: SkeletonShow;
omitClass?: boolean;
innerRef?: React.RefObject<HTMLAnchorElement>;
/** @deprecated use innerRef instead */
inner_ref?: React.RefObject<HTMLAnchorElement>;
/**
* Removes default animation.
* Default: `false`
*/
noAnimation?: boolean;
/**
* Removes default styling.
* Default: `false`
*/
noStyle?: boolean;
/**
* Removes default hover style.
* Default: `false`
*/
noHover?: boolean;
/**
* Removes underline.
* Default: `false`
*/
noUnderline?: boolean;
/**
* Removes Icon.
* Default: `false`
*/
noIcon?: boolean;
/**
* Removes Launch Icon.
* Default: `false`
*/
noLaunchIcon?: boolean;
/**
* Disables the Anchor element.
* Default: `false`
*/
disabled?: boolean;
};
export type AnchorAllProps = AnchorProps & Omit<React.HTMLProps<HTMLAnchorElement>, 'ref'> & SpacingProps;
export declare function AnchorInstance(localProps: AnchorAllProps): import("react/jsx-runtime").JSX.Element;
declare const Anchor: React.ForwardRefExoticComponent<AnchorProps & Omit<React.HTMLProps<HTMLAnchorElement>, "ref"> & import("../space/types").SpacingElementProps & {
space?: import("../space/types").SpaceTypeAll;
innerSpace?: import("../space/types").SpaceTypeAll | import("../space/types").SpaceTypeMedia;
} & React.RefAttributes<HTMLAnchorElement>>;
export default Anchor;
/**
* @deprecated – can be removed in v11
*/
export declare function scrollToHashHandler(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>): {
element: HTMLElement;
};
export declare function scrollToHash(hash: string): {
element: HTMLElement;
};
export declare function pickIcon(icon: any, className?: string): React.DetailedReactHTMLElement<{
key: string;
className: string;
}, HTMLElement>;
export declare const opensNewTab: (target: string, href: string) => boolean;