import React from 'react'; import PropTypes from 'prop-types'; import { ComponentProps } from '../utils/types'; type OptionClickHandler = (event: React.MouseEvent, data: { value: string; }) => void; interface OptionPropsBase { /** @private */ active?: boolean; /** * Additional information to explain the option, such as "Recommended". */ description?: string; /** * The description text may appear to the right of the label or under the label. */ descriptionPosition?: 'right' | 'bottom'; /** * If disabled=true, the option is grayed out and cannot be clicked. */ disabled?: boolean; /** * A React ref which is set to the DOM element when the component mounts and null when it unmounts. */ elementRef?: React.Ref; /** * The icon to show before the label. See the @splunk/react-icons package for * drop in icons. * * Caution: The element(s) passed here must be pure. All icons in the react-icons package are pure. */ icon?: React.ReactNode; /** * When provided, `label` is rendered instead of the `value` and used for matching. */ label?: string; /** * Sections of the label string to highlight as a match. This is automatically set for * uncontrolled filters, so it's not normally necessary to set this property when using * filtering. */ matchRanges?: { start: number; end: number; }[]; /** @private */ onClick?: OptionClickHandler; /** * When `true`, wrapping is disabled and any additional text is ellipsised. */ truncate?: boolean; /** * The value of this option and the label shown for it. */ value: string; } type OptionProps = ComponentProps; /** * An option within a `ComboBox`. */ declare function Option({ active, description, descriptionPosition, disabled, elementRef, icon, label, matchRanges, onClick, truncate, value, ...otherProps }: OptionProps): React.JSX.Element; declare namespace Option { var propTypes: { /** @private */ active: PropTypes.Requireable; description: PropTypes.Requireable; descriptionPosition: PropTypes.Requireable; disabled: PropTypes.Requireable; elementRef: PropTypes.Requireable; icon: PropTypes.Requireable; label: PropTypes.Requireable; matchRanges: PropTypes.Requireable<(PropTypes.InferProps<{ start: PropTypes.Validator; end: PropTypes.Validator; }> | null | undefined)[]>; /** @private */ onClick: PropTypes.Requireable<(...args: any[]) => any>; truncate: PropTypes.Requireable; value: PropTypes.Validator; }; var as: string; } export default Option; export { OptionClickHandler };