1.71.2 • Published 4 months ago

@aleph-alpha/ds-components-vue v1.71.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
4 months ago

Aleph Alpha Design System Vue Components

@aleph-alpha/design-system-vue

This package provides a collection of Vue components that adhere to the Aleph Alpha Design System guidelines. It aims to simplify the process of building consistent and visually appealing user interfaces across various projects.

Installation

To integrate the Aleph Alpha Design System Vue Components into your project, install it using your preferred package manager:

pnpm add @aleph-alpha/ds-components-vue

Storybook

The storybook is made available via GitLab pages here: https://gitlab-pages.aleph-alpha.de/engineering/frontend-hub/storybook/ui/

Usage

To use the components in your Vue project, follow these steps:

Install Design System Plugin

Import the DesignSystem plugin in your main application file (usually main.js or main.ts):

// Style imports
import '@unocss/reset/tailwind.css';
import 'uno.css';
import 'virtual:uno.css';

import DesignSystem from '@aleph-alpha/ds-components-vue';
app.use(DesignSystem);

CSS Setup

To get the styling for the components applied in your application, you need to set up UnoCSS in your project. UnoCSS is a utility-first CSS framework that allows for a more efficient and consistent styling approach.

For detailed instructions on setting up UnoCSS, please refer to the UnoCSS Installation Guide. This guide will walk you through the process of installing UnoCSS and configuring it for your project.

After setting up UnoCSS, you need to use the Aleph Alpha CSS preset to apply the styling for the components in your application.

To apply the Aleph Alpha CSS preset, you need to add it to your UnoCSS configuration.

// unocss.config.ts
import { defineConfig } from 'unocss';

import { presetAlephAlpha, designSystemContentPathConfig } from '@aleph-alpha/config-css-preset';
import { presetAlephAlphaIcons } from '@aleph-alpha/ds-icons';

export default defineConfig({
  ...designSystemContentPathConfig('vue'),
  presets: [...presetAlephAlpha(), presetAlephAlphaIcons()],
});

Now you can use the components in your Vue components via the global plugin like this:

<template>
  <div>
    <AaButton>Click Me</AaButton>
  </div>
</template>

or you can import the components directly in your components like this:

<template>
  <div>
    <AaButton>Click Me</AaButton>
  </div>
</template>

<script>
import { AaButton } from '@aleph-alpha/ds-components-vue';
</script>

Instructions on theme customization

You can customize the theme by extending it. The theme tokens can be found here

NOTE: This only works for the default light theme. Dark mode is not supported yet.

// unocss.config.ts
export default defineConfig({
  ...getDesignSystemContentPathConfig('vue'),
  presets: [presetAlephAlpha()],
  extendTheme:  (theme) => {
    return {
      ...theme,
      colors: {
        ...theme.colors,
        'brand-bg-brand': 'yellow',
        'core-bg-primary': 'red',
      },
    }
  },
});

For Developers

You can view the components in the storybook by running:

nx run ds-components-vue:storybook

To publish the packages locally, execute

nx run ds-components-vue:build
nx run ds-components-vue:publish:local

To use them in your application go to your app and run

yalc add <PACKAGE>
e.g. yalc add @aleph-alpha/ds-components-vue@0.15.0

For further information see the yalc package

Note: putting a release happens automatically after merging an MR to the main branch. In the case where your commit messages contain commitlint types like "style", "refactor", or "chore", it won't trigger a release.

Contribute

When adding a new component, it needs to adhere to a certain directory structure to be exposed in the published package. Every new components need to be either placed in the elements, patterns or interfaces directory. The component should be placed in a subdirectory with the same name as the component. The component subdirectory needs to include a index.ts, which exports everything you want to expose in the published package. Typically, this would include the component itself, child components and any other types or utilities that are helpful to use the component. The component subdirectory should also include a *.stories.ts file for the storybook and a __tests__ directory for the tests. Here is an example for a new component called AaButton:

ds-components-vue
└── src
    └── components
        └── elements
            └── AaButton
                ├── index.ts
                ├── AaButton.vue
                ├── AaButton.stories.ts
                └── __tests__
// index.ts
export { default as AaButton } from './AaButton.vue';
export * from './types';

Layout / visual regression tests

Layout tests (aka visual regression or snapshot tests) are done using storybook and test-runner (link).

To run the tests locally execute:

nx run ds-components-vue:test:storybook

The executed command will report any stories with detected differences between the expected and the actual screenshot.

If the layout tests fail, but the changes are intended, you can update the reference snapshots (for both local/darwin and CI/linux platforms) by running:

nx run ds-components-vue:test:storybook:update

Caveat: This will override your node_modules with modules from a different store (the store inside the docker container) - so afterward it will be necessary to run pnpm install in your terminal again.

Build Process

Before bundling the components, the components need to be built. This is done by running the following command:

nx run ds-components-vue:build

The build script runs the scripts/prepare-build.cjs script, which creates the necessary files for the components to be properly exposed.

Changelog

To stay up-to-date with the latest changes, bug fixes, and new features, check out the Changelog.

1.71.2

4 months ago

1.71.1

4 months ago

1.71.0

4 months ago

1.70.8

4 months ago

1.70.7

4 months ago

1.70.6

4 months ago

1.70.5

5 months ago

1.70.4

5 months ago

1.70.3

5 months ago

1.70.2

5 months ago

1.70.1

5 months ago

1.70.0

5 months ago

1.69.0

5 months ago

1.69.1

5 months ago

1.68.1

5 months ago

1.68.0

5 months ago

1.67.6

5 months ago

1.67.5

5 months ago

1.67.4

5 months ago

1.67.3

5 months ago

1.67.2

5 months ago

1.67.1

5 months ago

1.67.0

5 months ago

1.66.4

5 months ago

1.66.3

5 months ago

1.66.2

5 months ago

1.66.1

5 months ago

1.66.0

5 months ago

1.65.1

5 months ago

1.65.0

5 months ago

1.64.1

5 months ago

1.64.0

5 months ago

1.63.0

5 months ago

1.62.0

5 months ago

1.61.0

5 months ago

1.60.3

5 months ago

1.60.2

5 months ago

1.60.1

5 months ago

1.60.0

5 months ago

1.59.5

5 months ago

1.59.4

5 months ago

1.59.3

5 months ago

1.59.2

5 months ago

1.59.1

5 months ago

1.59.0

5 months ago

1.58.1

5 months ago

1.58.0

5 months ago

1.57.0

5 months ago

1.56.4

5 months ago

1.56.3

5 months ago

1.56.2

6 months ago

1.56.1

6 months ago

1.56.0

6 months ago

1.55.4

6 months ago

1.55.3

6 months ago

1.55.2

6 months ago

1.55.1

6 months ago

1.55.0

6 months ago

1.54.4

6 months ago

1.54.3

6 months ago

1.54.2

6 months ago

1.54.1

6 months ago

1.54.0

6 months ago

1.53.1

6 months ago

1.53.0

6 months ago

1.52.1

6 months ago

1.52.0

6 months ago

1.51.0

6 months ago

1.50.1

6 months ago

1.50.0

6 months ago

1.49.8

6 months ago

1.49.7

6 months ago

1.49.6

6 months ago

1.49.5

6 months ago

1.49.4

6 months ago

1.49.3

6 months ago

1.49.2

6 months ago

1.49.1

6 months ago

1.49.0

6 months ago

1.48.1

6 months ago

1.48.0

6 months ago

1.47.0

6 months ago

1.46.9

6 months ago

1.46.8

6 months ago

1.46.7

6 months ago

1.46.6

6 months ago

1.46.5

6 months ago

1.46.4

6 months ago

1.46.3

7 months ago

1.46.2

7 months ago

1.46.1

7 months ago

1.46.0

7 months ago

1.45.7

7 months ago

1.45.6

7 months ago

1.45.5

7 months ago

1.45.4

7 months ago

1.45.3

7 months ago

1.45.2

7 months ago

1.45.1

7 months ago

1.45.0

7 months ago

1.44.1

7 months ago

1.44.0

7 months ago

1.43.1

7 months ago

1.43.0

7 months ago

1.42.0

7 months ago

1.41.0

7 months ago

1.40.2

7 months ago

1.40.1

7 months ago

1.40.0

7 months ago

1.39.3

7 months ago

1.39.2

7 months ago

1.39.1

7 months ago

1.39.0

7 months ago

1.38.8

7 months ago

1.38.7

7 months ago

1.38.6

7 months ago

1.38.5

7 months ago

1.38.4

7 months ago

1.38.3

7 months ago

1.38.2

7 months ago

1.38.1

7 months ago

1.38.0

7 months ago

1.37.2

7 months ago

1.37.1

8 months ago

1.37.0

8 months ago

1.36.2

8 months ago