ember-headless-form icon indicating copy to clipboard operation
ember-headless-form copied to clipboard

Intl Number Input Feature

Open ErvinSabic opened this issue 8 months ago • 2 comments

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.

ErvinSabic avatar Apr 23 '25 15:04 ErvinSabic

⚠️ No Changeset found

Latest commit: 5dd6ae90ff71ec3ab9fe0d3b3c9a7eb42eecb82c

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

changeset-bot[bot] avatar Apr 23 '25 15:04 changeset-bot[bot]

I'll fix these test failures.

ErvinSabic avatar May 05 '25 15:05 ErvinSabic