@uh-design-system/component-library 0.0.1-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -0
  3. package/dist/cjs/app-globals-67d97547.js +506 -0
  4. package/dist/cjs/app-globals-67d97547.js.map +1 -0
  5. package/dist/cjs/component-library.cjs.js +26 -0
  6. package/dist/cjs/component-library.cjs.js.map +1 -0
  7. package/dist/cjs/index.cjs.js +4 -0
  8. package/dist/cjs/index.cjs.js.map +1 -0
  9. package/dist/cjs/loader.cjs.js +16 -0
  10. package/dist/cjs/loader.cjs.js.map +1 -0
  11. package/dist/collection/collection-manifest.json +10 -0
  12. package/dist/component-library/component-library.esm.js +2 -0
  13. package/dist/component-library/component-library.esm.js.map +1 -0
  14. package/dist/component-library/index.esm.js +2 -0
  15. package/dist/component-library/index.esm.js.map +1 -0
  16. package/dist/component-library/p-a49d7588.js +3 -0
  17. package/dist/component-library/p-a49d7588.js.map +1 -0
  18. package/dist/components/index.d.ts +33 -0
  19. package/dist/components/index.js +84 -0
  20. package/dist/components/index.js.map +1 -0
  21. package/dist/esm/app-globals-cde8e66f.js +481 -0
  22. package/dist/esm/app-globals-cde8e66f.js.map +1 -0
  23. package/dist/esm/component-library.js +21 -0
  24. package/dist/esm/component-library.js.map +1 -0
  25. package/dist/esm/index.js +3 -0
  26. package/dist/esm/index.js.map +1 -0
  27. package/dist/esm/loader.js +12 -0
  28. package/dist/esm/loader.js.map +1 -0
  29. package/dist/index.cjs.js +1 -0
  30. package/dist/index.js +1 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/types/Users/teemuparssinen/hy/uh-design-system/uh-component-library/.stencil/index.d.ts +11 -0
  33. package/dist/types/Users/teemuparssinen/hy/uh-design-system/uh-component-library/.stencil/utils/utils.d.ts +1 -0
  34. package/dist/types/components.d.ts +24 -0
  35. package/dist/types/stencil-public-runtime.d.ts +1680 -0
  36. package/dist/utils/utils.js +4 -0
  37. package/dist/utils/utils.js.map +1 -0
  38. package/docs/DEPLOYMENT.md +53 -0
  39. package/docs/DEVELOPMENT.md +52 -0
  40. package/docs/PUBLISHING.md +33 -0
  41. package/docs/TESTING.md +24 -0
  42. package/loader/cdn.js +1 -0
  43. package/loader/index.cjs.js +1 -0
  44. package/loader/index.d.ts +24 -0
  45. package/loader/index.es2017.js +1 -0
  46. package/loader/index.js +2 -0
  47. package/loader/package.json +11 -0
  48. package/package.json +96 -0
  49. package/react-wrapper/components.ts +0 -0
@@ -0,0 +1,4 @@
1
+ export function format(first, middle, last) {
2
+ return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
3
+ }
4
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM,CAAC,KAAc,EAAE,MAAe,EAAE,IAAa;IACnE,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACjF,CAAC","sourcesContent":["export function format(first?: string, middle?: string, last?: string): string {\n return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');\n}\n"]}
@@ -0,0 +1,53 @@
1
+ # University of Helsinki Design System Component Library
2
+
3
+ ## Deployment
4
+
5
+ ### CI worker
6
+
7
+ Atm. there is project specific Gitlab CI/CD runner in use. It is running as a Docker container. The runner is registered
8
+ to Gitlab manually on opa-worker-2.it.helsinki.fi server with the following command:
9
+
10
+ ```bash
11
+ docker exec -t uhds-gitlab-runner gitlab-runner register --non-interactive --executor docker \
12
+ --docker-image docker:stable --url https://version.helsinki.fi/ --token TOKEN --name uhds-runner --docker-privileged \
13
+ --docker-disable-cache=false --docker-volumes=/var/run/docker.sock:/var/run/docker.sock --docker-volumes=/builds:/builds
14
+ ```
15
+
16
+ ### Storybook
17
+
18
+ There is two servers in use. Official names are:
19
+ -
20
+ - designsystem-qa-24.it.helsinki.fi
21
+ - designsystem-prod-24.it.helsinki.fi
22
+
23
+ Design system was later decided to be published through 3rd party server, which will use domain name designsystem.helsinki.fi.
24
+
25
+ These servers are used for static Storybook site in the following addresses:
26
+ - https://storybook.it.helsinki.fi
27
+ - https://storybook-qa.it.helsinki.fi
28
+
29
+ Servers are provisioned using Ansible. At this point it means installing Nginx and configuring it. User with username
30
+ deployer with correct permissions to `/var/www/html` dir has been created manually to the servers with following commands as root user:
31
+
32
+ ```bash
33
+ adduser deployer
34
+ usermod -aG hysudo deployer
35
+ echo "deployer ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/deployer
36
+ mkdir -p /home/deployer/.ssh
37
+ chmod 700 /home/deployer/.ssh
38
+ echo "[deployer public key]" > /home/deployer/.ssh/authorized_keys
39
+ chmod 600 /home/deployer/.ssh/authorized_keys
40
+ chown -R deployer:deployer /home/deployer/.ssh
41
+ ```
42
+
43
+ deployer user's private key has been added to Gitlab as a file variable to be used for authentication in Gitlab CI/CD pipeline.
44
+
45
+ There is manual provision jobs in Gitlab CI/CD pipeline for both QA and production servers for setting up Nginx.
46
+
47
+ There is also automatic deployment job for Storybook site in Gitlab CI/CD pipeline. It uses `rsync` to copy files to the server.
48
+
49
+ Pushes to production branch will trigger automatic deployment to production server. Pushes to other branches will trigger automatic deployment to QA server.
50
+
51
+ Url to the other branches are in the form of `https://storybook-qa.it.helsinki.fi/[branch-name-slug]`. URL to the deployment is shown in the pipeline job log.
52
+
53
+ When the branch is deleted, the deployment job will remove the branch from the server except for the `main` and `production` branch.
@@ -0,0 +1,52 @@
1
+ # University of Helsinki Design System Component Library
2
+
3
+ ## Development Guide
4
+
5
+ This guide will help you set up the development environment for the University of Helsinki Design System Component Library.
6
+
7
+ ### Cloning the Repository
8
+
9
+ First, clone the repository to your local machine:
10
+
11
+ ```sh
12
+ git clone git@version.helsinki.fi:uh-design-system/component-library.git
13
+ cd component-library
14
+ ```
15
+
16
+ ### Installing Dependencies
17
+
18
+ Install the necessary dependencies using npm:
19
+
20
+ ```sh
21
+ npm install
22
+ ```
23
+
24
+ ### Building Components
25
+
26
+ To build the components, run the following command:
27
+
28
+ ```sh
29
+ npm run build
30
+ ```
31
+
32
+ This will compile the components and output them to the `dist` directory.
33
+
34
+ ### Running Storybook
35
+
36
+ To run Storybook for developing and testing components, use the following command:
37
+
38
+ ```sh
39
+ npm run develop
40
+ ```
41
+
42
+ This will start Storybook and watch for any changes in the components.
43
+
44
+ ### Running Static Storybook
45
+ To build and serve a static version of Storybook, use the following commands:
46
+
47
+ ```sh
48
+ npm run build-storybook-static
49
+ npx http-server storybook-static
50
+ ```
51
+
52
+ This will build the static Storybook files and serve them using a simple HTTP server.
@@ -0,0 +1,33 @@
1
+ # University of Helsinki Design System Component Library
2
+
3
+ ## Publishing Components
4
+
5
+ This document provides instructions on how to publish components in the University of Helsinki Design System Component Library using Lerna.
6
+
7
+ ### Prerequisites
8
+
9
+ - Ensure that Lerna is installed globally.
10
+
11
+ ```sh
12
+ npm install -g lerna
13
+ ```
14
+
15
+ ### Steps to Publish
16
+
17
+ 1. **Build the components**: Ensure that all components are built and ready for publishing.
18
+
19
+ ```sh
20
+ npm run build
21
+ ```
22
+
23
+ 2. **Publish with Lerna**: Use Lerna to publish the components. Lerna will handle versioning and pushing commits to GitLab.
24
+
25
+ ```sh
26
+ npx lerna publish
27
+ ```
28
+
29
+ ### Notes
30
+
31
+ - Ensure that you have the necessary permissions to publish the package.
32
+ - Follow the organization's guidelines for versioning and releasing components.
33
+ - Lerna will automatically update the version number and push the commit to GitLab.
@@ -0,0 +1,24 @@
1
+ # University of Helsinki Design System Component Library
2
+
3
+ ## Testing
4
+
5
+ [Storybook test runner](https://storybook.js.org/docs/writing-tests/test-runner) is used to run automatic tests in the repository. The types of tests include
6
+ - Visual testing using [jest-image-snapshot](https://github.com/americanexpress/jest-image-snapshot)
7
+ - Interaction testing using storybook test runner
8
+ - Accessibility tests using [axe-playwright](https://github.com/abhinaba-ghosh/axe-playwright)
9
+
10
+ Tests can be ran with command `npm run test-storybook`.
11
+
12
+ Visual tests can be updated with `npm run test-storybook:update`.
13
+
14
+ ### Compatibility issues
15
+
16
+ Different browsers and operating systems might render web content differently, so there's a possibility that visual tests
17
+ results in different outcomes locally and when ran in CI.
18
+
19
+ For this reason, there's also scripts to run tests and updating test snapshots using [docker](https://www.docker.com/).
20
+ This uses the same image as what is used in CI, so it should match the environment used in CI.
21
+
22
+ Tests using docker can be ran with command `npm run test-storybook:docker`.
23
+
24
+ Visual tests can be updated with docker with the command `npm run test-storybook:update:docker`.
package/loader/cdn.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/cjs/loader.cjs.js');
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/cjs/loader.cjs.js');
@@ -0,0 +1,24 @@
1
+ export * from '../dist/types/components';
2
+ export interface CustomElementsDefineOptions {
3
+ exclude?: string[];
4
+ resourcesUrl?: string;
5
+ syncQueue?: boolean;
6
+ jmp?: (c: Function) => any;
7
+ raf?: (c: FrameRequestCallback) => number;
8
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
9
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
10
+ }
11
+ export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): void;
12
+ /**
13
+ * @deprecated
14
+ */
15
+ export declare function applyPolyfills(): Promise<void>;
16
+
17
+ /**
18
+ * Used to specify a nonce value that corresponds with an application's CSP.
19
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
20
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
21
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
22
+ * will result in the same behavior.
23
+ */
24
+ export declare function setNonce(nonce: string): void;
@@ -0,0 +1 @@
1
+ export * from '../dist/esm/loader.js';
@@ -0,0 +1,2 @@
1
+ (function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})();
2
+ export * from '../dist/esm/loader.js';
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "component-library-loader",
3
+ "private": true,
4
+ "typings": "./index.d.ts",
5
+ "module": "./index.js",
6
+ "main": "./index.cjs.js",
7
+ "jsnext:main": "./index.es2017.js",
8
+ "es2015": "./index.es2017.js",
9
+ "es2017": "./index.es2017.js",
10
+ "unpkg": "./cdn.js"
11
+ }
package/package.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "@uh-design-system/component-library",
3
+ "version": "0.0.1-alpha.9",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "description": "University of Helsinki Design System Component Library",
8
+ "main": "dist/index.cjs.js",
9
+ "module": "dist/index.js",
10
+ "types": "dist/types/index.d.ts",
11
+ "collection": "dist/collection/collection-manifest.json",
12
+ "collection:main": "dist/collection/index.js",
13
+ "unpkg": "dist/uh-component-library/uh-component-library.esm.js",
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/uh-component-library/uh-component-library.esm.js",
17
+ "require": "./dist/uh-component-library/uh-component-library.cjs.js"
18
+ },
19
+ "./my-component": {
20
+ "import": "./dist/components/my-component.js",
21
+ "types": "./dist/components/my-component.d.ts"
22
+ },
23
+ "./loader": {
24
+ "types": "./loader/index.d.ts",
25
+ "import": "./loader/index.js",
26
+ "require": "./loader/index.cjs"
27
+ }
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://version.helsinki.fi/uh-design-system/component-library.git"
32
+ },
33
+ "files": [
34
+ "dist/",
35
+ "loader/",
36
+ "react-wrapper/",
37
+ "docs/"
38
+ ],
39
+ "scripts": {
40
+ "build": "stencil build",
41
+ "build.watch": "stencil build --watch",
42
+ "develop": "concurrently \"npm:build.watch\" \"npm:storybook\"",
43
+ "start": "stencil build --dev --watch --serve",
44
+ "test-storybook": "test-storybook",
45
+ "test-storybook:update": "test-storybook -u",
46
+ "test-storybook:docker": "./scripts/run-tests-in-docker.sh",
47
+ "test-storybook:update:docker": "./scripts/run-tests-in-docker.sh -u",
48
+ "test": "stencil test --spec --e2e",
49
+ "test.watch": "stencil test --spec --e2e --watchAll",
50
+ "generate": "stencil generate",
51
+ "storybook": "storybook dev -p 6006",
52
+ "build-storybook-static": "storybook build",
53
+ "build-storybook": "concurrently \"npm:build\" \"npm:storybook build\""
54
+ },
55
+ "devDependencies": {
56
+ "@chromatic-com/storybook": "^3.2.2",
57
+ "@material-symbols/svg-500": "^0.26.0",
58
+ "@stencil/core": "^4.22.2",
59
+ "@stencil/react-output-target": "^0.7.4",
60
+ "@storybook/addon-a11y": "^8.4.5",
61
+ "@storybook/addon-essentials": "^8.4.5",
62
+ "@storybook/addon-interactions": "^8.4.5",
63
+ "@storybook/addon-links": "^8.4.5",
64
+ "@storybook/addon-styling-webpack": "^1.0.1",
65
+ "@storybook/addon-webpack5-compiler-swc": "^1.0.5",
66
+ "@storybook/blocks": "^8.4.5",
67
+ "@storybook/manager-api": "^8.4.5",
68
+ "@storybook/test": "^8.4.5",
69
+ "@storybook/test-runner": "^0.19.1",
70
+ "@storybook/theming": "^8.4.5",
71
+ "@storybook/web-components": "^8.4.5",
72
+ "@storybook/web-components-webpack5": "^8.4.5",
73
+ "@types/jest": "^29.5.14",
74
+ "@types/node": "^16.18.119",
75
+ "axe-playwright": "^2.0.3",
76
+ "concurrently": "^9.1.0",
77
+ "css-loader": "^7.1.2",
78
+ "jest": "^29.7.0",
79
+ "jest-cli": "^29.7.0",
80
+ "jest-image-snapshot": "^6.4.0",
81
+ "lerna": "^8.1.9",
82
+ "lit": "^3.2.1",
83
+ "sass": "^1.81.0",
84
+ "sass-loader": "^16.0.3",
85
+ "stencil-inline-svg": "^1.1.0",
86
+ "storybook": "^8.4.5",
87
+ "storybook-dark-mode": "^4.0.2",
88
+ "style-loader": "^4.0.0"
89
+ },
90
+ "overrides": {
91
+ "rimraf": "^4.0.0",
92
+ "glob": "^9.0.0"
93
+ },
94
+ "license": "MIT",
95
+ "gitHead": "39df3fcff4ea2a3def7b423175b28255836042ec"
96
+ }
File without changes