@papernote/ui
Version:
A modern React component library with a paper notebook aesthetic - minimal, professional, and expressive
52 lines • 1.6 kB
TypeScript
import React from 'react';
import { InputProps } from './Input';
export interface CurrencyInputProps extends Omit<InputProps, 'type' | 'value' | 'onChange' | 'prefix'> {
/** Numeric value (not formatted) */
value?: number | string;
/** Callback when value changes (receives numeric value) */
onChange?: (value: number | null) => void;
/** Currency code (default: 'USD') */
currency?: string;
/** Locale for formatting (default: 'en-US') */
locale?: string;
/** Number of decimal places (default: 2) */
precision?: number;
/** Allow negative values (default: false) */
allowNegative?: boolean;
/** Minimum allowed value */
min?: number;
/** Maximum allowed value */
max?: number;
}
/**
* CurrencyInput - Specialized input for monetary values
*
* Automatically formats currency values with proper symbols and thousands separators.
* Handles parsing and validation of numeric currency input.
*
* @example Basic usage
* ```tsx
* <CurrencyInput
* label="Price"
* value={price}
* onChange={setPrice}
* currency="USD"
* />
* ```
*
* @example With validation
* ```tsx
* <CurrencyInput
* label="Budget"
* value={budget}
* onChange={setBudget}
* min={0}
* max={10000}
* validationState={budget > 10000 ? 'error' : null}
* validationMessage={budget > 10000 ? 'Exceeds maximum budget' : ''}
* />
* ```
*/
declare const CurrencyInput: React.ForwardRefExoticComponent<CurrencyInputProps & React.RefAttributes<HTMLInputElement>>;
export default CurrencyInput;
//# sourceMappingURL=CurrencyInput.d.ts.map