npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dataesr/react-dsfr

v3.10.0

Published

A React implementation of the french government design system.

Downloads

996

Readme

@dataesr/react-dsfr

Non-official React components of the official french Système de Design de l'État.

NPM JavaScript Style Guide GitHub contributors

Tests GitHub last commit semantic-release: react

Current version is using a degraded version of @gouvfr/[email protected] (new components are not yet available)

Requirements

  • node >= 14.18.x
  • npm >= 8.15.x
  • React >= 18.2.x

Installation

npm i @dataesr/react-dsfr

Generate and watch

Generate and watch dist folder containing bundles:

npm install --legacy-peer-deps
npm start

Library usage

Example page

A playground to test components

An example page is available containing all components. To launch it on your local machine, first launch watcher of the project and then:

cd example
npm install 
npm start

Use Icons

We are using remixicon.

import { Icon } from '@dataesr/react-dsfr';

<Icon
    name="ri-bubble-chart-line"
    size="lg"
    color="#f88"
    iconPosition="right"
>
    <p>I have an icon</p>
</Icon>

:warning: CDN link of css must be added to the <head> of your website.

<link href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css" rel="stylesheet">

Use Colors

Color variables are available in style/color.css. To make a new component dark theme compatible it's recommended to use variables from scheme.css in @gouvfr/dsfr project

Some components can be colored with variables (see colorFamily props) listed below:

['green-tilleul-verveine', 'green-bourgeon', 'green-emeraude', 'green-menthe', 'green-archipel', 'blue-ecume', 'blue-cumulus', 'purple-glycine', 'pink-macaron', 'pink-tuile', 'yellow-tournesol', 'yellow-moutarde', 'orange-terre-battue', 'brown-cafe-creme', 'brown-caramel', 'brown-opera', 'beige-gris-galet']

Documentation - Storybook

Storybook of the project is under construction.

Unit tests

Run all tests using react-scripts WHITH watcher option

npm run test:dev

Run all tests using react-scripts WITHOUT watcher option

npm run test:nowatch

Update snapshots

npm test -- --updateSnapshot

In Chrome

npm run test:debug

Access about:inspect

See doc debugging-tests

Release policy and package publishing

The @dataesr/react-dsfr package is published with semantic-release.

Merging code on the master branch will automatically bump the version, create a tag, produce a changelog and trigger the tests.

If new semantic commits are found (see below how to format commit) a new version of npm package is published and github pages is updated.

new patch version

git commit -m "fix: This is my fix"

new minor version

git commit -m "feat: This is my feature"

new major version

git commit -m "[subject]" -m "BREAKING CHANGE: [body]"

See Commit message formats for more details.

Accessibility

Components can be tested in Example's page App.js with @axe-core/react

npm instal --save-dev @axe-core/react

Another solution to test accessibility is CLI module https://pa11y.org/

Check configuration file .pa11y-ci

npm install -g pa11y-ci
pa11y-ci

They use react-dsfr and we like it!

Help from outside

Thanks to the internet world.

TODO

  • Limit usage of colors to colorFamilies
  • Upgrade to latest version of the DSFR (v1.9)
  • Full review ot the Typescript integration
  • Tree Shaking (instead of the whole bundle)