UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

53 lines (52 loc) 2.21 kB
import { type CurrencyType, type CurrencyLang, type CurrencyISO } from '../../constants/currencies'; import { FieldPropsWithExtraValue } from '../../types'; import { FieldBlockWidth } from '../../FieldBlock'; import { AutocompleteAllProps } from '../../../../components/autocomplete/Autocomplete'; export type CurrencyFilterSet = 'Scandinavia' | 'Nordic' | 'Europe' | 'Prioritized'; export type { CurrencyType }; export type Props = FieldPropsWithExtraValue<CurrencyISO, CurrencyType, undefined | string> & { /** * Lists only the currencies you want to show. Can be `Scandinavia`, `Nordic`, `Europe` or `Prioritized`. * Defaults to `Prioritized`. */ currencies?: CurrencyFilterSet; /** * Use this prop to filter out certain currencies. The function receives the currency object and should return a boolean. Returning `false` will omit the currency. */ filterCurrencies?: (currency: CurrencyType) => boolean; /** * For internal testing purposes */ noAnimation?: boolean; /** * The width of the component. */ width?: FieldBlockWidth; /** * The size of the component. */ size?: AutocompleteAllProps['size']; }; declare function SelectCurrency(props: Props): import("react/jsx-runtime").JSX.Element; declare namespace SelectCurrency { var _supportsSpacingProps: boolean; } type GetCurrencyData = { lang?: CurrencyLang; filter?: Props['filterCurrencies']; enableSort?: Extract<CurrencyFilterSet, 'Prioritized'>; enableSearch?: boolean; makeObject?: (currency: CurrencyType, lang: string) => { selectedKey: string; selected_value: string; content: string[]; }; }; export declare function getCurrencyData({ lang, filter, enableSort, enableSearch, makeObject, }?: GetCurrencyData): { selectedKey: string; selected_value: string; content: string[]; }[]; export declare function currencyFilter(currency: CurrencyType, filterCurrencies: (currency: CurrencyType) => boolean, ccFilter: CurrencyFilterSet): boolean; export declare function makeCurrencyFilterSet(ccFilter: CurrencyFilterSet): (currency: CurrencyType) => boolean; export default SelectCurrency;