14.0.6 • Published 14 days ago

@moller/design-system v14.0.6

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
14 days ago

Multi-brand React component library for Møller

@moller/design-system is a React component library containing reusable, multi-brand GUI building blocks for applications in the Møller ecosystem.

For instructions on developing components, see the Development docs.

Consuming the library

The library is published as @moller/design-system in the public npm registry. The prefix @moller is an npm scope associated with our organization on npm

Installing the library

Run the command

npm install @moller/design-system @moller/gnist-themes

Using the library

To use the library, the vanilla-extract plugin needs to be used. For Vite, you need

npm install -D @vanilla-extract/vite-plugin @vanilla-extract/esbuild-plugin

Your vite.config.ts might look like this:

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
import { vanillaExtractPlugin as veEsbuildPlugin } from "@vanilla-extract/esbuild-plugin";

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [react(), vanillaExtractPlugin()],
    optimizeDeps: {
        esbuildOptions: {
            // Handle vanilla-extract .css.js files during Vite dev mode optimization
            // This prevents error "Styles were unable to be assigned to a file." in dev mode
            // See https://github.com/vanilla-extract-css/vanilla-extract/discussions/1051
            plugins: [veEsbuildPlugin({ runtime: true })],
        },
    },
});

In the application entrypoint, import the required global styles and choose a theme

import { LocalizationProvider } from "@moller/design-system";
// Import one or more of these themes
import { bilholdLight } from "@moller/gnist-themes/themes/bilholdLight.css.js";
import { gumpen } from "@moller/gnist-themes/themes/gumpen.css.js";
import { brandless } from "@moller/gnist-themes/themes/brandless.css.js";
import { mollerBil } from "@moller/gnist-themes/themes/mollerBil.css.js";
import { skodaDark } from "@moller/gnist-themes/themes/skodaDark.css.js";
import { vw } from "@moller/gnist-themes/themes/vw.css.js";
import { dahles } from "@moller/gnist-themes/themes/dahles.css.js";
import { autoria } from "@moller/gnist-themes/themes/autoria.css.js";
import { audi } from "@moller/gnist-themes/themes/audi.css.js";
import { cupra } from "@moller/gnist-themes/themes/cupra.css.js";
// Import global styles
import { globalTextStyles } from "@moller/gnist-themes/typography.css";
// Import necessary fonts (one or more, dependent on which themes are in use)
import "@moller/design-system/fonts/moller";
import "@moller/design-system/fonts/bilhold";
import "@moller/design-system/fonts/skoda";
import "@moller/design-system/fonts/gumpen";
import "@moller/design-system/fonts/VW";
import "@moller/design-system/fonts/dahles";
import "@moller/design-system/fonts/autoria";
import "@moller/design-system/fonts/audi";
import "@moller/design-system/fonts/cupra";

// Apply the theme
document.body.classList.add(bilholdLight);

// Apply global styles
globalTextStyles.forEach((c) => {
    document.body.classList.add(c);
});

export const App: React.FC = () => {
    return (
        <LocalizationProvider language="en">
            {/* ...the rest of your app here...*/}
        </LocalizationProvider>
    );
};

Next.js projects

If you are setting up in a Next.js project, the procedure is a bit different.

  1. You will need to add the design system packages to transpilePackages.
  2. You will also need to specify the use of styled components in the compiler options.
  3. You will need to install and use @vanilla-extract/next-plugin

With this setup, your next.config.mjs might look like this

import { createVanillaExtractPlugin } from "@vanilla-extract/next-plugin";
const withVanillaExtract = createVanillaExtractPlugin();

/** @type {import('next').NextConfig} */
const nextConfig = {
    compiler: {
        styledComponents: true,
    },
    transpilePackages: ["@moller/design-system"],
};

export default withVanillaExtract(nextConfig);

If you are running a React version 18 project, you will also need to add this to your tsconfig.json for it to work with this React 17 library.

"paths": {
     ...
      "react": [ "./node_modules/@types/react"]
    }

Next, just add the styling to your layout.tsx file. It might look like this:

import { bilholdLight } from "@moller/gnist-themes/themes/bilholdLight.css.js";
import { globalTextStyles } from "@moller/gnist-themes/typography.css.js";
import "@moller/design-system/fonts/bilhold";

const bodyClassList = [bilholdLight, ...globalTextStyles];

export default function RootLayout({
    children,
}: {
    children: React.ReactNode;
}) {
    return (
        <html lang="en">
            <body className={bodyClassList.join(" ")}>{children}</body>
        </html>
    );
}

Finally, import components from @moller/design-system.

14.0.6

14 days ago

14.0.5

15 days ago

14.0.3

20 days ago

14.0.4

20 days ago

14.0.2

22 days ago

14.0.1

28 days ago

13.1.0

29 days ago

14.0.0

29 days ago

13.0.0

29 days ago

12.1.0

30 days ago

12.0.1

1 month ago

12.0.2

1 month ago

11.0.0

1 month ago

12.0.0

1 month ago

10.0.1

2 months ago

9.0.3

2 months ago

10.0.0

2 months ago

9.0.2

2 months ago

8.3.1

2 months ago

9.0.1

2 months ago

9.0.0

2 months ago

8.4.0

2 months ago

8.3.0

2 months ago

8.1.1

2 months ago

8.1.0

2 months ago

8.0.0

2 months ago

7.0.2

2 months ago

6.20.2

2 months ago

7.0.0

2 months ago

7.0.1

2 months ago

6.20.1

2 months ago

6.20.0

3 months ago

6.19.0

3 months ago

6.18.7

3 months ago

6.18.6

3 months ago

6.18.5

3 months ago

6.18.3

3 months ago

6.18.4

3 months ago

7.0.0-alpha.0

3 months ago

6.18.1

3 months ago

6.18.2

3 months ago

6.18.0-4

3 months ago

6.18.0-0

3 months ago

6.18.0-3

3 months ago

6.18.0-2

3 months ago

6.18.0

3 months ago

6.17.2

3 months ago

6.17.3

3 months ago

6.17.0

3 months ago

6.17.1

3 months ago

6.16.0

3 months ago

6.15.9

3 months ago

6.15.8

3 months ago

6.15.7

3 months ago

6.15.5

3 months ago

6.15.3

3 months ago

6.15.2

3 months ago

6.15.6

3 months ago

6.15.1

4 months ago

6.15.0

4 months ago

6.14.3-2

4 months ago

6.14.3-1

4 months ago

6.14.3-0

4 months ago

6.14.2

4 months ago

6.14.1

4 months ago

7.0.0-10

4 months ago

7.0.0-9

4 months ago

6.14.0

4 months ago

6.13.8

4 months ago

6.13.7

4 months ago

7.0.0-6

4 months ago

7.0.0-7

4 months ago

7.0.0-8

4 months ago

6.13.6

4 months ago

6.13.5

4 months ago

6.13.4

4 months ago

6.13.3

5 months ago

6.13.2

5 months ago

6.13.1

5 months ago

6.13.0

5 months ago

6.12.8

5 months ago

6.12.9

5 months ago

6.12.6

5 months ago

6.12.5

5 months ago

6.12.4

5 months ago

6.12.3

5 months ago

6.12.2

5 months ago

6.12.1

5 months ago

6.12.0

5 months ago

4.9.0

11 months ago

6.5.0

8 months ago

5.2.0-0

10 months ago

6.6.1

8 months ago

6.6.0

8 months ago

6.6.2

7 months ago

5.8.9

9 months ago

5.8.8

9 months ago

5.8.7

9 months ago

5.8.6

9 months ago

5.8.5

9 months ago

5.8.4

9 months ago

5.8.3

9 months ago

5.8.2

9 months ago

5.8.1

9 months ago

5.0.9

10 months ago

5.8.0

9 months ago

5.0.8

10 months ago

5.0.7

10 months ago

5.0.6

10 months ago

5.0.5

10 months ago

5.0.4

10 months ago

5.0.3

10 months ago

5.0.2

10 months ago

5.0.1

11 months ago

5.0.10

10 months ago

5.0.0

11 months ago

4.8.0

11 months ago

5.1.0-rc1

10 months ago

5.1.0-rc2

10 months ago

5.1.0-rc3

10 months ago

6.7.0

7 months ago

6.7.2

7 months ago

4.7.0

11 months ago

6.7.1

7 months ago

6.7.4

7 months ago

6.7.3

7 months ago

6.7.6

7 months ago

6.7.5

7 months ago

5.1.7

10 months ago

5.1.6

10 months ago

5.1.5

10 months ago

5.1.4

10 months ago

5.1.3

10 months ago

5.1.2

10 months ago

5.1.1

10 months ago

5.1.0

10 months ago

4.7.2

11 months ago

4.7.1

11 months ago

6.8.1

7 months ago

6.8.0

7 months ago

4.6.0

11 months ago

6.8.3

7 months ago

6.8.2

7 months ago

6.8.5

7 months ago

6.8.4

7 months ago

6.8.6

7 months ago

5.0.1-1

11 months ago

4.7.0-0

11 months ago

5.2.1

9 months ago

5.2.0

9 months ago

6.0.0

8 months ago

5.10.3

8 months ago

5.10.1

8 months ago

5.10.0

8 months ago

5.1.6-rc6

10 months ago

5.1.6-rc5

10 months ago

5.1.6-rc4

10 months ago

5.1.6-rc3

10 months ago

5.1.6-rc2

10 months ago

5.1.6-rc1

10 months ago

6.9.0

7 months ago

5.3.1

9 months ago

5.0.0-2

11 months ago

5.3.0

9 months ago

6.1.0

8 months ago

5.0.0-4

11 months ago

5.0.0-5

11 months ago

5.0.0-6

11 months ago

5.4.2

9 months ago

5.4.1

9 months ago

5.4.0

9 months ago

5.8.11

8 months ago

6.2.1

8 months ago

6.2.0

8 months ago

5.8.16

8 months ago

5.8.17

8 months ago

5.8.12

8 months ago

5.8.13

8 months ago

5.8.14

8 months ago

5.8.15

8 months ago

5.5.2

9 months ago

5.5.1

9 months ago

5.5.0

9 months ago

5.1.4-rc2

10 months ago

5.1.4-rc1

10 months ago

6.3.0

8 months ago

6.11.0

6 months ago

5.6.2

9 months ago

5.6.1

9 months ago

5.6.0

9 months ago

7.0.0-0

6 months ago

6.4.1

8 months ago

7.0.0-1

6 months ago

6.4.0

8 months ago

6.10.1

6 months ago

6.10.0

6 months ago

7.0.0-2

6 months ago

7.0.0-3

6 months ago

6.5.1

8 months ago

7.0.0-4

6 months ago

7.0.0-5

6 months ago

5.7.6

9 months ago

5.7.5

9 months ago

5.7.4

9 months ago

5.7.3

9 months ago

5.7.2

9 months ago

5.7.1

9 months ago

5.7.0

9 months ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

3.3.8

11 months ago

3.3.7

11 months ago

3.3.6

11 months ago

1.21.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

3.2.0

12 months ago

3.4.0-0

11 months ago

4.4.0

11 months ago

4.0.0

11 months ago

3.1.2-1

12 months ago

3.1.2-0

12 months ago

2.3.0

12 months ago

1.22.0

1 year ago

3.1.2

12 months ago

3.1.1

12 months ago

3.1.0

12 months ago

4.3.2

11 months ago

4.3.1

11 months ago

3.0.0-1

1 year ago

3.0.0-0

1 year ago

3.0.0-3

12 months ago

3.0.0-2

1 year ago

4.3.0

11 months ago

3.0.0-4

12 months ago

2.2.0

12 months ago

3.0.2

12 months ago

1.23.0

1 year ago

3.0.1

12 months ago

1.23.1

1 year ago

3.0.0

12 months ago

4.2.0

11 months ago

2.1.0

1 year ago

3.3.1

12 months ago

3.3.0

12 months ago

3.3.5

11 months ago

3.3.4

11 months ago

3.3.3

12 months ago

3.3.2

12 months ago

4.5.0

11 months ago

4.5.2

11 months ago

4.5.1

11 months ago

4.1.0

11 months ago

4.1.1

11 months ago

1.12.3

1 year ago

1.14.0

1 year ago

1.18.0

1 year ago

1.16.0

1 year ago

1.19.1-0

1 year ago

1.20.1-0

1 year ago

1.15.0

1 year ago

1.13.0

1 year ago

1.19.0

1 year ago

1.17.0

1 year ago

1.15.1

1 year ago

1.18.0-0

1 year ago

1.19.0-0

1 year ago

1.20.1

1 year ago

1.20.2

1 year ago

1.19.2-0

1 year ago

1.20.0

1 year ago

1.17.1-0

1 year ago

1.20.2-0

1 year ago

1.20.0-0

1 year ago

1.12.2

1 year ago

1.12.1

1 year ago

1.12.0

1 year ago

1.9.0

1 year ago

1.8.0

1 year ago

1.12.1-0

1 year ago

1.12.2-0

1 year ago

1.11.0

1 year ago

1.10.1

1 year ago

1.10.0

1 year ago

1.8.0-0

1 year ago

1.7.2

1 year ago

1.7.1

1 year ago

1.7.0

1 year ago

1.6.1

1 year ago

1.6.0

1 year ago

1.5.1

1 year ago

1.5.0

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.1-2

1 year ago

1.2.1-1

1 year ago

1.2.1-0

1 year ago

1.2.0

1 year ago

1.2.0-6

1 year ago

1.2.0-5

1 year ago

1.2.0-4

1 year ago

1.2.0-3

1 year ago

1.2.0-2

1 year ago

1.1.4

1 year ago

1.2.0-1

1 year ago

1.2.0-0

1 year ago

1.3.0-1

1 year ago

1.3.0-0

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.1-0

1 year ago

1.0.0

1 year ago