@wix/design-system
Version:
@wix/design-system
37 lines (32 loc) • 1.19 kB
TypeScript
import { DropdownLayoutProps } from '../DropdownLayout';
import InputWithOptions, {
InputWithOptionsProps,
ManualInputFnSignature,
OnSelectFnSignature,
} from '../InputWithOptions';
export interface DropdownPropsControlled extends InputWithOptionsProps {
/** Specifies selected option by its id. */
selectedId?: DropdownLayoutProps['selectedId'];
/** An initial selected option id. (Implies Uncontrolled mode) */
initialSelectedId?: never;
/** Controls whether a user can select a text of a selected value.
* @default true
*/
allowTextSelection?: boolean;
}
export interface DropdownPropsUncontrolled extends InputWithOptionsProps {
/** Specifies selected option by its id. */
selectedId?: never;
/** An initial selected option id. (Implies Uncontrolled mode) */
initialSelectedId?: DropdownLayoutProps['selectedId'];
/** Controls whether a user can select a text of a selected value.
* @default true
*/
allowTextSelection?: boolean;
}
export type DropdownProps = DropdownPropsControlled | DropdownPropsUncontrolled;
export default class Dropdown extends InputWithOptions<
ManualInputFnSignature,
OnSelectFnSignature,
DropdownProps
> {}