trussworks / react-uswds

USWDS 3.0 components built in React
https://trussworks.github.io/react-uswds/
Apache License 2.0
182 stars 81 forks source link

build!: Allow direct imports and component normalization #2899

Open jpandersen87 opened 5 months ago

jpandersen87 commented 5 months ago

Summary

This PR makes project-wide changes to allow importing from files directly in addition to the index. Build and project configuration changes were made to ensure the package passes tests from https://arethetypeswrong.github.io/. All components were modified for one of the following reasons:

Some areas where we could use one of the react-uswds components instead of a jsx element (ex: Button, Grid) were updated to use those components instead.

A dedicated build script for handling the logic of building the library in various formats and related dependencies were added. Other build notes:

The project also now uses the USWDS' compile package via gulpfile to create the default settings css file (with all assets generated exposed).

In order to create compatible typescript declarations for both cjs and es modes, the module setting for typescript was changed to node16. This makes it required to include the extension on all relative imports (reflective of the fact this package is now esm by default and es modules have that import extension requirement. The isolatedModules option was also enabled, requiring type import/exports to be explicitly marked as type.

The .usa-tooltip__body override was removed as its issue appears to have been resolved (https://github.com/uswds/uswds/issues/4458).

Related Issues or PRs

N/A

How To Test