dataesr / react-dsfr

Non-official React components of the official french Système de Design de l'État.
https://dataesr.github.io/react-dsfr/
MIT License
44 stars 22 forks source link

Fix typescript missing properties #301

Closed Falinor closed 1 year ago

Falinor commented 1 year ago

In an effort to provide a better, safer and more accurate developer experience, I worked on typescript definitions.

Missing component types

Exposed missing component types using the provided command. This could be automated as part of the deployment.

TextInput

TextInput has a textarea boolean property, which generates the underlying element as input or textarea. Those have different properties. Textarea, for example, has a rows property defining how many rows are displayed. Depending on the value of textarea, TextInput will extend either InputHTMLElement or TextareaHTMLElement properties. No need for event handlers as well like onChange or onBlur, they will be forwarded natively..

Alert

This component was missing the type warning, which is present in the official DS FR.

Checkbox

Checkbox was missing checked and other properties that should be controllable e.g. using a select-all checkbox. These properties were not available to TypeScript, although being treated by the component.

Checkbox now extends InputHTMLElement to automatically provide its properties, while being able to add some more. It omits type, which always equals checkbox in the underlying component.

Closes #298

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 3.4.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket: