import React from 'react'; import PropTypes from 'prop-types'; import { ComponentProps } from '../utils/types'; /** @public */ type ChipRequestRemoveHandler = (event: React.MouseEvent, data: { value?: any; }) => void; interface ChipPropsBase { /** * Sets the severity or type of this `Chip`. * Setting this prop causes the `backgroundColor` prop to be ignored. */ appearance?: 'info' | 'success' | 'warning' | 'error' | 'outline'; /** * Changes the background color of the `Chip`. * Hexadecimal colors and valid color names are allowed, such as `#ffffff` or `white`. * If the `appearance` prop is set, this prop is ignored. */ backgroundColor?: string; children: React.ReactNode; /** Disables the `Chip`. */ disabled?: boolean; /** A React ref which is set to the DOM element when the component mounts and null when it unmounts. */ elementRef?: React.Ref; /** * Changes the text and icon color of the `Chip`. * Hexadecimal colors and valid color names are allowed, such as `#ffffff` or `white`. */ foregroundColor?: string; /** The icon to show before the label. See the Icon component for more information. */ icon?: React.ReactNode; /** Includes a remove button if callback is set. */ onRequestRemove?: ChipRequestRemoveHandler; /** Includes this value in `onRequestRemove` callbacks. */ value?: any; } type ChipInteractiveProps = ComponentProps & { elementRef?: React.Ref; onRequestRemove: ChipRequestRemoveHandler; }; type ChipNonInteractiveProps = ComponentProps & { elementRef?: React.Ref; onRequestRemove?: never; }; type ChipProps = ChipInteractiveProps | ChipNonInteractiveProps; declare function Chip(props: ChipProps): React.JSX.Element; declare namespace Chip { var propTypes: { appearance: PropTypes.Requireable; backgroundColor: PropTypes.Requireable; children: PropTypes.Validator>; disabled: PropTypes.Requireable; elementRef: PropTypes.Requireable; foregroundColor: PropTypes.Requireable; icon: PropTypes.Requireable; onRequestRemove: PropTypes.Requireable<(...args: any[]) => any>; /** Includes this value in `onRequestRemove` callbacks. */ value: PropTypes.Requireable; }; } export default Chip; export { ChipInteractiveProps, ChipNonInteractiveProps, ChipRequestRemoveHandler };