@canutin/svelte-currency-input
Version:
A fully-featured currency input component for Svelte 5 that handles formatting, localization, and validation
30 lines (29 loc) • 1.04 kB
TypeScript
import type { HTMLInputAttributes } from 'svelte/elements';
import type { IntlConfig, CurrencyInputValues } from './types';
type Props = Omit<HTMLInputAttributes, 'value'> & {
value?: string;
intlConfig?: IntlConfig;
prefix?: string;
suffix?: string;
decimalSeparator?: string;
groupSeparator?: string;
allowDecimals?: boolean;
decimalsLimit?: number;
decimalScale?: number;
fixedDecimalLength?: number;
allowNegativeValue?: boolean;
min?: number;
max?: number;
maxLength?: number;
step?: number;
disableGroupSeparators?: boolean;
disableAbbreviations?: boolean;
formatValueOnBlur?: boolean;
transformRawValue?: (rawValue: string) => string;
oninputvalue?: (values: CurrencyInputValues) => void;
onchangevalue?: (values: CurrencyInputValues) => void;
ref?: HTMLInputElement | null;
};
declare const CurrencyInput: import("svelte").Component<Props, {}, "value" | "ref">;
type CurrencyInput = ReturnType<typeof CurrencyInput>;
export default CurrencyInput;