@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
46 lines (45 loc) • 1.69 kB
TypeScript
/**
* MSKCC DSM 2021, 2023
*/
import PropTypes from 'prop-types';
import React, { type ElementType, type Ref } from 'react';
import { type PolymorphicProps } from '../../types/common';
type LinkBaseProps<E extends ElementType> = {
/**
* @deprecated Use `as` instead
*/
element?: E | undefined;
ref?: Ref<E>;
};
export type LinkProps<E extends ElementType> = PolymorphicProps<E, LinkBaseProps<E>>;
/**
* Link is a custom component that allows us to supporting rendering elements
* other than `a` in our markup. The goal is to allow users to support passing
* in their own components to support use-cases like `react-router` or
* `@reach/router`
*/
declare const Link: (<E extends React.ElementType<any> = "a">(props: LinkProps<E>) => JSX.Element) & {
displayName?: string | undefined;
propTypes?: React.WeakValidationMap<LinkProps<any>> | undefined;
};
declare const LinkPropTypes: {
/**
* Provide a custom element or component to render the top-level node for the
* component.
*/
as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
/**
* The base element to use to build the link. Defaults to `a`, can also accept
* alternative tag names or custom components like `Link` from `react-router`.
* @deprecated Use `as` instead
*
*/
element: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
/**
* Property to indicate if the side nav container is open (or not). Use to
* keep local state and styling in step with the SideNav expansion state.
*/
isSideNavExpanded: PropTypes.Requireable<boolean>;
};
export { LinkPropTypes };
export default Link;