carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.76k stars 1.8k forks source link

[Feature Request]: NumberInput SCSS selector #13512

Open JPM72 opened 1 year ago

JPM72 commented 1 year ago

The problem

The CSS selector for the NumberInput component is limited to input [type="text"] elements, which limits reuse and complicates implementations.

The solution

i'd like to strongly suggest that the CSS selector for the NumberInput component either be changed or extended to something closer to that of the TextInput component, e.g.

// from

.#{$prefix}--number input[type='number'] {
    // ...
}

// to

.#{$prefix}--number-input {
    // ...
}
// or
.#{$prefix}--number input[type='number'],
.#{$prefix}--number-input {
    // ...
}

the primary reason for this request is that 'typed' text inputs (such as search) are notoriously hard to work with and style, and in this case the number type can be quite frustrating from a developer standpoint when attempting to implement a flexible radix (e.g. accepting both 123,45 and 123.45) and input masking (my client complains that their $45648.98 costing sheet total is a pain to look at, versus the $ 45 648,98 they see in Excel)

i believe this selector change would make the style component much more useful.

please take this into consideration as you continue your excellent work

Examples

No response

Application/PAL

No response

Business priority

None

Available extra resources

No response

Code of Conduct

sstrubberg commented 1 year ago

@JPM72 apologies for the delayed response. This sound like a great idea, unfortunately our roadmap is packed a bit tight at the moment. We'd happily accept a contribution from the community, if you're so inclined.

tay1orjones commented 1 year ago

Worth noting this change would have a high likelyhood to break @carbon/web-components and the framework variants carbon-components-angular, carbon-components-svelte, etc.

Since these projects control the html/dom of their components, they would need to update to ensure the proper classname is applied to the input element.