import React from 'react'; import { Divider, Heading } from '@splunk/react-ui/Menu'; import Option from './Option'; import { ComponentProps } from '../utils/types'; /** @public */ type SearchChangeHandler = (event: React.ChangeEvent | React.MouseEvent | React.KeyboardEvent, data: { name?: string; value: string; }) => void; /** @public */ type SearchBlurHandler = (event: React.FocusEvent, data: { name?: string; value: string; }) => void; /** @public */ type SearchFocusHandler = (event: React.FocusEvent, data: { name?: string; value: string; }) => void; interface SearchPropsBase { animateLoading?: boolean; /** Append removes rounded borders and the border from the right side. */ append?: boolean; /** All children must be instances of `Search.Option`. */ children?: React.ReactNode; /** * The default placement of the dropdown menu. It might be rendered in a different direction * depending upon the space available. */ defaultPlacement?: 'above' | 'below' | 'vertical'; /** The initial value of the input. Only applicable in uncontrolled mode. */ defaultValue?: string; /** * The id of the description. */ describedBy?: string; disabled?: boolean; /** * A React ref which is set to the DOM element when the component mounts and null when it unmounts. */ elementRef?: React.Ref; /** * Highlight the field as having an error. The border and text will turn red. */ error?: boolean; /** * The footer message can show additional information, such as a truncation message. */ footerMessage?: React.ReactNode; /** Make the control an inline block with variable width. */ inline?: boolean; /** * A React ref which is set to the input element when the component mounts and null when it unmounts. */ inputRef?: React.Ref; isLoadingOptions?: boolean; /** * The id of the label. */ labelledBy?: string; /** * The loading message to show when isLoadingOptions. */ loadingMessage?: React.ReactNode; menuStyle?: React.CSSProperties; /** The name is returned with onChange events, which can be used to identify the * control when multiple controls share an onChange callback. */ name?: string; /** * The noOptionsMessage is shown when there are no children and it's not loading, such as when * there are no Options matching the filter. This can be customized to the type of content, * for example: "No matching dashboards". You can insert content such as an error message or * communicate a minimum number of characters to enter to see results. */ noOptionsMessage?: React.ReactNode; onBlur?: SearchBlurHandler; onChange?: SearchChangeHandler; onFocus?: SearchFocusHandler; onKeyDown?: React.KeyboardEventHandler; /** * A callback function invoked when the menu is scrolled. */ onScroll?: React.UIEventHandler; onSelect?: React.ReactEventHandler; /** * A callback function invoked when the popover closes. */ onClose?: () => void; /** * A callback function invoked when the popover opens. */ onOpen?: () => void; placeholder?: string; /** Prepend removes rounded borders from the left side. */ prepend?: boolean; /** The value of the input. Only applicable in controlled mode. */ value?: string; } interface SearchPropsBaseControlled extends SearchPropsBase { defaultValue?: never; onChange: SearchChangeHandler; value?: string; } interface SearchPropsBaseUncontrolled extends SearchPropsBase { defaultValue?: string; value?: never; } type SearchProps = ComponentProps; declare function Search({ animateLoading, append, children, defaultPlacement, defaultValue, describedBy, disabled, elementRef, error, footerMessage, inline, inputRef, isLoadingOptions, labelledBy, loadingMessage, menuStyle, name, noOptionsMessage, onChange, onClose, onFocus, onKeyDown, onOpen, placeholder, prepend, value: propValue, ...otherProps }: SearchProps): React.JSX.Element; declare namespace Search { var propTypes: React.WeakValidationMap; var Option: typeof import("./Option").default; var Divider: typeof import("@splunk/react-ui/Menu").Divider; var Heading: typeof import("@splunk/react-ui/Menu").Heading; } export default Search; export { SearchBlurHandler, SearchChangeHandler, SearchFocusHandler, Option, Divider, Heading, SearchProps, SearchPropsBase, SearchPropsBaseControlled, SearchPropsBaseUncontrolled, };