wix-style-react
Version:
wix-style-react
207 lines • 13 kB
TypeScript
export default Search;
/**
* Search component with suggestions based on input value listed in dropdown
*/
declare class Search extends React.Component<any, any, any> {
static contextType: React.Context<import("../WixStyleReactDefaultsOverrideProvider").WixStyleReactDefaultsOverride>;
static displayName: string;
static propTypes: {
/** Associate a control with the regions that it controls */
ariaControls: PropTypes.Requireable<string>;
/** Associate a region with its descriptions. Similar to aria-controls but instead associating descriptions to the region and description identifiers are separated with a space. */
ariaDescribedby: PropTypes.Requireable<string>;
/** Define a string that labels the current element in case where a text label is not visible on the screen */
ariaLabel: PropTypes.Requireable<string>;
/** Sets the value of native autocomplete attribute (consult the [HTML spec](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete) for possible values) */
autocomplete: PropTypes.Requireable<string>;
/** Focus the element on mount (standard React input autoFocus) */
autoFocus: PropTypes.Requireable<boolean>;
/** Control the border style of input */
border: PropTypes.Requireable<string>;
/** Specifies a CSS class name to be appended to the component’s root element */
className: PropTypes.Requireable<string>;
/** Displays clear button (X) on a non-empty input */
clearButton: PropTypes.Requireable<boolean>;
/** Closes DropdownLayout when option is selected */
closeOnSelect: PropTypes.Requireable<boolean>;
/** Applies a data-hook HTML attribute that can be used in the tests */
dataHook: PropTypes.Requireable<string>;
/** Specifies the `onChange` debounce in milliseconds */
debounceMs: PropTypes.Requireable<number>;
/** Defines the initial value of an input for those who want to use this component un-controlled */
defaultValue: PropTypes.Requireable<string>;
/** Specifies whether the input should be disabled or not */
disabled: PropTypes.Requireable<boolean>;
/** Restricts input editing */
disableEditing: PropTypes.Requireable<boolean>;
/** Sets the width of the dropdown in pixels */
dropdownWidth: PropTypes.Requireable<string>;
/** Specifies whether to collapse input to search icon only. Once clicked, icon will expand to a full search input. */
expandable: PropTypes.Requireable<boolean>;
/** Specifies the width of an input in an expanded state */
expandWidth: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
/** USED FOR TESTING - forces focus state on the input */
forceFocus: PropTypes.Requireable<boolean>;
/** USED FOR TESTING - forces hover state on the input */
forceHover: PropTypes.Requireable<boolean>;
/** Specifies whether there are more items to be loaded */
hasMore: PropTypes.Requireable<boolean>;
/** Specifies whether the status suffix should be hidden */
hideStatusSuffix: PropTypes.Requireable<boolean>;
/** Highlight word parts that match search criteria in bold */
highlight: PropTypes.Requireable<boolean>;
/** Assigns an unique identifier for the root element */
id: PropTypes.Requireable<string>;
/** Specifies whether lazy loading of the dropdown layout items is enabled */
infiniteScroll: PropTypes.Requireable<boolean>;
/** Defines a callback function which is called on a request to render more list items */
loadMore: PropTypes.Requireable<(...args: any[]) => any>;
/** Sets the maximum height of the `dropdownLayout` in pixels */
maxHeightPixels: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
/** Sets the maximum number of characters that can be entered into a field */
maxLength: PropTypes.Requireable<number>;
/** Sets the minimum width of dropdownLayout in pixels */
minWidthPixels: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
/** Reference element data when a form is submitted */
name: PropTypes.Requireable<string>;
/** Specifies whether input shouldn’t have rounded corners on its left */
noLeftBorderRadius: PropTypes.Requireable<boolean>;
/** Specifies whether input shouldn’t have rounded corners on its right */
noRightBorderRadius: PropTypes.Requireable<boolean>;
/** Defines a standard input `onBlur` callback */
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a standard input `onChange` callback */
onChange: PropTypes.Requireable<(...args: any[]) => any>;
/** Displays clear button (X) on a non-empty input and calls a callback function with no arguments */
onClear: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called whenever the user presses the escape key */
onClose: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function called on `compositionstart`/`compositionend` events */
onCompositionChange: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback handler that is called when the presses -enter- */
onEnterPressed: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback handler that is called when the user presses -escape- */
onEscapePressed: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a standard input `onFocus` callback */
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a standard input `onClick` callback */
onInputClicked: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a standard input `onKeyDown` callback */
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a standard input `onKeyUp` callback */
onKeyUp: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called when the user performs a submit action. Submit action triggers are:
* "Enter", "Tab", [typing any defined delimiters], paste action.
* `onManuallyInput(values: Array<string>): void` - the array of strings is the result of splitting the input value by the given delimiters */
onManuallyInput: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called whenever the user enters dropdown layout with the mouse cursor */
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called whenever the user exits from dropdown layout with a mouse cursor */
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called whenever an option becomes focused (hovered/active). Receives the relevant option object from the original `props.options array`. */
onOptionMarked: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called when options dropdown is hidden */
onOptionsHide: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called when the options dropdown is shown */
onOptionsShow: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback handler that is called when user pastes text from a clipboard (using mouse or keyboard shortcut) */
onPaste: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called whenever user selects a different option in the list */
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
/** Array of objects:
* - `id <string / number>` *required*: the id of the option, should be unique;
* - value `<function / string / node>` *required*: can be a string, react element or a builder function;
* - disabled `<bool>` *default value- false*: whether this option is disabled or not;
* - linkTo `<string>`: when provided the option will be an anchor to the given value;
* - title `<bool>` *default value- false* **deprecated**: please use `listItemSectionBuilder` for rendering a title;
* - overrideStyle `<bool>` *default value- false* **deprecated**: please use `overrideOptionStyle` for override option styles;
* - overrideOptionStyle `<bool>` *default value- false* - when set to `true`, the option will be responsible for its own styles. No styles will be applied from the DropdownLayout itself;
* - label `<string>`: the string displayed within an input when the option is selected. This is used when using `<DropdownLayout/>` with an `<Input/>`.
*/
options: PropTypes.Requireable<any[]>;
/** Handles container overflow */
overflow: PropTypes.Requireable<string>;
/** Sets a pattern that the typed value must match to be valid (regex) */
pattern: PropTypes.Requireable<string>;
/** Sets a placeholder message to display */
placeholder: PropTypes.Requireable<string>;
/** Allows to pass common popover props. Check `<Popover/>` API for a full list. */
popoverProps: PropTypes.Requireable<PropTypes.InferProps<{
appendTo: PropTypes.Requireable<string>;
maxWidth: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
minWidth: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
flip: PropTypes.Requireable<boolean>;
fixed: PropTypes.Requireable<boolean>;
placement: PropTypes.Requireable<string>;
dynamicWidth: PropTypes.Requireable<boolean>;
}>>;
/** Defines a custom function for options filtering */
predicate: PropTypes.Requireable<(...args: any[]) => any>;
/** Specifies whether input is read only */
readOnly: PropTypes.Requireable<boolean>;
/** Specifies that an input must be filled out before submitting the form */
required: PropTypes.Requireable<boolean>;
/** Specifies selected option by its id */
selectedId: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
/** Controls whether to show options if input is empty */
showOptionsIfEmptyInput: PropTypes.Requireable<boolean>;
/** Controls the size of the input */
size: PropTypes.Requireable<string>;
/** Specify the status of a field */
status: PropTypes.Requireable<string>;
/** Defines the message to display on status icon hover. If not given or empty there will be no tooltip. */
statusMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
/** Indicates that element can be focused and where it participates in sequential keyboard navigation */
tabIndex: PropTypes.Requireable<number>;
/** Handles text overflow behavior. It can either `clip` (default) or display `ellipsis`. */
textOverflow: PropTypes.Requireable<string>;
/** Controls the placement of a status tooltip */
tooltipPlacement: PropTypes.Requireable<string>;
/** Specifies the type of `<input>` element to display. The default type is text. */
type: PropTypes.Requireable<string>;
/** Specifies the current value of the element */
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
};
static defaultProps: any;
constructor(props: any);
_onChangeHandler: any;
state: {
inputValue: any;
collapsed: any;
};
searchInput: React.RefObject<any>;
componentDidUpdate(prevProps: any): void;
/**
* Creates an onChange debounced function
*/
_createDebouncedOnChange: () => any;
_getIsControlled: () => boolean;
_getFilteredOptions: () => any;
_stringFilter: (option: any) => boolean;
_onChange: (e: any) => void;
_onClear: (event: any) => void;
_onClearHandler: (event: any) => void;
_currentValue: () => any;
_onFocus: (event: any) => void;
_onBlur: (event: any) => Promise<void>;
_onWrapperClick: () => void;
_onWrapperMouseDown: (e: any) => void;
/**
* Sets focus on the input element
*/
focus: () => void;
/**
* Removes focus on the input element
*/
blur: () => void;
/**
* Clears the input.
*
* @param event
*/
clear: (event: any) => void;
render(): React.JSX.Element;
}
import React from 'react';
import PropTypes from 'prop-types';
//# sourceMappingURL=Search.d.ts.map