-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Angular support for the nimble-card (#1646)
# Pull Request Add Angular support for the `nimble-card` component. See #296 and the [`nimble-card` spec](https://github.com/ni/nimble/blob/main/packages/nimble-components/src/card/specs/README.md) for more information. ## 🤨 Rationale We want to be able to use the `nimble-card` in Angular applications. ## 👩💻 Implementation - Add and export a new Angular directive and module for the `nimble-card` component - Update the component status table to "incubating" for Angular support ## 🧪 Testing - Added a basic unit test - Added an example to example-client-app: ![image](https://github.com/ni/nimble/assets/35350751/57827bf5-91dd-4654-98a6-053900aba046) ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: mollykreis <[email protected]> Co-authored-by: Milan Raj <[email protected]>
- Loading branch information
1 parent
ecff8f8
commit 57ee0e9
Showing
12 changed files
with
84 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
angular-workspace/projects/ni/nimble-angular/card/ng-package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "../../../../../node_modules/ng-packagr/ng-package.schema.json", | ||
"lib": { | ||
"entryFile": "public-api.ts" | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
angular-workspace/projects/ni/nimble-angular/card/nimble-card.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Directive } from '@angular/core'; | ||
import { type Card, cardTag } from '@ni/nimble-components/dist/esm/card'; | ||
|
||
export type { Card }; | ||
export { cardTag }; | ||
|
||
/** | ||
* Directive to provide Angular integration for the card. | ||
*/ | ||
@Directive({ | ||
selector: 'nimble-card' | ||
}) | ||
export class NimbleCardDirective { } |
12 changes: 12 additions & 0 deletions
12
angular-workspace/projects/ni/nimble-angular/card/nimble-card.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { NimbleCardDirective } from './nimble-card.directive'; | ||
|
||
import '@ni/nimble-components/dist/esm/card'; | ||
|
||
@NgModule({ | ||
declarations: [NimbleCardDirective], | ||
imports: [CommonModule], | ||
exports: [NimbleCardDirective] | ||
}) | ||
export class NimbleCardModule { } |
2 changes: 2 additions & 0 deletions
2
angular-workspace/projects/ni/nimble-angular/card/public-api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './nimble-card.directive'; | ||
export * from './nimble-card.module'; |
16 changes: 16 additions & 0 deletions
16
angular-workspace/projects/ni/nimble-angular/card/tests/card.directive.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { NimbleCardModule } from '../nimble-card.module'; | ||
|
||
describe('Nimble card', () => { | ||
describe('module', () => { | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [NimbleCardModule] | ||
}); | ||
}); | ||
|
||
it('custom element is defined', () => { | ||
expect(customElements.get('nimble-card')).not.toBeUndefined(); | ||
}); | ||
}); | ||
}); |
7 changes: 7 additions & 0 deletions
7
change/@ni-nimble-angular-fb64a60a-b575-4965-bea7-df33b3911b9f.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Add Angular support for the nimble-card component", | ||
"packageName": "@ni/nimble-angular", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@ni-nimble-components-258183d7-7c0f-4208-978c-61b6089e7796.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Workaround for Lighthouse accessibility error in nimble-card. Update Angular status of nimble-card component.", | ||
"packageName": "@ni/nimble-components", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters