playcanvas / pcui

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

React components in TypeScript #186

Closed ellthompson closed 1 year ago

ellthompson commented 1 year ago

This PR rewrites the PCUI react components using typescript. The type definitions for our react builds can now be generated from the TypeScript compiler.

Each react component extends the ElementComponent class, which has an extendable and generic type for its properties of ElementComponentProps. Each component classes' props interface then extends the ElementComponentProps interface in order to receive a base set of props common to all components and then adds their own additional props. Each component props interface can also extend other common props interfaces (IFlexProps, IParentProps, IResizableProps) based on the components underlying functionality.

This PR also outputs module builds of PCUI using a preserved module directory structure to support tree shaking.