import React from 'react'; import PropTypes from 'prop-types'; import Body from './Body'; import Footer from './Footer'; import Header from './Header'; import { ComponentProps } from '../utils/types'; /** @public */ type CardClickHandler = (event: React.MouseEvent, data: { selected: boolean; value?: any; }) => void; interface CardPropsBase { /** * Any children that can be rendered can be passed to the `Card`. * * To use the default Splunk UI `Card` styles, use the * `Card.Header`, `Card.Body`, and `Card.Footer`. */ children?: React.ReactNode; /** * A React ref which is set to the DOM element when the component mounts and null when it unmounts. */ elementRef?: React.Ref; /** @private */ margin?: number; /** @private */ minWidth?: number | string; /** @private */ maxWidth?: number | string; /** * Callback when the `Card` is clicked. */ onClick?: CardClickHandler; /** * To open the `to` link in a new window, set `openInNewContext` to `true`. */ openInNewContext?: boolean; /** * Renders `Card` as selected if set to `true`. Use only when `onClick` is also provided. * @deprecated This prop is deprecated and will be removed in the next major version. */ selected?: boolean; /** * Takes a URL to go to when the `Card` is clicked. */ to?: string; /** Returns a value on click. Use when composing or if you have more than one selectable `Card`. */ value?: any; /** Overrides the HTML tag for the Card component. Defaults to `article`. Ignored if `to` or `onClick` are present. */ tag?: 'article' | 'div' | 'aside' | 'section'; } interface CardPropsBaseNonClickable extends CardPropsBase { elementRef?: React.Ref; onClick?: never; selected?: never; to?: never; } interface CardPropsBaseOnClickClickable extends CardPropsBase { elementRef?: React.Ref; onClick: CardClickHandler; selected?: boolean; to?: string; tag?: never; } interface CardPropsBaseClickable extends CardPropsBase { elementRef?: React.Ref; onClick?: CardClickHandler; selected?: never; to?: string; tag?: never; } type CardNonClickableProps = ComponentProps; type CardClickableButtonProps = ComponentProps; type CardClickableLinkProps = ComponentProps; type CardProps = CardNonClickableProps | CardClickableButtonProps | CardClickableLinkProps; declare function Card(props: CardProps): React.JSX.Element; declare namespace Card { var propTypes: { children: PropTypes.Requireable; elementRef: PropTypes.Requireable; /** @private */ margin: PropTypes.Requireable; /** @private */ maxWidth: PropTypes.Requireable>; /** @private */ minWidth: PropTypes.Requireable>; onClick: PropTypes.Requireable<(...args: any[]) => any>; openInNewContext: PropTypes.Requireable; selected: PropTypes.Requireable; to: PropTypes.Requireable; value: PropTypes.Requireable; tag: PropTypes.Requireable; }; var Header: typeof import("./Header").default; var Body: typeof import("./Body").default; var Footer: typeof import("./Footer").default; } export default Card; export { CardClickHandler, Header, Body, Footer };