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

paris

v0.10.2

Published

Paris is Slingshot's React design system. It's a collection of reusable components, design tokens, and guidelines that help us build consistent, accessible, and performant user interfaces.

Downloads

298

Readme

Paris

Paris is Slingshot's React design system, meant to work universally across server and client components. It's a collection of reusable components, design tokens, and guidelines for building consistent, accessible, and performant user interfaces.

Currently, Paris is provided as a set of unbundled .tsx components styled with SCSS modules. This means that you can import only the components you need, and you can use your own bundler to optimize your bundle size. As a result, Paris works best with frameworks like Next.js that have built-in support for TypeScript and SCSS modules.

Paris 1.x styling is heavily inspired by Uber's Base Web, which we previously used in our production apps. We built Paris to move away from Styletron and CSS-in-JS, since we're now largely working with React 18, RSC, and the Next.js app directory.

Getting started

First, install Paris in your project:

pnpm i paris
# or
yarn add paris
# or
npm i paris

Make sure your tsconfig module resolution is set to nodenext, node16, or bundler to support paris imports:

{
    "compilerOptions": {
        "moduleResolution": "bundler"
    }
}

You'll need to tell your bundler to transpile files from Paris. This is easy in Next.js 13.1+ with the transpilePackages option in next.config.js:

// next.config.js
module.exports = {
    // ...
    transpilePackages: ['paris'],
};

For older versions of Next.js, you can use a plugin like next-transpile-modules. Instructions for other bundlers are coming soon.

You'll need to configure your bundler to support Sass/SCSS and SCSS modules. In Next.js, support for SCSS modules is built-in and can be enabled by simply installing sass as a dependency.

Paris uses pte (our theming engine) for powering theming and initial styles through CSS variables. You can use generateCSS or generateThemeInjection from paris/theme to generate the CSS variables and inject them into your app through either a style or script tag in your document head respectively. Either method supports SSR and server components, since the initial theme is static.

Additionally, you need to import the static global styles from paris/theme/global.scss.

Paris also relies on CSS Container Queries for responsive changes on certain elements, like the Tabs component when kind = auto. Adding the Google polyfill for Container Queries is recommended to ensure legacy browser support:

// Use the `Script` component instead in Next.js
<script src="https://cdn.jsdelivr.net/npm/container-query-polyfill@1/dist/container-query-polyfill.modern.js" />

For example, with the Next.js 13 app directory, you can do all of this in your root layout.tsx file:

// app/layout.tsx
import { generateCSS, generateThemeInjection, theme } from 'paris/theme';

// Import Paris's static global styling
import 'paris/theme/global.scss';

export default function RootLayout({
    children,
}: {
    children: React.ReactNode
}) {
    return (
        <html lang="en">
        <head>
            {/* Using a `style` tag (MUST have the id `pte-vars` and be in the document head) */}
            <style
                id="pte-vars"
                dangerouslySetInnerHTML={{
                    __html: generateCSS(theme),
                }}
            />

            {/* Or, use a `script` tag (can be located anywhere, should be loaded as early as possible to avoid an unstyled flash) */}
            <script
                dangerouslySetInnerHTML={{
                    __html: generateThemeInjection(theme),
                }}
            />
        </head>
        {/* Set the class "paris-container" to your root layout container */}
        <body className="paris-container">
            {children}
            <Script src="https://cdn.jsdelivr.net/npm/container-query-polyfill@1/dist/container-query-polyfill.modern.js" />
        </body>
        </html>
    );
}

That's it! You can now import any component from Paris:

import { Button } from 'paris/button';

const App = () => (
    <Button>Click me</Button>
);

This should work out of the box with Next.js, since it has built-in support for TypeScript and SCSS modules. If you're using another framework or bundler, you may need to configure it for generic SCSS support.