1.13.1 • Published 1 day ago

@vcita/design-system v1.13.1

Weekly downloads
-
License
ISC
Repository
github
Last release
1 day ago

design-system

You can find storybook here

This project's goal is to create a set of tools that will enable future development to be quicker and more standard, while providing the vcita flavor.

Getting started

npm i @vcita/design-system

External Dependencies

This package depends on Vuetify as an external dependency, so your project must have it installed. Currently, the needed version is 2.4.0, we will update this from time to time.

Initializing in your project

To initialize the project create plugins/designSystem.js

// plugins/designSystem.js
import DesignSystem from '@vcita/design-system';
import DesignSystemInit from '@vcita/design-system/init/DesignSystem';
import Vue from "vue";

// Use this in case you want to receive all the components from DS
Vue.use(DesignSystem);

// Use this in case you want to load selectively only the components you need
Vue.use(DesignSystem, { 
  components: {
    VcComponent: () => import('@vcita/design-system/src/components/VcComponent/VcComponent.vue'),
    ...
  },
});
export default DesignSystemInit();

Import into src/main.js and into the vue initialization

// src/main.js
import ds from './plugins/designSystem';

new Vue({
    ...
    vuetify: ds,
    ...
    render: h => h(App)
  }).$mount("#app");

If you need to also adjust some values, such as theme or configurations, it will look something like this:

// plugins/designSystem.js
import Vue from "vue";
import DesignSystem from '@vcita/design-system';
import DesignSystemInit from '@vcita/design-system/init/DesignSystem';

Vue.use(DesignSystem);

const config = {
                  // Your configuration choices
               };

export default DesignSystemInit(config);

All configuration options are specified here

Applying the styling to your project

Create the file src/styles/variables.scss and edit to fit your needs. you may only need the import statement.

@import "~@vcita/design-system/styles/variables.scss";

In order to load the variables.scss file, add this to src/main.js

import "@/../styles/variables.scss";

Create the file src/styles/vuetify-variables.scss

@forward "~@vcita/design-system/styles/vuetify-variables.scss";

// Vuetify variables can be modified here,
// BUT! please consider if they should be set here or in the design system project

In order to load the vuetify-variables.scss file, in vue.config.js add this value

css: {
    loaderOptions: {
      sass: {
        // Here we can specify the older indent syntax formatted SASS
        // Note that there is *not* a semicolon at the end of the below line
        additionalData: `@import "@/../styles/vuetify-variables.scss"`
      },
      scss: {
        // Here we can use the newer SCSS flavor of Sass.
        // Note that there *is* a semicolon at the end of the below line
        additionalData: `@import "@/../styles/vuetify-variables.scss";`
      }
    }
  }

Please note: to receive the theme in your components, make sure to initialize your app using the v-app tag. Your App.vue will look something like this:

<template>
  <v-app id="app">
    ... your components here ...
  </v-app>
</template>

The src/styles/variables.scss file can be used to override some styling variables. You can do this by specifying a different value to one or more of the css variables that have been provided.

For example, to use another font

body {
  --primary-font-family: YourFont;
}

All component styling options are specified here

Using the components

You can now use the components from the new library anywhere in the application, as you normally would

<VcButton>label</VcButton>

Available configuration options

Theme

The default theme values are based on default vcita colors, but they can be set according to the current business. Please note that colors must be set as hex values.

To facilitate that the file colorUtil.js has been included, which contains the following functions:

  • rgbToHex() - Use this to convert rgb values to hex values.
  • hexToRgb() - If you have other areas in your project that require rgb format, you can use this to convert any hex values to rgb.
  • pSBC() - This function can calculate various opacity levels, based on an initial color, and return them in hex or rgb formats, as needed
// stringUtil.pSBC(opacity, baseColor)
stringUtil.pSBC(0.6, this.secondaryColor)
During startup

This is how they can be set during startup of the app:

// plugins/designSystem.js
const config = {
    theme: {
        primary: '#0C315E',
        secondary: {
            base: '#0093B8',
            lighten1: '#99D4E3',
            lighten2: '#C2E5EE',
            lighten3: '#EDF7FA'
        },
    }
}
During runtime
import colorUtil from '@vcita/design-system/utils/colorUtil.js';

this.$vuetify.theme.themes.light.primary = colorUtil.rgbToHex(this.primaryColor);
this.$vuetify.theme.themes.light.secondary = {
  base: colorUtil.rgbToHex(this.secondaryColor),
  lighten1: colorUtil.pSBC(0.6, colorUtil.rgbToHex(this.secondaryColor)),
  lighten2: colorUtil.pSBC(0.76, colorUtil.rgbToHex(this.secondaryColor)),
  lighten3: colorUtil.pSBC(0.93, colorUtil.rgbToHex(this.secondaryColor))
}

Localization

There are a few components that contain localized strings. For example, the wizard and modal components.

Initialization
import initI18n from '@vcita/design-system/init/initI18n';
...
Vue.use(DesignSystem);
initI18n();
...

This will enable the components to use the this.$dst function to get the localized strings.

By default, the texts will be presented in English, so should you need to display them in another locale, this is now you can set the locale as needed.

Available locales: en, de, es, fr, he, it, nl, pl, pt, ru, sl, tr

During startup
// plugins/designSystem.js
import DesignSystemInit from '@vcita/design-system/init/DesignSystem';
...
const config = {...};
const locale = 'yourSelection';
export default DesignSystemInit(config, locale);
During runtime

In a component, such as App.vue, add this call

// App.vue
this.$ds.setLocale(locale);

Component configuration options

VcTextField

Usage of VcTextField with googleAddressAutoComplete set to 'true'

// plugins/designSystem.js
const config = { 
                  options: {googleAppKey: 'yourGoogleAddressKey'}
               };

VcToast

Change VcToast default timeout

By default, the VcToast timeout is 3000ms. You can change that for a specific instance by setting the timeout prop to your desired value. In case you want to change that for the entire project, so any instance will use another timeout value, it can be done by calling this code

// plugins/designSystem.js
const config = {
                  options: {toastTimeout: 5000 }
               };

This will set the default timeout for all instances of VcToast in your project. Any instance that is getting a different value in the timeout prop will keep using that value.

Adding external icons

The package comes with a set of icons already included, which can easily be displayed using the VcIcon component. It is possible to extend that set by creating an object with key-value format

export default {
    yourKey1: `<svg ... /></svg>`,
    yourKey2: `<svg ... /></svg>`,
}

And passing that to the DesignSystem initialization

// plugins/designSystem.js
import extIcons from './yourFile.js';
const config = { 
                  extIcons
               };

Then to use the icons

<template>
    <VcIcon>$yourKey1</VcIcon>
</template>

Automation hooks

In order to facilitate automation, each design system component has a prop called dataQa. This prop has a default value matching the component's name. The value set in this prop will become an attribute on the component instance, which you can use in your automation code, to easily locate the component on the page.

To differentiate different instances, you can pass different dataQa values to different instances.

1.13.1

1 day ago

1.12.19

4 days ago

1.12.16-beta.7

5 days ago

1.12.16-beta.8

5 days ago

1.12.16-beta.6

8 days ago

1.12.18

8 days ago

1.12.16-beta.3

12 days ago

1.12.16-beta.2

12 days ago

1.12.16-beta.5

12 days ago

1.12.16-beta.4

12 days ago

1.12.17

12 days ago

1.12.16-beta.1

13 days ago

1.12.16-beta.0

13 days ago

1.12.16

26 days ago

1.12.15

28 days ago

1.12.14

1 month ago

1.12.13

1 month ago

1.12.12

1 month ago

1.12.11

2 months ago

1.12.9

2 months ago

1.12.8

2 months ago

1.12.10

2 months ago

1.12.7

2 months ago

1.12.6

2 months ago

1.12.5

2 months ago

1.12.3

2 months ago

1.12.2

2 months ago

1.12.4

2 months ago

1.12.1

2 months ago

1.11.33

2 months ago

1.11.3-2.beta-5

2 months ago

1.11.31

2 months ago

1.11.32

2 months ago

1.11.31-beta.3

2 months ago

1.11.31-beta.2

2 months ago

1.11.31-beta.1

2 months ago

1.11.31-beta.0

2 months ago

1.11.31-beta.4

2 months ago

1.11.30

2 months ago

1.11.29

2 months ago

1.11.28

2 months ago

1.11.27

2 months ago

1.11.25

3 months ago

1.11.26

3 months ago

1.11.24

3 months ago

1.11.23

3 months ago

1.11.22

3 months ago

1.11.21

3 months ago

1.11.20

3 months ago

1.11.18

3 months ago

1.11.19

3 months ago

1.11.16

3 months ago

1.11.17

3 months ago

1.11.15

3 months ago

1.11.14

3 months ago

1.11.13

4 months ago

1.11.12

4 months ago

1.11.11

4 months ago

1.11.10

4 months ago

1.11.9

5 months ago

1.11.8

5 months ago

1.11.7

5 months ago

1.11.6

5 months ago

1.11.4

5 months ago

1.11.3

5 months ago

1.11.5

5 months ago

1.11.2

5 months ago

1.11.1

5 months ago

1.10.5

5 months ago

1.10.4

5 months ago

1.10.3

6 months ago

1.10.2

6 months ago

1.6.2

10 months ago

1.6.1

10 months ago

1.6.0

10 months ago

1.9.14

6 months ago

1.9.13

6 months ago

1.9.12

7 months ago

1.9.11

7 months ago

1.9.10

7 months ago

1.9.0-beta.2

8 months ago

1.9.0-beta.1

8 months ago

1.10.1

6 months ago

1.9.1

8 months ago

1.9.0

8 months ago

1.9.6-beta.1

8 months ago

1.9.12-beta.1

6 months ago

1.9.12-beta.3

6 months ago

1.9.12-beta.2

6 months ago

1.8.2

9 months ago

1.8.1

9 months ago

1.8.0

9 months ago

1.9.7-beta.3

8 months ago

1.9.7-beta.2

8 months ago

1.9.7-beta.1

8 months ago

1.9.9

7 months ago

1.9.8

7 months ago

1.9.7

8 months ago

1.9.6

8 months ago

1.9.5

8 months ago

1.9.4

8 months ago

1.9.3

8 months ago

1.9.2

8 months ago

1.5.23-beta.2

10 months ago

1.7.2

9 months ago

1.5.23-beta.3

10 months ago

1.7.1

10 months ago

1.5.23-beta.0

10 months ago

1.5.23-beta.1

10 months ago

1.7.0

10 months ago

1.5.21

12 months ago

1.5.23

11 months ago

1.5.22

12 months ago

1.5.5

1 year ago

1.5.4

1 year ago

1.5.3

1 year ago

1.5.9

1 year ago

1.5.8

1 year ago

1.5.7

1 year ago

1.5.6

1 year ago

1.5.10

1 year ago

1.5.12

1 year ago

1.5.11

1 year ago

1.5.14

1 year ago

1.5.13

1 year ago

1.5.16

1 year ago

1.5.15

1 year ago

1.5.18

1 year ago

1.5.17

1 year ago

1.5.19

1 year ago

1.5.20

1 year ago

1.5.2

1 year ago

1.5.1

1 year ago

1.5.0

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.17

1 year ago

1.3.18

1 year ago

1.3.15

1 year ago

1.3.16

1 year ago

1.3.19

1 year ago

1.3.20

1 year ago

1.3.10

1 year ago

1.3.13

1 year ago

1.3.14

1 year ago

1.3.11

1 year ago

1.3.12

1 year ago

1.3.7

1 year ago

1.3.6

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.3.9

1 year ago

1.3.8

1 year ago

1.3.7-beta.1

1 year ago

1.1.1-beta.1

2 years ago

1.1.2-beta.2

2 years ago

1.1.2-beta.1

2 years ago

1.2.0

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.0-beta.1

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.10

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.1.7-beta.1

2 years ago

1.1.7-beta.2

2 years ago

0.6.27-beta.1

2 years ago

0.6.27

2 years ago

0.6.26

2 years ago

0.6.23-beta.2

2 years ago

0.6.23-beta.3

2 years ago

0.6.23

2 years ago

0.6.22

2 years ago

0.6.25

2 years ago

0.6.24

2 years ago

0.6.25-beta.1

2 years ago

0.6.23-beta.1

2 years ago

0.6.21

2 years ago

0.6.20

2 years ago

0.6.18

2 years ago

0.6.21-beta.1

2 years ago

0.6.17

2 years ago

0.6.19

2 years ago

0.6.16

2 years ago

0.6.15

2 years ago

0.6.17-beta.0

2 years ago

0.6.16-beta.0

2 years ago

0.6.14-beta.2

2 years ago

0.6.10

2 years ago

0.6.12

2 years ago

0.6.11

2 years ago

0.6.14

2 years ago

0.6.13

2 years ago

0.6.14-beta.1

2 years ago

0.6.13-beta.1

2 years ago

0.5.1-beta.14

2 years ago

0.5.1-beta.12

2 years ago

0.5.1-beta.13

2 years ago

0.5.1-beta.10

2 years ago

0.5.1-beta.11

2 years ago

0.6.0-beta.1

2 years ago

0.5.0-beta.1

2 years ago

0.5.1-beta.1

2 years ago

0.5.1-beta.2

2 years ago

0.5.1-beta.9

2 years ago

0.5.1-beta.7

2 years ago

0.5.1-beta.8

2 years ago

0.5.1-beta.5

2 years ago

0.5.1-beta.6

2 years ago

0.5.1-beta.3

2 years ago

0.5.0-beta.2

2 years ago

0.5.1-beta.4

2 years ago

0.6.7

2 years ago

0.6.6

2 years ago

0.6.9

2 years ago

0.6.8

2 years ago

0.6.2-beta.0

2 years ago

0.5.0

2 years ago

0.5.1

2 years ago

0.6.9-beta.1

2 years ago

0.6.3

2 years ago

0.6.2

2 years ago

0.6.4

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.3.16-beta.3

2 years ago

0.3.16-beta.2

2 years ago

0.3.12-beta.1

2 years ago

0.3.12-beta.2

2 years ago

0.2.6-beta.5

2 years ago

0.2.6-beta.3

2 years ago

0.2.11

2 years ago

0.3.1

2 years ago

0.3.15-beta.1

2 years ago

0.2.10-beta.5

2 years ago

0.2.10-beta.3

2 years ago

0.4.0

2 years ago

0.2.4-beta.2

2 years ago

0.1.5-beta.2

2 years ago

0.1.5-beta.1

2 years ago

0.3.16

2 years ago

0.3.15

2 years ago

0.3.14

2 years ago

0.1.5-beta.7

2 years ago

0.3.13

2 years ago

0.1.5-beta.6

2 years ago

0.3.12

2 years ago

0.1.5-beta.5

2 years ago

0.3.11

2 years ago

0.1.5-beta.4

2 years ago

0.1.5-beta.3

2 years ago

0.2.3-beta.1

2 years ago

1.0.0-beta.1

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.1.0-beta.0.0.1

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.5

2 years ago

0.1.3-beta.1

2 years ago

0.0.12-beta.30

3 years ago

0.0.12-beta.34

3 years ago

0.0.12-beta.33

3 years ago

0.0.12-beta.32

3 years ago

0.0.12-beta.31

3 years ago

0.0.12-beta.38

3 years ago

0.0.12-beta.37

3 years ago

0.0.12-beta.36

3 years ago

0.0.12-beta.35

3 years ago

0.0.12-beta.23

3 years ago

0.0.12-beta.22

3 years ago

0.0.12-beta.21

3 years ago

0.1.0

3 years ago

0.0.12-beta.27

3 years ago

0.0.12-beta.26

3 years ago

0.0.12-beta.25

3 years ago

0.0.12-beta.24

3 years ago

0.0.12-beta.29

3 years ago

0.0.12-beta.28

3 years ago

0.0.12-beta.40

3 years ago

0.0.12-beta.16

3 years ago

0.0.12-beta.19

3 years ago

0.0.12-beta.18

3 years ago

0.0.12-beta.17

3 years ago

0.0.12-beta.20

3 years ago

0.0.12-beta.15

3 years ago

0.0.12-beta.12

3 years ago

0.0.12-beta.14

3 years ago

0.0.12-beta.13

3 years ago

0.0.12-beta.11

3 years ago

0.0.12-beta.10

3 years ago

0.0.12-beta.8

3 years ago

0.0.12-beta.9

3 years ago

0.0.12-beta.7

3 years ago

0.0.12-beta.5

3 years ago

0.0.12-beta.6

3 years ago

0.0.12-beta.4

3 years ago

0.0.12-beta.3

3 years ago

0.0.12-beta.0

3 years ago

0.0.12-beta.1

3 years ago

0.0.12-beta.2

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.1

3 years ago

0.0.2

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago