Skip to content

feat(number-input): matches parity on WC type='text', custom validations, format options#21681

Merged
devadula-nandan merged 38 commits into
carbon-design-system:mainfrom
devadula-nandan:feat/number-input-type-text-feature
Apr 8, 2026
Merged

feat(number-input): matches parity on WC type='text', custom validations, format options#21681
devadula-nandan merged 38 commits into
carbon-design-system:mainfrom
devadula-nandan:feat/number-input-type-text-feature

Conversation

@devadula-nandan

@devadula-nandan devadula-nandan commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Closes #19848, #21663

matches parity on WC number-input with
#19471
#19742
#21135
and formatOptions

Changelog

New

  • Added new stories With Type Of Text, With Type Of Text Controlled, With Type Of Custom Validation. same as react.
  • Brings in parity with WC number-input from mentioned work on React NumberInput. more below.
  • Support for locale based user input and formatting in NumberInput w/ @internationalized/number
  • Props to NumberInput: type, locale, formatOptions, pattern, inputMode
  • A large new suite of tests covering all this
  • German locale option to the switcher in the storybook toolbar
  • Harden existing logic to guard against NaN values
  • Update the event detail value to be a Number, not the locale-formatted string. with strict typing
  • Ensure onBlur is called when the input is blurred, and also when stepper buttons are blurred
  • Enhanced number parsing and validation to support all major Unicode numeral systems recognized by Intl.NumberFormat.

Changed

  • fixes skeleton not rendering for number input. along with skeleton sizes
  • fixes storybook global controls for locale. which should now work on all provided options. English, German, Arabic, Japanese.

Removed

Testing / Reviewing

all tests referenced from mentioned pr's were added with patch coverage of 98%.
can also be tested manually by enabling the hidden test story which covers all cases for type="text"

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples
  • Wrote passing tests that cover this change
    - [ ] Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@devadula-nandan devadula-nandan changed the title feat: number input type text and custom validations initial commit feat(number-input): type='text' and custom validations parity initial commit Feb 27, 2026
@netlify

netlify Bot commented Feb 27, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 67f1ca0
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/69d66f40eb03ad0008793183
😎 Deploy Preview https://deploy-preview-21681--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Mar 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.04217% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.89%. Comparing base (9376495) to head (67f1ca0).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...onents/src/components/number-input/number-input.ts 97.96% 13 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #21681    +/-   ##
========================================
  Coverage   94.89%   94.89%            
========================================
  Files         539      539            
  Lines       44549    45102   +553     
  Branches     6291     6313    +22     
========================================
+ Hits        42274    42801   +527     
- Misses       2143     2169    +26     
  Partials      132      132            
Flag Coverage Δ
main-packages 89.15% <ø> (ø)
web-components 97.70% <98.04%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@netlify

netlify Bot commented Mar 2, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit 67f1ca0
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/69d66f40c022230008d95e19
😎 Deploy Preview https://deploy-preview-21681--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@devadula-nandan devadula-nandan marked this pull request as ready for review March 4, 2026 13:44
@devadula-nandan devadula-nandan requested a review from a team as a code owner March 4, 2026 13:44
@devadula-nandan

Copy link
Copy Markdown
Contributor Author

@carbon-design-system/design this needs a design review as mentioned in the issue.

@devadula-nandan

Copy link
Copy Markdown
Contributor Author

any missing controls are expected to be added in. #20939

@devadula-nandan devadula-nandan changed the title feat(number-input): type='text' and custom validations parity initial commit feat(number-input): matches parity on WC type='text', custom validations, format options Mar 4, 2026
@devadula-nandan devadula-nandan linked an issue Mar 6, 2026 that may be closed by this pull request
2 tasks
@adamalston

Copy link
Copy Markdown
Contributor

I noticed this pull request is in the merge queue, but it still has a pending visual review label. Is there any remaining work related to that, or should the label be removed?

@devadula-nandan devadula-nandan removed this pull request from the merge queue due to a manual request Mar 30, 2026
@devadula-nandan

devadula-nandan commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

I noticed this pull request is in the merge queue, but it still has a pending visual review label. Is there any remaining work related to that, or should the label be removed?

right! this needs visual review. as i mentioned before #21681 (comment)

edit: also status ready to merge was an old tag used to trigger the merge queue, through kodiakhq bot. i think we moved away from it 🤔

@Kritvi-bhatia17 Kritvi-bhatia17 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @devadula-nandan, just some suggestions from content and visual consistency.

  1. Can we arrange the stories alphabetically? For example, “With Type of Custom Validation” could come after “With AI Label”, which would also align with the React Storybook ordering. (Screenshot attached for reference)
Image
  1. Can we use the same label across all Number Input stories in WC—specifically “NumberInput label”? Currently, it varies across 3–4 stories.

  2. Can we update the error message to: “Number is not valid. Must be between -100 and 100.” This should make the error clearer for users and also match the React Storybook.

  3. In WC, for the “With AI Label”, “With Type of Text Controlled”, and “With Type of Custom Validation” stories, a lot of props don’t seem to be working for me. I’ve added a screen recording here for reference:
    https://github.com/user-attachments/assets/d679e153-8ac9-4d86-b189-3600467e6d53
    Once this is fixed, I’ll be able to continue the review.

@adamalston

adamalston commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

edit: also status ready to merge was an old tag used to trigger the merge queue, through kodiakhq bot. i think we moved away from it 🤔

I still see it used frequently. The docs also indicate that it should be used, as of the latest commit in this pull request:

- After the second review:
- Remove all `status` labels.
- Add the
https://github.com/carbon-design-system/carbon/labels/status%3A%20ready%20to%20merge%20%F0%9F%8E%89
label and queue the PR for merging.

@devadula-nandan

Copy link
Copy Markdown
Contributor Author

edit: also status ready to merge was an old tag used to trigger the merge queue, through kodiakhq bot. i think we moved away from it 🤔

I still see it used frequently. The docs also indicate that it should be used, as of the latest commit in this pull request:

- After the second review:
- Remove all `status` labels.
- Add the
https://github.com/carbon-design-system/carbon/labels/status%3A%20ready%20to%20merge%20%F0%9F%8E%89
label and queue the PR for merging.

yes. it was repurposed to be just a status. previously it used to trigger some merge automations.

@devadula-nandan

devadula-nandan commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

@Kritvi-bhatia17

Can we arrange the stories alphabetically? For example, “With Type of Custom Validation” could come after “With AI Label”, which would also align with the React Storybook ordering. (Screenshot attached for reference)

^ done

Can we use the same label across all Number Input stories in WC—specifically “NumberInput label”? Currently, it varies across 3–4 stories.

^ updated as per suggestion

Can we update the error message to: “Number is not valid. Must be between -100 and 100.” This should make the error clearer for users and also match the React Storybook.

^ done. this appeared on default story. i updated it as per suggestion.

In WC, for the “With AI Label”, “With Type of Text Controlled”, and “With Type of Custom Validation” stories, a lot of props don’t seem to be working for me. I’ve added a screen recording here for reference:
https://github.com/user-attachments/assets/d679e153-8ac9-4d86-b189-3600467e6d53
Once this is fixed, I’ll be able to continue the review.

as mentioned in pr template

Removed playground story and enabled all controls to default story. any other story controls will be covered in #20939

and in the comment

#21681 (comment)

there is a seperate scope for this to be handled there. the newer stories needs to share same story template that must be working for all stories similar to default story. as part of that issue

@Kritvi-bhatia17 Kritvi-bhatia17 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @devadula-nandan, great work! 🚀

@devadula-nandan devadula-nandan added this pull request to the merge queue Apr 8, 2026
Merged via the queue into carbon-design-system:main with commit 13f2327 Apr 8, 2026
39 checks passed
@devadula-nandan devadula-nandan deleted the feat/number-input-type-text-feature branch April 8, 2026 16:12
MarianaAa01 pushed a commit to MarianaAa01/carbon that referenced this pull request May 29, 2026
…ons, format options (carbon-design-system#21681)

* feat: number input type text and custom validations initial commit

* fix: ts build errors, and in inheriting fluid number input

* chore: comment new tests

* fix: add @carbon/utilities as explicit dependency

* fix: update lock file

* fix: validate on input and controlled set value and tests

* chore: update copyright current year

* fix: update yarn lock

* Update packages/web-components/src/components/number-input/__tests__/number-input-test.js

remove test comment

Co-authored-by: Mahmoud <132728978+maradwan26@users.noreply.github.com>

* fix: few inconsistencies and add tests

* chore: add clarity on note

* revert: test stories

* chore: remove note and update jsdoc

* fix: validation logic which are failing tests after merge from main

* fix: some edge cases and add tests

* revert: test stories, and mark new features as experimental

* chore: update utilities to 0.17.0

* fix: modify contradicting test, and fix button disable state in readonly

* refactor: add review suggestions, bump test coverage, add story actions

* fix: review comments

* chore: export re-usable direction type used in event detail

* Update number-input.ts

Co-authored-by: Adam Alston <aalston9@gmail.com>

* docs: update stories

---------

Co-authored-by: Mahmoud <132728978+maradwan26@users.noreply.github.com>
Co-authored-by: emyarod <emyarod@users.noreply.github.com>
Co-authored-by: Adam Alston <aalston9@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: cds-number-input-skeleton is not rendering React|WC Parity: NumberInput - add type='text' and locale-based formatting

5 participants