react-dsfr icon indicating copy to clipboard operation
react-dsfr copied to clipboard

Compatibility with @gouvfr/dsfr-chart 2.x

Open tonai opened this issue 8 months ago • 8 comments

By default when installing @gouvfr/dsfr-chart, it will install version 2.x that is not compatible with react-dsfr. I got the following error when trying to use the bar chart component:

✘ [ERROR] Missing "./BarChart/bar-chart.common" specifier in "@gouvfr/dsfr-chart" package [plugin vite:dep-pre-bundle]

    node_modules/@codegouvfr/react-dsfr/Chart/BarChart.js:4:7:
      4 │ import "@gouvfr/dsfr-chart/BarChart/bar-chart.common";
        ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  This error came from the "onResolve" callback registered here:

    node_modules/esbuild/lib/main.js:1151:20:
      1151 │       let promise = setup({
           ╵                     ^

    at setup (file:///home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/vite/dist/node/chunks/dep-ByPKlqZ5.js:16969:13)
    at handlePlugins (/home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/esbuild/lib/main.js:1151:21)
    at buildOrContextImpl (/home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/esbuild/lib/main.js:874:5)
    at Object.buildOrContext (/home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/esbuild/lib/main.js:700:5)
    at /home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/esbuild/lib/main.js:2039:68
    at new Promise (<anonymous>)
    at Object.context (/home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/esbuild/lib/main.js:2039:27)
    at Object.context (/home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/esbuild/lib/main.js:1881:58)
    at prepareEsbuildOptimizerRun (file:///home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/vite/dist/node/chunks/dep-ByPKlqZ5.js:19170:33)

It would be great if react-dsfr can be compatible with version 2.x of @gouvfr/dsfr-chart

tonai avatar Mar 06 '25 15:03 tonai

Also a lot of props are not exposed by the props of the React component (but exist in the @gouvfr/dsfr-chart web component). Example it is possible de set the bar size in the bar component with:

<BarChart {...barChartData} barsize="24" />

It works but there is a typescript error because the barsize props is not declared inside BarChartProps.

tonai avatar Mar 06 '25 16:03 tonai

Hey @tonai,
Sure! We just need to update it. Would you do be up for submitting a PR?

garronej avatar Mar 06 '25 18:03 garronej

I'll try to have a look it

tonai avatar Mar 07 '25 13:03 tonai

I found an issue on @gouvfr/dsfr-chart which is probably blocking the migration towards: 2.x https://github.com/GouvernementFR/dsfr-chart/issues/43

tonai avatar Mar 07 '25 15:03 tonai

I have the same error, any plans for a fix?

Alezco avatar Mar 27 '25 15:03 Alezco

I can review a PR

garronej avatar Mar 27 '25 15:03 garronej

I am working on it but in order to be able to integrate version 2.x there are some issues that needs to be solved on dsfr charts part:

  • https://github.com/GouvernementFR/dsfr-chart/pull/45
  • https://github.com/GouvernementFR/dsfr-chart/pull/44

I created PR for both of them 3 weeks ago but still no news...

tonai avatar Mar 31 '25 15:03 tonai

Thank you very much @tonai!

garronej avatar Apr 01 '25 16:04 garronej