UNPKG

@funkit/connect

Version:

Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.

46 lines (45 loc) 1.91 kB
import React from 'react'; import type { BaseActiveDropdownItemProps } from './BaseActiveDropdownItem'; export interface AccountSelectOption { /** Stable identifier, also the dropdown's selected value. */ value: string; label: string; /** Secondary line under the label, e.g. a formatted balance. */ description?: React.ReactNode; } export interface AccountSelectAction { /** Stable id; must not collide with an account {@link AccountSelectOption.value}. */ id: string; label: string; icon?: React.ReactNode; onSelect: () => void; } export interface AccountSelectDropdownProps { accounts: AccountSelectOption[]; selectedValue: string; onSelect: (value: string) => void; /** * Optional row rendered below the accounts, separated by a divider — e.g. a * "Transfer between accounts" action. It carries no selected state. */ action?: AccountSelectAction; /** Secondary prefix shown on the trigger, e.g. "Deposit to". */ prefixLabel?: string; /** Field label rendered above the trigger. */ label?: string; size?: BaseActiveDropdownItemProps['size']; /** * Fixed width (px) of the options popover. Defaults to the trigger width; * set this to make the popover narrower than the (full-width) trigger. The * popover is right-aligned to the trigger. */ dropdownWidth?: number; testId?: string; } /** * A dropdown for picking between a small set of accounts (each with a balance * subline + a selected check), with an optional trailing action row below a * divider. Built on {@link BaseDropdown}; selection routes through each * {@link BaseDropdownItem} so Radix closes the menu on choose. */ export declare function AccountSelectDropdown({ accounts, selectedValue, onSelect, action, prefixLabel, label, size, dropdownWidth, testId, }: AccountSelectDropdownProps): React.JSX.Element;