amir-input 9.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.
Files changed (38) hide show
  1. package/.editorconfig +13 -0
  2. package/angular.json +128 -0
  3. package/browserslist +12 -0
  4. package/index.ts +5 -0
  5. package/karma.conf.js +44 -0
  6. package/package.json +48 -0
  7. package/protractor.conf.js +30 -0
  8. package/src/app/app.component.css +46 -0
  9. package/src/app/app.component.html +96 -0
  10. package/src/app/app.component.spec.ts +56 -0
  11. package/src/app/app.component.ts +10 -0
  12. package/src/app/app.module.ts +24 -0
  13. package/src/app/lib/au-fa-input/_au-fa-input-red-theme.scss +17 -0
  14. package/src/app/lib/au-fa-input/au-fa-input.component.css +6 -0
  15. package/src/app/lib/au-fa-input/au-fa-input.component.html +6 -0
  16. package/src/app/lib/au-fa-input/au-fa-input.component.ts +40 -0
  17. package/src/app/lib/au-input.module.ts +17 -0
  18. package/src/app/lib/au-md-input/au-md-input.component.css +10 -0
  19. package/src/app/lib/au-md-input/au-md-input.component.html +8 -0
  20. package/src/app/lib/au-md-input/au-md-input.component.ts +30 -0
  21. package/src/app/lib/common/_default-theme.scss +11 -0
  22. package/src/app/lib/common/common.css +30 -0
  23. package/src/app/lib/common/input-ref.directive.ts +20 -0
  24. package/src/assets/.gitkeep +0 -0
  25. package/src/environments/environment.prod.ts +3 -0
  26. package/src/environments/environment.ts +8 -0
  27. package/src/favicon.ico +0 -0
  28. package/src/index.html +31 -0
  29. package/src/main.ts +11 -0
  30. package/src/polyfills.ts +68 -0
  31. package/src/styles.css +1 -0
  32. package/src/test.ts +32 -0
  33. package/src/tsconfig.app.json +12 -0
  34. package/src/tsconfig.spec.json +19 -0
  35. package/src/typings.d.ts +5 -0
  36. package/tsconfig.json +21 -0
  37. package/tslint.json +116 -0
  38. package/yarn.lock +5812 -0
package/.editorconfig ADDED
@@ -0,0 +1,13 @@
1
+ # Editor configuration, see http://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ indent_style = space
7
+ indent_size = 2
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.md]
12
+ max_line_length = off
13
+ trim_trailing_whitespace = false
package/angular.json ADDED
@@ -0,0 +1,128 @@
1
+ {
2
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
+ "version": 1,
4
+ "newProjectRoot": "projects",
5
+ "projects": {
6
+ "au-input": {
7
+ "root": "",
8
+ "sourceRoot": "src",
9
+ "projectType": "application",
10
+ "architect": {
11
+ "build": {
12
+ "builder": "@angular-devkit/build-angular:browser",
13
+ "options": {
14
+ "outputPath": "dist",
15
+ "index": "src/index.html",
16
+ "main": "src/main.ts",
17
+ "tsConfig": "src/tsconfig.app.json",
18
+ "polyfills": "src/polyfills.ts",
19
+ "assets": [
20
+ "src/assets",
21
+ "src/favicon.ico"
22
+ ],
23
+ "styles": [
24
+ "src/styles.css"
25
+ ],
26
+ "scripts": []
27
+ },
28
+ "configurations": {
29
+ "production": {
30
+ "optimization": true,
31
+ "outputHashing": "all",
32
+ "sourceMap": false,
33
+ "extractCss": true,
34
+ "namedChunks": false,
35
+ "aot": true,
36
+ "extractLicenses": true,
37
+ "vendorChunk": false,
38
+ "buildOptimizer": true,
39
+ "fileReplacements": [
40
+ {
41
+ "replace": "src/environments/environment.ts",
42
+ "with": "src/environments/environment.prod.ts"
43
+ }
44
+ ]
45
+ }
46
+ }
47
+ },
48
+ "serve": {
49
+ "builder": "@angular-devkit/build-angular:dev-server",
50
+ "options": {
51
+ "browserTarget": "au-input:build"
52
+ },
53
+ "configurations": {
54
+ "production": {
55
+ "browserTarget": "au-input:build:production"
56
+ }
57
+ }
58
+ },
59
+ "extract-i18n": {
60
+ "builder": "@angular-devkit/build-angular:extract-i18n",
61
+ "options": {
62
+ "browserTarget": "au-input:build"
63
+ }
64
+ },
65
+ "test": {
66
+ "builder": "@angular-devkit/build-angular:karma",
67
+ "options": {
68
+ "main": "src/test.ts",
69
+ "karmaConfig": "./karma.conf.js",
70
+ "polyfills": "src/polyfills.ts",
71
+ "tsConfig": "src/tsconfig.spec.json",
72
+ "scripts": [],
73
+ "styles": [
74
+ "src/styles.css"
75
+ ],
76
+ "assets": [
77
+ "src/assets",
78
+ "src/favicon.ico"
79
+ ]
80
+ }
81
+ },
82
+ "lint": {
83
+ "builder": "@angular-devkit/build-angular:tslint",
84
+ "options": {
85
+ "tsConfig": [
86
+ "src/tsconfig.app.json",
87
+ "src/tsconfig.spec.json"
88
+ ],
89
+ "exclude": []
90
+ }
91
+ }
92
+ }
93
+ },
94
+ "au-input-e2e": {
95
+ "root": "",
96
+ "sourceRoot": "",
97
+ "projectType": "application",
98
+ "architect": {
99
+ "e2e": {
100
+ "builder": "@angular-devkit/build-angular:protractor",
101
+ "options": {
102
+ "protractorConfig": "./protractor.conf.js",
103
+ "devServerTarget": "au-input:serve"
104
+ }
105
+ },
106
+ "lint": {
107
+ "builder": "@angular-devkit/build-angular:tslint",
108
+ "options": {
109
+ "tsConfig": [
110
+ "e2e/tsconfig.e2e.json"
111
+ ],
112
+ "exclude": []
113
+ }
114
+ }
115
+ }
116
+ }
117
+ },
118
+ "defaultProject": "au-input",
119
+ "schematics": {
120
+ "@schematics/angular:component": {
121
+ "prefix": "",
122
+ "styleext": "css"
123
+ },
124
+ "@schematics/angular:directive": {
125
+ "prefix": ""
126
+ }
127
+ }
128
+ }
package/browserslist ADDED
@@ -0,0 +1,12 @@
1
+ # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2
+ # For additional information regarding the format and rule options, please see:
3
+ # https://github.com/browserslist/browserslist#queries
4
+
5
+ # You can see what browsers were selected by your queries by running:
6
+ # npx browserslist
7
+
8
+ > 0.5%
9
+ last 2 versions
10
+ Firefox ESR
11
+ not dead
12
+ not IE 9-11 # For IE 9-11 support, remove 'not'.
package/index.ts ADDED
@@ -0,0 +1,5 @@
1
+
2
+
3
+ export {AuInputModule} from './src/app/lib/au-input.module';
4
+
5
+
package/karma.conf.js ADDED
@@ -0,0 +1,44 @@
1
+ // Karma configuration file, see link for more information
2
+ // https://karma-runner.github.io/0.13/config/configuration-file.html
3
+
4
+ module.exports = function (config) {
5
+ config.set({
6
+ basePath: '',
7
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
+ plugins: [
9
+ require('karma-jasmine'),
10
+ require('karma-chrome-launcher'),
11
+ require('karma-jasmine-html-reporter'),
12
+ require('karma-coverage-istanbul-reporter'),
13
+ require('@angular-devkit/build-angular/plugins/karma')
14
+ ],
15
+ client:{
16
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
17
+ },
18
+ files: [
19
+
20
+ ],
21
+ preprocessors: {
22
+
23
+ },
24
+ mime: {
25
+ 'text/x-typescript': ['ts','tsx']
26
+ },
27
+ coverageIstanbulReporter: {
28
+ dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
29
+ fixWebpackSourcePaths: true
30
+ },
31
+ angularCli: {
32
+ environment: 'dev'
33
+ },
34
+ reporters: config.angularCli && config.angularCli.codeCoverage
35
+ ? ['progress', 'coverage-istanbul']
36
+ : ['progress', 'kjhtml'],
37
+ port: 9876,
38
+ colors: true,
39
+ logLevel: config.LOG_INFO,
40
+ autoWatch: true,
41
+ browsers: ['Chrome'],
42
+ singleRun: false
43
+ });
44
+ };
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "amir-input",
3
+ "version": "9.0.0",
4
+ "license": "MIT",
5
+ "scripts": {
6
+ "ng": "ng",
7
+ "start": "ng serve",
8
+ "build": "ng build",
9
+ "test": "ng test",
10
+ "lint": "ng lint",
11
+ "e2e": "ng e2e"
12
+ },
13
+ "private": false,
14
+ "dependencies": {
15
+ "@angular/animations": "8.0.0",
16
+ "@angular/common": "8.0.0",
17
+ "@angular/compiler": "8.0.0",
18
+ "@angular/core": "8.0.0",
19
+ "@angular/forms": "8.0.0",
20
+ "@angular/platform-browser": "8.0.0",
21
+ "@angular/platform-browser-dynamic": "8.0.0",
22
+ "@angular/router": "8.0.0",
23
+ "core-js": "^2.4.1",
24
+ "rxjs": "6.5.2",
25
+ "zone.js": "~0.9.1"
26
+ },
27
+ "devDependencies": {
28
+ "@angular-devkit/build-angular": "~0.800.0",
29
+ "@angular/cli": "^8.0.1",
30
+ "@angular/compiler-cli": "8.0.0",
31
+ "@angular/language-service": "8.0.0",
32
+ "@types/jasmine": "~2.5.53",
33
+ "@types/jasminewd2": "~2.0.2",
34
+ "@types/node": "~6.0.60",
35
+ "codelyzer": "^5.0.1",
36
+ "jasmine-core": "~2.6.2",
37
+ "jasmine-spec-reporter": "~4.1.0",
38
+ "karma": "^4.1.0",
39
+ "karma-chrome-launcher": "~2.1.1",
40
+ "karma-cli": "~1.0.1",
41
+ "karma-coverage-istanbul-reporter": "^1.2.1",
42
+ "karma-jasmine": "~1.1.0",
43
+ "karma-jasmine-html-reporter": "^0.2.2",
44
+ "ts-node": "~3.2.0",
45
+ "tslint": "~5.7.0",
46
+ "typescript": "~3.4.5"
47
+ }
48
+ }
@@ -0,0 +1,30 @@
1
+ // Protractor configuration file, see link for more information
2
+ // https://github.com/angular/protractor/blob/master/lib/config.ts
3
+
4
+ const { SpecReporter } = require('jasmine-spec-reporter');
5
+
6
+ exports.config = {
7
+ allScriptsTimeout: 11000,
8
+ specs: [
9
+ './e2e/**/*.e2e-spec.ts'
10
+ ],
11
+ capabilities: {
12
+ 'browserName': 'chrome'
13
+ },
14
+ directConnect: true,
15
+ baseUrl: 'http://localhost:4200/',
16
+ framework: 'jasmine',
17
+ jasmineNodeOpts: {
18
+ showColors: true,
19
+ defaultTimeoutInterval: 30000,
20
+ print: function() {}
21
+ },
22
+ beforeLaunch: function() {
23
+ require('ts-node').register({
24
+ project: 'e2e/tsconfig.e2e.json'
25
+ });
26
+ },
27
+ onPrepare() {
28
+ jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
29
+ }
30
+ };
@@ -0,0 +1,46 @@
1
+
2
+
3
+
4
+ .container {
5
+ margin: 0 auto;
6
+ max-width: 300px;
7
+ padding-top:65px;
8
+ }
9
+
10
+ label {
11
+ width: 100px;
12
+ text-align: right;
13
+ }
14
+
15
+ .form-row {
16
+ width:500px;
17
+ margin-bottom: 10px;
18
+ }
19
+
20
+
21
+ input {
22
+ height: 25px;
23
+ }
24
+
25
+ .normal-input {
26
+ width:150px;
27
+ }
28
+
29
+ h1 {
30
+ text-align: center;
31
+ margin-bottom: 30px;
32
+ margin-top: 50px;
33
+ }
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
@@ -0,0 +1,96 @@
1
+ <header class="l-header">
2
+ <ul class="top-menu disable-link-styles">
3
+ <li class="logo-small-container">
4
+ <a class="v-center-block-parent">
5
+ <img class="v-center-block logo-small angular-university-logo"
6
+ src="https://angular-academy.s3.amazonaws.com/main-logo/main-page-logo-small-hat.png"
7
+ data-pin-nopin="true">
8
+
9
+ </a>
10
+ </li>
11
+ <li>
12
+ <a>Inputs</a>
13
+ </li>
14
+ </ul>
15
+
16
+ </header>
17
+
18
+ <body>
19
+ <div class="container">
20
+ <h1>Font Awesome</h1>
21
+
22
+ <div class="form">
23
+
24
+ <div class="form-row">
25
+ <label>Normal Input:</label>
26
+ <input class="normal-input" type="email"
27
+ name="email" placeholder="E-mail" autocomplete="off">
28
+ </div>
29
+
30
+ <div class="form-row">
31
+ <label>Email:</label>
32
+
33
+ <au-fa-input id="email-field" icon="envelope">
34
+ <input type="email" name="email" placeholder="Email" autocomplete="off" class="test-class">
35
+ </au-fa-input>
36
+
37
+ </div>
38
+
39
+ <div class="form-row">
40
+ <label>Password:</label>
41
+ <au-fa-input id="password-field" icon="lock" >
42
+ <input placeholder="Password" class="test-class">
43
+ </au-fa-input>
44
+ </div>
45
+
46
+ <div class="form-row stripe-field">
47
+ <label>Stripe:</label>
48
+ <au-fa-input icon="cc-stripe">
49
+ <input placeholder="Stripe">
50
+ </au-fa-input>
51
+ </div>
52
+
53
+ <div class="form-row">
54
+ <label>Paypal:</label>
55
+ <au-fa-input icon="paypal">
56
+ <input placeholder="Paypal">
57
+ </au-fa-input>
58
+ </div>
59
+
60
+ <h1>Material Design</h1>
61
+
62
+ <div class="form-row">
63
+ <label>Lock:</label>
64
+ <au-md-input icon="search">
65
+ <input type="email" name="email" placeholder="E-mail">
66
+ </au-md-input>
67
+ </div>
68
+
69
+ <div class="form-row">
70
+ <label>Id Number:</label>
71
+ <au-md-input icon="perm_identity">
72
+ <input type="email" name="email" placeholder="E-mail">
73
+ </au-md-input>
74
+ </div>
75
+
76
+ <div class="form-row">
77
+ <label>Receipt Number:</label>
78
+ <au-md-input icon="receipt">
79
+ <input type="email" name="email" placeholder="E-mail">
80
+ </au-md-input>
81
+ </div>
82
+
83
+
84
+ </div>
85
+
86
+ </div>
87
+
88
+ </body>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
@@ -0,0 +1,56 @@
1
+ import {TestBed, async, ComponentFixture} from '@angular/core/testing';
2
+ import {AppComponent} from './app.component';
3
+ import {DebugElement} from '@angular/core';
4
+ import {By} from '@angular/platform-browser';
5
+ import {AuInputModule} from "./lib/au-input.module";
6
+
7
+ describe('AppComponent', () => {
8
+
9
+ let component: AppComponent,
10
+ fixture: ComponentFixture<AppComponent>,
11
+ el: DebugElement,
12
+ emailField: DebugElement;
13
+
14
+
15
+ beforeEach(async(() => {
16
+ TestBed.configureTestingModule({
17
+ declarations: [
18
+ AppComponent
19
+ ],
20
+ imports:[AuInputModule]
21
+ }).compileComponents();
22
+ }));
23
+
24
+ beforeEach(() => {
25
+
26
+ fixture = TestBed.createComponent(AppComponent);
27
+ component = fixture.debugElement.componentInstance;
28
+ el = fixture.debugElement;
29
+ emailField = el.query(By.css('#email-field'));
30
+
31
+ fixture.detectChanges();
32
+
33
+ });
34
+
35
+
36
+ it('should create the test application', async(() => {
37
+ expect(component).toBeTruthy();
38
+ }));
39
+
40
+
41
+ it('should create a font awesome email input', async(() => {
42
+ expect(emailField).toBeTruthy();
43
+
44
+ }));
45
+
46
+ it('should include the correct email icon inside the email input', async(() => {
47
+ expect(emailField.query(By.css('i.icon.fa.fa-envelope'))).toBeTruthy();
48
+ }));
49
+
50
+ it('should have projected the correct test input inside the email field', async(() => {
51
+ expect(emailField.query(By.css('input.test-class'))).toBeTruthy();
52
+ }));
53
+
54
+
55
+
56
+ });
@@ -0,0 +1,10 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'app-root',
5
+ templateUrl: './app.component.html',
6
+ styleUrls: ['./app.component.css']
7
+ })
8
+ export class AppComponent {
9
+ title = 'app works!';
10
+ }
@@ -0,0 +1,24 @@
1
+ import { BrowserModule } from '@angular/platform-browser';
2
+ import { NgModule } from '@angular/core';
3
+ import { FormsModule } from '@angular/forms';
4
+ import { AppComponent } from './app.component';
5
+
6
+ import {AuInputModule} from "./lib/au-input.module";
7
+ import {HttpClientModule} from "@angular/common/http";
8
+
9
+
10
+
11
+ @NgModule({
12
+ declarations: [
13
+ AppComponent
14
+ ],
15
+ imports: [
16
+ BrowserModule,
17
+ FormsModule,
18
+ HttpClientModule,
19
+ AuInputModule
20
+ ],
21
+ providers: [],
22
+ bootstrap: [AppComponent]
23
+ })
24
+ export class AppModule { }
@@ -0,0 +1,17 @@
1
+
2
+ $border-color: red;
3
+
4
+ :host-context(.au-fa-input-red-theme) {
5
+
6
+ border-color: $border-color;
7
+
8
+
9
+ &.input-focus {
10
+ -webkit-box-shadow: 0px 0px 5px $border-color;
11
+ box-shadow: 0px 0px 5px $border-color;
12
+ }
13
+
14
+ }
15
+
16
+
17
+
@@ -0,0 +1,6 @@
1
+
2
+ @import "../common/common.css";
3
+
4
+ @import "../common/_default-theme.scss";
5
+
6
+ @import "_au-fa-input-red-theme.scss";
@@ -0,0 +1,6 @@
1
+
2
+ <i class="icon fa" [ngClass]="classes"></i>
3
+
4
+
5
+ <ng-content></ng-content>
6
+
@@ -0,0 +1,40 @@
1
+ import {Component, Input, ContentChild, AfterContentInit, HostBinding, ViewEncapsulation} from '@angular/core';
2
+ import {InputRefDirective} from "../common/input-ref.directive";
3
+
4
+ @Component({
5
+ selector: 'au-fa-input',
6
+ templateUrl: './au-fa-input.component.html',
7
+ styleUrls: ['./au-fa-input.component.css']
8
+ })
9
+ export class AuFaInputComponent implements AfterContentInit {
10
+
11
+ @Input()
12
+ icon: string;
13
+
14
+ @ContentChild(InputRefDirective,{static:false})
15
+ input: InputRefDirective;
16
+
17
+ ngAfterContentInit() {
18
+ if (!this.input) {
19
+ console.error('the au-fa-input needs an input inside its content');
20
+ }
21
+ }
22
+
23
+ @HostBinding('class.input-focus')
24
+ get isInputFocus() {
25
+ return this.input ? this.input.focus : false;
26
+ }
27
+
28
+
29
+ get classes() {
30
+
31
+ const cssClasses = {};
32
+
33
+ if (this.icon) {
34
+ cssClasses['fa-' + this.icon] = true;
35
+ }
36
+
37
+ return cssClasses;
38
+ }
39
+
40
+ }
@@ -0,0 +1,17 @@
1
+
2
+
3
+ import { NgModule } from '@angular/core';
4
+ import { CommonModule } from '@angular/common';
5
+ import {AuFaInputComponent} from "./au-fa-input/au-fa-input.component";
6
+ import {InputRefDirective} from "./common/input-ref.directive";
7
+ import { AuMdInputComponent } from './au-md-input/au-md-input.component';
8
+
9
+ @NgModule({
10
+ declarations: [AuFaInputComponent, InputRefDirective, AuMdInputComponent],
11
+ imports: [
12
+ CommonModule
13
+ ],
14
+ exports: [AuFaInputComponent, AuMdInputComponent, InputRefDirective]
15
+ })
16
+ export class AuInputModule { }
17
+
@@ -0,0 +1,10 @@
1
+
2
+ @import "../common/common.css";
3
+
4
+ @import "../common/_default-theme.scss";
5
+
6
+ .md-icon {
7
+ line-height: 21px;
8
+ vertical-align: middle;
9
+ }
10
+
@@ -0,0 +1,8 @@
1
+
2
+ <i class="md-icon" [innerHtml]="icon"></i>
3
+
4
+
5
+ <ng-content></ng-content>
6
+
7
+
8
+
@@ -0,0 +1,30 @@
1
+ import {Component, Input, OnInit, ContentChild, AfterContentInit, HostBinding} from '@angular/core';
2
+ import {InputRefDirective} from "../common/input-ref.directive";
3
+
4
+
5
+ @Component({
6
+ selector: 'au-md-input',
7
+ templateUrl: './au-md-input.component.html',
8
+ styleUrls: ['./au-md-input.component.css']
9
+ })
10
+ export class AuMdInputComponent implements AfterContentInit {
11
+
12
+ @Input()
13
+ icon: string;
14
+
15
+ @ContentChild(InputRefDirective, {static:false})
16
+ input: InputRefDirective;
17
+
18
+ ngAfterContentInit() {
19
+ if (!this.input) {
20
+ console.error("the au-md-input needs an input inside its content");
21
+ }
22
+ }
23
+
24
+ @HostBinding('class.input-focus')
25
+ get isInputFocus() {
26
+ return this.input ? this.input.focus : false;
27
+ }
28
+
29
+
30
+ }
@@ -0,0 +1,11 @@
1
+
2
+ :host {
3
+ background: white;
4
+ border-color: lightgray;
5
+ }
6
+
7
+ :host(.input-focus) {
8
+ border-color: #4D90FE;
9
+ -webkit-box-shadow: 0px 0px 5px #4D90FE;
10
+ box-shadow: 0px 0px 5px #4D90FE;
11
+ }