3.60.0 • Published 2 years ago

virtuoso-design-system v3.60.0

Weekly downloads
328
License
MIT
Repository
github
Last release
2 years ago

Virtuoso Design System

Validate PR Release Deploy Storybook

This repo enables using the Virtuoso Design System as front-end code (HTML, CSS, & JavaScript).

This project is not a common place for library reuse. For instance charts and graphs should be added to the app directly. For charting we suggest nivo charts.

📖 Dive into the docs

🤖 Explore the code

Docs

The documentation for Virtuoso is hosted on GitHub Pages and powered by Storybook.

To run storybook locally:

npm run storybook

Installing

🚨 Virtuoso is still a work in progress and installation instructions are limited.

Create-React-App

To install with Create React App you will need to use Craco (Create React App Configuration Override).

  1. Install Craco npm i --save-dev craco
  2. Install Craco-Antd plugin npm i --save-dev craco-antd
  3. Install Virtuoso and Antd npm i --save virtuoso-design-system antd
  4. Create a craco.config.js and add the config
  5. Use Virtuoso

Config:

// craco.config.js
// https://github.com/gsoft-inc/craco/blob/master/packages/craco/README.md#configuration
const { when, whenDev, whenProd, whenTest, ESLINT_MODES, POSTCSS_MODES } = require("@craco/craco");
const CracoAntDesignPlugin = require("craco-antd");
const VirtuosoTheme = require('virtuoso-design-system/dist/antd')

module.exports = {
  plugins: [
    {
      plugin: CracoAntDesignPlugin,
      options: {
        customizeTheme: VirtuosoTheme
      }
    }
  ],
} 

Update the existing calls to react-scripts in the scripts section of your package.json file to use the craco CLI:

/* package.json */

"scripts": {
-   "start": "react-scripts start",
+   "start": "craco start",
-   "build": "react-scripts build",
+   "build": "craco build"
-   "test": "react-scripts test",
+   "test": "craco test"
}

In index.css need add

@import '~virtuoso-design-system/dist/design_tokens.css';
@import '~virtuoso-design-system/dist/bundle.cjs.css';
@import '~virtuoso-design-system/dist/open-sans.css';
@import '~virtuoso-design-system/dist/raleway.css';

html {
    font-size: 62.5%;
}

Example:

import React from 'react';
import { Button } from 'virtuoso-design-system';

export default function MyComponment() {
 return <Button>Hi there!</Button>
}

Design Tokens

Design tokens are the visual design atoms of the design system — specifically, they are named entities that store visual design attributes. We use them in place of hard-coded values (such as hex values for color or pixel values for spacing) in order to maintain a scalable and consistent visual system for UI development.

Salesforce Lightning Design System

Style Dictionary is a build system that allows you to define design tokens once, in a way for any platform or language to consume.

  1. Our design tokens are defined in lib/styles/style_dict/tokens/ as JSON files…

  2. …read by the config in lib/styles/style_dict/config.json

  3. …and built by the command

npm run style-dictionary:build
  1. …which creates lib/styles/build/ files for CSS, JS, or whatever platform needs them.

  2. You can clear the built tokens with

npm run style-dictionary:clean

Examples

Examples can be found in /examples

Releasing

Releases are handled by Auto.

  1. Please tag your PRs "release" in order for Auto to find them.

  2. Then, all you have to do is npm run release and you'll get:

  • automatic changelog
  • bump npm version
  • publish to npm — based on your npm login or NPM_TOKEN in .env
  • make a GitHub release — based on your GH_TOKEN in .env

This works with the magic described in auto shipit docs.

A static version of the Storybook docs are generated automatically before we publish releases to npm.

Development & Testing & Updating

To develop new components make sure to:

  • add components to /lib/components
  • add helpers and hooks to /lib/helpers
  • add relevant stories to /stories
  • add tests next to the component

Run locally

npm run storybook

Run tests

npm run test

Visual Regression Testing (VRT)

This repository uses Loki for VRT to ensure the visual appearance of states of the components does not regress. Baseline reference images are intentionally checked into this repository in .loki/reference/.

Running VRT locally

You can run the VRT tests locally to check to see if your changes have caused visual regressions from the existing baselines for all components based on the loki config in package.json:

npm run test:vrt

For faster results, you can run a subset of tests using --storiesFilter:

npm run test:vrt -- --storiesFilter=Input

Any failed tests will be output in .loki/difference/. You can inspect any visual differences that are highlighted in these output images.

If the differences are intended, you can update the baselines by following the instructions in the next section.

Updating Loki Baselines

Note: Before performing this step, you must first run the VRT once (see previous section).

If you run the tests above and have legitimate changes in the visual appearance of the components, you can approve new baselines, which will replace the existing baseline images with the new, current images:

npm run loki:approve

This will immediately take all new baseline images from the last test run and replace the existing baseline images. If you wish to update a specific test case image only but reject other changes, see the Loki CLI reference.

We recommend only approving new baselines once all unintended visual changes have been fixed, then running the command above so no fine-grained filtering of new baselines is needed.


Copyright © 2020 Virtru Corporation

3.60.0

2 years ago

3.59.0

2 years ago

3.54.0

2 years ago

3.50.0

2 years ago

3.55.0

2 years ago

3.51.0

2 years ago

3.56.0

2 years ago

3.52.0

2 years ago

3.58.0

2 years ago

3.57.0

2 years ago

3.53.0

2 years ago

3.43.0

2 years ago

3.47.0

2 years ago

3.44.0

2 years ago

3.48.0

2 years ago

3.45.0

2 years ago

3.49.0

2 years ago

3.46.0

2 years ago

3.36.0

2 years ago

3.35.0

2 years ago

3.40.0

2 years ago

3.37.0

2 years ago

3.41.0

2 years ago

3.38.0

2 years ago

3.42.0

2 years ago

3.39.0

2 years ago

3.34.0

2 years ago

3.20.0

3 years ago

3.24.0

3 years ago

3.31.0

2 years ago

3.28.0

3 years ago

3.21.0

3 years ago

3.32.0

2 years ago

3.25.0

3 years ago

3.29.0

2 years ago

3.22.0

3 years ago

3.33.0

2 years ago

3.26.0

3 years ago

3.23.0

3 years ago

3.30.0

2 years ago

3.27.0

3 years ago

3.19.0

3 years ago

3.18.0

3 years ago

3.15.0

3 years ago

3.17.0

3 years ago

3.14.0

3 years ago

3.16.0

3 years ago

3.13.0

3 years ago

3.9.0

3 years ago

3.8.0

3 years ago

3.10.0

3 years ago

3.6.0

3 years ago

3.12.0

3 years ago

3.11.0

3 years ago

3.7.0

3 years ago

3.5.0

3 years ago

3.4.0

3 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.1

3 years ago

2.0.0

3 years ago

3.0.0

3 years ago

1.19.12

4 years ago

1.19.10

4 years ago

1.21.0

4 years ago

1.21.1

4 years ago

1.20.0

4 years ago

1.19.8

4 years ago

1.19.7

4 years ago

1.19.6

4 years ago

1.19.4

4 years ago

1.19.5

4 years ago

1.19.3

4 years ago

1.19.2

4 years ago

1.18.3

4 years ago

1.19.0

4 years ago

1.19.1

4 years ago

1.18.2

4 years ago

1.18.1

4 years ago

1.18.0

4 years ago

1.17.1

4 years ago

1.17.0

4 years ago

1.16.1

4 years ago

1.16.0

4 years ago

1.15.1

4 years ago

1.15.0

4 years ago

1.14.3

4 years ago

1.14.1

4 years ago

1.14.2

4 years ago

1.14.0

4 years ago

1.13.0

4 years ago

1.12.0

4 years ago

1.11.2

4 years ago

1.11.1

4 years ago

1.10.0

4 years ago

1.9.0

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.8

4 years ago

1.6.7

4 years ago

1.6.6

4 years ago

1.6.5

4 years ago

1.6.4

4 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.3

4 years ago