@carbon/ibm-products
Version:
Carbon for IBM Products
62 lines • 2.71 kB
TypeScript
/**
* Copyright IBM Corp. 2024, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { PropsWithChildren, ReactNode } from 'react';
import PropTypes from 'prop-types';
type Scopes = string[] | object[];
export interface SearchBarProps extends PropsWithChildren {
/** @type {string} Optional additional class name. */
className?: string;
/** @type {string} The label text for the search text input. */
clearButtonLabelText: string;
/**
* Whether or not the scopes MultiSelect label is visually hidden.
*/
hideScopesLabel?: boolean;
/** @type {string} The label text for the search text input. */
labelText: string;
/** @type {Function} Function handler for when the user changes their query search. */
onChange?: (event: any) => void;
/** @type {Function} Function handler for when the user submits a search. */
onSubmit?: (event: any) => void;
/** @type {string} Placeholder text to be displayed in the search input. */
placeholderText: string;
/** @type {Function} Function to get the text for each scope to display in dropdown. */
scopeToString?: (item: string | object) => string;
/** @type {Array<any>} Array of allowed search scopes. */
scopes?: Scopes;
/** @type {string} The name text for the search scope type. */
scopesTypeLabel?: NonNullable<ReactNode>;
/** @type {Array<any> Array of initially selected search scopes. */
selectedScopes?: Scopes;
/**
* Optional custom sorting algorithm for an array of scope items.
* By default, scope items are sorted in ascending alphabetical order,
* with "selected" items moved to the start of the scope items array.
*/
sortItems?: (items: readonly unknown[]) => unknown[];
/** @type {string} The label text for the search submit button. */
submitLabel: string;
/**
* Provide accessible label text for the scopes MultiSelect.
*/
titleText?: string;
/** @type {func} Callback function for translating MultiSelect's child ListBoxMenuIcon SVG title. */
translateWithId?: (messageId: 'close.menu' | 'open.menu' | 'clear.all' | 'clear.selection') => string;
/** @type {string} Search query value. */
value?: string;
}
export declare const SearchBar: React.ForwardRefExoticComponent<SearchBarProps & React.RefAttributes<HTMLFormElement>>;
export declare const deprecatedProps: {
/**
* **Deprecated**
*
* Provide accessible label text for the scopes MultiSelect.
*/
titleText: PropTypes.Requireable<string>;
};
export {};
//# sourceMappingURL=SearchBar.d.ts.map