Repository navigation
[@mantine/core] PhoneInput: Omit the dial code from value when international is false - #9581
Open
sernstberger wants to merge 1 commit into
Open
sernstberger wants to merge 1 commit into
sernstberger wants to merge 1 commit into
Conversation
…ational is false (mantinedev#9579) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9579.
Problem
With
international={false}the input hides the dial code, butvalueandonChangestill include it ("+12025551234"). Apps that take domestic numbers have to strip it on every change and add it back to everyvalue.Changes
international={false},onChangeemits national digits ("2025551234"); the country stays indetails.country.value/defaultValueaccept national digits in that mode. Values that start with+are still accepted, so existing stored values keep working.+dialCode…); conversion happens only at thevalue/onChangeboundary.international={true}(default) is untouched.Note
This changes the emitted value for existing
international={false}users, so 10 existing assertions were updated. If you'd rather keep the current output, I can make it opt-in (e.g.valueFormat="national") instead.Validation
npm run jest packages/@mantine/core/src/components/PhoneInput: 317 passed20…,44…) stays on the selected country, digit-by-digit typing, clearing, extension round trip, country switch, and a+44…value set by the parent.HomePageSponsors.tsx, is also on master)🤖 Generated with Claude Code