@wix/design-system
Version:
@wix/design-system
60 lines • 3.14 kB
TypeScript
import * as React from 'react';
import { DropdownLayoutOption, DropdownLayoutValueOption } from '../DropdownLayout';
import { ManualInputFnSignature } from '../InputWithOptions';
import { PopoverCommonProps } from '../common';
import { STATUS, BORDER, SIZE } from './AddressInput.constants';
import { ValuesOf } from '../utils/typeUtils';
export interface AddressInputProps {
/** Applies a data-hook HTML attribute that can be used in the tests. */
dataHook?: string;
/** Specifies a CSS class name to be appended to the component’s root element.
* @internal
*/
className?: string;
/** Displays a clear button (X) on a non-empty input. */
clearButton?: boolean;
/** Aria label for the clear button */
clearButtonAriaLabel?: string;
/** Sets the initial input value. */
initialValue?: string;
/** Sets a value to display (controlled mode). */
value?: string;
/** Specifies whether input is disabled. */
disabled?: boolean;
/** Defines a callback function which is called whenever a user selects a different option in the list. */
onSelect?: (option: DropdownLayoutValueOption) => void;
/** Defines a callback function which is called when user performs a submit action.
* Submit-Action triggers are: "Enter", "Tab".
*/
onManuallyInput?: ManualInputFnSignature;
/** Defines a callback function which is called every time input value is changed. */
onChange?: React.ChangeEventHandler<HTMLInputElement>;
/** Defines a standard input onFocus callback. */
onFocus?: (e?: React.FocusEvent<HTMLInputElement>) => void;
/** Defines a standard input onBlur callback. */
onBlur?: React.FocusEventHandler<HTMLInputElement>;
/** Specifies whether input is auto selected on focus. */
autoSelect?: boolean;
/** Defines a handler for getting notified upon a clear event. When passed, it displays a clear button in the input. */
onClear?: () => void;
/** Specify an array of options to render. When the option is an {optionProps}, the <AddressInput.Option/> component will be rendered on behalf of the user. */
options?: DropdownLayoutOption[];
/** Specify the status of a field. Mostly used for “loading” indication upon async request calls. */
status?: AddressInputStatus;
/** Defines the message to display on status icon hover. If not given or empty there will be no tooltip. */
statusMessage?: React.ReactNode;
/** Control the border style of an input. */
border?: AddressInputBorder;
/** Controls the size of the input. Default value: `medium`. */
size?: AddressInputSize;
/** Sets a placeholder message to display. */
placeholder?: string;
/** Sets the message to show in a dropdown when no results are found. */
noResultsText?: React.ReactNode;
/** Allows to pass common popover props. */
popoverProps?: PopoverCommonProps;
}
export type AddressInputStatus = ValuesOf<typeof STATUS>;
export type AddressInputBorder = ValuesOf<typeof BORDER>;
export type AddressInputSize = ValuesOf<typeof SIZE>;
//# sourceMappingURL=AddressInput.types.d.ts.map