import React from 'react'; import { OptionClickHandler as OptionBaseClickHandler } from '@splunk/react-ui/SelectBase'; import { ComponentProps } from '../utils/types'; interface OptionPropsBase { /** @private */ active?: boolean; /** * When provided, `children` is rendered instead of the `label`. * * Caution: The element(s) passed here must be pure. */ children?: React.ReactNode; /** * 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'; /** * Prevents user interaction and adds disabled styling. * * If set to `dimmed`, the component is able to receive focus. * If set to `disabled`, the component is unable to receive focus (as a result of setting the html `disabled` attribute). */ disabled?: boolean | 'dimmed' | 'disabled'; /** * A React ref which is set to the DOM element when the component mounts, and null when it unmounts. */ elementRef?: React.Ref; /** * Allow the endAdornment to be passed to the underlying Menu.Item. * @private */ endAdornment?: React.ReactNode; /** * Adding hidden options can be useful for resolving the selected display label and icon, * when the option should not be in the list. This scenario can arise when Select's filter is * controlled, because the selected item may be filtered out; and when a legacy option is * valid, but should no longer be displayed as a selectable option. */ hidden?: boolean; /** * 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; /** * The text to show for the option when `children` is not defined. When filtering, the * `label` is used for matching to the filter text. */ 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?: OptionBaseClickHandler; /** @private */ role?: 'menuitemcheckbox' | 'option'; /** @private */ selected?: boolean; /** * When `true`, wrapping is disabled and any additional text is ellipsised. */ truncate?: boolean; /** * The label and/or icon will be placed on the Control's toggle if it matches this value. */ value: string | number | boolean; } type OptionProps = ComponentProps; /** * An option within a `Select`. Any elements passed to it should be memoized. */ declare function Option({ children, descriptionPosition, disabled, elementRef, label, ...otherProps }: OptionProps): React.JSX.Element; declare const OptionMemoized: React.MemoExoticComponent; export default OptionMemoized; export type { OptionBaseClickHandler, OptionPropsBase };