@ni/nimble-angular 1.0.0-beta.96 → 1.0.0
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 +87 -21
- package/bundles/ni-nimble-angular.umd.js +1313 -1047
- package/bundles/ni-nimble-angular.umd.js.map +1 -1
- package/directives/button/nimble-button.directive.d.ts +17 -5
- package/directives/button/nimble-button.module.d.ts +0 -6
- package/directives/button/nimble-button.module.ngfactory.d.ts +3 -0
- package/directives/checkbox/nimble-checkbox-control-value-accessor.directive.d.ts +0 -3
- package/directives/checkbox/nimble-checkbox.directive.d.ts +2 -3
- package/directives/checkbox/nimble-checkbox.module.d.ts +0 -7
- package/directives/checkbox/nimble-checkbox.module.ngfactory.d.ts +3 -0
- package/directives/drawer/nimble-drawer.directive.d.ts +25 -0
- package/directives/drawer/nimble-drawer.module.d.ts +3 -0
- package/directives/drawer/nimble-drawer.module.ngfactory.d.ts +3 -0
- package/directives/listbox-option/nimble-listbox-option.directive.d.ts +9 -7
- package/directives/listbox-option/nimble-listbox-option.module.d.ts +0 -6
- package/directives/listbox-option/nimble-listbox-option.module.ngfactory.d.ts +3 -0
- package/directives/menu/nimble-menu.directive.d.ts +7 -0
- package/directives/menu/nimble-menu.module.d.ts +3 -0
- package/directives/menu/nimble-menu.module.ngfactory.d.ts +3 -0
- package/directives/menu-item/nimble-menu-item.directive.d.ts +14 -0
- package/directives/menu-item/nimble-menu-item.module.d.ts +3 -0
- package/directives/menu-item/nimble-menu-item.module.ngfactory.d.ts +3 -0
- package/directives/number-field/nimble-number-field-control-value-accessor.directive.d.ts +9 -0
- package/directives/number-field/nimble-number-field.directive.d.ts +17 -8
- package/directives/number-field/nimble-number-field.module.d.ts +0 -7
- package/directives/number-field/nimble-number-field.module.ngfactory.d.ts +3 -0
- package/directives/select/nimble-select-control-value-accessor.directive.d.ts +0 -3
- package/directives/select/nimble-select.directive.d.ts +2 -3
- package/directives/select/nimble-select.module.d.ts +0 -7
- package/directives/select/nimble-select.module.ngfactory.d.ts +3 -0
- package/directives/tab/nimble-tab.directive.d.ts +9 -4
- package/directives/tab/nimble-tab.module.d.ts +0 -6
- package/directives/tab/nimble-tab.module.ngfactory.d.ts +3 -0
- package/directives/tab-panel/nimble-tab-panel.directive.d.ts +2 -3
- package/directives/tab-panel/nimble-tab-panel.module.d.ts +0 -6
- package/directives/tab-panel/nimble-tab-panel.module.ngfactory.d.ts +3 -0
- package/directives/tabs/nimble-tabs.directive.d.ts +9 -9
- package/directives/tabs/nimble-tabs.module.d.ts +0 -6
- package/directives/tabs/nimble-tabs.module.ngfactory.d.ts +3 -0
- package/directives/tabs-toolbar/nimble-tabs-toolbar.directive.d.ts +2 -3
- package/directives/tabs-toolbar/nimble-tabs-toolbar.module.d.ts +0 -6
- package/directives/tabs-toolbar/nimble-tabs-toolbar.module.ngfactory.d.ts +3 -0
- package/directives/text-field/nimble-text-field-control-value-accessor.directive.d.ts +9 -0
- package/directives/text-field/nimble-text-field.directive.d.ts +14 -4
- package/directives/text-field/nimble-text-field.module.d.ts +0 -7
- package/directives/text-field/nimble-text-field.module.ngfactory.d.ts +3 -0
- package/directives/theme-provider/nimble-theme-provider.directive.d.ts +11 -4
- package/directives/theme-provider/nimble-theme-provider.module.d.ts +0 -6
- package/directives/theme-provider/nimble-theme-provider.module.ngfactory.d.ts +3 -0
- package/directives/tree-item/nimble-tree-item.directive.d.ts +14 -13
- package/directives/tree-item/nimble-tree-item.module.d.ts +0 -6
- package/directives/tree-item/nimble-tree-item.module.ngfactory.d.ts +3 -0
- package/directives/tree-view/nimble-tree-view.directive.d.ts +11 -3
- package/directives/tree-view/nimble-tree-view.module.d.ts +0 -6
- package/directives/tree-view/nimble-tree-view.module.ngfactory.d.ts +3 -0
- package/directives/utilities/template-value-helpers.d.ts +20 -0
- package/esm2015/directives/button/nimble-button.directive.js +50 -21
- package/esm2015/directives/button/nimble-button.directive.ngsummary.json +1 -0
- package/esm2015/directives/button/nimble-button.module.js +8 -13
- package/esm2015/directives/button/nimble-button.module.ngfactory.js +12 -0
- package/esm2015/directives/button/nimble-button.module.ngsummary.json +1 -0
- package/esm2015/directives/checkbox/nimble-checkbox-control-value-accessor.directive.js +14 -22
- package/esm2015/directives/checkbox/nimble-checkbox-control-value-accessor.directive.ngsummary.json +1 -0
- package/esm2015/directives/checkbox/nimble-checkbox.directive.js +6 -10
- package/esm2015/directives/checkbox/nimble-checkbox.directive.ngsummary.json +1 -0
- package/esm2015/directives/checkbox/nimble-checkbox.module.js +8 -13
- package/esm2015/directives/checkbox/nimble-checkbox.module.ngfactory.js +12 -0
- package/esm2015/directives/checkbox/nimble-checkbox.module.ngsummary.json +1 -0
- package/esm2015/directives/drawer/nimble-drawer.directive.js +60 -0
- package/esm2015/directives/drawer/nimble-drawer.directive.ngsummary.json +1 -0
- package/esm2015/directives/drawer/nimble-drawer.module.js +14 -0
- package/esm2015/directives/drawer/nimble-drawer.module.ngfactory.js +12 -0
- package/esm2015/directives/drawer/nimble-drawer.module.ngsummary.json +1 -0
- package/esm2015/directives/listbox-option/nimble-listbox-option.directive.js +27 -23
- package/esm2015/directives/listbox-option/nimble-listbox-option.directive.ngsummary.json +1 -0
- package/esm2015/directives/listbox-option/nimble-listbox-option.module.js +8 -13
- package/esm2015/directives/listbox-option/nimble-listbox-option.module.ngfactory.js +12 -0
- package/esm2015/directives/listbox-option/nimble-listbox-option.module.ngsummary.json +1 -0
- package/esm2015/directives/menu/nimble-menu.directive.js +12 -0
- package/esm2015/directives/menu/nimble-menu.directive.ngsummary.json +1 -0
- package/esm2015/directives/menu/nimble-menu.module.js +14 -0
- package/esm2015/directives/menu/nimble-menu.module.ngfactory.js +12 -0
- package/esm2015/directives/menu/nimble-menu.module.ngsummary.json +1 -0
- package/esm2015/directives/menu-item/nimble-menu-item.directive.js +30 -0
- package/esm2015/directives/menu-item/nimble-menu-item.directive.ngsummary.json +1 -0
- package/esm2015/directives/menu-item/nimble-menu-item.module.js +14 -0
- package/esm2015/directives/menu-item/nimble-menu-item.module.ngfactory.js +12 -0
- package/esm2015/directives/menu-item/nimble-menu-item.module.ngsummary.json +1 -0
- package/esm2015/directives/number-field/nimble-number-field-control-value-accessor.directive.js +24 -0
- package/esm2015/directives/number-field/nimble-number-field-control-value-accessor.directive.ngsummary.json +1 -0
- package/esm2015/directives/number-field/nimble-number-field.directive.js +56 -36
- package/esm2015/directives/number-field/nimble-number-field.directive.ngsummary.json +1 -0
- package/esm2015/directives/number-field/nimble-number-field.module.js +9 -15
- package/esm2015/directives/number-field/nimble-number-field.module.ngfactory.js +12 -0
- package/esm2015/directives/number-field/nimble-number-field.module.ngsummary.json +1 -0
- package/esm2015/directives/select/nimble-select-control-value-accessor.directive.js +14 -22
- package/esm2015/directives/select/nimble-select-control-value-accessor.directive.ngsummary.json +1 -0
- package/esm2015/directives/select/nimble-select.directive.js +6 -10
- package/esm2015/directives/select/nimble-select.directive.ngsummary.json +1 -0
- package/esm2015/directives/select/nimble-select.module.js +8 -13
- package/esm2015/directives/select/nimble-select.module.ngfactory.js +12 -0
- package/esm2015/directives/select/nimble-select.module.ngsummary.json +1 -0
- package/esm2015/directives/tab/nimble-tab.directive.js +25 -16
- package/esm2015/directives/tab/nimble-tab.directive.ngsummary.json +1 -0
- package/esm2015/directives/tab/nimble-tab.module.js +8 -13
- package/esm2015/directives/tab/nimble-tab.module.ngfactory.js +12 -0
- package/esm2015/directives/tab/nimble-tab.module.ngsummary.json +1 -0
- package/esm2015/directives/tab-panel/nimble-tab-panel.directive.js +6 -10
- package/esm2015/directives/tab-panel/nimble-tab-panel.directive.ngsummary.json +1 -0
- package/esm2015/directives/tab-panel/nimble-tab-panel.module.js +8 -13
- package/esm2015/directives/tab-panel/nimble-tab-panel.module.ngfactory.js +12 -0
- package/esm2015/directives/tab-panel/nimble-tab-panel.module.ngsummary.json +1 -0
- package/esm2015/directives/tabs/nimble-tabs.directive.js +29 -25
- package/esm2015/directives/tabs/nimble-tabs.directive.ngsummary.json +1 -0
- package/esm2015/directives/tabs/nimble-tabs.module.js +8 -13
- package/esm2015/directives/tabs/nimble-tabs.module.ngfactory.js +12 -0
- package/esm2015/directives/tabs/nimble-tabs.module.ngsummary.json +1 -0
- package/esm2015/directives/tabs-toolbar/nimble-tabs-toolbar.directive.js +6 -10
- package/esm2015/directives/tabs-toolbar/nimble-tabs-toolbar.directive.ngsummary.json +1 -0
- package/esm2015/directives/tabs-toolbar/nimble-tabs-toolbar.module.js +8 -13
- package/esm2015/directives/tabs-toolbar/nimble-tabs-toolbar.module.ngfactory.js +12 -0
- package/esm2015/directives/tabs-toolbar/nimble-tabs-toolbar.module.ngsummary.json +1 -0
- package/esm2015/directives/text-field/nimble-text-field-control-value-accessor.directive.js +29 -0
- package/esm2015/directives/text-field/nimble-text-field-control-value-accessor.directive.ngsummary.json +1 -0
- package/esm2015/directives/text-field/nimble-text-field.directive.js +37 -16
- package/esm2015/directives/text-field/nimble-text-field.directive.ngsummary.json +1 -0
- package/esm2015/directives/text-field/nimble-text-field.module.js +9 -15
- package/esm2015/directives/text-field/nimble-text-field.module.ngfactory.js +12 -0
- package/esm2015/directives/text-field/nimble-text-field.module.ngsummary.json +1 -0
- package/esm2015/directives/theme-provider/nimble-theme-provider.directive.js +26 -16
- package/esm2015/directives/theme-provider/nimble-theme-provider.directive.ngsummary.json +1 -0
- package/esm2015/directives/theme-provider/nimble-theme-provider.module.js +8 -13
- package/esm2015/directives/theme-provider/nimble-theme-provider.module.ngfactory.js +12 -0
- package/esm2015/directives/theme-provider/nimble-theme-provider.module.ngsummary.json +1 -0
- package/esm2015/directives/tree-item/nimble-tree-item.directive.js +43 -52
- package/esm2015/directives/tree-item/nimble-tree-item.directive.ngsummary.json +1 -0
- package/esm2015/directives/tree-item/nimble-tree-item.module.js +8 -13
- package/esm2015/directives/tree-item/nimble-tree-item.module.ngfactory.js +12 -0
- package/esm2015/directives/tree-item/nimble-tree-item.module.ngsummary.json +1 -0
- package/esm2015/directives/tree-view/nimble-tree-view.directive.js +28 -11
- package/esm2015/directives/tree-view/nimble-tree-view.directive.ngsummary.json +1 -0
- package/esm2015/directives/tree-view/nimble-tree-view.module.js +8 -13
- package/esm2015/directives/tree-view/nimble-tree-view.module.ngfactory.js +12 -0
- package/esm2015/directives/tree-view/nimble-tree-view.module.ngsummary.json +1 -0
- package/esm2015/directives/utilities/template-value-helpers.js +37 -0
- package/esm2015/directives/utilities/template-value-helpers.ngsummary.json +1 -0
- package/esm2015/ni-nimble-angular.ngsummary.json +1 -0
- package/esm2015/public-api.js +38 -15
- package/esm2015/public-api.ngsummary.json +1 -0
- package/esm2015/testing/async-helpers.js +12 -0
- package/esm2015/testing/async-helpers.ngsummary.json +1 -0
- package/fesm2015/ni-nimble-angular.js +714 -540
- package/fesm2015/ni-nimble-angular.js.map +1 -1
- package/ni-nimble-angular.d.ts +0 -1
- package/ni-nimble-angular.metadata.json +1 -0
- package/package.json +4 -20
- package/public-api.d.ts +37 -14
- package/styles/fonts.scss +4 -0
- package/styles/tokens.scss +6 -0
- package/testing/async-helpers.d.ts +11 -0
- package/directives/button/index.d.ts +0 -2
- package/directives/checkbox/index.d.ts +0 -3
- package/directives/control-value-accessor/index.d.ts +0 -3
- package/directives/control-value-accessor/nimble-control-value-accessor.module.d.ts +0 -9
- package/directives/control-value-accessor/nimble-default-control-value-accessor.directive.d.ts +0 -12
- package/directives/control-value-accessor/nimble-number-control-value-accessor.directive.d.ts +0 -12
- package/directives/listbox-option/index.d.ts +0 -2
- package/directives/number-field/index.d.ts +0 -2
- package/directives/select/index.d.ts +0 -3
- package/directives/tab/index.d.ts +0 -2
- package/directives/tab-panel/index.d.ts +0 -2
- package/directives/tabs/index.d.ts +0 -2
- package/directives/tabs-toolbar/index.d.ts +0 -2
- package/directives/text-field/index.d.ts +0 -2
- package/directives/theme-provider/index.d.ts +0 -2
- package/directives/tree-item/index.d.ts +0 -2
- package/directives/tree-view/index.d.ts +0 -2
- package/esm2015/directives/button/index.js +0 -3
- package/esm2015/directives/checkbox/index.js +0 -4
- package/esm2015/directives/control-value-accessor/index.js +0 -4
- package/esm2015/directives/control-value-accessor/nimble-control-value-accessor.module.js +0 -19
- package/esm2015/directives/control-value-accessor/nimble-default-control-value-accessor.directive.js +0 -37
- package/esm2015/directives/control-value-accessor/nimble-number-control-value-accessor.directive.js +0 -32
- package/esm2015/directives/listbox-option/index.js +0 -3
- package/esm2015/directives/number-field/index.js +0 -3
- package/esm2015/directives/select/index.js +0 -4
- package/esm2015/directives/tab/index.js +0 -3
- package/esm2015/directives/tab-panel/index.js +0 -3
- package/esm2015/directives/tabs/index.js +0 -3
- package/esm2015/directives/tabs-toolbar/index.js +0 -3
- package/esm2015/directives/text-field/index.js +0 -3
- package/esm2015/directives/theme-provider/index.js +0 -3
- package/esm2015/directives/tree-item/index.js +0 -3
- package/esm2015/directives/tree-view/index.js +0 -3
package/README.md
CHANGED
|
@@ -6,43 +6,109 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@ni/nimble-angular)
|
|
8
8
|
|
|
9
|
-
NI-styled UI components for Angular applications
|
|
9
|
+
NI-styled UI components for [Angular](https://angular.io) applications
|
|
10
10
|
|
|
11
11
|
## Getting started
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The steps to use components from Nimble Angular are similar to using components from any other Angular library. You can see the [Example Client App](/angular-workspace/projects/example-client-app) project for an example.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
1. Install Nimble Angular from the [public NPM registry](https://www.npmjs.com/package/@ni/nimble-angular) by running `npm install @ni/nimble-angular`.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
*This guide assumes you have an existing Angular application and are using NPM 7 or greater.*
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
2. Each application should update `app.module.ts` to import the module for `NimbleThemeProviderModule`. Additionally, import modules for the components you want to use:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {
|
|
23
|
+
NimbleDrawerModule,
|
|
24
|
+
NimbleThemeProviderModule
|
|
25
|
+
} from '@ni/nimble-angular';
|
|
26
|
+
|
|
27
|
+
@NgModule ({
|
|
28
|
+
imports: [
|
|
29
|
+
NimbleDrawerModule,
|
|
30
|
+
NimbleThemeProviderModule
|
|
31
|
+
]
|
|
32
|
+
})
|
|
33
|
+
class AppModule {}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
3. Each application should add the `<nimble-theme-provider>` element to `app.component.html` and set its `theme` attribute. The theme provider has no appearance of its own but defines tokens that are used by descendant components.
|
|
20
37
|
|
|
21
|
-
|
|
38
|
+
```html
|
|
39
|
+
<nimble-theme-provider theme="light">
|
|
40
|
+
<router-outlet></router-outlet>
|
|
41
|
+
</nimble-theme-provider>
|
|
42
|
+
```
|
|
22
43
|
|
|
23
|
-
|
|
24
|
-
# NimbleAngular
|
|
44
|
+
4. Each application should import the Nimble fonts once in the root `src/styles.scss`. Nimble recommends using SCSS for capabilities such as build time property checking.
|
|
25
45
|
|
|
26
|
-
|
|
46
|
+
```scss
|
|
47
|
+
@import '~@ni/nimble-angular/styles/fonts';
|
|
48
|
+
```
|
|
27
49
|
|
|
28
|
-
|
|
50
|
+
5. As needed, import the theme-aware design tokens in each SCSS file that will leverage the tokens for other parts of your application (for colors, fonts, etc).
|
|
29
51
|
|
|
30
|
-
|
|
31
|
-
|
|
52
|
+
```scss
|
|
53
|
+
@import '~@ni/nimble-angular/styles/tokens';
|
|
32
54
|
|
|
33
|
-
|
|
55
|
+
.my-element {
|
|
56
|
+
font-family: $ni-nimble-font-family
|
|
57
|
+
}
|
|
58
|
+
```
|
|
34
59
|
|
|
35
|
-
|
|
60
|
+
See [the theming documentation in `nimble-components`](/packages/nimble-components/README.md#theming) for more information.
|
|
36
61
|
|
|
37
|
-
|
|
62
|
+
6. As needed, add Nimble components to the templates in your application:
|
|
38
63
|
|
|
39
|
-
|
|
64
|
+
```html
|
|
65
|
+
<nimble-drawer #drawerReference location="right">This is a drawer</nimble-drawer>
|
|
66
|
+
```
|
|
40
67
|
|
|
41
|
-
|
|
68
|
+
7. As needed, import the Nimble component's directive and types in your component scripts to use programmatic APIs:
|
|
42
69
|
|
|
43
|
-
|
|
70
|
+
```ts
|
|
71
|
+
import { NimbleDrawerDirective } from '@ni/nimble-angular';
|
|
44
72
|
|
|
45
|
-
|
|
73
|
+
@Component({ /* ... */ })
|
|
74
|
+
class AppComponent {
|
|
75
|
+
@ViewChild('drawerReference', { read: NimbleDrawerDirective }) public drawer: NimbleDrawerDirective;
|
|
76
|
+
|
|
77
|
+
public openDrawer() {
|
|
78
|
+
this.drawer.show();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Note: Nimble components are exposed in Angular as Angular Directives and have the suffix `Directive`.
|
|
84
|
+
|
|
85
|
+
### Learn more
|
|
86
|
+
|
|
87
|
+
See the [README.md for the ni/nimble repository](/README.md) for documentation of individual components.
|
|
88
|
+
|
|
89
|
+
### Using Nimble form controls
|
|
90
|
+
|
|
91
|
+
For best results, always use `ngModel`, `formControl`, or `formControlName` bindings when integrating Nimble form controls in Angular. Binding to the control's native value property or event (e.g. `[value]` or `(change)`) is not supported, and can cause build failures and other issues. If a value change event is necessary, use `ngModel (ngModelChange)="onChange()"`.
|
|
92
|
+
|
|
93
|
+
### Testing with Nimble elements and `fakeAsync`
|
|
94
|
+
|
|
95
|
+
Angular's `fakeAsync` utility is useful for writing quickly-executing tests, but it can cause issues when testing components containing Nimble elements. Nimble uses an internal process queue to schedule work. If a `fakeAsync` test schedules work on the queue (by creating or interacting with Nimble elements) and the queue isn't processed by the end of the test, the queue will never be processed and subsequent tests may fail.
|
|
96
|
+
|
|
97
|
+
To avoid this, call `processUpdates()` after each `fakeAsync` test. This will synchronously process the internal queue and put it in a good state for subsequent tests. The `processUpdates()` method can also be called mid-test to synchronously complete operations which would otherwise require waiting for an animation frame.
|
|
98
|
+
|
|
99
|
+
## Known Issues
|
|
100
|
+
|
|
101
|
+
Currently the fast-animation library we depend on only exports CommonJS modules, which triggers an Angular project build warning (and potentially suboptimal bundle optimizations).
|
|
102
|
+
|
|
103
|
+
Currently clients consuming the nimble Angular integration may need to make the following change in their `angular.json`, if they wish to suppress that build warning, in the `projects.[projectName].architect.build.options` section:
|
|
104
|
+
```json
|
|
105
|
+
"allowedCommonJsDependencies": [
|
|
106
|
+
"@microsoft/fast-animation"
|
|
107
|
+
]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
[nimble issue #189](https://github.com/ni/nimble/issues/189) tracks this issue.
|
|
111
|
+
|
|
112
|
+
## Contributing
|
|
46
113
|
|
|
47
|
-
|
|
48
|
-
-->
|
|
114
|
+
Follow the instructions in [CONTRIBUTING.md](/angular-workspace/projects/ni/nimble-angular/CONTRIBUTING.md) to modify this library.
|