- README: Removed the Bundlephobia badge (Shields.io often rate-limits the upstream API on npm).
- Currency default locale: Preset and helper defaults are now US/English (
1,234.56— thousand,, decimal.). Turkish (1.234,56/₺) is an options override. - Phone default mask: Preset
phoneis now NANP-style(999) 999-9999. Turkey grouping(999) 999 99 99is a mask override on thephonepreset.
- IME / dead-key lock: Recover when
compositionstartfires withoutcompositionend(e.g.^on dead-key layouts).onChangetrustsnativeEvent.isComposing, clears a stuck flag, and resets composition state on blur. - Raw value pollution on blur:
rawValue/ form state no longer pick up masked DOM values (spaces, parentheses) after blur when usingregister. Canonical raw is kept in an internal ref and re-asserted on blur. - Mask raw literals: Card/phone/etc. raw values are scrubbed with
allowedCharsso mask literals never remain in form state. - Dependent CVV length: When card type changes from Amex (4-digit CVV) to a non-Amex card, CVV
rawValueand form state truncate to 3 digits (not only the display value). - Mixed custom masks: Masks that combine letter and digit slots (e.g.
aaa-999) no longer strip letters via a digits-only allowlist.
rawValuesRefsource of truth: Display formatting and siblingresolveMasklookups prefer canonical raw over possibly masked form/DOM values.syncDependentRaws: After a field updates, sibling fields withresolveMask(e.g. CVV) are re-processed immediately.
- @virastack/mask: A lightweight, zero-dependency masking library for React Hook Form is now live!
- Architecture: Custom masking engine built for performance and reliability.
- Hook:
useViraMaskprovides a simple, type-safe API for React Hook Form. - React Server Components: Added
'use client'directive for Next.js App Router and TanStack Start compatibility.
- Full Type Support: Enhanced TypeScript definitions for better developer experience.
- Validation: Built-in algorithmic validation for Credit Cards (Luhn) and Turkish Identity Number (TCKN).
- Enhanced Card Validation: Strict length checks based on card type (15 digits for Amex, 16 digits for others).
- Card Type Detection: Added
onCardTypeChangecallback to detect card issuer (Visa, Mastercard, Amex, Troy). - Dynamic CVV: CVV field automatically adjusts length (3 or 4 digits) based on the entered card number.
- Dynamic Masking: Support for Amex cards (auto-switches to 4-6-5 format).
- Presets: Includes
card,expiry,cvv,tckn,phone,email,url,username,iban,taxNumber,zipCode,date,numeric, andcurrency. - Currency Formatting: Advanced currency handling with precision, decimal/thousand separators, and prefix/suffix symbol support.
- Alpha Formatting: Built-in support for alphabetical inputs with space handling.
- UX Improvements:
- Enhanced cursor stability during typing.
- Improved backspace handling for currency fields with suffixes.
- Prevented validation errors from triggering immediately while typing.
- Customization: Options for
allowedChars,forbiddenChars,transform, and detailed currency configuration.