@ni/nimble-angular 1.0.0-beta.142 → 1.0.0-beta.146

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 CHANGED
@@ -10,38 +10,77 @@ NI-styled UI components for Angular applications
10
10
 
11
11
  ## Getting started
12
12
 
13
- *This guide assumes you have an existing Angular application and are using NPM 7 or greater.*
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
- 2. 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.
17
- 1. Update your `app.module.ts` to import the module for each component you want to use:
18
- ```ts
19
- import { NimbleDrawerModule } from '@ni/nimble-angular';
20
-
21
- @NgModule ({
22
- imports: [
23
- NimbleDrawerModule,
24
- ]
25
- })
26
- class AppModule {}
27
- ```
28
- 2. Add the component to your `app.component.html` (or to the template for another component in your application):
29
- ```html
30
- <nimble-drawer #drawerReference location="right">This is a drawer</nimble-drawer>
31
- ```
32
- 3. If needed, import the Nimble component's directive and types in `app.component.ts` (or the TypeScript file backing another component) to use its programmatic API:
33
- ```ts
34
- import { NimbleDrawerDirective } from '@ni/nimble-angular';
35
-
36
- @Component({ /* ... */ })
37
- class AppComponent {
38
- @ViewChild('drawerReference', { read: NimbleDrawerDirective }) public drawer: NimbleDrawerDirective;
39
-
40
- public openDrawer() {
41
- this.drawer.show();
42
- }
16
+
17
+ *This guide assumes you have an existing Angular application and are using NPM 7 or greater.*
18
+
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.
37
+
38
+ ```html
39
+ <nimble-theme-provider theme="light">
40
+ <router-outlet></router-outlet>
41
+ </nimble-theme-provider>
42
+ ```
43
+
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.
45
+
46
+ ```scss
47
+ @import '~@ni/nimble-angular/styles/fonts';
48
+ ```
49
+
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).
51
+
52
+ ```scss
53
+ @import '~@ni/nimble-angular/styles/tokens';
54
+
55
+ .my-element {
56
+ font-family: $ni-nimble-font-family
57
+ }
58
+ ```
59
+
60
+ See [the theming documentation in `nimble-components`](/packages/nimble-components/README.md#theming) for more information.
61
+
62
+ 6. As needed, add Nimble components to the templates in your application:
63
+
64
+ ```html
65
+ <nimble-drawer #drawerReference location="right">This is a drawer</nimble-drawer>
66
+ ```
67
+
68
+ 7. As needed, import the Nimble component's directive and types in your component scripts to use programmatic APIs:
69
+
70
+ ```ts
71
+ import { NimbleDrawerDirective } from '@ni/nimble-angular';
72
+
73
+ @Component({ /* ... */ })
74
+ class AppComponent {
75
+ @ViewChild('drawerReference', { read: NimbleDrawerDirective }) public drawer: NimbleDrawerDirective;
76
+
77
+ public openDrawer() {
78
+ this.drawer.show();
43
79
  }
44
- ```
80
+ }
81
+ ```
82
+
83
+ Note: Nimble components are exposed in Angular as Angular Directives and have the suffix `Directive`.
45
84
 
46
85
  ### Learn more
47
86
 
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@ni/nimble-components/dist/esm/button/types'), require('@angular/common'), require('@ni/nimble-components/dist/esm/button'), require('@angular/forms'), require('@ni/nimble-components/dist/esm/checkbox'), require('@ni/nimble-components/dist/esm/drawer/types'), require('@ni/nimble-components/dist/esm/drawer'), require('@ni/nimble-components/dist/esm/listbox-option'), require('@ni/nimble-components/dist/esm/menu'), require('@ni/nimble-components/dist/esm/menu-item'), require('@ni/nimble-components/dist/esm/number-field'), require('@ni/nimble-components/dist/esm/select'), require('@ni/nimble-components/dist/esm/tab'), require('@ni/nimble-components/dist/esm/tab-panel'), require('@ni/nimble-components/dist/esm/tabs'), require('@ni/nimble-components/dist/esm/tabs-toolbar'), require('@ni/nimble-components/dist/esm/text-field/types'), require('@ni/nimble-components/dist/esm/text-field'), require('@ni/nimble-components/dist/esm/theme-provider/types'), require('@ni/nimble-components/dist/esm/theme-provider'), require('@ni/nimble-components/dist/esm/tree-item'), require('@ni/nimble-components/dist/esm/tree-view/types'), require('@ni/nimble-components/dist/esm/tree-view'), require('@ni/nimble-components/dist/esm/testing/async-helpers')) :
3
3
  typeof define === 'function' && define.amd ? define('@ni/nimble-angular', ['exports', '@angular/core', '@ni/nimble-components/dist/esm/button/types', '@angular/common', '@ni/nimble-components/dist/esm/button', '@angular/forms', '@ni/nimble-components/dist/esm/checkbox', '@ni/nimble-components/dist/esm/drawer/types', '@ni/nimble-components/dist/esm/drawer', '@ni/nimble-components/dist/esm/listbox-option', '@ni/nimble-components/dist/esm/menu', '@ni/nimble-components/dist/esm/menu-item', '@ni/nimble-components/dist/esm/number-field', '@ni/nimble-components/dist/esm/select', '@ni/nimble-components/dist/esm/tab', '@ni/nimble-components/dist/esm/tab-panel', '@ni/nimble-components/dist/esm/tabs', '@ni/nimble-components/dist/esm/tabs-toolbar', '@ni/nimble-components/dist/esm/text-field/types', '@ni/nimble-components/dist/esm/text-field', '@ni/nimble-components/dist/esm/theme-provider/types', '@ni/nimble-components/dist/esm/theme-provider', '@ni/nimble-components/dist/esm/tree-item', '@ni/nimble-components/dist/esm/tree-view/types', '@ni/nimble-components/dist/esm/tree-view', '@ni/nimble-components/dist/esm/testing/async-helpers'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ni = global.ni || {}, global.ni['nimble-angular'] = {}), global.ng.core, global.types, global.ng.common, null, global.ng.forms, null, global.types$1, null, null, null, null, null, null, null, null, null, null, global.types$2, null, global.types$3, null, null, global.types$4, null, global.asyncHelpers));
5
- }(this, (function (exports, core, types, common, button, forms, checkbox, types$1, drawer, listboxOption, menu, menuItem, numberField, select, tab, tabPanel, tabs, tabsToolbar, types$2, textField, types$3, themeProvider, treeItem, types$4, treeView, asyncHelpers) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ni = global.ni || {}, global.ni["nimble-angular"] = {}), global.ng.core, global.types, global.ng.common, null, global.ng.forms, null, global.types$1, null, null, null, null, null, null, null, null, null, null, global.types$2, null, global.types$3, null, null, global.types$4, null, global.asyncHelpers));
5
+ })(this, (function (exports, core, types, common, button, forms, checkbox, types$1, drawer, listboxOption, menu, menuItem, numberField, select, tab, tabPanel, tabs, tabsToolbar, types$2, textField, types$3, themeProvider, treeItem, types$4, treeView, asyncHelpers) { 'use strict';
6
6
 
7
7
  /**
8
8
  * Conversion helpers for values coming from template attributes or property bindings
@@ -79,6 +79,18 @@
79
79
  enumerable: false,
80
80
  configurable: true
81
81
  });
82
+ Object.defineProperty(NimbleButtonDirective.prototype, "contentHidden", {
83
+ get: function () {
84
+ return this.elementRef.nativeElement.contentHidden;
85
+ },
86
+ // contentHidden property intentionally maps to the content-hidden attribute
87
+ // eslint-disable-next-line @angular-eslint/no-input-rename
88
+ set: function (value) {
89
+ this.renderer.setProperty(this.elementRef.nativeElement, 'contentHidden', toBooleanProperty(value));
90
+ },
91
+ enumerable: false,
92
+ configurable: true
93
+ });
82
94
  return NimbleButtonDirective;
83
95
  }());
84
96
  NimbleButtonDirective.decorators = [
@@ -93,7 +105,8 @@
93
105
  NimbleButtonDirective.propDecorators = {
94
106
  appearance: [{ type: core.Input }],
95
107
  disabled: [{ type: core.Input }],
96
- type: [{ type: core.Input }]
108
+ type: [{ type: core.Input }],
109
+ contentHidden: [{ type: core.Input, args: ['content-hidden',] }]
97
110
  };
98
111
 
99
112
  var NimbleButtonModule = /** @class */ (function () {
@@ -1300,45 +1313,31 @@
1300
1313
 
1301
1314
  Object.defineProperty(exports, 'ButtonAppearance', {
1302
1315
  enumerable: true,
1303
- get: function () {
1304
- return types.ButtonAppearance;
1305
- }
1316
+ get: function () { return types.ButtonAppearance; }
1306
1317
  });
1307
1318
  Object.defineProperty(exports, 'DrawerLocation', {
1308
1319
  enumerable: true,
1309
- get: function () {
1310
- return types$1.DrawerLocation;
1311
- }
1320
+ get: function () { return types$1.DrawerLocation; }
1312
1321
  });
1313
1322
  Object.defineProperty(exports, 'DrawerState', {
1314
1323
  enumerable: true,
1315
- get: function () {
1316
- return types$1.DrawerState;
1317
- }
1324
+ get: function () { return types$1.DrawerState; }
1318
1325
  });
1319
1326
  Object.defineProperty(exports, 'TextFieldType', {
1320
1327
  enumerable: true,
1321
- get: function () {
1322
- return types$2.TextFieldType;
1323
- }
1328
+ get: function () { return types$2.TextFieldType; }
1324
1329
  });
1325
1330
  Object.defineProperty(exports, 'NimbleTheme', {
1326
1331
  enumerable: true,
1327
- get: function () {
1328
- return types$3.NimbleTheme;
1329
- }
1332
+ get: function () { return types$3.NimbleTheme; }
1330
1333
  });
1331
1334
  Object.defineProperty(exports, 'TreeViewSelectionMode', {
1332
1335
  enumerable: true,
1333
- get: function () {
1334
- return types$4.TreeViewSelectionMode;
1335
- }
1336
+ get: function () { return types$4.TreeViewSelectionMode; }
1336
1337
  });
1337
1338
  Object.defineProperty(exports, 'processUpdates', {
1338
1339
  enumerable: true,
1339
- get: function () {
1340
- return asyncHelpers.processUpdates;
1341
- }
1340
+ get: function () { return asyncHelpers.processUpdates; }
1342
1341
  });
1343
1342
  exports.NimbleButtonDirective = NimbleButtonDirective;
1344
1343
  exports.NimbleButtonModule = NimbleButtonModule;
@@ -1380,5 +1379,5 @@
1380
1379
 
1381
1380
  Object.defineProperty(exports, '__esModule', { value: true });
1382
1381
 
1383
- })));
1382
+ }));
1384
1383
  //# sourceMappingURL=ni-nimble-angular.umd.js.map