@ongov/ontario-design-system-component-library-angular 7.0.0 → 8.0.0-alpha.1
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.
- package/README.md +58 -38
- package/dist/component-library/README.md +1 -1
- package/dist/component-library/fesm2022/angular-component-library.mjs +1019 -733
- package/dist/component-library/fesm2022/angular-component-library.mjs.map +1 -1
- package/dist/component-library/package.json +2 -4
- package/dist/component-library/{lib/stencil-generated/components.d.ts → types/angular-component-library.d.ts} +543 -482
- package/package.json +36 -21
- package/projects/component-library/README.md +1 -1
- package/projects/component-library/src/lib/stencil-generated/angular-component-lib/utils.ts +44 -44
- package/projects/component-library/src/lib/stencil-generated/components.ts +2388 -2767
- package/projects/component-library/src/lib/stencil-generated/index.ts +152 -151
- package/projects/component-library/src/public-api.ts +1 -1
- package/dist/component-library/esm2022/angular-component-library.mjs +0 -5
- package/dist/component-library/esm2022/lib/component-library.module.mjs +0 -20
- package/dist/component-library/esm2022/lib/stencil-generated/angular-component-lib/utils.mjs +0 -59
- package/dist/component-library/esm2022/lib/stencil-generated/components.mjs +0 -3796
- package/dist/component-library/esm2022/lib/stencil-generated/index.mjs +0 -155
- package/dist/component-library/esm2022/public-api.mjs +0 -8
- package/dist/component-library/index.d.ts +0 -5
- package/dist/component-library/lib/component-library.module.d.ts +0 -7
- package/dist/component-library/lib/stencil-generated/angular-component-lib/utils.d.ts +0 -9
- package/dist/component-library/lib/stencil-generated/index.d.ts +0 -2
- package/dist/component-library/public-api.d.ts +0 -4
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Introduction
|
|
11
11
|
|
|
12
|
-
This library
|
|
12
|
+
This library is built using [`@stencil/angular-output-target`](https://www.npmjs.com/package/@stencil/angular-output-target) and supports Angular versions 20+. It is based off the [Ontario Design System Component Library](https://www.npmjs.com/package/@ongov/ontario-design-system-component-library) built using [Stencil](https://stenciljs.com/). For more information, [find it on NPM](https://www.npmjs.com/package/@ongov/ontario-design-system-component-library-angular).
|
|
13
13
|
|
|
14
14
|
## Installation and usage
|
|
15
15
|
|
|
@@ -17,61 +17,81 @@ To find documentation on individual web components in this component library, pl
|
|
|
17
17
|
|
|
18
18
|
To use the Ontario Design System Angular component library, follow these steps:
|
|
19
19
|
|
|
20
|
-
1. Install the npm package
|
|
20
|
+
### 1. Install the npm package
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
```bash
|
|
23
|
+
npm install --save @ongov/ontario-design-system-component-library-angular
|
|
24
|
+
```
|
|
25
25
|
|
|
26
|
-
2.
|
|
26
|
+
### 2. Importing the component library styles
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
There are three supported ways to include the Ontario Design System theme in your Angular application.
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
"build": {
|
|
32
|
-
"options": {
|
|
33
|
-
"styles": ["node_modules/@ongov/ontario-design-system-component-library-angular/dist/styles/theme.scss"]
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
```
|
|
30
|
+
**Option A: Direct Import in Angular Styles**
|
|
37
31
|
|
|
38
|
-
|
|
32
|
+
Add the following to your global `styles.scss` file:
|
|
39
33
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
```scss
|
|
35
|
+
@forward 'pkg:@ongov/ontario-design-system-component-library-angular/styles/theme.scss';
|
|
36
|
+
```
|
|
43
37
|
|
|
44
|
-
|
|
38
|
+
**Option B: Create a Separate Styles File**
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
import { ComponentLibraryModule } from '@ongov/ontario-design-system-component-library-angular/dist/component-library';
|
|
40
|
+
Alternatively, you can create a new SCSS file (e.g., `theme.scss`). If you need to override the global styles theme with a custom asset base path, you can create a local theme wrapper that forwards the global styles and sets `$asset-base-path`, then import that wrapper in your app entry point.
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
```scss
|
|
43
|
+
@forward 'pkg:@ongov/ontario-design-system-component-library-angular/styles/theme.scss' with (
|
|
44
|
+
$asset-base-path: '/assets'
|
|
45
|
+
);
|
|
46
|
+
```
|
|
54
47
|
|
|
55
|
-
|
|
48
|
+
Then, include this file in your Angular project by adding it to the `styles` array in `angular.json`:
|
|
56
49
|
|
|
57
|
-
|
|
50
|
+
```json
|
|
51
|
+
"styles": [
|
|
52
|
+
"src/theme.scss"
|
|
53
|
+
]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Option C: Add the Design System theme CSS**
|
|
57
|
+
|
|
58
|
+
Add the following to the styles array in your project’s `angular.json` file:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
"build": {
|
|
62
|
+
"options": {
|
|
63
|
+
"styles": [
|
|
64
|
+
"node_modules/@ongov/ontario-design-system-global-styles/dist/styles/css/compiled/ontario-theme.css"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
You may also use the minified version in production if desired: `ontario-theme.min.css`.
|
|
70
|
+
|
|
71
|
+
### 3. Import the ComponentLibraryModule
|
|
72
|
+
|
|
73
|
+
Import `ComponentLibraryModule` into your root module. This registers all Ontario Design System web components for use in your Angular application.
|
|
58
74
|
|
|
59
75
|
```typescript
|
|
60
|
-
import {
|
|
76
|
+
import { ComponentLibraryModule } from '@ongov/ontario-design-system-component-library-angular';
|
|
61
77
|
|
|
62
|
-
|
|
78
|
+
@NgModule({
|
|
79
|
+
imports: [ComponentLibraryModule],
|
|
80
|
+
})
|
|
81
|
+
export class AppModule {}
|
|
63
82
|
```
|
|
64
83
|
|
|
65
|
-
|
|
84
|
+
## Asset path configuration (optional)
|
|
66
85
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
86
|
+
If your app serves component assets (fonts, images, favicons) from a non-root path, configure the asset base path before components render.
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { setAssetPath } from '@ongov/ontario-design-system-component-library-angular';
|
|
90
|
+
|
|
91
|
+
setAssetPath(`${window.location.origin}/assets/`);
|
|
72
92
|
```
|
|
73
93
|
|
|
74
|
-
|
|
94
|
+
## Usage
|
|
75
95
|
|
|
76
96
|
You can now use the Angular Components in your component template files.
|
|
77
97
|
|
|
@@ -79,7 +99,7 @@ You can now use the Angular Components in your component template files.
|
|
|
79
99
|
<ontario-button type="primary">Primary Button</ontario-button>
|
|
80
100
|
```
|
|
81
101
|
|
|
82
|
-
|
|
102
|
+
## Local assets
|
|
83
103
|
|
|
84
104
|
Along with the components, the local assets (logos, fonts, etc.) need to be copied into your project so that they are available for bundling upon building your Angular application.
|
|
85
105
|
|
|
@@ -17,7 +17,7 @@ To use the Angular Component Library, follow these steps:
|
|
|
17
17
|
2. Import the `ComponentLibraryModule`, or whichever specific component you wish to use into your root module. The `ComponentLibraryModule` import will include all the Ontario Design System web components.
|
|
18
18
|
|
|
19
19
|
```typescript
|
|
20
|
-
import { ComponentLibraryModule } from '@ongov/ontario-design-system-component-library-angular
|
|
20
|
+
import { ComponentLibraryModule } from '@ongov/ontario-design-system-component-library-angular';
|
|
21
21
|
|
|
22
22
|
@NgModule({
|
|
23
23
|
imports: [ComponentLibraryModule],
|