14.0.0 • Published 4 months ago

@dpa-id-components/dpa-shared-components v14.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

DPA shared components library

Collection of vue 3 components for usage across dpa projects.

Pre-requirements

This project requires a node version of 16.x or higher. For Node environments such as nuxt.js Node v20 or higher is required to prevent errors from the missing crypto library, which is needed for uuid.

You need to add and integrate the Inter font that can be found in src/assets/fonts to your project manually. An example how the CSS could look can be found in src/tailwind/fonts.css

Notes

This project uses Typescript version >= 5.0. This upgrade included changes to the module resolution, which are not yet reflected fully in the tsconfig. If your project uses TS 5.0 or higher itself you most likely need to set

"resolvePackageJsonExports": false

to prevent transpiler errors. For more information see the migration guide of ts.

Usage

To use a component just import it from @dpa-id-components/dpa-shared-components like

import { UiBadge } from "@dpa-id-components/dpa-shared-components";

Tailwind

To have the styling working correctly you have to extend the tailwind config in your project.

Please ensure that the version of Tailwind in your host application meets the version specified under peerDependencies in package.json.

import sharedComponentsConfig from '@dpa-id-components/dpa-shared-components/tailwindConfig'
import { Config } from 'tailwindcss'

export default {
  presets: [sharedComponentsConfig],
  content: [
    // ... your content globs ...
    './node_modules/@dpa-id-components/dpa-shared-components/**/*.{js,mjs,cjs}'
  ]
}
satisfies
Config

The tailwind config is located at ./src/tailwind/tailwind.config.ts. Please be aware that used plugins must be listed in the dependencies or the projects using the components have to install it.

ESLint

As of version 11.x.x, this project is setup to use ESLint 9+ which no longer supports the .eslintrc configuration format. The ESLint flat configuration file for this project is located at ./eslint.config.mjs. The base ESLint configuration ./eslint.base.config.mjs is exported in the published npm package as a shareable config file and can be used as the base configuration for host projects. Plugins and third party configs used in ./eslint.base.config.mjs should be added to dependencies in package.json.

Please note the following when configuring the eslint.config.mjs file in a host project:

  • Project specific third-party plugins and config (updated accordingly for flat config support) should be added as devDependencies
  • Files to be included or ignored by ESLint should be configured here
  • Adjust the lint script in package.json to "lint": "eslint . --fix"

To use the shared ESLint config in a host project's eslint.config.mjs:

import sharedConfig from "@dpa-id-components/dpa-shared-components/eslint.config";
// Other project specific plugins
import pluginCypress from "eslint-plugin-cypress/flat";

export default [
  // Files to include or ignore under linting
  {
    files: ["**/*.js", "**/*.mjs", "**/*.ts", "**/*.mts", "**/*.vue"],
  },
  {
    ignores: ["_infrastructure/*", "**/dist/**", "**/coverage/**"],
  },
  ...sharedConfig,
  pluginCypress.configs.recommended,
];

Add a component

To add a new component please add at least the following files:

  • Readme.md
  • Component.spec.ts
  • Component.stories.js
  • Component.vue

The readme should contain a minimal explanation of the usage and a definition of the api of the component (props, events, slots...). Also don't forget to add an import/export in ./src/components/index.ts to make your component available.

Tests

Tests are based on vitest and Vue Test Utils 2 running in a jsdom environment. To run the tests run

npm run test

The tests automatically are run as a watch task.

Storybook

This project runs on a 6.5 version of Storybook with a vite integration. If you want to change the vite config for storybook, please be aware that storybook overwrites the plugin section of the config in ./.storybook/main.ts, since storybook can't handle the vue plugin.

To start storybook locally run

npm run storybook

A deployed version of the storybook can be found here.

Link the project locally

For a better developer experience and testing in your actual it's recommended to link the package locally. For that run

npm link

in the root of your cloned shared components and

npm link "@dpa-id-components/dpa-shared-components"

in your target project.

Don't forget to run

npm run build

before linking or otherwise you wouldn't have a dist folder.

If linking doesn't seem to work, you can try to clear your vite-cache by deleting the node_modules/.vite folder

SVG icons

To add SVG icons, just copy the .svg file to ./src/assets/icons. Preferably you add the filename also to the ìconNames.ts so it's available in Storybook as option and in the overview. SVGs get loaded by vite-svg-loader, which optimizes the SVGs with svgo. Config can be added in vite.config.ts and ./.storybook/main.ts ( duplicated since Storybook can't handle the vite config plugins). Custom optimizations right now are:

  • removing dimensions (width/height attributes)
  • removing fills (to enable styling)

Releasing

To publish a new release just go to the Actions tab and click "Publish new version". You are prompted with the option to choose which version to bump. Behind the scenes it just does one of those commands below. They will still work on their own but the #shared-components Slack channel won't be notified.

npm run release:patch
npm run release:minor
npm run release:major
10.0.0

10 months ago

9.12.0

10 months ago

12.4.0

5 months ago

9.9.8

11 months ago

9.9.9

11 months ago

9.9.7

11 months ago

12.3.0

5 months ago

9.11.0

10 months ago

13.1.0

5 months ago

11.0.0

9 months ago

10.1.0

10 months ago

13.2.0

5 months ago

14.0.0

4 months ago

13.2.1

4 months ago

12.0.0

9 months ago

12.0.1

9 months ago

12.0.2

8 months ago

13.0.0

5 months ago

13.0.1

5 months ago

12.2.1

6 months ago

12.2.2

6 months ago

12.2.3

6 months ago

12.2.4

6 months ago

12.2.0

6 months ago

11.0.0-alpha.0

9 months ago

12.1.0

7 months ago

9.9.6

12 months ago

9.9.5

12 months ago

9.9.4

12 months ago

9.9.3

1 year ago

9.8.1

1 year ago

9.8.0

1 year ago

9.9.0-alpha.0

1 year ago

9.9.0-alpha.1

1 year ago

9.9.0

1 year ago

9.9.1

1 year ago

9.9.2

1 year ago

9.4.6

1 year ago

9.4.5

1 year ago

9.4.4

1 year ago

9.4.3

1 year ago

9.4.2

1 year ago

9.5.2

1 year ago

9.5.1

1 year ago

9.5.0

1 year ago

9.4.1

1 year ago

9.4.0

1 year ago

9.2.1

2 years ago

9.2.0

2 years ago

9.1.2

2 years ago

9.1.1

2 years ago

9.1.1-0

2 years ago

9.1.0

2 years ago

9.0.0

2 years ago

8.13.1

2 years ago

8.13.0

2 years ago

8.12.9

2 years ago

8.13.0-alpha

2 years ago

8.12.8

2 years ago

8.12.7

2 years ago

8.12.4

2 years ago

8.12.6

2 years ago

8.12.5

2 years ago

8.12.3

2 years ago

8.12.2

2 years ago

8.12.1

2 years ago

8.12.0

2 years ago

8.11.11

2 years ago

8.11.10

2 years ago

8.11.5

2 years ago

8.11.7

2 years ago

8.11.6

2 years ago

8.11.9

2 years ago

8.11.8

2 years ago

8.11.4

2 years ago

8.11.3

2 years ago

8.11.3-1

2 years ago

8.11.3-0

2 years ago

8.11.2

2 years ago

8.11.1

2 years ago

8.11.0

2 years ago

8.10.5

2 years ago

8.10.4

2 years ago

8.10.0

2 years ago

8.10.3

2 years ago

8.9.7

2 years ago

8.9.6

2 years ago

8.9.5

2 years ago

8.9.4

2 years ago

8.5.1-1

2 years ago

8.5.1-0

2 years ago

8.2.3

2 years ago

8.6.1

2 years ago

8.6.0

2 years ago

8.2.4

2 years ago

7.0.8

2 years ago

7.0.7

2 years ago

7.0.6

2 years ago

7.0.5

2 years ago

7.0.9

2 years ago

8.1.0

2 years ago

8.1.2

2 years ago

8.1.1

2 years ago

7.0.9-0

2 years ago

8.0.3-0

2 years ago

8.3.2

2 years ago

8.3.1

2 years ago

8.7.0

2 years ago

7.0.0

2 years ago

7.0.4

2 years ago

7.0.3

2 years ago

7.0.2

2 years ago

7.0.1

2 years ago

7.1.5

2 years ago

7.1.4

2 years ago

8.2.3-1

2 years ago

8.2.3-0

2 years ago

8.2.1

2 years ago

8.2.3-2

2 years ago

8.2.0

2 years ago

8.1.1-0

2 years ago

8.0.8-1

2 years ago

8.0.8-4

2 years ago

8.0.8-3

2 years ago

8.0.8-6

2 years ago

8.0.8-5

2 years ago

8.0.8-0

2 years ago

8.8.2-0

2 years ago

8.8.1

2 years ago

8.8.0

2 years ago

8.8.3

2 years ago

8.8.2

2 years ago

8.4.1

2 years ago

8.0.5

2 years ago

8.4.0

2 years ago

8.0.7

2 years ago

8.4.2

2 years ago

8.0.6

2 years ago

8.8.5

2 years ago

7.1.3

2 years ago

8.8.4

2 years ago

7.1.1

2 years ago

7.1.0

2 years ago

8.3.0

2 years ago

8.5.2-1

2 years ago

8.5.2-0

2 years ago

8.5.2-2

2 years ago

8.9.0

2 years ago

8.9.2

2 years ago

8.9.1

2 years ago

8.5.0

2 years ago

8.5.1

2 years ago

7.2.2

2 years ago

8.9.3

2 years ago

7.2.1

2 years ago

7.2.0

2 years ago

8.0.1

2 years ago

8.0.0

2 years ago

8.0.3

2 years ago

8.0.2

2 years ago

6.0.9

2 years ago

6.0.7

2 years ago

6.0.8

2 years ago

4.0.3-0

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

5.0.3

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

3.1.7

2 years ago

3.1.6

2 years ago

3.1.5

2 years ago

4.3.0

2 years ago

5.1.1

2 years ago

5.1.0

2 years ago

4.0.1-2

2 years ago

4.0.1-3

2 years ago

4.0.1-0

2 years ago

4.0.1-1

2 years ago

6.0.6

2 years ago

4.2.2

2 years ago

4.2.1

2 years ago

4.2.0

2 years ago

6.0.1

2 years ago

6.0.0

2 years ago

6.0.3

2 years ago

6.0.2

2 years ago

4.1.0

2 years ago

3.1.4

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.2

2 years ago

3.0.0

2 years ago

2.0.1-1

2 years ago

2.0.1-0

2 years ago

2.0.0

2 years ago

1.9.0

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

1.7.1-0

2 years ago

1.7.0

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.4.5

2 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.5.0

3 years ago

1.4.1

3 years ago

1.4.1-0

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.1-0

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

0.17.0

3 years ago

0.15.7

3 years ago

0.15.6

3 years ago

0.15.5

3 years ago

0.15.4

3 years ago

0.15.3

3 years ago

1.0.0

3 years ago

0.16.0

3 years ago

0.15.2

3 years ago

0.15.1

3 years ago

0.15.0

3 years ago

0.14.2

3 years ago

0.14.1

3 years ago

0.14.0

3 years ago

0.13.1

3 years ago

0.13.0

3 years ago

0.11.1

3 years ago

0.11.0

3 years ago

0.10.1

3 years ago

0.10.0

3 years ago

0.9.0

3 years ago

0.8.1

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.4

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago