playcanvas / pcui

UI component library for web-based tools
http://playcanvas.github.io/pcui
MIT License
663 stars 62 forks source link

`NumericInput` inherits from `TextInput` #248

Closed willeastcott closed 1 year ago

willeastcott commented 1 year ago

NumericInput inherits from TextInput. This is awkward from a types perspective because a TextInput has a value of type string but a NumericInput has a value of type number.

A better inheritance hierarchy would be:

Element
  |--InputElement (abstract base class that creates + manages the input DOM element)
       |--TextInput
       |--NumericInput

...where each TextInput and NumericInput reads/validates/types the actual textual entry of the input element.