Skip to content

Add locale-aware renderer-independent NumberInput - #242

Open
woksin wants to merge 1 commit into
mainfrom
feat/locale-aware-number-input
Open

Add locale-aware renderer-independent NumberInput#242
woksin wants to merge 1 commit into
mainfrom
feat/locale-aware-number-input

Conversation

@woksin

@woksin woksin commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a Cratis-owned numeric input for applications that need locale formatting without exposing renderer implementation types. The standalone control and CommandForm adapter share one parsing, formatting, validation, accessibility, parts, and token contract.

Added

Fixed

Public contract

  • NumberInput is controlled through number | null, takes its BCP 47 locale from CratisComponentsProvider with an optional per-control override, and supports grouping, fraction policy, bounds, stepping, prefixes, suffixes, native form semantics, descriptions, errors, and disabled/read-only/invalid states.
  • Semantic changes use value-first onChange; onCommit reports blur, enter, paste, or step after any corresponding change. Controlled normalization is withheld from form submission until the owner accepts it.
  • Stable typed parts and --cratis-number-input-* token aliases provide the styling contract. No React Aria or renderer-specific type is public.
  • NumberInputField reuses the same primitive through Arc's CommandForm adapter seam. Non-null command properties retain the established clear/non-finite-to-zero policy without a second parser or formatter.

Verification

  • The affected package CI, Storybook production build, and 6 focused specification files covering 35 tests passed.
  • The 11 primary contract mutations were proven red and restored exactly; eight review-repair mutations extend the final bound run to 19/19 red with exact source restoration.
  • The reviewed 144-row Chromium, Firefox, and WebKit browser/reflow/accessibility matrix passed; six final controlled-range and required-submit rows extend the bound evidence without replacing the reviewed matrix. It covers locale behavior, keyboard/focus, paste ordering, form submission, 200% text reflow, axe, computed contrast, accessibility trees, forced colors, reduced motion, and mobile browser profiles.
  • Package preparation, archive contents, exports, API documentation, all 24 public TypeScript 6 subpaths, production/tree-shaking, strict packed-consumer typecheck/build, and renderer-adapter package checks passed.
  • All 22 current Ada runtime configuration shapes typecheck against the packed candidate through the documented compatibility facade.

Limitations

  • This PR does not migrate Ada, remove Ada's current Prime number-input island, or establish drop-in visual/product parity at Ada's 22 call sites.
  • Visible step controls, mobile input-mode behavior, adornment accessibility associations, and incumbent callback-volume differences remain consumer review items.
  • Browser accessibility trees, axe, computed contrast, and Playwright device profiles are automated evidence; no human-operated screen-reader session or physical-device run was performed.
  • No performance claim is made.

@cratis-stagehand

Copy link
Copy Markdown

Build Fix Required

The "JavaScript Build" workflow is failing on this PR due to an outdated yarn lockfile entry. See issue #243 for details.

Quick fix: Remove the obsolete supports-color@npm:* entry (version 11.0.0) from yarn.lock. This entry is no longer needed by the current dependency tree.

The entry spans 7 lines and is located before the supports-color@npm:^7.1.0 entry. After removal, run yarn install --immutable to verify the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant