Skip to content

Conversation

ErvinSabic
Copy link
Contributor

@ErvinSabic ErvinSabic commented Apr 23, 2025

This PR Consists of a input that supports the majority of the options offered by Intl.NumberFormat by specifying your locale and the options you would like to use. The majority of the which are supported (Except for Scientific Notation and Compact Notation).

In short:

  • This is a text input emulating a number input.
  • It shows the number in the user's own locale using the specified options as they type. (thousands separators, decimal mark, minus sign, currency/unit/percent affixes, non‑Latin numerals).
  • It will support most of the Intl.NumberFormat options. Save for some edge cases (Ex, typing "2" in a input setup for units, in arabic, for liters might cause unexpected behavior).
  • It stores the canonical dot based value through the usual setValue method. Meaning whatever the user types into the input is eventually turned back into a workable number that you can store in a database. Ex: While the text input may show "€ 1,234.56" the data value of the input is 1234.56. When working with percentages, it may show "75%" but the data value is 0.75.
  • It rejects or adapts to inputs such as multiple decimal places, too many fraction digits, NaNs, etc. Usually by reverting to a previously valid value.
  • The position of the user's input (caret) will adjust based on formatting and inputs.

Copy link

changeset-bot bot commented Apr 23, 2025

⚠️ No Changeset found

Latest commit: 5dd6ae9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ErvinSabic
Copy link
Contributor Author

I'll fix these test failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant