mis-crystal-design-system 4.0.44 → 4.0.46
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/bundles/mis-crystal-design-system-input.umd.js +3 -1
- package/bundles/mis-crystal-design-system-input.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-input.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-input.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-phone-input.umd.js +48 -7
- package/bundles/mis-crystal-design-system-phone-input.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-phone-input.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-phone-input.umd.min.js.map +1 -1
- package/esm2015/input/mis-input.component.js +4 -2
- package/esm2015/phone-input/phone-input.component.js +45 -4
- package/fesm2015/mis-crystal-design-system-input.js +3 -1
- package/fesm2015/mis-crystal-design-system-input.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-phone-input.js +44 -3
- package/fesm2015/mis-crystal-design-system-phone-input.js.map +1 -1
- package/input/mis-crystal-design-system-input.metadata.json +1 -1
- package/input/mis-input.component.d.ts +1 -0
- package/package.json +1 -1
- package/phone-input/mis-crystal-design-system-phone-input.metadata.json +1 -1
- package/phone-input/phone-input.component.d.ts +12 -3
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
this.size = "sm";
|
|
47
47
|
this.noHints = false;
|
|
48
48
|
this.hasError = false; // show input in error state
|
|
49
|
+
this.isMandatory = false; // show input as mandatory
|
|
49
50
|
this.inputValidity = true;
|
|
50
51
|
}
|
|
51
52
|
Object.defineProperty(MisInputComponent.prototype, "formInput", {
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
MisInputComponent.decorators = [
|
|
74
75
|
{ type: core.Component, args: [{
|
|
75
76
|
selector: "mis-input",
|
|
76
|
-
template: "<div\n [class]=\"'input-container ' + size\"\n [ngClass]=\"{\n rounded: type === 'rounded',\n floating: type === 'floating',\n 'has-error': !inputValidity || hasError,\n 'no-hint': noHints,\n 'mis-disabled': inputCtrl?.disabled\n }\"\n>\n <div class=\"input-wrapper\">\n <ng-content select=\"[mis-input-icon]\"></ng-content>\n <div class=\"mis-input\">\n <ng-content select=\"input\"></ng-content>\n <span class=\"mis-placeholder\">{{ placeholder }}
|
|
77
|
+
template: "<div\n [class]=\"'input-container ' + size\"\n [ngClass]=\"{\n rounded: type === 'rounded',\n floating: type === 'floating',\n 'has-error': !inputValidity || hasError,\n 'no-hint': noHints,\n 'mis-disabled': inputCtrl?.disabled\n }\"\n>\n <div class=\"input-wrapper\">\n <ng-content select=\"[mis-input-icon]\"></ng-content>\n <div class=\"mis-input\">\n <ng-content select=\"input\"></ng-content>\n <span class=\"mis-placeholder\">{{ placeholder }}<span *ngIf=\"isMandatory\" style=\"color: red;\">*</span></span>\n </div>\n <ng-content select=\"[mis-input-act]\"></ng-content>\n </div>\n <ng-content select=\"[mis-input-hint]\"></ng-content>\n <ng-content select=\"[mis-input-error]\"></ng-content>\n</div>\n",
|
|
77
78
|
styles: [":root{--pmry-200:#99baf7;--pmry-100:#cbddfb;--pmry-500:#0937b2;--pmry-400:#3c68d0;--pmry-600:#062a99;--pmry-700:#041f80;--pmry-300:#638fe7;--pmry-800:#021567;--pmry-900:#010f55;--sec-d-purple:#40447f;--sec-maroon:#6b034e;--sec-mud-red:#b23600;--sec-orange:#ed711c;--sec-purple:#815fd5;--sec-teal:#10adae;--sec-yellow:#d4900c;--sec-green:#547f40;--sec-bright-green:#27d22e;--sec-dark-teal:#035f6b;--sec-chocolate:#7c2f33;--sec-rube-pink:#c13d6d;--sec-cerulean:#0087b2;--sem-error:#b00020;--sem-info:#0091ff;--sem-warning:#ff9d00;--sem-success:#38af49;--grey-bg-1:#fafafa;--grey-bg:#f5f5f5;--grey-seperators:#e0e0e0;--grey-disabled:#c8cdd3;--grey-hover:#f5f7fc;--grey-pressed:#e6ebf7;--grey-row:#f5f7fc;--dec-light-yellow:#f4e7c3;--dec-light-purple:#dacff9;--dec-light-green:#e4f5e9;--dec-light-green2:#f1fff3;--dec-light-pink:#fae1ea;--dec-:#f4cbc1;--dec-lt-orange:#faefed;--dec-light-blue:#cfecf9;--dec-row-selection:#f1fdf8;--dec-row-selection2:#f2fbff;--dec-row-lines:#d3e1e9;--text-white:#fff;--text-disabled:#929dab;--text-muted:#6a737d;--text-black:#181f33;--MR-solid-blue2:#c8d5f6;--MR-solid-purple:#c9c3fb;--MR-solid-orange:#eeac9f;--MR-solid-green:#acdada;--MR-solid-brown:#e8c8af;--MR-solid-yellow:#ffefc7;--MR-solid-blue:#bbe6ff;--MR-solid-pink:#ffc6f2;--tr-hover:#f0f3fa;--tr-pressed:#dae1f3}.input-container{position:relative;padding-bottom:24px}.input-container.mis-disabled .input-wrapper{pointer-events:none!important}.input-container .input-wrapper{box-sizing:border-box;display:flex;align-items:center;flex-direction:row;flex-wrap:nowrap;transition:all 60ms ease-in;background-color:#fff;padding:3px 16px;gap:16px}.input-container .input-wrapper .mis-input{flex:1 1 auto;z-index:0;position:relative;display:flex;align-items:center}.input-container .input-wrapper input{flex:1 1 auto;border:none;outline:none;height:100%;padding:0;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;height:24px;color:#181f33;background-color:transparent;width:100%;vertical-align:middle}.input-container .input-wrapper input::-moz-placeholder{-moz-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input:-ms-input-placeholder{-ms-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input::placeholder{transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper .mis-placeholder{position:absolute;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#6a737d;z-index:-1;transition:all .15s ease-in}.input-container .input-wrapper:focus-within{background-color:#f5f5f5}.input-container .input-wrapper:focus-within{border:1px solid #0937b2}.input-container .input-wrapper [mis-input-act],.input-container .input-wrapper [mis-input-icon]{width:18px;height:18px;color:#6a737d;font-size:24px;line-height:18px}.input-container .input-wrapper [mis-input-act]{cursor:pointer}.input-container.no-hint{padding-bottom:0}.input-container.rounded input{box-sizing:initial}.input-container.rounded.sm input{padding:3px 16px}.input-container.rounded.md input{padding:9px 16px}.input-container.rounded.lg input{padding:15px 16px}.input-container.rounded .input-wrapper{border-radius:4px;border:1px solid #e0e0e0;padding:0}.input-container.rounded .input-wrapper:hover{background-color:#f5f5f5}.input-container.rounded .input-wrapper:focus-within{border:1px solid #0937b2}.input-container.rounded .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper .mis-placeholder{margin-left:16px;transition-duration:50ms}.input-container.rounded.has-error .input-wrapper{border:1px solid #b00020!important}.input-container.floating .input-wrapper{padding-top:24px;padding-bottom:7px;border-bottom:1px solid #e0e0e0}.input-container.floating .input-wrapper input:focus+.mis-placeholder{color:#0937b2!important}.input-container.floating .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:focus+.mis-placeholder,.input-container.floating .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper:focus-within{border:none;border-bottom:1px solid #0937b2}.input-container.floating .input-wrapper:focus-within input::-moz-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input:-ms-input-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input::placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating.has-error .input-wrapper{border-bottom:1px solid #b00020!important}.input-container.floating.has-error .input-wrapper .mis-placeholder{color:#b00020!important}.input-container [mis-input-error],.input-container [mis-input-hint]{position:absolute;left:0;right:0;bottom:0;line-height:24px;height:24px;font-size:12px;color:#6a737d;letter-spacing:.2px}.input-container [mis-input-error]{color:#b00020}"]
|
|
78
79
|
},] }
|
|
79
80
|
];
|
|
@@ -84,6 +85,7 @@
|
|
|
84
85
|
placeholder: [{ type: core.Input }],
|
|
85
86
|
noHints: [{ type: core.Input }],
|
|
86
87
|
hasError: [{ type: core.Input }],
|
|
88
|
+
isMandatory: [{ type: core.Input }],
|
|
87
89
|
formInput: [{ type: core.ContentChild, args: [MisInputDirective,] }]
|
|
88
90
|
};
|
|
89
91
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-input.umd.js","sources":["../../../projects/mis-components/input/directives/input/input.directive.ts","../../../projects/mis-components/input/mis-input.component.ts","../../../projects/mis-components/input/mis-input.module.ts","../../../projects/mis-components/input/mis-crystal-design-system-input.ts"],"sourcesContent":["import { Directive, ElementRef, OnDestroy, OnInit, Optional, Self } from \"@angular/core\";\nimport { NgControl } from \"@angular/forms\";\nimport { ReplaySubject, Subject, Subscription } from \"rxjs\";\nimport { takeUntil } from \"rxjs/operators\";\n\n@Directive({\n // tslint:disable-next-line\n selector: \"input[misInput]\"\n})\nexport class MisInputDirective implements OnInit, OnDestroy {\n constructor(public el: ElementRef, @Self() @Optional() public control: NgControl) {}\n private validityChange: ReplaySubject<boolean> = new ReplaySubject(1);\n validity = this.validityChange.asObservable();\n endObs: Subject<void> = new Subject();\n focus = false;\n hasValue = false;\n\n ngOnInit(): void {\n this.control?.control?.valueChanges.pipe(takeUntil(this.endObs)).subscribe(() => {\n this.validityChange.next(!this.control.control?.invalid);\n });\n this.el.nativeElement.placeholder += \" \";\n }\n ngOnDestroy(): void {\n this.endObs.next();\n this.endObs.complete();\n }\n}\n","import { Component, ContentChild, Input, OnDestroy, OnInit, ViewEncapsulation } from \"@angular/core\";\nimport { AbstractControl } from \"@angular/forms\";\nimport { Subscription } from \"rxjs\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\n\n@Component({\n selector: \"mis-input\",\n templateUrl: \"./mis-input.component.html\",\n styleUrls: [\"./mis-input.component.scss\"]\n})\nexport class MisInputComponent implements OnInit, OnDestroy {\n @Input() type: \"rounded\" | \"floating\" = \"floating\";\n @Input() size: \"sm\" | \"md\" | \"lg\" = \"sm\";\n @Input() placeholder: string; // floating placeholder text\n @Input() noHints = false;\n @Input() hasError = false; // show input in error state\n @ContentChild(MisInputDirective) set formInput(input: MisInputDirective) {\n if (!this.placeholder) {\n this.placeholder = input?.el.nativeElement.placeholder || \"\";\n }\n this.inputCtrl = input.control?.control;\n this.inputSubscription?.unsubscribe();\n this.inputSubscription = input?.validity.subscribe(res => (this.inputValidity = res));\n this.placeholder += \" \";\n }\n inputCtrl: AbstractControl;\n inputSubscription: Subscription | undefined;\n inputValidity: boolean = true;\n constructor() {}\n\n ngOnInit(): void {}\n ngOnDestroy(): void {\n this.inputSubscription?.unsubscribe();\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\nimport { MisInputComponent } from \"./mis-input.component\";\n\n@NgModule({\n declarations: [MisInputComponent, MisInputDirective],\n imports: [CommonModule, FormsModule],\n exports: [MisInputComponent, MisInputDirective]\n})\nexport class MisInputModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ReplaySubject","Subject","takeUntil","Directive","ElementRef","NgControl","Self","Optional","Component","Input","ContentChild","NgModule","CommonModule","FormsModule"],"mappings":";;;;;;;QAUE,2BAAmB,EAAc,EAA6B,OAAkB;YAA7D,OAAE,GAAF,EAAE,CAAY;YAA6B,YAAO,GAAP,OAAO,CAAW;YACxE,mBAAc,GAA2B,IAAIA,kBAAa,CAAC,CAAC,CAAC,CAAC;YACtE,aAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;YAC9C,WAAM,GAAkB,IAAIC,YAAO,EAAE,CAAC;YACtC,UAAK,GAAG,KAAK,CAAC;YACd,aAAQ,GAAG,KAAK,CAAC;SALmE;QAOpF,oCAAQ,GAAR;YAAA,iBAKC;;YAJC,YAAA,IAAI,CAAC,OAAO,0CAAE,OAAO,0CAAE,YAAY,CAAC,IAAI,CAACC,mBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;;gBACzE,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAC,KAAI,CAAC,OAAO,CAAC,OAAO,0CAAE,OAAO,CAAA,CAAC,CAAC;aAC1D,EAAE;YACH,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,WAAW,IAAI,GAAG,CAAC;SAC1C;QACD,uCAAW,GAAX;YACE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;SACxB;;;;gBArBFC,cAAS,SAAC;;oBAET,QAAQ,EAAE,iBAAiB;iBAC5B;;;gBARmBC,eAAU;gBACrBC,eAAS,uBASoBC,SAAI,YAAIC,aAAQ;;;;
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-input.umd.js","sources":["../../../projects/mis-components/input/directives/input/input.directive.ts","../../../projects/mis-components/input/mis-input.component.ts","../../../projects/mis-components/input/mis-input.module.ts","../../../projects/mis-components/input/mis-crystal-design-system-input.ts"],"sourcesContent":["import { Directive, ElementRef, OnDestroy, OnInit, Optional, Self } from \"@angular/core\";\nimport { NgControl } from \"@angular/forms\";\nimport { ReplaySubject, Subject, Subscription } from \"rxjs\";\nimport { takeUntil } from \"rxjs/operators\";\n\n@Directive({\n // tslint:disable-next-line\n selector: \"input[misInput]\"\n})\nexport class MisInputDirective implements OnInit, OnDestroy {\n constructor(public el: ElementRef, @Self() @Optional() public control: NgControl) {}\n private validityChange: ReplaySubject<boolean> = new ReplaySubject(1);\n validity = this.validityChange.asObservable();\n endObs: Subject<void> = new Subject();\n focus = false;\n hasValue = false;\n\n ngOnInit(): void {\n this.control?.control?.valueChanges.pipe(takeUntil(this.endObs)).subscribe(() => {\n this.validityChange.next(!this.control.control?.invalid);\n });\n this.el.nativeElement.placeholder += \" \";\n }\n ngOnDestroy(): void {\n this.endObs.next();\n this.endObs.complete();\n }\n}\n","import { Component, ContentChild, Input, OnDestroy, OnInit, ViewEncapsulation } from \"@angular/core\";\nimport { AbstractControl } from \"@angular/forms\";\nimport { Subscription } from \"rxjs\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\n\n@Component({\n selector: \"mis-input\",\n templateUrl: \"./mis-input.component.html\",\n styleUrls: [\"./mis-input.component.scss\"]\n})\nexport class MisInputComponent implements OnInit, OnDestroy {\n @Input() type: \"rounded\" | \"floating\" = \"floating\";\n @Input() size: \"sm\" | \"md\" | \"lg\" = \"sm\";\n @Input() placeholder: string; // floating placeholder text\n @Input() noHints = false;\n @Input() hasError = false; // show input in error state\n @Input() isMandatory:boolean = false; // show input as mandatory\n @ContentChild(MisInputDirective) set formInput(input: MisInputDirective) {\n if (!this.placeholder) {\n this.placeholder = input?.el.nativeElement.placeholder || \"\";\n }\n this.inputCtrl = input.control?.control;\n this.inputSubscription?.unsubscribe();\n this.inputSubscription = input?.validity.subscribe(res => (this.inputValidity = res));\n this.placeholder += \" \";\n }\n inputCtrl: AbstractControl;\n inputSubscription: Subscription | undefined;\n inputValidity: boolean = true;\n constructor() {}\n\n ngOnInit(): void {}\n ngOnDestroy(): void {\n this.inputSubscription?.unsubscribe();\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\nimport { MisInputComponent } from \"./mis-input.component\";\n\n@NgModule({\n declarations: [MisInputComponent, MisInputDirective],\n imports: [CommonModule, FormsModule],\n exports: [MisInputComponent, MisInputDirective]\n})\nexport class MisInputModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ReplaySubject","Subject","takeUntil","Directive","ElementRef","NgControl","Self","Optional","Component","Input","ContentChild","NgModule","CommonModule","FormsModule"],"mappings":";;;;;;;QAUE,2BAAmB,EAAc,EAA6B,OAAkB;YAA7D,OAAE,GAAF,EAAE,CAAY;YAA6B,YAAO,GAAP,OAAO,CAAW;YACxE,mBAAc,GAA2B,IAAIA,kBAAa,CAAC,CAAC,CAAC,CAAC;YACtE,aAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;YAC9C,WAAM,GAAkB,IAAIC,YAAO,EAAE,CAAC;YACtC,UAAK,GAAG,KAAK,CAAC;YACd,aAAQ,GAAG,KAAK,CAAC;SALmE;QAOpF,oCAAQ,GAAR;YAAA,iBAKC;;YAJC,YAAA,IAAI,CAAC,OAAO,0CAAE,OAAO,0CAAE,YAAY,CAAC,IAAI,CAACC,mBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;;gBACzE,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAC,KAAI,CAAC,OAAO,CAAC,OAAO,0CAAE,OAAO,CAAA,CAAC,CAAC;aAC1D,EAAE;YACH,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,WAAW,IAAI,GAAG,CAAC;SAC1C;QACD,uCAAW,GAAX;YACE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;SACxB;;;;gBArBFC,cAAS,SAAC;;oBAET,QAAQ,EAAE,iBAAiB;iBAC5B;;;gBARmBC,eAAU;gBACrBC,eAAS,uBASoBC,SAAI,YAAIC,aAAQ;;;;QCmBpD;YAlBS,SAAI,GAA2B,UA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,iBAAiB,CAAC;iBAChD;;;ICVD;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/input",["exports","@angular/core","@angular/forms","rxjs","rxjs/operators","@angular/common"],t):t(((n="undefined"!=typeof globalThis?globalThis:n||self)["mis-crystal-design-system"]=n["mis-crystal-design-system"]||{},n["mis-crystal-design-system"].input={}),n.ng.core,n.ng.forms,n.rxjs,n.rxjs.operators,n.ng.common)}(this,(function(n,t,e,i,r,o){"use strict";var p=function(){function n(n,t){this.el=n,this.control=t,this.validityChange=new i.ReplaySubject(1),this.validity=this.validityChange.asObservable(),this.endObs=new i.Subject,this.focus=!1,this.hasValue=!1}return n.prototype.ngOnInit=function(){var n,t,e=this;null===(t=null===(n=this.control)||void 0===n?void 0:n.control)||void 0===t||t.valueChanges.pipe(r.takeUntil(this.endObs)).subscribe((function(){var n;e.validityChange.next(!(null===(n=e.control.control)||void 0===n?void 0:n.invalid))})),this.el.nativeElement.placeholder+=" "},n.prototype.ngOnDestroy=function(){this.endObs.next(),this.endObs.complete()},n}();p.decorators=[{type:t.Directive,args:[{selector:"input[misInput]"}]}],p.ctorParameters=function(){return[{type:t.ElementRef},{type:e.NgControl,decorators:[{type:t.Self},{type:t.Optional}]}]};var a=function(){function n(){this.type="floating",this.size="sm",this.noHints=!1,this.hasError=!1,this.inputValidity=!0}return Object.defineProperty(n.prototype,"formInput",{set:function(n){var t,e,i=this;this.placeholder||(this.placeholder=(null==n?void 0:n.el.nativeElement.placeholder)||""),this.inputCtrl=null===(t=n.control)||void 0===t?void 0:t.control,null===(e=this.inputSubscription)||void 0===e||e.unsubscribe(),this.inputSubscription=null==n?void 0:n.validity.subscribe((function(n){return i.inputValidity=n})),this.placeholder+=" "},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){},n.prototype.ngOnDestroy=function(){var n;null===(n=this.inputSubscription)||void 0===n||n.unsubscribe()},n}();a.decorators=[{type:t.Component,args:[{selector:"mis-input",template:'<div\n [class]="\'input-container \' + size"\n [ngClass]="{\n rounded: type === \'rounded\',\n floating: type === \'floating\',\n \'has-error\': !inputValidity || hasError,\n \'no-hint\': noHints,\n \'mis-disabled\': inputCtrl?.disabled\n }"\n>\n <div class="input-wrapper">\n <ng-content select="[mis-input-icon]"></ng-content>\n <div class="mis-input">\n <ng-content select="input"></ng-content>\n <span class="mis-placeholder">{{ placeholder }}
|
|
1
|
+
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/input",["exports","@angular/core","@angular/forms","rxjs","rxjs/operators","@angular/common"],t):t(((n="undefined"!=typeof globalThis?globalThis:n||self)["mis-crystal-design-system"]=n["mis-crystal-design-system"]||{},n["mis-crystal-design-system"].input={}),n.ng.core,n.ng.forms,n.rxjs,n.rxjs.operators,n.ng.common)}(this,(function(n,t,e,i,r,o){"use strict";var p=function(){function n(n,t){this.el=n,this.control=t,this.validityChange=new i.ReplaySubject(1),this.validity=this.validityChange.asObservable(),this.endObs=new i.Subject,this.focus=!1,this.hasValue=!1}return n.prototype.ngOnInit=function(){var n,t,e=this;null===(t=null===(n=this.control)||void 0===n?void 0:n.control)||void 0===t||t.valueChanges.pipe(r.takeUntil(this.endObs)).subscribe((function(){var n;e.validityChange.next(!(null===(n=e.control.control)||void 0===n?void 0:n.invalid))})),this.el.nativeElement.placeholder+=" "},n.prototype.ngOnDestroy=function(){this.endObs.next(),this.endObs.complete()},n}();p.decorators=[{type:t.Directive,args:[{selector:"input[misInput]"}]}],p.ctorParameters=function(){return[{type:t.ElementRef},{type:e.NgControl,decorators:[{type:t.Self},{type:t.Optional}]}]};var a=function(){function n(){this.type="floating",this.size="sm",this.noHints=!1,this.hasError=!1,this.isMandatory=!1,this.inputValidity=!0}return Object.defineProperty(n.prototype,"formInput",{set:function(n){var t,e,i=this;this.placeholder||(this.placeholder=(null==n?void 0:n.el.nativeElement.placeholder)||""),this.inputCtrl=null===(t=n.control)||void 0===t?void 0:t.control,null===(e=this.inputSubscription)||void 0===e||e.unsubscribe(),this.inputSubscription=null==n?void 0:n.validity.subscribe((function(n){return i.inputValidity=n})),this.placeholder+=" "},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){},n.prototype.ngOnDestroy=function(){var n;null===(n=this.inputSubscription)||void 0===n||n.unsubscribe()},n}();a.decorators=[{type:t.Component,args:[{selector:"mis-input",template:'<div\n [class]="\'input-container \' + size"\n [ngClass]="{\n rounded: type === \'rounded\',\n floating: type === \'floating\',\n \'has-error\': !inputValidity || hasError,\n \'no-hint\': noHints,\n \'mis-disabled\': inputCtrl?.disabled\n }"\n>\n <div class="input-wrapper">\n <ng-content select="[mis-input-icon]"></ng-content>\n <div class="mis-input">\n <ng-content select="input"></ng-content>\n <span class="mis-placeholder">{{ placeholder }}<span *ngIf="isMandatory" style="color: red;">*</span></span>\n </div>\n <ng-content select="[mis-input-act]"></ng-content>\n </div>\n <ng-content select="[mis-input-hint]"></ng-content>\n <ng-content select="[mis-input-error]"></ng-content>\n</div>\n',styles:[":root{--pmry-200:#99baf7;--pmry-100:#cbddfb;--pmry-500:#0937b2;--pmry-400:#3c68d0;--pmry-600:#062a99;--pmry-700:#041f80;--pmry-300:#638fe7;--pmry-800:#021567;--pmry-900:#010f55;--sec-d-purple:#40447f;--sec-maroon:#6b034e;--sec-mud-red:#b23600;--sec-orange:#ed711c;--sec-purple:#815fd5;--sec-teal:#10adae;--sec-yellow:#d4900c;--sec-green:#547f40;--sec-bright-green:#27d22e;--sec-dark-teal:#035f6b;--sec-chocolate:#7c2f33;--sec-rube-pink:#c13d6d;--sec-cerulean:#0087b2;--sem-error:#b00020;--sem-info:#0091ff;--sem-warning:#ff9d00;--sem-success:#38af49;--grey-bg-1:#fafafa;--grey-bg:#f5f5f5;--grey-seperators:#e0e0e0;--grey-disabled:#c8cdd3;--grey-hover:#f5f7fc;--grey-pressed:#e6ebf7;--grey-row:#f5f7fc;--dec-light-yellow:#f4e7c3;--dec-light-purple:#dacff9;--dec-light-green:#e4f5e9;--dec-light-green2:#f1fff3;--dec-light-pink:#fae1ea;--dec-:#f4cbc1;--dec-lt-orange:#faefed;--dec-light-blue:#cfecf9;--dec-row-selection:#f1fdf8;--dec-row-selection2:#f2fbff;--dec-row-lines:#d3e1e9;--text-white:#fff;--text-disabled:#929dab;--text-muted:#6a737d;--text-black:#181f33;--MR-solid-blue2:#c8d5f6;--MR-solid-purple:#c9c3fb;--MR-solid-orange:#eeac9f;--MR-solid-green:#acdada;--MR-solid-brown:#e8c8af;--MR-solid-yellow:#ffefc7;--MR-solid-blue:#bbe6ff;--MR-solid-pink:#ffc6f2;--tr-hover:#f0f3fa;--tr-pressed:#dae1f3}.input-container{position:relative;padding-bottom:24px}.input-container.mis-disabled .input-wrapper{pointer-events:none!important}.input-container .input-wrapper{box-sizing:border-box;display:flex;align-items:center;flex-direction:row;flex-wrap:nowrap;transition:all 60ms ease-in;background-color:#fff;padding:3px 16px;gap:16px}.input-container .input-wrapper .mis-input{flex:1 1 auto;z-index:0;position:relative;display:flex;align-items:center}.input-container .input-wrapper input{flex:1 1 auto;border:none;outline:none;height:100%;padding:0;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;height:24px;color:#181f33;background-color:transparent;width:100%;vertical-align:middle}.input-container .input-wrapper input::-moz-placeholder{-moz-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input:-ms-input-placeholder{-ms-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input::placeholder{transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper .mis-placeholder{position:absolute;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#6a737d;z-index:-1;transition:all .15s ease-in}.input-container .input-wrapper:focus-within{background-color:#f5f5f5}.input-container .input-wrapper:focus-within{border:1px solid #0937b2}.input-container .input-wrapper [mis-input-act],.input-container .input-wrapper [mis-input-icon]{width:18px;height:18px;color:#6a737d;font-size:24px;line-height:18px}.input-container .input-wrapper [mis-input-act]{cursor:pointer}.input-container.no-hint{padding-bottom:0}.input-container.rounded input{box-sizing:initial}.input-container.rounded.sm input{padding:3px 16px}.input-container.rounded.md input{padding:9px 16px}.input-container.rounded.lg input{padding:15px 16px}.input-container.rounded .input-wrapper{border-radius:4px;border:1px solid #e0e0e0;padding:0}.input-container.rounded .input-wrapper:hover{background-color:#f5f5f5}.input-container.rounded .input-wrapper:focus-within{border:1px solid #0937b2}.input-container.rounded .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper .mis-placeholder{margin-left:16px;transition-duration:50ms}.input-container.rounded.has-error .input-wrapper{border:1px solid #b00020!important}.input-container.floating .input-wrapper{padding-top:24px;padding-bottom:7px;border-bottom:1px solid #e0e0e0}.input-container.floating .input-wrapper input:focus+.mis-placeholder{color:#0937b2!important}.input-container.floating .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:focus+.mis-placeholder,.input-container.floating .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper:focus-within{border:none;border-bottom:1px solid #0937b2}.input-container.floating .input-wrapper:focus-within input::-moz-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input:-ms-input-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input::placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating.has-error .input-wrapper{border-bottom:1px solid #b00020!important}.input-container.floating.has-error .input-wrapper .mis-placeholder{color:#b00020!important}.input-container [mis-input-error],.input-container [mis-input-hint]{position:absolute;left:0;right:0;bottom:0;line-height:24px;height:24px;font-size:12px;color:#6a737d;letter-spacing:.2px}.input-container [mis-input-error]{color:#b00020}"]}]}],a.ctorParameters=function(){return[]},a.propDecorators={type:[{type:t.Input}],size:[{type:t.Input}],placeholder:[{type:t.Input}],noHints:[{type:t.Input}],hasError:[{type:t.Input}],isMandatory:[{type:t.Input}],formInput:[{type:t.ContentChild,args:[p]}]};var s=function(){};s.decorators=[{type:t.NgModule,args:[{declarations:[a,p],imports:[o.CommonModule,e.FormsModule],exports:[a,p]}]}],n.MisInputComponent=a,n.MisInputDirective=p,n.MisInputModule=s,Object.defineProperty(n,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=mis-crystal-design-system-input.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/mis-components/input/directives/input/input.directive.ts","../../../projects/mis-components/input/mis-input.component.ts","../../../projects/mis-components/input/mis-input.module.ts"],"names":["MisInputDirective","el","control","this","validityChange","ReplaySubject","validity","asObservable","endObs","Subject","focus","hasValue","prototype","ngOnInit","_this","_b","_a","valueChanges","pipe","takeUntil","subscribe","next","invalid","nativeElement","placeholder","ngOnDestroy","complete","Directive","args","selector","ElementRef","NgControl","decorators","type","Self","Optional","MisInputComponent","size","noHints","hasError","inputValidity","Object","defineProperty","input","inputCtrl","inputSubscription","unsubscribe","res","Component","template","Input","ContentChild","NgModule","declarations","imports","CommonModule","FormsModule","exports"],"mappings":"uoBAUE,SAAAA,EAAmBC,EAA2CC,GAA3CC,KAAAF,GAAAA,EAA2CE,KAAAD,QAAAA,EACtDC,KAAAC,eAAyC,IAAIC,EAAAA,cAAc,GACnEF,KAAAG,SAAWH,KAAKC,eAAeG,eAC/BJ,KAAAK,OAAwB,IAAIC,EAAAA,QAC5BN,KAAAO,OAAQ,EACRP,KAAAQ,UAAW,SAEXX,EAAAY,UAAAC,SAAA,WAAA,QAAAC,EAAAX,KACuB,QAArBY,EAAY,QAAZC,EAAAb,KAAKD,eAAO,IAAAc,OAAA,EAAAA,EAAEd,eAAO,IAAAa,GAAAA,EAAEE,aAAaC,KAAKC,EAAAA,UAAUhB,KAAKK,SAASY,WAAU,iBACzEN,EAAKV,eAAeiB,OAA0B,QAArBL,EAACF,EAAKZ,QAAQA,eAAO,IAAAc,OAAA,EAAAA,EAAEM,aAElDnB,KAAKF,GAAGsB,cAAcC,aAAe,KAEvCxB,EAAAY,UAAAa,YAAA,WACEtB,KAAKK,OAAOa,OACZlB,KAAKK,OAAOkB,qCApBfC,EAAAA,UAASC,KAAA,CAAC,CAETC,SAAU,+DAPQC,EAAAA,kBACXC,EAAAA,UAASC,WAAA,CAAA,CAAAC,KASoBC,EAAAA,MAAI,CAAAD,KAAIE,EAAAA,+
|
|
1
|
+
{"version":3,"sources":["../../../projects/mis-components/input/directives/input/input.directive.ts","../../../projects/mis-components/input/mis-input.component.ts","../../../projects/mis-components/input/mis-input.module.ts"],"names":["MisInputDirective","el","control","this","validityChange","ReplaySubject","validity","asObservable","endObs","Subject","focus","hasValue","prototype","ngOnInit","_this","_b","_a","valueChanges","pipe","takeUntil","subscribe","next","invalid","nativeElement","placeholder","ngOnDestroy","complete","Directive","args","selector","ElementRef","NgControl","decorators","type","Self","Optional","MisInputComponent","size","noHints","hasError","isMandatory","inputValidity","Object","defineProperty","input","inputCtrl","inputSubscription","unsubscribe","res","Component","template","Input","ContentChild","NgModule","declarations","imports","CommonModule","Forms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a,EAAAZ,KAAK2C,yBAAiB,IAAA/B,GAAAA,EAAEgC,cACxB5C,KAAK2C,kBAAoBF,MAAAA,OAAK,EAALA,EAAOtC,SAASc,WAAU,SAAA4B,GAAO,OAAClC,EAAK2B,cAAgBO,KAChF7C,KAAKqB,aAAe,qCAOtBY,EAAAxB,UAAAC,SAAA,aACAuB,EAAAxB,UAAAa,YAAA,iBACwB,QAAtBT,EAAAb,KAAK2C,yBAAiB,IAAA9B,GAAAA,EAAE+B,wCA5B3BE,EAAAA,UAASrB,KAAA,CAAC,CACTC,SAAU,YACVqB,SAAA,k/MAICC,EAAAA,oBACAA,EAAAA,2BACAA,EAAAA,uBACAA,EAAAA,wBACAA,EAAAA,2BACAA,EAAAA,yBACAC,EAAAA,aAAYxB,KAAA,CAAC5B,YCNhB,iCALCqD,EAAAA,SAAQzB,KAAA,CAAC,CACR0B,aAAc,CAAClB,EAAmBpC,GAClCuD,QAAS,CAACC,EAAAA,aAAcC,EAAAA,aACxBC,QAAS,CAACtB,EAAmBpC","sourcesContent":["import { Directive, ElementRef, OnDestroy, OnInit, Optional, Self } from \"@angular/core\";\nimport { NgControl } from \"@angular/forms\";\nimport { ReplaySubject, Subject, Subscription } from \"rxjs\";\nimport { takeUntil } from \"rxjs/operators\";\n\n@Directive({\n // tslint:disable-next-line\n selector: \"input[misInput]\"\n})\nexport class MisInputDirective implements OnInit, OnDestroy {\n constructor(public el: ElementRef, @Self() @Optional() public control: NgControl) {}\n private validityChange: ReplaySubject<boolean> = new ReplaySubject(1);\n validity = this.validityChange.asObservable();\n endObs: Subject<void> = new Subject();\n focus = false;\n hasValue = false;\n\n ngOnInit(): void {\n this.control?.control?.valueChanges.pipe(takeUntil(this.endObs)).subscribe(() => {\n this.validityChange.next(!this.control.control?.invalid);\n });\n this.el.nativeElement.placeholder += \" \";\n }\n ngOnDestroy(): void {\n this.endObs.next();\n this.endObs.complete();\n }\n}\n","import { Component, ContentChild, Input, OnDestroy, OnInit, ViewEncapsulation } from \"@angular/core\";\nimport { AbstractControl } from \"@angular/forms\";\nimport { Subscription } from \"rxjs\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\n\n@Component({\n selector: \"mis-input\",\n templateUrl: \"./mis-input.component.html\",\n styleUrls: [\"./mis-input.component.scss\"]\n})\nexport class MisInputComponent implements OnInit, OnDestroy {\n @Input() type: \"rounded\" | \"floating\" = \"floating\";\n @Input() size: \"sm\" | \"md\" | \"lg\" = \"sm\";\n @Input() placeholder: string; // floating placeholder text\n @Input() noHints = false;\n @Input() hasError = false; // show input in error state\n @Input() isMandatory:boolean = false; // show input as mandatory\n @ContentChild(MisInputDirective) set formInput(input: MisInputDirective) {\n if (!this.placeholder) {\n this.placeholder = input?.el.nativeElement.placeholder || \"\";\n }\n this.inputCtrl = input.control?.control;\n this.inputSubscription?.unsubscribe();\n this.inputSubscription = input?.validity.subscribe(res => (this.inputValidity = res));\n this.placeholder += \" \";\n }\n inputCtrl: AbstractControl;\n inputSubscription: Subscription | undefined;\n inputValidity: boolean = true;\n constructor() {}\n\n ngOnInit(): void {}\n ngOnDestroy(): void {\n this.inputSubscription?.unsubscribe();\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\nimport { MisInputComponent } from \"./mis-input.component\";\n\n@NgModule({\n declarations: [MisInputComponent, MisInputDirective],\n imports: [CommonModule, FormsModule],\n exports: [MisInputComponent, MisInputDirective]\n})\nexport class MisInputModule {}\n"]}
|
|
@@ -1,31 +1,69 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@angular/common'), require('@angular/cdk/overlay'), require('@angular/cdk-experimental/scrolling'), require('mis-crystal-design-system/dropdown')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('mis-crystal-design-system/phone-input', ['exports', '@angular/core', '@angular/forms', '@angular/common', '@angular/cdk/overlay', '@angular/cdk-experimental/scrolling', 'mis-crystal-design-system/dropdown'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['mis-crystal-design-system'] = global['mis-crystal-design-system'] || {}, global['mis-crystal-design-system']['phone-input'] = {}), global.ng.core, global.ng.forms, global.ng.common, global.ng.cdk.overlay, global.ng.cdkExperimental.scrolling, global['mis-crystal-design-system'].dropdown));
|
|
5
|
-
}(this, (function (exports, core, forms, common, overlay, scrolling, dropdown) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('libphonenumber-js'), require('@angular/common'), require('@angular/cdk/overlay'), require('@angular/cdk-experimental/scrolling'), require('mis-crystal-design-system/dropdown')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('mis-crystal-design-system/phone-input', ['exports', '@angular/core', '@angular/forms', 'libphonenumber-js', '@angular/common', '@angular/cdk/overlay', '@angular/cdk-experimental/scrolling', 'mis-crystal-design-system/dropdown'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['mis-crystal-design-system'] = global['mis-crystal-design-system'] || {}, global['mis-crystal-design-system']['phone-input'] = {}), global.ng.core, global.ng.forms, global.libphonenumberJs, global.ng.common, global.ng.cdk.overlay, global.ng.cdkExperimental.scrolling, global['mis-crystal-design-system'].dropdown));
|
|
5
|
+
}(this, (function (exports, core, forms, libphonenumberJs, common, overlay, scrolling, dropdown) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var PhoneInputComponent = /** @class */ (function () {
|
|
8
8
|
function PhoneInputComponent() {
|
|
9
|
+
this.dropdownHeight = "";
|
|
10
|
+
this.dropdownWidth = "";
|
|
9
11
|
this.dropdownData = [];
|
|
10
12
|
this.dropdownSelectedItem = { value: "", label: "" };
|
|
13
|
+
this.defaultCountryCode = 'IN';
|
|
11
14
|
this.inputPlaceholder = 'Enter';
|
|
12
15
|
this.inputFormControl = new forms.FormControl();
|
|
13
16
|
this.onDropdownSelection = new core.EventEmitter();
|
|
14
|
-
this.
|
|
17
|
+
this.onInvalidPhoneNumber = new core.EventEmitter();
|
|
18
|
+
this.dropdownListWidth = "";
|
|
19
|
+
this.dropdownListHeight = "";
|
|
20
|
+
this.searchEnabled = true;
|
|
15
21
|
this.inputType = "number";
|
|
16
22
|
this.searchLabel = "Search Keyword";
|
|
23
|
+
this.phoneValidator = false;
|
|
24
|
+
this.countryCodes = [{ label: '', value: '' }];
|
|
25
|
+
this.selectedCountryName = '';
|
|
17
26
|
}
|
|
18
27
|
PhoneInputComponent.prototype.ngOnInit = function () {
|
|
28
|
+
var _this = this;
|
|
29
|
+
if (this.phoneValidator) {
|
|
30
|
+
this.loadCountryCodes();
|
|
31
|
+
this.dropdownData = this.countryCodes;
|
|
32
|
+
this.selectedCountryName = this.dropdownSelectedItem.label;
|
|
33
|
+
}
|
|
34
|
+
if (this.defaultCountryCode) {
|
|
35
|
+
var selectedCountry = this.dropdownData.find(function (country) { return country.value.toUpperCase() === _this.defaultCountryCode.toUpperCase(); });
|
|
36
|
+
if (selectedCountry) {
|
|
37
|
+
this.dropdownSelectedItem = selectedCountry;
|
|
38
|
+
this.selectedCountryName = selectedCountry.label;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
19
41
|
};
|
|
20
42
|
PhoneInputComponent.prototype.handleDropdownSelection = function (item) {
|
|
43
|
+
this.dropdownSelectedItem = item;
|
|
21
44
|
this.onDropdownSelection.emit(item);
|
|
45
|
+
this.selectedCountryName = item.label;
|
|
46
|
+
this.validatePhoneNumber(this.inputFormControl.value, this.dropdownSelectedItem.value);
|
|
47
|
+
};
|
|
48
|
+
PhoneInputComponent.prototype.loadCountryCodes = function () {
|
|
49
|
+
var countries = libphonenumberJs.getCountries();
|
|
50
|
+
this.countryCodes = countries.map(function (countryCode) { return ({
|
|
51
|
+
value: countryCode,
|
|
52
|
+
label: countryCode + " (+" + libphonenumberJs.getCountryCallingCode(countryCode) + ")"
|
|
53
|
+
}); });
|
|
54
|
+
};
|
|
55
|
+
PhoneInputComponent.prototype.validatePhoneNumber = function (phoneNumber, countryCode) {
|
|
56
|
+
var parsedPhoneNumber = libphonenumberJs.parsePhoneNumberFromString(phoneNumber, countryCode);
|
|
57
|
+
if (!parsedPhoneNumber || !parsedPhoneNumber.isValid()) {
|
|
58
|
+
this.onInvalidPhoneNumber.emit("Phone number is invalid for " + this.selectedCountryName);
|
|
59
|
+
}
|
|
22
60
|
};
|
|
23
61
|
return PhoneInputComponent;
|
|
24
62
|
}());
|
|
25
63
|
PhoneInputComponent.decorators = [
|
|
26
64
|
{ type: core.Component, args: [{
|
|
27
65
|
selector: "mis-phone-input",
|
|
28
|
-
template: "<div class=\"main-container-phone\">\n <mis-dropdown [height]=\"dropdownHeight\" [dropdownListWidth]=\"dropdownListWidth\"[dropdownListHeight]=\"dropdownListHeight\" [width]=\"dropdownWidth\" [data]=\"dropdownData\" [selectedItem]=\"dropdownSelectedItem\" [label]=\"label\" [searchEnabled]=\"searchEnabled\" [multiLine]=\"false\" (onChange)=\"handleDropdownSelection($event)\" [searchLabel]=\"searchLabel\"></mis-dropdown>\n <div class=\"details-field\">\n <div class=\"input-box\">\n <input\n [ngStyle]=\"{'height': inputHeight }\"\n class=\"black-text\"\n [placeholder]=\"inputPlaceholder\"\n [formControl]=\"inputFormControl\" \n [type]=\"inputType\"\n />\n </div>\n </div>\n</div>\n",
|
|
66
|
+
template: "<div class=\"main-container-phone\">\n <mis-dropdown [height]=\"dropdownHeight\" [dropdownListWidth]=\"dropdownListWidth\"[dropdownListHeight]=\"dropdownListHeight\" [width]=\"dropdownWidth\" [data]=\"dropdownData\" [selectedItem]=\"dropdownSelectedItem\" [label]=\"label\" [searchEnabled]=\"searchEnabled\" [multiLine]=\"false\" (onChange)=\"handleDropdownSelection($event)\" [searchLabel]=\"searchLabel\"></mis-dropdown>\n <div class=\"details-field\">\n <div class=\"input-box\">\n <input\n [ngStyle]=\"{'height': inputHeight }\"\n class=\"black-text\" \n [placeholder]=\"inputPlaceholder\"\n [formControl]=\"inputFormControl\" \n [type]=\"inputType\"\n />\n </div>\n </div>\n</div>\n",
|
|
29
67
|
styles: [".main-container-phone{display:flex;border:1px solid #e0e0e0;border-radius:6px}.details-field label{display:inline-block;min-width:224px;margin-right:24px}.details-field .input-box{width:100%}.details-field .input-box input{width:100%;height:32px}input{padding:10px 16px;border:none;outline:none;width:100%;height:auto;border-radius:6px}.black-text,input{color:#181f33;line-height:24px;font-size:16px}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.main-container-phone ::ng-deep .item{padding:8px!important}.main-container-phone ::ng-deep .dropdown{border:unset!important}"]
|
|
30
68
|
},] }
|
|
31
69
|
];
|
|
@@ -36,15 +74,18 @@
|
|
|
36
74
|
inputHeight: [{ type: core.Input }],
|
|
37
75
|
dropdownData: [{ type: core.Input }],
|
|
38
76
|
dropdownSelectedItem: [{ type: core.Input }],
|
|
77
|
+
defaultCountryCode: [{ type: core.Input }],
|
|
39
78
|
label: [{ type: core.Input }],
|
|
40
79
|
inputPlaceholder: [{ type: core.Input }],
|
|
41
80
|
inputFormControl: [{ type: core.Input }],
|
|
42
81
|
onDropdownSelection: [{ type: core.Output }],
|
|
82
|
+
onInvalidPhoneNumber: [{ type: core.Output }],
|
|
43
83
|
dropdownListWidth: [{ type: core.Input }],
|
|
44
84
|
dropdownListHeight: [{ type: core.Input }],
|
|
45
85
|
searchEnabled: [{ type: core.Input }],
|
|
46
86
|
inputType: [{ type: core.Input }],
|
|
47
|
-
searchLabel: [{ type: core.Input }]
|
|
87
|
+
searchLabel: [{ type: core.Input }],
|
|
88
|
+
phoneValidator: [{ type: core.Input }]
|
|
48
89
|
};
|
|
49
90
|
|
|
50
91
|
var PhoneInputModule = /** @class */ (function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-phone-input.umd.js","sources":["../../../projects/mis-components/phone-input/phone-input.component.ts","../../../projects/mis-components/phone-input/phone-input.module.ts","../../../projects/mis-components/phone-input/mis-crystal-design-system-phone-input.ts"],"sourcesContent":["import { Component,
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-phone-input.umd.js","sources":["../../../projects/mis-components/phone-input/phone-input.component.ts","../../../projects/mis-components/phone-input/phone-input.module.ts","../../../projects/mis-components/phone-input/mis-crystal-design-system-phone-input.ts"],"sourcesContent":["import { Component, EventEmitter, Input, OnInit, Output } from \"@angular/core\";\nimport { FormControl } from \"@angular/forms\";\nimport { parsePhoneNumberFromString, getCountryCallingCode, CountryCode, getCountries } from 'libphonenumber-js';\nimport { DropdownItem } from \"mis-crystal-design-system/dropdown\";\n\n@Component({\n selector: \"mis-phone-input\",\n templateUrl: \"./phone-input.component.html\",\n styleUrls: [\"./phone-input.component.scss\"]\n})\nexport class PhoneInputComponent implements OnInit {\n @Input() dropdownHeight?: string = \"\";\n @Input() dropdownWidth?: string = \"\";\n @Input() inputHeight?;\n @Input() dropdownData: DropdownItem[] = [];\n @Input() dropdownSelectedItem: DropdownItem = { value: \"\", label: \"\" };\n @Input() defaultCountryCode?: string = 'IN';\n @Input() label: string;\n @Input() inputPlaceholder: string = 'Enter';\n @Input() inputFormControl: FormControl = new FormControl();\n @Output() onDropdownSelection = new EventEmitter<any>();\n @Output() onInvalidPhoneNumber = new EventEmitter<string>();\n @Input() dropdownListWidth = \"\";\n @Input() dropdownListHeight = \"\";\n @Input() searchEnabled: boolean = true;\n @Input() inputType: string = \"number\";\n @Input() searchLabel: string = \"Search Keyword\"; \n @Input() phoneValidator? = false;\n \n countryCodes: DropdownItem[] = [{label:'',value:''}];\n countryCode: CountryCode | undefined;\n selectedCountryName: string = '';\n\n constructor() {}\n\n ngOnInit() {\n if (this.phoneValidator) {\n this.loadCountryCodes();\n this.dropdownData = this.countryCodes;\n this.selectedCountryName = this.dropdownSelectedItem.label;\n }\n\n if (this.defaultCountryCode) {\n const selectedCountry = this.dropdownData.find(\n country => country.value.toUpperCase() === this.defaultCountryCode.toUpperCase()\n );\n if (selectedCountry) {\n this.dropdownSelectedItem = selectedCountry;\n this.selectedCountryName = selectedCountry.label;\n }\n }\n }\n\n handleDropdownSelection(item: DropdownItem){\n this.dropdownSelectedItem = item;\n this.onDropdownSelection.emit(item);\n this.selectedCountryName = item.label;\n this.validatePhoneNumber(this.inputFormControl.value, this.dropdownSelectedItem.value);\n }\n\n loadCountryCodes() {\n const countries = getCountries();\n this.countryCodes = countries.map(countryCode => ({\n value: countryCode,\n label: `${countryCode} (+${getCountryCallingCode(countryCode)})`\n }));\n }\n\n validatePhoneNumber(phoneNumber: string, countryCode: string) {\n const parsedPhoneNumber = parsePhoneNumberFromString(phoneNumber, countryCode as CountryCode);\n\n if (!parsedPhoneNumber || !parsedPhoneNumber.isValid()) {\n this.onInvalidPhoneNumber.emit(`Phone number is invalid for ${this.selectedCountryName}`);\n }\n }\n\n}\n","import { CommonModule } from \"@angular/common\";\nimport { FormsModule } from \"@angular/forms\";\nimport { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { PhoneInputComponent } from \"./phone-input.component\";\nimport { OverlayModule } from \"@angular/cdk/overlay\";\nimport { ScrollingModule } from \"@angular/cdk-experimental/scrolling\";\nimport { DropdownModule } from \"mis-crystal-design-system/dropdown\";\nimport { ReactiveFormsModule } from \"@angular/forms\";\n\n\n@NgModule({\n declarations: [PhoneInputComponent],\n imports: [CommonModule,ReactiveFormsModule, FormsModule, OverlayModule, ScrollingModule, DropdownModule],\n exports: [PhoneInputComponent]\n})\nexport class PhoneInputModule {\n static forRoot(): ModuleWithProviders<PhoneInputModule> {\n return { ngModule: PhoneInputModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["FormControl","EventEmitter","getCountries","getCountryCallingCode","parsePhoneNumberFromString","Component","Input","Output","NgModule","CommonModule","ReactiveFormsModule","FormsModule","OverlayModule","ScrollingModule","Dropd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AM;oCACND,UAAK;qCACLA,UAAK;gCACLA,UAAK;4BACLA,UAAK;8BACLA,UAAK;iCACLA,UAAK;;;;QCZR;;QACS,wBAAO,GAAd;YACE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;SACtD;;;;gBARFE,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,mBAAmB,CAAC;oBACnC,OAAO,EAAE,CAACC,mBAAY,EAACC,yBAAmB,EAAEC,iBAAW,EAAEC,qBAAa,EAAEC,yBAAe,EAAEC,uBAAc,CAAC;oBACxG,OAAO,EAAE,CAAC,mBAAmB,CAAC;iBAC/B;;;ICdD;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("libphonenumber-js"),require("@angular/common"),require("@angular/cdk/overlay"),require("@angular/cdk-experimental/scrolling"),require("mis-crystal-design-system/dropdown")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/phone-input",["exports","@angular/core","@angular/forms","libphonenumber-js","@angular/common","@angular/cdk/overlay","@angular/cdk-experimental/scrolling","mis-crystal-design-system/dropdown"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["mis-crystal-design-system"]=e["mis-crystal-design-system"]||{},e["mis-crystal-design-system"]["phone-input"]={}),e.ng.core,e.ng.forms,e.libphonenumberJs,e.ng.common,e.ng.cdk.overlay,e.ng.cdkExperimental.scrolling,e["mis-crystal-design-system"].dropdown)}(this,(function(e,t,n,o,i,r,d,p){"use strict";var a=function(){function e(){this.dropdownHeight="",this.dropdownWidth="",this.dropdownData=[],this.dropdownSelectedItem={value:"",label:""},this.defaultCountryCode="IN",this.inputPlaceholder="Enter",this.inputFormControl=new n.FormControl,this.onDropdownSelection=new t.EventEmitter,this.onInvalidPhoneNumber=new t.EventEmitter,this.dropdownListWidth="",this.dropdownListHeight="",this.searchEnabled=!0,this.inputType="number",this.searchLabel="Search Keyword",this.phoneValidator=!1,this.countryCodes=[{label:"",value:""}],this.selectedCountryName=""}return e.prototype.ngOnInit=function(){var e=this;if(this.phoneValidator&&(this.loadCountryCodes(),this.dropdownData=this.countryCodes,this.selectedCountryName=this.dropdownSelectedItem.label),this.defaultCountryCode){var t=this.dropdownData.find((function(t){return t.value.toUpperCase()===e.defaultCountryCode.toUpperCase()}));t&&(this.dropdownSelectedItem=t,this.selectedCountryName=t.label)}},e.prototype.handleDropdownSelection=function(e){this.dropdownSelectedItem=e,this.onDropdownSelection.emit(e),this.selectedCountryName=e.label,this.validatePhoneNumber(this.inputFormControl.value,this.dropdownSelectedItem.value)},e.prototype.loadCountryCodes=function(){var e=o.getCountries();this.countryCodes=e.map((function(e){return{value:e,label:e+" (+"+o.getCountryCallingCode(e)+")"}}))},e.prototype.validatePhoneNumber=function(e,t){var n=o.parsePhoneNumberFromString(e,t);n&&n.isValid()||this.onInvalidPhoneNumber.emit("Phone number is invalid for "+this.selectedCountryName)},e}();a.decorators=[{type:t.Component,args:[{selector:"mis-phone-input",template:'<div class="main-container-phone">\n <mis-dropdown [height]="dropdownHeight" [dropdownListWidth]="dropdownListWidth"[dropdownListHeight]="dropdownListHeight" [width]="dropdownWidth" [data]="dropdownData" [selectedItem]="dropdownSelectedItem" [label]="label" [searchEnabled]="searchEnabled" [multiLine]="false" (onChange)="handleDropdownSelection($event)" [searchLabel]="searchLabel"></mis-dropdown>\n <div class="details-field">\n <div class="input-box">\n <input\n [ngStyle]="{\'height\': inputHeight }"\n class="black-text" \n [placeholder]="inputPlaceholder"\n [formControl]="inputFormControl" \n [type]="inputType"\n />\n </div>\n </div>\n</div>\n',styles:[".main-container-phone{display:flex;border:1px solid #e0e0e0;border-radius:6px}.details-field label{display:inline-block;min-width:224px;margin-right:24px}.details-field .input-box{width:100%}.details-field .input-box input{width:100%;height:32px}input{padding:10px 16px;border:none;outline:none;width:100%;height:auto;border-radius:6px}.black-text,input{color:#181f33;line-height:24px;font-size:16px}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.main-container-phone ::ng-deep .item{padding:8px!important}.main-container-phone ::ng-deep .dropdown{border:unset!important}"]}]}],a.ctorParameters=function(){return[]},a.propDecorators={dropdownHeight:[{type:t.Input}],dropdownWidth:[{type:t.Input}],inputHeight:[{type:t.Input}],dropdownData:[{type:t.Input}],dropdownSelectedItem:[{type:t.Input}],defaultCountryCode:[{type:t.Input}],label:[{type:t.Input}],inputPlaceholder:[{type:t.Input}],inputFormControl:[{type:t.Input}],onDropdownSelection:[{type:t.Output}],onInvalidPhoneNumber:[{type:t.Output}],dropdownListWidth:[{type:t.Input}],dropdownListHeight:[{type:t.Input}],searchEnabled:[{type:t.Input}],inputType:[{type:t.Input}],searchLabel:[{type:t.Input}],phoneValidator:[{type:t.Input}]};var l=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[]}},e}();l.decorators=[{type:t.NgModule,args:[{declarations:[a],imports:[i.CommonModule,n.ReactiveFormsModule,n.FormsModule,r.OverlayModule,d.ScrollingModule,p.DropdownModule],exports:[a]}]}],e.PhoneInputComponent=a,e.PhoneInputModule=l,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=mis-crystal-design-system-phone-input.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/mis-components/phone-input/phone-input.component.ts","../../../projects/mis-components/phone-input/phone-input.module.ts"],"names":["PhoneInputComponent","this","dropdownData","dropdownSelectedItem","value","label","inputPlaceholder","inputFormControl","FormControl","onDropdownSelection","EventEmitter","searchEnabled","inputType","searchLabel","prototype","ngOnInit","handleDropdownSelection","item","emit","Component","args","selector","template","Input","Output","PhoneInputModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","ReactiveFormsModule","FormsModule","OverlayModule","ScrollingModule","DropdownModule","exports"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../projects/mis-components/phone-input/phone-input.component.ts","../../../projects/mis-components/phone-input/phone-input.module.ts"],"names":["PhoneInputComponent","this","dropdownHeight","dropdownWidth","dropdownData","dropdownSelectedItem","value","label","defaultCountryCode","inputPlaceholder","inputFormControl","FormControl","onDropdownSelection","EventEmitter","onInvalidPhoneNumber","dropdownListWidth","dropdownListHeight","searchEnabled","inputType","searchLabel","phoneValidator","countryCodes","selectedCountryName","prototype","ngOnInit","_this","loadCountryCodes","selectedCountry","find","country","toUpperCase","handleDropdownSelection","item","emit","validatePhoneNumber","countries","getCountries","map","countryCode","getCountryCallingCode","phoneNumber","parsedPhoneNumber","parsePhoneNumberFromString","isValid","Component","args","selector","template","Input","Output","PhoneInputModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","ReactiveFormsModule","FormsModule","OverlayModule","ScrollingModule","DropdownModule","exports"],"mappings":"27BAiCE,SAAAA,IAtBSC,KAAAC,eAA0B,GAC1BD,KAAAE,cAAyB,GAEzBF,KAAAG,aAA+B,GAC/BH,KAAAI,qBAAqC,CAAEC,MAAO,GAAIC,MAAO,IACzDN,KAAAO,mBAA8B,KAE9BP,KAAAQ,iBAA2B,QAC3BR,KAAAS,iBAAgC,IAAIC,EAAAA,YACnCV,KAAAW,oBAAsB,IAAIC,EAAAA,aAC1BZ,KAAAa,qBAAuB,IAAID,EAAAA,aAC5BZ,KAAAc,kBAAoB,GACpBd,KAAAe,mBAAqB,GACrBf,KAAAgB,eAAyB,EACzBhB,KAAAiB,UAAoB,SACpBjB,KAAAkB,YAAsB,iBACtBlB,KAAAmB,gBAAkB,EAE3BnB,KAAAoB,aAA+B,CAAC,CAACd,MAAM,GAAGD,MAAM,KAEhDL,KAAAqB,oBAA8B,UAI9BtB,EAAAuB,UAAAC,SAAA,WAAA,IAAAC,EAAAxB,KAOE,GANIA,KAAKmB,iBACPnB,KAAKyB,mBACLzB,KAAKG,aAAeH,KAAKoB,aACzBpB,KAAKqB,oBAAsBrB,KA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AS,CAACC,EAAAA,aAAaC,EAAAA,oBAAqBC,EAAAA,YAAaC,EAAAA,cAAeC,EAAAA,gBAAiBC,EAAAA,gBACzFC,QAAS,CAAC/D","sourcesContent":["import { Component, EventEmitter, Input, OnInit, Output } from \"@angular/core\";\nimport { FormControl } from \"@angular/forms\";\nimport { parsePhoneNumberFromString, getCountryCallingCode, CountryCode, getCountries } from 'libphonenumber-js';\nimport { DropdownItem } from \"mis-crystal-design-system/dropdown\";\n\n@Component({\n selector: \"mis-phone-input\",\n templateUrl: \"./phone-input.component.html\",\n styleUrls: [\"./phone-input.component.scss\"]\n})\nexport class PhoneInputComponent implements OnInit {\n @Input() dropdownHeight?: string = \"\";\n @Input() dropdownWidth?: string = \"\";\n @Input() inputHeight?;\n @Input() dropdownData: DropdownItem[] = [];\n @Input() dropdownSelectedItem: DropdownItem = { value: \"\", label: \"\" };\n @Input() defaultCountryCode?: string = 'IN';\n @Input() label: string;\n @Input() inputPlaceholder: string = 'Enter';\n @Input() inputFormControl: FormControl = new FormControl();\n @Output() onDropdownSelection = new EventEmitter<any>();\n @Output() onInvalidPhoneNumber = new EventEmitter<string>();\n @Input() dropdownListWidth = \"\";\n @Input() dropdownListHeight = \"\";\n @Input() searchEnabled: boolean = true;\n @Input() inputType: string = \"number\";\n @Input() searchLabel: string = \"Search Keyword\"; \n @Input() phoneValidator? = false;\n \n countryCodes: DropdownItem[] = [{label:'',value:''}];\n countryCode: CountryCode | undefined;\n selectedCountryName: string = '';\n\n constructor() {}\n\n ngOnInit() {\n if (this.phoneValidator) {\n this.loadCountryCodes();\n this.dropdownData = this.countryCodes;\n this.selectedCountryName = this.dropdownSelectedItem.label;\n }\n\n if (this.defaultCountryCode) {\n const selectedCountry = this.dropdownData.find(\n country => country.value.toUpperCase() === this.defaultCountryCode.toUpperCase()\n );\n if (selectedCountry) {\n this.dropdownSelectedItem = selectedCountry;\n this.selectedCountryName = selectedCountry.label;\n }\n }\n }\n\n handleDropdownSelection(item: DropdownItem){\n this.dropdownSelectedItem = item;\n this.onDropdownSelection.emit(item);\n this.selectedCountryName = item.label;\n this.validatePhoneNumber(this.inputFormControl.value, this.dropdownSelectedItem.value);\n }\n\n loadCountryCodes() {\n const countries = getCountries();\n this.countryCodes = countries.map(countryCode => ({\n value: countryCode,\n label: `${countryCode} (+${getCountryCallingCode(countryCode)})`\n }));\n }\n\n validatePhoneNumber(phoneNumber: string, countryCode: string) {\n const parsedPhoneNumber = parsePhoneNumberFromString(phoneNumber, countryCode as CountryCode);\n\n if (!parsedPhoneNumber || !parsedPhoneNumber.isValid()) {\n this.onInvalidPhoneNumber.emit(`Phone number is invalid for ${this.selectedCountryName}`);\n }\n }\n\n}\n","import { CommonModule } from \"@angular/common\";\nimport { FormsModule } from \"@angular/forms\";\nimport { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { PhoneInputComponent } from \"./phone-input.component\";\nimport { OverlayModule } from \"@angular/cdk/overlay\";\nimport { ScrollingModule } from \"@angular/cdk-experimental/scrolling\";\nimport { DropdownModule } from \"mis-crystal-design-system/dropdown\";\nimport { ReactiveFormsModule } from \"@angular/forms\";\n\n\n@NgModule({\n declarations: [PhoneInputComponent],\n imports: [CommonModule,ReactiveFormsModule, FormsModule, OverlayModule, ScrollingModule, DropdownModule],\n exports: [PhoneInputComponent]\n})\nexport class PhoneInputModule {\n static forRoot(): ModuleWithProviders<PhoneInputModule> {\n return { ngModule: PhoneInputModule, providers: [] };\n }\n}\n"]}
|
|
@@ -6,6 +6,7 @@ export class MisInputComponent {
|
|
|
6
6
|
this.size = "sm";
|
|
7
7
|
this.noHints = false;
|
|
8
8
|
this.hasError = false; // show input in error state
|
|
9
|
+
this.isMandatory = false; // show input as mandatory
|
|
9
10
|
this.inputValidity = true;
|
|
10
11
|
}
|
|
11
12
|
set formInput(input) {
|
|
@@ -27,7 +28,7 @@ export class MisInputComponent {
|
|
|
27
28
|
MisInputComponent.decorators = [
|
|
28
29
|
{ type: Component, args: [{
|
|
29
30
|
selector: "mis-input",
|
|
30
|
-
template: "<div\n [class]=\"'input-container ' + size\"\n [ngClass]=\"{\n rounded: type === 'rounded',\n floating: type === 'floating',\n 'has-error': !inputValidity || hasError,\n 'no-hint': noHints,\n 'mis-disabled': inputCtrl?.disabled\n }\"\n>\n <div class=\"input-wrapper\">\n <ng-content select=\"[mis-input-icon]\"></ng-content>\n <div class=\"mis-input\">\n <ng-content select=\"input\"></ng-content>\n <span class=\"mis-placeholder\">{{ placeholder }}
|
|
31
|
+
template: "<div\n [class]=\"'input-container ' + size\"\n [ngClass]=\"{\n rounded: type === 'rounded',\n floating: type === 'floating',\n 'has-error': !inputValidity || hasError,\n 'no-hint': noHints,\n 'mis-disabled': inputCtrl?.disabled\n }\"\n>\n <div class=\"input-wrapper\">\n <ng-content select=\"[mis-input-icon]\"></ng-content>\n <div class=\"mis-input\">\n <ng-content select=\"input\"></ng-content>\n <span class=\"mis-placeholder\">{{ placeholder }}<span *ngIf=\"isMandatory\" style=\"color: red;\">*</span></span>\n </div>\n <ng-content select=\"[mis-input-act]\"></ng-content>\n </div>\n <ng-content select=\"[mis-input-hint]\"></ng-content>\n <ng-content select=\"[mis-input-error]\"></ng-content>\n</div>\n",
|
|
31
32
|
styles: [":root{--pmry-200:#99baf7;--pmry-100:#cbddfb;--pmry-500:#0937b2;--pmry-400:#3c68d0;--pmry-600:#062a99;--pmry-700:#041f80;--pmry-300:#638fe7;--pmry-800:#021567;--pmry-900:#010f55;--sec-d-purple:#40447f;--sec-maroon:#6b034e;--sec-mud-red:#b23600;--sec-orange:#ed711c;--sec-purple:#815fd5;--sec-teal:#10adae;--sec-yellow:#d4900c;--sec-green:#547f40;--sec-bright-green:#27d22e;--sec-dark-teal:#035f6b;--sec-chocolate:#7c2f33;--sec-rube-pink:#c13d6d;--sec-cerulean:#0087b2;--sem-error:#b00020;--sem-info:#0091ff;--sem-warning:#ff9d00;--sem-success:#38af49;--grey-bg-1:#fafafa;--grey-bg:#f5f5f5;--grey-seperators:#e0e0e0;--grey-disabled:#c8cdd3;--grey-hover:#f5f7fc;--grey-pressed:#e6ebf7;--grey-row:#f5f7fc;--dec-light-yellow:#f4e7c3;--dec-light-purple:#dacff9;--dec-light-green:#e4f5e9;--dec-light-green2:#f1fff3;--dec-light-pink:#fae1ea;--dec-:#f4cbc1;--dec-lt-orange:#faefed;--dec-light-blue:#cfecf9;--dec-row-selection:#f1fdf8;--dec-row-selection2:#f2fbff;--dec-row-lines:#d3e1e9;--text-white:#fff;--text-disabled:#929dab;--text-muted:#6a737d;--text-black:#181f33;--MR-solid-blue2:#c8d5f6;--MR-solid-purple:#c9c3fb;--MR-solid-orange:#eeac9f;--MR-solid-green:#acdada;--MR-solid-brown:#e8c8af;--MR-solid-yellow:#ffefc7;--MR-solid-blue:#bbe6ff;--MR-solid-pink:#ffc6f2;--tr-hover:#f0f3fa;--tr-pressed:#dae1f3}.input-container{position:relative;padding-bottom:24px}.input-container.mis-disabled .input-wrapper{pointer-events:none!important}.input-container .input-wrapper{box-sizing:border-box;display:flex;align-items:center;flex-direction:row;flex-wrap:nowrap;transition:all 60ms ease-in;background-color:#fff;padding:3px 16px;gap:16px}.input-container .input-wrapper .mis-input{flex:1 1 auto;z-index:0;position:relative;display:flex;align-items:center}.input-container .input-wrapper input{flex:1 1 auto;border:none;outline:none;height:100%;padding:0;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;height:24px;color:#181f33;background-color:transparent;width:100%;vertical-align:middle}.input-container .input-wrapper input::-moz-placeholder{-moz-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input:-ms-input-placeholder{-ms-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input::placeholder{transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper .mis-placeholder{position:absolute;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#6a737d;z-index:-1;transition:all .15s ease-in}.input-container .input-wrapper:focus-within{background-color:#f5f5f5}.input-container .input-wrapper:focus-within{border:1px solid #0937b2}.input-container .input-wrapper [mis-input-act],.input-container .input-wrapper [mis-input-icon]{width:18px;height:18px;color:#6a737d;font-size:24px;line-height:18px}.input-container .input-wrapper [mis-input-act]{cursor:pointer}.input-container.no-hint{padding-bottom:0}.input-container.rounded input{box-sizing:initial}.input-container.rounded.sm input{padding:3px 16px}.input-container.rounded.md input{padding:9px 16px}.input-container.rounded.lg input{padding:15px 16px}.input-container.rounded .input-wrapper{border-radius:4px;border:1px solid #e0e0e0;padding:0}.input-container.rounded .input-wrapper:hover{background-color:#f5f5f5}.input-container.rounded .input-wrapper:focus-within{border:1px solid #0937b2}.input-container.rounded .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper .mis-placeholder{margin-left:16px;transition-duration:50ms}.input-container.rounded.has-error .input-wrapper{border:1px solid #b00020!important}.input-container.floating .input-wrapper{padding-top:24px;padding-bottom:7px;border-bottom:1px solid #e0e0e0}.input-container.floating .input-wrapper input:focus+.mis-placeholder{color:#0937b2!important}.input-container.floating .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:focus+.mis-placeholder,.input-container.floating .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper:focus-within{border:none;border-bottom:1px solid #0937b2}.input-container.floating .input-wrapper:focus-within input::-moz-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input:-ms-input-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input::placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating.has-error .input-wrapper{border-bottom:1px solid #b00020!important}.input-container.floating.has-error .input-wrapper .mis-placeholder{color:#b00020!important}.input-container [mis-input-error],.input-container [mis-input-hint]{position:absolute;left:0;right:0;bottom:0;line-height:24px;height:24px;font-size:12px;color:#6a737d;letter-spacing:.2px}.input-container [mis-input-error]{color:#b00020}"]
|
|
32
33
|
},] }
|
|
33
34
|
];
|
|
@@ -38,6 +39,7 @@ MisInputComponent.propDecorators = {
|
|
|
38
39
|
placeholder: [{ type: Input }],
|
|
39
40
|
noHints: [{ type: Input }],
|
|
40
41
|
hasError: [{ type: Input }],
|
|
42
|
+
isMandatory: [{ type: Input }],
|
|
41
43
|
formInput: [{ type: ContentChild, args: [MisInputDirective,] }]
|
|
42
44
|
};
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlzLWlucHV0LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL21pcy1jb21wb25lbnRzL2lucHV0L21pcy1pbnB1dC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUF3QyxNQUFNLGVBQWUsQ0FBQztBQUdyRyxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQU92RSxNQUFNLE9BQU8saUJBQWlCO0lBbUI1QjtRQWxCUyxTQUFJLEdBQTJCLFVBQVUsQ0FBQztRQUMxQyxTQUFJLEdBQXVCLElBQUksQ0F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dyBpbnB1dCBpbiBlcnJvciBzdGF0ZVxuICBASW5wdXQoKSBpc01hbmRhdG9yeTpib29sZWFuID0gZmFsc2U7IC8vIHNob3cgaW5wdXQgYXMgbWFuZGF0b3J5XG4gIEBDb250ZW50Q2hpbGQoTWlzSW5wdXREaXJlY3RpdmUpIHNldCBmb3JtSW5wdXQoaW5wdXQ6IE1pc0lucHV0RGlyZWN0aXZlKSB7XG4gICAgaWYgKCF0aGlzLnBsYWNlaG9sZGVyKSB7XG4gICAgICB0aGlzLnBsYWNlaG9sZGVyID0gaW5wdXQ/LmVsLm5hdGl2ZUVsZW1lbnQucGxhY2Vob2xkZXIgfHwgXCJcIjtcbiAgICB9XG4gICAgdGhpcy5pbnB1dEN0cmwgPSBpbnB1dC5jb250cm9sPy5jb250cm9sO1xuICAgIHRoaXMuaW5wdXRTdWJzY3JpcHRpb24/LnVuc3Vic2NyaWJlKCk7XG4gICAgdGhpcy5pbnB1dFN1YnNjcmlwdGlvbiA9IGlucHV0Py52YWxpZGl0eS5zdWJzY3JpYmUocmVzID0+ICh0aGlzLmlucHV0VmFsaWRpdHkgPSByZXMpKTtcbiAgICB0aGlzLnBsYWNlaG9sZGVyICs9IFwiIFwiO1xuICB9XG4gIGlucHV0Q3RybDogQWJzdHJhY3RDb250cm9sO1xuICBpbnB1dFN1YnNjcmlwdGlvbjogU3Vic2NyaXB0aW9uIHwgdW5kZWZpbmVkO1xuICBpbnB1dFZhbGlkaXR5OiBib29sZWFuID0gdHJ1ZTtcbiAgY29uc3RydWN0b3IoKSB7fVxuXG4gIG5nT25Jbml0KCk6IHZvaWQge31cbiAgbmdPbkRlc3Ryb3koKTogdm9pZCB7XG4gICAgdGhpcy5pbnB1dFN1YnNjcmlwdGlvbj8udW5zdWJzY3JpYmUoKTtcbiAgfVxufVxuIl19
|
|
@@ -1,26 +1,64 @@
|
|
|
1
1
|
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
|
2
2
|
import { FormControl } from "@angular/forms";
|
|
3
|
+
import { parsePhoneNumberFromString, getCountryCallingCode, getCountries } from 'libphonenumber-js';
|
|
3
4
|
export class PhoneInputComponent {
|
|
4
5
|
constructor() {
|
|
6
|
+
this.dropdownHeight = "";
|
|
7
|
+
this.dropdownWidth = "";
|
|
5
8
|
this.dropdownData = [];
|
|
6
9
|
this.dropdownSelectedItem = { value: "", label: "" };
|
|
10
|
+
this.defaultCountryCode = 'IN';
|
|
7
11
|
this.inputPlaceholder = 'Enter';
|
|
8
12
|
this.inputFormControl = new FormControl();
|
|
9
13
|
this.onDropdownSelection = new EventEmitter();
|
|
10
|
-
this.
|
|
14
|
+
this.onInvalidPhoneNumber = new EventEmitter();
|
|
15
|
+
this.dropdownListWidth = "";
|
|
16
|
+
this.dropdownListHeight = "";
|
|
17
|
+
this.searchEnabled = true;
|
|
11
18
|
this.inputType = "number";
|
|
12
19
|
this.searchLabel = "Search Keyword";
|
|
20
|
+
this.phoneValidator = false;
|
|
21
|
+
this.countryCodes = [{ label: '', value: '' }];
|
|
22
|
+
this.selectedCountryName = '';
|
|
13
23
|
}
|
|
14
24
|
ngOnInit() {
|
|
25
|
+
if (this.phoneValidator) {
|
|
26
|
+
this.loadCountryCodes();
|
|
27
|
+
this.dropdownData = this.countryCodes;
|
|
28
|
+
this.selectedCountryName = this.dropdownSelectedItem.label;
|
|
29
|
+
}
|
|
30
|
+
if (this.defaultCountryCode) {
|
|
31
|
+
const selectedCountry = this.dropdownData.find(country => country.value.toUpperCase() === this.defaultCountryCode.toUpperCase());
|
|
32
|
+
if (selectedCountry) {
|
|
33
|
+
this.dropdownSelectedItem = selectedCountry;
|
|
34
|
+
this.selectedCountryName = selectedCountry.label;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
15
37
|
}
|
|
16
38
|
handleDropdownSelection(item) {
|
|
39
|
+
this.dropdownSelectedItem = item;
|
|
17
40
|
this.onDropdownSelection.emit(item);
|
|
41
|
+
this.selectedCountryName = item.label;
|
|
42
|
+
this.validatePhoneNumber(this.inputFormControl.value, this.dropdownSelectedItem.value);
|
|
43
|
+
}
|
|
44
|
+
loadCountryCodes() {
|
|
45
|
+
const countries = getCountries();
|
|
46
|
+
this.countryCodes = countries.map(countryCode => ({
|
|
47
|
+
value: countryCode,
|
|
48
|
+
label: `${countryCode} (+${getCountryCallingCode(countryCode)})`
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
validatePhoneNumber(phoneNumber, countryCode) {
|
|
52
|
+
const parsedPhoneNumber = parsePhoneNumberFromString(phoneNumber, countryCode);
|
|
53
|
+
if (!parsedPhoneNumber || !parsedPhoneNumber.isValid()) {
|
|
54
|
+
this.onInvalidPhoneNumber.emit(`Phone number is invalid for ${this.selectedCountryName}`);
|
|
55
|
+
}
|
|
18
56
|
}
|
|
19
57
|
}
|
|
20
58
|
PhoneInputComponent.decorators = [
|
|
21
59
|
{ type: Component, args: [{
|
|
22
60
|
selector: "mis-phone-input",
|
|
23
|
-
template: "<div class=\"main-container-phone\">\n <mis-dropdown [height]=\"dropdownHeight\" [dropdownListWidth]=\"dropdownListWidth\"[dropdownListHeight]=\"dropdownListHeight\" [width]=\"dropdownWidth\" [data]=\"dropdownData\" [selectedItem]=\"dropdownSelectedItem\" [label]=\"label\" [searchEnabled]=\"searchEnabled\" [multiLine]=\"false\" (onChange)=\"handleDropdownSelection($event)\" [searchLabel]=\"searchLabel\"></mis-dropdown>\n <div class=\"details-field\">\n <div class=\"input-box\">\n <input\n [ngStyle]=\"{'height': inputHeight }\"\n class=\"black-text\"\n [placeholder]=\"inputPlaceholder\"\n [formControl]=\"inputFormControl\" \n [type]=\"inputType\"\n />\n </div>\n </div>\n</div>\n",
|
|
61
|
+
template: "<div class=\"main-container-phone\">\n <mis-dropdown [height]=\"dropdownHeight\" [dropdownListWidth]=\"dropdownListWidth\"[dropdownListHeight]=\"dropdownListHeight\" [width]=\"dropdownWidth\" [data]=\"dropdownData\" [selectedItem]=\"dropdownSelectedItem\" [label]=\"label\" [searchEnabled]=\"searchEnabled\" [multiLine]=\"false\" (onChange)=\"handleDropdownSelection($event)\" [searchLabel]=\"searchLabel\"></mis-dropdown>\n <div class=\"details-field\">\n <div class=\"input-box\">\n <input\n [ngStyle]=\"{'height': inputHeight }\"\n class=\"black-text\" \n [placeholder]=\"inputPlaceholder\"\n [formControl]=\"inputFormControl\" \n [type]=\"inputType\"\n />\n </div>\n </div>\n</div>\n",
|
|
24
62
|
styles: [".main-container-phone{display:flex;border:1px solid #e0e0e0;border-radius:6px}.details-field label{display:inline-block;min-width:224px;margin-right:24px}.details-field .input-box{width:100%}.details-field .input-box input{width:100%;height:32px}input{padding:10px 16px;border:none;outline:none;width:100%;height:auto;border-radius:6px}.black-text,input{color:#181f33;line-height:24px;font-size:16px}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.main-container-phone ::ng-deep .item{padding:8px!important}.main-container-phone ::ng-deep .dropdown{border:unset!important}"]
|
|
25
63
|
},] }
|
|
26
64
|
];
|
|
@@ -31,14 +69,17 @@ PhoneInputComponent.propDecorators = {
|
|
|
31
69
|
inputHeight: [{ type: Input }],
|
|
32
70
|
dropdownData: [{ type: Input }],
|
|
33
71
|
dropdownSelectedItem: [{ type: Input }],
|
|
72
|
+
defaultCountryCode: [{ type: Input }],
|
|
34
73
|
label: [{ type: Input }],
|
|
35
74
|
inputPlaceholder: [{ type: Input }],
|
|
36
75
|
inputFormControl: [{ type: Input }],
|
|
37
76
|
onDropdownSelection: [{ type: Output }],
|
|
77
|
+
onInvalidPhoneNumber: [{ type: Output }],
|
|
38
78
|
dropdownListWidth: [{ type: Input }],
|
|
39
79
|
dropdownListHeight: [{ type: Input }],
|
|
40
80
|
searchEnabled: [{ type: Input }],
|
|
41
81
|
inputType: [{ type: Input }],
|
|
42
|
-
searchLabel: [{ type: Input }]
|
|
82
|
+
searchLabel: [{ type: Input }],
|
|
83
|
+
phoneValidator: [{ type: Input }]
|
|
43
84
|
};
|
|
44
|
-
//# sourceMappingURL=data:application/json;base64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lzLmlucHV0Rm9ybUNvbnRyb2wudmFsdWUsIHRoaXMuZHJvcGRvd25TZWxlY3RlZEl0ZW0udmFsdWUpO1xuICB9XG5cbiAgbG9hZENvdW50cnlDb2RlcygpIHtcbiAgICBjb25zdCBjb3VudHJpZXMgPSBnZXRDb3VudHJpZXMoKTtcbiAgICB0aGlzLmNvdW50cnlDb2RlcyA9IGNvdW50cmllcy5tYXAoY291bnRyeUNvZGUgPT4gKHtcbiAgICAgIHZhbHVlOiBjb3VudHJ5Q29kZSxcbiAgICAgIGxhYmVsOiBgJHtjb3VudHJ5Q29kZX0gKCske2dldENvdW50cnlDYWxsaW5nQ29kZShjb3VudHJ5Q29kZSl9KWBcbiAgICB9KSk7XG4gIH1cblxuICB2YWxpZGF0ZVBob25lTnVtYmVyKHBob25lTnVtYmVyOiBzdHJpbmcsIGNvdW50cnlDb2RlOiBzdHJpbmcpIHtcbiAgICBjb25zdCBwYXJzZWRQaG9uZU51bWJlciA9IHBhcnNlUGhvbmVOdW1iZXJGcm9tU3RyaW5nKHBob25lTnVtYmVyLCBjb3VudHJ5Q29kZSBhcyBDb3VudHJ5Q29kZSk7XG5cbiAgICBpZiAoIXBhcnNlZFBob25lTnVtYmVyIHx8ICFwYXJzZWRQaG9uZU51bWJlci5pc1ZhbGlkKCkpIHtcbiAgICAgIHRoaXMub25JbnZhbGlkUGhvbmVOdW1iZXIuZW1pdChgUGhvbmUgbnVtYmVyIGlzIGludmFsaWQgZm9yICR7dGhpcy5zZWxlY3RlZENvdW50cnlOYW1lfWApO1xuICAgIH1cbiAgfVxuXG59XG4iXX0=
|
|
@@ -44,6 +44,7 @@ class MisInputComponent {
|
|
|
44
44
|
this.size = "sm";
|
|
45
45
|
this.noHints = false;
|
|
46
46
|
this.hasError = false; // show input in error state
|
|
47
|
+
this.isMandatory = false; // show input as mandatory
|
|
47
48
|
this.inputValidity = true;
|
|
48
49
|
}
|
|
49
50
|
set formInput(input) {
|
|
@@ -65,7 +66,7 @@ class MisInputComponent {
|
|
|
65
66
|
MisInputComponent.decorators = [
|
|
66
67
|
{ type: Component, args: [{
|
|
67
68
|
selector: "mis-input",
|
|
68
|
-
template: "<div\n [class]=\"'input-container ' + size\"\n [ngClass]=\"{\n rounded: type === 'rounded',\n floating: type === 'floating',\n 'has-error': !inputValidity || hasError,\n 'no-hint': noHints,\n 'mis-disabled': inputCtrl?.disabled\n }\"\n>\n <div class=\"input-wrapper\">\n <ng-content select=\"[mis-input-icon]\"></ng-content>\n <div class=\"mis-input\">\n <ng-content select=\"input\"></ng-content>\n <span class=\"mis-placeholder\">{{ placeholder }}
|
|
69
|
+
template: "<div\n [class]=\"'input-container ' + size\"\n [ngClass]=\"{\n rounded: type === 'rounded',\n floating: type === 'floating',\n 'has-error': !inputValidity || hasError,\n 'no-hint': noHints,\n 'mis-disabled': inputCtrl?.disabled\n }\"\n>\n <div class=\"input-wrapper\">\n <ng-content select=\"[mis-input-icon]\"></ng-content>\n <div class=\"mis-input\">\n <ng-content select=\"input\"></ng-content>\n <span class=\"mis-placeholder\">{{ placeholder }}<span *ngIf=\"isMandatory\" style=\"color: red;\">*</span></span>\n </div>\n <ng-content select=\"[mis-input-act]\"></ng-content>\n </div>\n <ng-content select=\"[mis-input-hint]\"></ng-content>\n <ng-content select=\"[mis-input-error]\"></ng-content>\n</div>\n",
|
|
69
70
|
styles: [":root{--pmry-200:#99baf7;--pmry-100:#cbddfb;--pmry-500:#0937b2;--pmry-400:#3c68d0;--pmry-600:#062a99;--pmry-700:#041f80;--pmry-300:#638fe7;--pmry-800:#021567;--pmry-900:#010f55;--sec-d-purple:#40447f;--sec-maroon:#6b034e;--sec-mud-red:#b23600;--sec-orange:#ed711c;--sec-purple:#815fd5;--sec-teal:#10adae;--sec-yellow:#d4900c;--sec-green:#547f40;--sec-bright-green:#27d22e;--sec-dark-teal:#035f6b;--sec-chocolate:#7c2f33;--sec-rube-pink:#c13d6d;--sec-cerulean:#0087b2;--sem-error:#b00020;--sem-info:#0091ff;--sem-warning:#ff9d00;--sem-success:#38af49;--grey-bg-1:#fafafa;--grey-bg:#f5f5f5;--grey-seperators:#e0e0e0;--grey-disabled:#c8cdd3;--grey-hover:#f5f7fc;--grey-pressed:#e6ebf7;--grey-row:#f5f7fc;--dec-light-yellow:#f4e7c3;--dec-light-purple:#dacff9;--dec-light-green:#e4f5e9;--dec-light-green2:#f1fff3;--dec-light-pink:#fae1ea;--dec-:#f4cbc1;--dec-lt-orange:#faefed;--dec-light-blue:#cfecf9;--dec-row-selection:#f1fdf8;--dec-row-selection2:#f2fbff;--dec-row-lines:#d3e1e9;--text-white:#fff;--text-disabled:#929dab;--text-muted:#6a737d;--text-black:#181f33;--MR-solid-blue2:#c8d5f6;--MR-solid-purple:#c9c3fb;--MR-solid-orange:#eeac9f;--MR-solid-green:#acdada;--MR-solid-brown:#e8c8af;--MR-solid-yellow:#ffefc7;--MR-solid-blue:#bbe6ff;--MR-solid-pink:#ffc6f2;--tr-hover:#f0f3fa;--tr-pressed:#dae1f3}.input-container{position:relative;padding-bottom:24px}.input-container.mis-disabled .input-wrapper{pointer-events:none!important}.input-container .input-wrapper{box-sizing:border-box;display:flex;align-items:center;flex-direction:row;flex-wrap:nowrap;transition:all 60ms ease-in;background-color:#fff;padding:3px 16px;gap:16px}.input-container .input-wrapper .mis-input{flex:1 1 auto;z-index:0;position:relative;display:flex;align-items:center}.input-container .input-wrapper input{flex:1 1 auto;border:none;outline:none;height:100%;padding:0;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;height:24px;color:#181f33;background-color:transparent;width:100%;vertical-align:middle}.input-container .input-wrapper input::-moz-placeholder{-moz-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input:-ms-input-placeholder{-ms-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input::placeholder{transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper .mis-placeholder{position:absolute;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#6a737d;z-index:-1;transition:all .15s ease-in}.input-container .input-wrapper:focus-within{background-color:#f5f5f5}.input-container .input-wrapper:focus-within{border:1px solid #0937b2}.input-container .input-wrapper [mis-input-act],.input-container .input-wrapper [mis-input-icon]{width:18px;height:18px;color:#6a737d;font-size:24px;line-height:18px}.input-container .input-wrapper [mis-input-act]{cursor:pointer}.input-container.no-hint{padding-bottom:0}.input-container.rounded input{box-sizing:initial}.input-container.rounded.sm input{padding:3px 16px}.input-container.rounded.md input{padding:9px 16px}.input-container.rounded.lg input{padding:15px 16px}.input-container.rounded .input-wrapper{border-radius:4px;border:1px solid #e0e0e0;padding:0}.input-container.rounded .input-wrapper:hover{background-color:#f5f5f5}.input-container.rounded .input-wrapper:focus-within{border:1px solid #0937b2}.input-container.rounded .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper .mis-placeholder{margin-left:16px;transition-duration:50ms}.input-container.rounded.has-error .input-wrapper{border:1px solid #b00020!important}.input-container.floating .input-wrapper{padding-top:24px;padding-bottom:7px;border-bottom:1px solid #e0e0e0}.input-container.floating .input-wrapper input:focus+.mis-placeholder{color:#0937b2!important}.input-container.floating .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:focus+.mis-placeholder,.input-container.floating .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper:focus-within{border:none;border-bottom:1px solid #0937b2}.input-container.floating .input-wrapper:focus-within input::-moz-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input:-ms-input-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input::placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating.has-error .input-wrapper{border-bottom:1px solid #b00020!important}.input-container.floating.has-error .input-wrapper .mis-placeholder{color:#b00020!important}.input-container [mis-input-error],.input-container [mis-input-hint]{position:absolute;left:0;right:0;bottom:0;line-height:24px;height:24px;font-size:12px;color:#6a737d;letter-spacing:.2px}.input-container [mis-input-error]{color:#b00020}"]
|
|
70
71
|
},] }
|
|
71
72
|
];
|
|
@@ -76,6 +77,7 @@ MisInputComponent.propDecorators = {
|
|
|
76
77
|
placeholder: [{ type: Input }],
|
|
77
78
|
noHints: [{ type: Input }],
|
|
78
79
|
hasError: [{ type: Input }],
|
|
80
|
+
isMandatory: [{ type: Input }],
|
|
79
81
|
formInput: [{ type: ContentChild, args: [MisInputDirective,] }]
|
|
80
82
|
};
|
|
81
83
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-input.js","sources":["../../../projects/mis-components/input/directives/input/input.directive.ts","../../../projects/mis-components/input/mis-input.component.ts","../../../projects/mis-components/input/mis-input.module.ts","../../../projects/mis-components/input/mis-crystal-design-system-input.ts"],"sourcesContent":["import { Directive, ElementRef, OnDestroy, OnInit, Optional, Self } from \"@angular/core\";\nimport { NgControl } from \"@angular/forms\";\nimport { ReplaySubject, Subject, Subscription } from \"rxjs\";\nimport { takeUntil } from \"rxjs/operators\";\n\n@Directive({\n // tslint:disable-next-line\n selector: \"input[misInput]\"\n})\nexport class MisInputDirective implements OnInit, OnDestroy {\n constructor(public el: ElementRef, @Self() @Optional() public control: NgControl) {}\n private validityChange: ReplaySubject<boolean> = new ReplaySubject(1);\n validity = this.validityChange.asObservable();\n endObs: Subject<void> = new Subject();\n focus = false;\n hasValue = false;\n\n ngOnInit(): void {\n this.control?.control?.valueChanges.pipe(takeUntil(this.endObs)).subscribe(() => {\n this.validityChange.next(!this.control.control?.invalid);\n });\n this.el.nativeElement.placeholder += \" \";\n }\n ngOnDestroy(): void {\n this.endObs.next();\n this.endObs.complete();\n }\n}\n","import { Component, ContentChild, Input, OnDestroy, OnInit, ViewEncapsulation } from \"@angular/core\";\nimport { AbstractControl } from \"@angular/forms\";\nimport { Subscription } from \"rxjs\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\n\n@Component({\n selector: \"mis-input\",\n templateUrl: \"./mis-input.component.html\",\n styleUrls: [\"./mis-input.component.scss\"]\n})\nexport class MisInputComponent implements OnInit, OnDestroy {\n @Input() type: \"rounded\" | \"floating\" = \"floating\";\n @Input() size: \"sm\" | \"md\" | \"lg\" = \"sm\";\n @Input() placeholder: string; // floating placeholder text\n @Input() noHints = false;\n @Input() hasError = false; // show input in error state\n @ContentChild(MisInputDirective) set formInput(input: MisInputDirective) {\n if (!this.placeholder) {\n this.placeholder = input?.el.nativeElement.placeholder || \"\";\n }\n this.inputCtrl = input.control?.control;\n this.inputSubscription?.unsubscribe();\n this.inputSubscription = input?.validity.subscribe(res => (this.inputValidity = res));\n this.placeholder += \" \";\n }\n inputCtrl: AbstractControl;\n inputSubscription: Subscription | undefined;\n inputValidity: boolean = true;\n constructor() {}\n\n ngOnInit(): void {}\n ngOnDestroy(): void {\n this.inputSubscription?.unsubscribe();\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\nimport { MisInputComponent } from \"./mis-input.component\";\n\n@NgModule({\n declarations: [MisInputComponent, MisInputDirective],\n imports: [CommonModule, FormsModule],\n exports: [MisInputComponent, MisInputDirective]\n})\nexport class MisInputModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MASa,iBAAiB;IAC5B,YAAmB,EAAc,EAA6B,OAAkB;QAA7D,OAAE,GAAF,EAAE,CAAY;QAA6B,YAAO,GAAP,OAAO,CAAW;QACxE,mBAAc,GAA2B,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;QACtE,aAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;QAC9C,WAAM,GAAkB,IAAI,OAAO,EAAE,CAAC;QACtC,UAAK,GAAG,KAAK,CAAC;QACd,aAAQ,GAAG,KAAK,CAAC;KALmE;IAOpF,QAAQ;;QACN,YAAA,IAAI,CAAC,OAAO,0CAAE,OAAO,0CAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;;YACzE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAC,IAAI,CAAC,OAAO,CAAC,OAAO,0CAAE,OAAO,CAAA,CAAC,CAAC;SAC1D,EAAE;QACH,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,WAAW,IAAI,GAAG,CAAC;KAC1C;IACD,WAAW;QACT,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;KACxB;;;YArBF,SAAS,SAAC;;gBAET,QAAQ,EAAE,iBAAiB;aAC5B;;;YARmB,UAAU;YACrB,SAAS,uBASoB,IAAI,YAAI,QAAQ;;;MCAzC,iBAAiB;
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-input.js","sources":["../../../projects/mis-components/input/directives/input/input.directive.ts","../../../projects/mis-components/input/mis-input.component.ts","../../../projects/mis-components/input/mis-input.module.ts","../../../projects/mis-components/input/mis-crystal-design-system-input.ts"],"sourcesContent":["import { Directive, ElementRef, OnDestroy, OnInit, Optional, Self } from \"@angular/core\";\nimport { NgControl } from \"@angular/forms\";\nimport { ReplaySubject, Subject, Subscription } from \"rxjs\";\nimport { takeUntil } from \"rxjs/operators\";\n\n@Directive({\n // tslint:disable-next-line\n selector: \"input[misInput]\"\n})\nexport class MisInputDirective implements OnInit, OnDestroy {\n constructor(public el: ElementRef, @Self() @Optional() public control: NgControl) {}\n private validityChange: ReplaySubject<boolean> = new ReplaySubject(1);\n validity = this.validityChange.asObservable();\n endObs: Subject<void> = new Subject();\n focus = false;\n hasValue = false;\n\n ngOnInit(): void {\n this.control?.control?.valueChanges.pipe(takeUntil(this.endObs)).subscribe(() => {\n this.validityChange.next(!this.control.control?.invalid);\n });\n this.el.nativeElement.placeholder += \" \";\n }\n ngOnDestroy(): void {\n this.endObs.next();\n this.endObs.complete();\n }\n}\n","import { Component, ContentChild, Input, OnDestroy, OnInit, ViewEncapsulation } from \"@angular/core\";\nimport { AbstractControl } from \"@angular/forms\";\nimport { Subscription } from \"rxjs\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\n\n@Component({\n selector: \"mis-input\",\n templateUrl: \"./mis-input.component.html\",\n styleUrls: [\"./mis-input.component.scss\"]\n})\nexport class MisInputComponent implements OnInit, OnDestroy {\n @Input() type: \"rounded\" | \"floating\" = \"floating\";\n @Input() size: \"sm\" | \"md\" | \"lg\" = \"sm\";\n @Input() placeholder: string; // floating placeholder text\n @Input() noHints = false;\n @Input() hasError = false; // show input in error state\n @Input() isMandatory:boolean = false; // show input as mandatory\n @ContentChild(MisInputDirective) set formInput(input: MisInputDirective) {\n if (!this.placeholder) {\n this.placeholder = input?.el.nativeElement.placeholder || \"\";\n }\n this.inputCtrl = input.control?.control;\n this.inputSubscription?.unsubscribe();\n this.inputSubscription = input?.validity.subscribe(res => (this.inputValidity = res));\n this.placeholder += \" \";\n }\n inputCtrl: AbstractControl;\n inputSubscription: Subscription | undefined;\n inputValidity: boolean = true;\n constructor() {}\n\n ngOnInit(): void {}\n ngOnDestroy(): void {\n this.inputSubscription?.unsubscribe();\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\nimport { MisInputComponent } from \"./mis-input.component\";\n\n@NgModule({\n declarations: [MisInputComponent, MisInputDirective],\n imports: [CommonModule, FormsModule],\n exports: [MisInputComponent, MisInputDirective]\n})\nexport class MisInputModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MASa,iBAAiB;IAC5B,YAAmB,EAAc,EAA6B,OAAkB;QAA7D,OAAE,GAAF,EAAE,CAAY;QAA6B,YAAO,GAAP,OAAO,CAAW;QACxE,mBAAc,GAA2B,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;QACtE,aAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;QAC9C,WAAM,GAAkB,IAAI,OAAO,EAAE,CAAC;QACtC,UAAK,GAAG,KAAK,CAAC;QACd,aAAQ,GAAG,KAAK,CAAC;KALmE;IAOpF,QAAQ;;QACN,YAAA,IAAI,CAAC,OAAO,0CAAE,OAAO,0CAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;;YACzE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAC,IAAI,CAAC,OAAO,CAAC,OAAO,0CAAE,OAAO,CAAA,CAAC,CAAC;SAC1D,EAAE;QACH,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,WAAW,IAAI,GAAG,CAAC;KAC1C;IACD,WAAW;QACT,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;KACxB;;;YArBF,SAAS,SAAC;;gBAET,QAAQ,EAAE,iBAAiB;aAC5B;;;YARmB,UAAU;YACrB,SAAS,uBASoB,IAAI,YAAI,QAAQ;;;MCAzC,iBAAiB;IAmB5B;QAlBS,SAAI,GAA2B,UAAU,CAAC;QAC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gModule } from '@angular/core';
|
|
2
2
|
import { FormControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
3
|
+
import { getCountries, getCountryCallingCode, parsePhoneNumberFromString } from 'libphonenumber-js';
|
|
3
4
|
import { CommonModule } from '@angular/common';
|
|
4
5
|
import { OverlayModule } from '@angular/cdk/overlay';
|
|
5
6
|
import { ScrollingModule } from '@angular/cdk-experimental/scrolling';
|
|
@@ -7,25 +8,62 @@ import { DropdownModule } from 'mis-crystal-design-system/dropdown';
|
|
|
7
8
|
|
|
8
9
|
class PhoneInputComponent {
|
|
9
10
|
constructor() {
|
|
11
|
+
this.dropdownHeight = "";
|
|
12
|
+
this.dropdownWidth = "";
|
|
10
13
|
this.dropdownData = [];
|
|
11
14
|
this.dropdownSelectedItem = { value: "", label: "" };
|
|
15
|
+
this.defaultCountryCode = 'IN';
|
|
12
16
|
this.inputPlaceholder = 'Enter';
|
|
13
17
|
this.inputFormControl = new FormControl();
|
|
14
18
|
this.onDropdownSelection = new EventEmitter();
|
|
15
|
-
this.
|
|
19
|
+
this.onInvalidPhoneNumber = new EventEmitter();
|
|
20
|
+
this.dropdownListWidth = "";
|
|
21
|
+
this.dropdownListHeight = "";
|
|
22
|
+
this.searchEnabled = true;
|
|
16
23
|
this.inputType = "number";
|
|
17
24
|
this.searchLabel = "Search Keyword";
|
|
25
|
+
this.phoneValidator = false;
|
|
26
|
+
this.countryCodes = [{ label: '', value: '' }];
|
|
27
|
+
this.selectedCountryName = '';
|
|
18
28
|
}
|
|
19
29
|
ngOnInit() {
|
|
30
|
+
if (this.phoneValidator) {
|
|
31
|
+
this.loadCountryCodes();
|
|
32
|
+
this.dropdownData = this.countryCodes;
|
|
33
|
+
this.selectedCountryName = this.dropdownSelectedItem.label;
|
|
34
|
+
}
|
|
35
|
+
if (this.defaultCountryCode) {
|
|
36
|
+
const selectedCountry = this.dropdownData.find(country => country.value.toUpperCase() === this.defaultCountryCode.toUpperCase());
|
|
37
|
+
if (selectedCountry) {
|
|
38
|
+
this.dropdownSelectedItem = selectedCountry;
|
|
39
|
+
this.selectedCountryName = selectedCountry.label;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
20
42
|
}
|
|
21
43
|
handleDropdownSelection(item) {
|
|
44
|
+
this.dropdownSelectedItem = item;
|
|
22
45
|
this.onDropdownSelection.emit(item);
|
|
46
|
+
this.selectedCountryName = item.label;
|
|
47
|
+
this.validatePhoneNumber(this.inputFormControl.value, this.dropdownSelectedItem.value);
|
|
48
|
+
}
|
|
49
|
+
loadCountryCodes() {
|
|
50
|
+
const countries = getCountries();
|
|
51
|
+
this.countryCodes = countries.map(countryCode => ({
|
|
52
|
+
value: countryCode,
|
|
53
|
+
label: `${countryCode} (+${getCountryCallingCode(countryCode)})`
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
validatePhoneNumber(phoneNumber, countryCode) {
|
|
57
|
+
const parsedPhoneNumber = parsePhoneNumberFromString(phoneNumber, countryCode);
|
|
58
|
+
if (!parsedPhoneNumber || !parsedPhoneNumber.isValid()) {
|
|
59
|
+
this.onInvalidPhoneNumber.emit(`Phone number is invalid for ${this.selectedCountryName}`);
|
|
60
|
+
}
|
|
23
61
|
}
|
|
24
62
|
}
|
|
25
63
|
PhoneInputComponent.decorators = [
|
|
26
64
|
{ type: Component, args: [{
|
|
27
65
|
selector: "mis-phone-input",
|
|
28
|
-
template: "<div class=\"main-container-phone\">\n <mis-dropdown [height]=\"dropdownHeight\" [dropdownListWidth]=\"dropdownListWidth\"[dropdownListHeight]=\"dropdownListHeight\" [width]=\"dropdownWidth\" [data]=\"dropdownData\" [selectedItem]=\"dropdownSelectedItem\" [label]=\"label\" [searchEnabled]=\"searchEnabled\" [multiLine]=\"false\" (onChange)=\"handleDropdownSelection($event)\" [searchLabel]=\"searchLabel\"></mis-dropdown>\n <div class=\"details-field\">\n <div class=\"input-box\">\n <input\n [ngStyle]=\"{'height': inputHeight }\"\n class=\"black-text\"\n [placeholder]=\"inputPlaceholder\"\n [formControl]=\"inputFormControl\" \n [type]=\"inputType\"\n />\n </div>\n </div>\n</div>\n",
|
|
66
|
+
template: "<div class=\"main-container-phone\">\n <mis-dropdown [height]=\"dropdownHeight\" [dropdownListWidth]=\"dropdownListWidth\"[dropdownListHeight]=\"dropdownListHeight\" [width]=\"dropdownWidth\" [data]=\"dropdownData\" [selectedItem]=\"dropdownSelectedItem\" [label]=\"label\" [searchEnabled]=\"searchEnabled\" [multiLine]=\"false\" (onChange)=\"handleDropdownSelection($event)\" [searchLabel]=\"searchLabel\"></mis-dropdown>\n <div class=\"details-field\">\n <div class=\"input-box\">\n <input\n [ngStyle]=\"{'height': inputHeight }\"\n class=\"black-text\" \n [placeholder]=\"inputPlaceholder\"\n [formControl]=\"inputFormControl\" \n [type]=\"inputType\"\n />\n </div>\n </div>\n</div>\n",
|
|
29
67
|
styles: [".main-container-phone{display:flex;border:1px solid #e0e0e0;border-radius:6px}.details-field label{display:inline-block;min-width:224px;margin-right:24px}.details-field .input-box{width:100%}.details-field .input-box input{width:100%;height:32px}input{padding:10px 16px;border:none;outline:none;width:100%;height:auto;border-radius:6px}.black-text,input{color:#181f33;line-height:24px;font-size:16px}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.main-container-phone ::ng-deep .item{padding:8px!important}.main-container-phone ::ng-deep .dropdown{border:unset!important}"]
|
|
30
68
|
},] }
|
|
31
69
|
];
|
|
@@ -36,15 +74,18 @@ PhoneInputComponent.propDecorators = {
|
|
|
36
74
|
inputHeight: [{ type: Input }],
|
|
37
75
|
dropdownData: [{ type: Input }],
|
|
38
76
|
dropdownSelectedItem: [{ type: Input }],
|
|
77
|
+
defaultCountryCode: [{ type: Input }],
|
|
39
78
|
label: [{ type: Input }],
|
|
40
79
|
inputPlaceholder: [{ type: Input }],
|
|
41
80
|
inputFormControl: [{ type: Input }],
|
|
42
81
|
onDropdownSelection: [{ type: Output }],
|
|
82
|
+
onInvalidPhoneNumber: [{ type: Output }],
|
|
43
83
|
dropdownListWidth: [{ type: Input }],
|
|
44
84
|
dropdownListHeight: [{ type: Input }],
|
|
45
85
|
searchEnabled: [{ type: Input }],
|
|
46
86
|
inputType: [{ type: Input }],
|
|
47
|
-
searchLabel: [{ type: Input }]
|
|
87
|
+
searchLabel: [{ type: Input }],
|
|
88
|
+
phoneValidator: [{ type: Input }]
|
|
48
89
|
};
|
|
49
90
|
|
|
50
91
|
class PhoneInputModule {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-phone-input.js","sources":["../../../projects/mis-components/phone-input/phone-input.component.ts","../../../projects/mis-components/phone-input/phone-input.module.ts","../../../projects/mis-components/phone-input/mis-crystal-design-system-phone-input.ts"],"sourcesContent":["import { Component,
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-phone-input.js","sources":["../../../projects/mis-components/phone-input/phone-input.component.ts","../../../projects/mis-components/phone-input/phone-input.module.ts","../../../projects/mis-components/phone-input/mis-crystal-design-system-phone-input.ts"],"sourcesContent":["import { Component, EventEmitter, Input, OnInit, Output } from \"@angular/core\";\nimport { FormControl } from \"@angular/forms\";\nimport { parsePhoneNumberFromString, getCountryCallingCode, CountryCode, getCountries } from 'libphonenumber-js';\nimport { DropdownItem } from \"mis-crystal-design-system/dropdown\";\n\n@Component({\n selector: \"mis-phone-input\",\n templateUrl: \"./phone-input.component.html\",\n styleUrls: [\"./phone-input.component.scss\"]\n})\nexport class PhoneInputComponent implements OnInit {\n @Input() dropdownHeight?: string = \"\";\n @Input() dropdownWidth?: string = \"\";\n @Input() inputHeight?;\n @Input() dropdownData: DropdownItem[] = [];\n @Input() dropdownSelectedItem: DropdownItem = { value: \"\", label: \"\" };\n @Input() defaultCountryCode?: string = 'IN';\n @Input() label: string;\n @Input() inputPlaceholder: string = 'Enter';\n @Input() inputFormControl: FormControl = new FormControl();\n @Output() onDropdownSelection = new EventEmitter<any>();\n @Output() onInvalidPhoneNumber = new EventEmitter<string>();\n @Input() dropdownListWidth = \"\";\n @Input() dropdownListHeight = \"\";\n @Input() searchEnabled: boolean = true;\n @Input() inputType: string = \"number\";\n @Input() searchLabel: string = \"Search Keyword\"; \n @Input() phoneValidator? = false;\n \n countryCodes: DropdownItem[] = [{label:'',value:''}];\n countryCode: CountryCode | undefined;\n selectedCountryName: string = '';\n\n constructor() {}\n\n ngOnInit() {\n if (this.phoneValidator) {\n this.loadCountryCodes();\n this.dropdownData = this.countryCodes;\n this.selectedCountryName = this.dropdownSelectedItem.label;\n }\n\n if (this.defaultCountryCode) {\n const selectedCountry = this.dropdownData.find(\n country => country.value.toUpperCase() === this.defaultCountryCode.toUpperCase()\n );\n if (selectedCountry) {\n this.dropdownSelectedItem = selectedCountry;\n this.selectedCountryName = selectedCountry.label;\n }\n }\n }\n\n handleDropdownSelection(item: DropdownItem){\n this.dropdownSelectedItem = item;\n this.onDropdownSelection.emit(item);\n this.selectedCountryName = item.label;\n this.validatePhoneNumber(this.inputFormControl.value, this.dropdownSelectedItem.value);\n }\n\n loadCountryCodes() {\n const countries = getCountries();\n this.countryCodes = countries.map(countryCode => ({\n value: countryCode,\n label: `${countryCode} (+${getCountryCallingCode(countryCode)})`\n }));\n }\n\n validatePhoneNumber(phoneNumber: string, countryCode: string) {\n const parsedPhoneNumber = parsePhoneNumberFromString(phoneNumber, countryCode as CountryCode);\n\n if (!parsedPhoneNumber || !parsedPhoneNumber.isValid()) {\n this.onInvalidPhoneNumber.emit(`Phone number is invalid for ${this.selectedCountryName}`);\n }\n }\n\n}\n","import { CommonModule } from \"@angular/common\";\nimport { FormsModule } from \"@angular/forms\";\nimport { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { PhoneInputComponent } from \"./phone-input.component\";\nimport { OverlayModule } from \"@angular/cdk/overlay\";\nimport { ScrollingModule } from \"@angular/cdk-experimental/scrolling\";\nimport { DropdownModule } from \"mis-crystal-design-system/dropdown\";\nimport { ReactiveFormsModule } from \"@angular/forms\";\n\n\n@NgModule({\n declarations: [PhoneInputComponent],\n imports: [CommonModule,ReactiveFormsModule, FormsModule, OverlayModule, ScrollingModule, DropdownModule],\n exports: [PhoneInputComponent]\n})\nexport class PhoneInputModule {\n static forRoot(): ModuleWithProviders<PhoneInputModule> {\n return { ngModule: PhoneInputModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAUa,mBAAmB;IAuB9B;QAtBS,mBAAc,GAAY,EAAE,CAAC;QAC7B,kBAAa,GAAY,EAAE,CAAC;QAE5B,iBAAY,GAAmB,EAAE,CAAC;QAClC,yBAAoB,GAAiB,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QAC9D,uBAAkB,GAAY,IAAI,CAAC;QAEnC,qBAAgB,GAAW,OAAO,CAAC;QACnC,qBAAgB,GAAgB,IAAI,WAAW,EAAE,CAAC;QACjD,wBAAmB,GAAG,IAAI,YAAY,EAAO,CAAC;QAC9C,yBAAoB,GAAG,IAAI,YAAY,EAAU,CAAC;QACnD,sBAAiB,GAAG,EAAE,CAAC;QACvB,uBAAkB,GAAG,EAAE,CAAC;QACxB,kBAAa,GAAY,IAAI,CAAC;QAC9B,cAAS,GAAW,QAAQ,CAAC;QAC7B,gBAAW,GAAW,gBAAgB,CAAC;QACvC,mBAAc,GAAI,KAAK,CAAC;QAEjC,iBAAY,GAAmB,CAAC,EAAC,KAAK,EAAC,EAAE,EAAC,KAAK,EAAC,EAAE,EAAC,CAAC,CAAC;QAErD,wBAAmB,GAAW,EAAE,CAAC;KAEjB;IAEhB,QAAQ;QACN,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;YACtC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC;SAC5D;QAED,IAAI,IAAI,CAAC,kBAAkB,E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;;;6BAEE,KAAK;4BACL,KAAK;0BACL,KAAK;2BACL,KAAK;mCACL,KAAK;iCACL,KAAK;oBACL,KAAK;+BACL,KAAK;+BACL,KAAK;kCACL,MAAM;mCACN,MAAM;gCACN,KAAK;iCACL,KAAK;4BACL,KAAK;wBACL,KAAK;0BACL,KAAK;6BACL,KAAK;;;MCZK,gBAAgB;IAC3B,OAAO,OAAO;QACZ,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;KACtD;;;YARF,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,mBAAmB,CAAC;gBACnC,OAAO,EAAE,CAAC,YAAY,EAAC,mBAAmB,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,CAAC;gBACxG,OAAO,EAAE,CAAC,mBAAmB,CAAC;aAC/B;;;ACdD;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"MisInputDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":5,"character":1},"arguments":[{"selector":"input[misInput]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self","line":10,"character":38}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":10,"character":46}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":10,"character":25},{"__symbolic":"reference","module":"@angular/forms","name":"NgControl","line":10,"character":73}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"MisInputComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"mis-input","template":"<div\n [class]=\"'input-container ' + size\"\n [ngClass]=\"{\n rounded: type === 'rounded',\n floating: type === 'floating',\n 'has-error': !inputValidity || hasError,\n 'no-hint': noHints,\n 'mis-disabled': inputCtrl?.disabled\n }\"\n>\n <div class=\"input-wrapper\">\n <ng-content select=\"[mis-input-icon]\"></ng-content>\n <div class=\"mis-input\">\n <ng-content select=\"input\"></ng-content>\n <span class=\"mis-placeholder\">{{ placeholder }}</span>\n </div>\n <ng-content select=\"[mis-input-act]\"></ng-content>\n </div>\n <ng-content select=\"[mis-input-hint]\"></ng-content>\n <ng-content select=\"[mis-input-error]\"></ng-content>\n</div>\n","styles":[":root{--pmry-200:#99baf7;--pmry-100:#cbddfb;--pmry-500:#0937b2;--pmry-400:#3c68d0;--pmry-600:#062a99;--pmry-700:#041f80;--pmry-300:#638fe7;--pmry-800:#021567;--pmry-900:#010f55;--sec-d-purple:#40447f;--sec-maroon:#6b034e;--sec-mud-red:#b23600;--sec-orange:#ed711c;--sec-purple:#815fd5;--sec-teal:#10adae;--sec-yellow:#d4900c;--sec-green:#547f40;--sec-bright-green:#27d22e;--sec-dark-teal:#035f6b;--sec-chocolate:#7c2f33;--sec-rube-pink:#c13d6d;--sec-cerulean:#0087b2;--sem-error:#b00020;--sem-info:#0091ff;--sem-warning:#ff9d00;--sem-success:#38af49;--grey-bg-1:#fafafa;--grey-bg:#f5f5f5;--grey-seperators:#e0e0e0;--grey-disabled:#c8cdd3;--grey-hover:#f5f7fc;--grey-pressed:#e6ebf7;--grey-row:#f5f7fc;--dec-light-yellow:#f4e7c3;--dec-light-purple:#dacff9;--dec-light-green:#e4f5e9;--dec-light-green2:#f1fff3;--dec-light-pink:#fae1ea;--dec-:#f4cbc1;--dec-lt-orange:#faefed;--dec-light-blue:#cfecf9;--dec-row-selection:#f1fdf8;--dec-row-selection2:#f2fbff;--dec-row-lines:#d3e1e9;--text-white:#fff;--text-disabled:#929dab;--text-muted:#6a737d;--text-black:#181f33;--MR-solid-blue2:#c8d5f6;--MR-solid-purple:#c9c3fb;--MR-solid-orange:#eeac9f;--MR-solid-green:#acdada;--MR-solid-brown:#e8c8af;--MR-solid-yellow:#ffefc7;--MR-solid-blue:#bbe6ff;--MR-solid-pink:#ffc6f2;--tr-hover:#f0f3fa;--tr-pressed:#dae1f3}.input-container{position:relative;padding-bottom:24px}.input-container.mis-disabled .input-wrapper{pointer-events:none!important}.input-container .input-wrapper{box-sizing:border-box;display:flex;align-items:center;flex-direction:row;flex-wrap:nowrap;transition:all 60ms ease-in;background-color:#fff;padding:3px 16px;gap:16px}.input-container .input-wrapper .mis-input{flex:1 1 auto;z-index:0;position:relative;display:flex;align-items:center}.input-container .input-wrapper input{flex:1 1 auto;border:none;outline:none;height:100%;padding:0;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;height:24px;color:#181f33;background-color:transparent;width:100%;vertical-align:middle}.input-container .input-wrapper input::-moz-placeholder{-moz-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input:-ms-input-placeholder{-ms-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input::placeholder{transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper .mis-placeholder{position:absolute;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#6a737d;z-index:-1;transition:all .15s ease-in}.input-container .input-wrapper:focus-within{background-color:#f5f5f5}.input-container .input-wrapper:focus-within{border:1px solid #0937b2}.input-container .input-wrapper [mis-input-act],.input-container .input-wrapper [mis-input-icon]{width:18px;height:18px;color:#6a737d;font-size:24px;line-height:18px}.input-container .input-wrapper [mis-input-act]{cursor:pointer}.input-container.no-hint{padding-bottom:0}.input-container.rounded input{box-sizing:initial}.input-container.rounded.sm input{padding:3px 16px}.input-container.rounded.md input{padding:9px 16px}.input-container.rounded.lg input{padding:15px 16px}.input-container.rounded .input-wrapper{border-radius:4px;border:1px solid #e0e0e0;padding:0}.input-container.rounded .input-wrapper:hover{background-color:#f5f5f5}.input-container.rounded .input-wrapper:focus-within{border:1px solid #0937b2}.input-container.rounded .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper .mis-placeholder{margin-left:16px;transition-duration:50ms}.input-container.rounded.has-error .input-wrapper{border:1px solid #b00020!important}.input-container.floating .input-wrapper{padding-top:24px;padding-bottom:7px;border-bottom:1px solid #e0e0e0}.input-container.floating .input-wrapper input:focus+.mis-placeholder{color:#0937b2!important}.input-container.floating .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:focus+.mis-placeholder,.input-container.floating .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper:focus-within{border:none;border-bottom:1px solid #0937b2}.input-container.floating .input-wrapper:focus-within input::-moz-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input:-ms-input-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input::placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating.has-error .input-wrapper{border-bottom:1px solid #b00020!important}.input-container.floating.has-error .input-wrapper .mis-placeholder{color:#b00020!important}.input-container [mis-input-error],.input-container [mis-input-hint]{position:absolute;left:0;right:0;bottom:0;line-height:24px;height:24px;font-size:12px;color:#6a737d;letter-spacing:.2px}.input-container [mis-input-error]{color:#b00020}"]}]}],"members":{"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":3}}]}],"size":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3}}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"noHints":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":14,"character":3}}]}],"hasError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"formInput":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":16,"character":3},"arguments":[{"__symbolic":"reference","name":"MisInputDirective"}]}]}],"__ctor__":[{"__symbolic":"constructor"}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"MisInputModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"MisInputComponent"},{"__symbolic":"reference","name":"MisInputDirective"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":8,"character":12},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":8,"character":26}],"exports":[{"__symbolic":"reference","name":"MisInputComponent"},{"__symbolic":"reference","name":"MisInputDirective"}]}]}],"members":{}}},"origins":{"MisInputDirective":"./directives/input/input.directive","MisInputComponent":"./mis-input.component","MisInputModule":"./mis-input.module"},"importAs":"mis-crystal-design-system/input"}
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"MisInputDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":5,"character":1},"arguments":[{"selector":"input[misInput]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self","line":10,"character":38}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":10,"character":46}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":10,"character":25},{"__symbolic":"reference","module":"@angular/forms","name":"NgControl","line":10,"character":73}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"MisInputComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"mis-input","template":"<div\n [class]=\"'input-container ' + size\"\n [ngClass]=\"{\n rounded: type === 'rounded',\n floating: type === 'floating',\n 'has-error': !inputValidity || hasError,\n 'no-hint': noHints,\n 'mis-disabled': inputCtrl?.disabled\n }\"\n>\n <div class=\"input-wrapper\">\n <ng-content select=\"[mis-input-icon]\"></ng-content>\n <div class=\"mis-input\">\n <ng-content select=\"input\"></ng-content>\n <span class=\"mis-placeholder\">{{ placeholder }}<span *ngIf=\"isMandatory\" style=\"color: red;\">*</span></span>\n </div>\n <ng-content select=\"[mis-input-act]\"></ng-content>\n </div>\n <ng-content select=\"[mis-input-hint]\"></ng-content>\n <ng-content select=\"[mis-input-error]\"></ng-content>\n</div>\n","styles":[":root{--pmry-200:#99baf7;--pmry-100:#cbddfb;--pmry-500:#0937b2;--pmry-400:#3c68d0;--pmry-600:#062a99;--pmry-700:#041f80;--pmry-300:#638fe7;--pmry-800:#021567;--pmry-900:#010f55;--sec-d-purple:#40447f;--sec-maroon:#6b034e;--sec-mud-red:#b23600;--sec-orange:#ed711c;--sec-purple:#815fd5;--sec-teal:#10adae;--sec-yellow:#d4900c;--sec-green:#547f40;--sec-bright-green:#27d22e;--sec-dark-teal:#035f6b;--sec-chocolate:#7c2f33;--sec-rube-pink:#c13d6d;--sec-cerulean:#0087b2;--sem-error:#b00020;--sem-info:#0091ff;--sem-warning:#ff9d00;--sem-success:#38af49;--grey-bg-1:#fafafa;--grey-bg:#f5f5f5;--grey-seperators:#e0e0e0;--grey-disabled:#c8cdd3;--grey-hover:#f5f7fc;--grey-pressed:#e6ebf7;--grey-row:#f5f7fc;--dec-light-yellow:#f4e7c3;--dec-light-purple:#dacff9;--dec-light-green:#e4f5e9;--dec-light-green2:#f1fff3;--dec-light-pink:#fae1ea;--dec-:#f4cbc1;--dec-lt-orange:#faefed;--dec-light-blue:#cfecf9;--dec-row-selection:#f1fdf8;--dec-row-selection2:#f2fbff;--dec-row-lines:#d3e1e9;--text-white:#fff;--text-disabled:#929dab;--text-muted:#6a737d;--text-black:#181f33;--MR-solid-blue2:#c8d5f6;--MR-solid-purple:#c9c3fb;--MR-solid-orange:#eeac9f;--MR-solid-green:#acdada;--MR-solid-brown:#e8c8af;--MR-solid-yellow:#ffefc7;--MR-solid-blue:#bbe6ff;--MR-solid-pink:#ffc6f2;--tr-hover:#f0f3fa;--tr-pressed:#dae1f3}.input-container{position:relative;padding-bottom:24px}.input-container.mis-disabled .input-wrapper{pointer-events:none!important}.input-container .input-wrapper{box-sizing:border-box;display:flex;align-items:center;flex-direction:row;flex-wrap:nowrap;transition:all 60ms ease-in;background-color:#fff;padding:3px 16px;gap:16px}.input-container .input-wrapper .mis-input{flex:1 1 auto;z-index:0;position:relative;display:flex;align-items:center}.input-container .input-wrapper input{flex:1 1 auto;border:none;outline:none;height:100%;padding:0;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;height:24px;color:#181f33;background-color:transparent;width:100%;vertical-align:middle}.input-container .input-wrapper input::-moz-placeholder{-moz-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input:-ms-input-placeholder{-ms-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input::placeholder{transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper .mis-placeholder{position:absolute;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#6a737d;z-index:-1;transition:all .15s ease-in}.input-container .input-wrapper:focus-within{background-color:#f5f5f5}.input-container .input-wrapper:focus-within{border:1px solid #0937b2}.input-container .input-wrapper [mis-input-act],.input-container .input-wrapper [mis-input-icon]{width:18px;height:18px;color:#6a737d;font-size:24px;line-height:18px}.input-container .input-wrapper [mis-input-act]{cursor:pointer}.input-container.no-hint{padding-bottom:0}.input-container.rounded input{box-sizing:initial}.input-container.rounded.sm input{padding:3px 16px}.input-container.rounded.md input{padding:9px 16px}.input-container.rounded.lg input{padding:15px 16px}.input-container.rounded .input-wrapper{border-radius:4px;border:1px solid #e0e0e0;padding:0}.input-container.rounded .input-wrapper:hover{background-color:#f5f5f5}.input-container.rounded .input-wrapper:focus-within{border:1px solid #0937b2}.input-container.rounded .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper .mis-placeholder{margin-left:16px;transition-duration:50ms}.input-container.rounded.has-error .input-wrapper{border:1px solid #b00020!important}.input-container.floating .input-wrapper{padding-top:24px;padding-bottom:7px;border-bottom:1px solid #e0e0e0}.input-container.floating .input-wrapper input:focus+.mis-placeholder{color:#0937b2!important}.input-container.floating .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:focus+.mis-placeholder,.input-container.floating .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper:focus-within{border:none;border-bottom:1px solid #0937b2}.input-container.floating .input-wrapper:focus-within input::-moz-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input:-ms-input-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input::placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating.has-error .input-wrapper{border-bottom:1px solid #b00020!important}.input-container.floating.has-error .input-wrapper .mis-placeholder{color:#b00020!important}.input-container [mis-input-error],.input-container [mis-input-hint]{position:absolute;left:0;right:0;bottom:0;line-height:24px;height:24px;font-size:12px;color:#6a737d;letter-spacing:.2px}.input-container [mis-input-error]{color:#b00020}"]}]}],"members":{"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":3}}]}],"size":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3}}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"noHints":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":14,"character":3}}]}],"hasError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"isMandatory":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":16,"character":3}}]}],"formInput":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":17,"character":3},"arguments":[{"__symbolic":"reference","name":"MisInputDirective"}]}]}],"__ctor__":[{"__symbolic":"constructor"}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"MisInputModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"MisInputComponent"},{"__symbolic":"reference","name":"MisInputDirective"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":8,"character":12},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":8,"character":26}],"exports":[{"__symbolic":"reference","name":"MisInputComponent"},{"__symbolic":"reference","name":"MisInputDirective"}]}]}],"members":{}}},"origins":{"MisInputDirective":"./directives/input/input.directive","MisInputComponent":"./mis-input.component","MisInputModule":"./mis-input.module"},"importAs":"mis-crystal-design-system/input"}
|
|
@@ -8,6 +8,7 @@ export declare class MisInputComponent implements OnInit, OnDestroy {
|
|
|
8
8
|
placeholder: string;
|
|
9
9
|
noHints: boolean;
|
|
10
10
|
hasError: boolean;
|
|
11
|
+
isMandatory: boolean;
|
|
11
12
|
set formInput(input: MisInputDirective);
|
|
12
13
|
inputCtrl: AbstractControl;
|
|
13
14
|
inputSubscription: Subscription | undefined;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"PhoneInputComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"PhoneInputComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"mis-phone-input","template":"<div class=\"main-container-phone\">\n <mis-dropdown [height]=\"dropdownHeight\" [dropdownListWidth]=\"dropdownListWidth\"[dropdownListHeight]=\"dropdownListHeight\" [width]=\"dropdownWidth\" [data]=\"dropdownData\" [selectedItem]=\"dropdownSelectedItem\" [label]=\"label\" [searchEnabled]=\"searchEnabled\" [multiLine]=\"false\" (onChange)=\"handleDropdownSelection($event)\" [searchLabel]=\"searchLabel\"></mis-dropdown>\n <div class=\"details-field\">\n <div class=\"input-box\">\n <input\n [ngStyle]=\"{'height': inputHeight }\"\n class=\"black-text\" \n [placeholder]=\"inputPlaceholder\"\n [formControl]=\"inputFormControl\" \n [type]=\"inputType\"\n />\n </div>\n </div>\n</div>\n","styles":[".main-container-phone{display:flex;border:1px solid #e0e0e0;border-radius:6px}.details-field label{display:inline-block;min-width:224px;margin-right:24px}.details-field .input-box{width:100%}.details-field .input-box input{width:100%;height:32px}input{padding:10px 16px;border:none;outline:none;width:100%;height:auto;border-radius:6px}.black-text,input{color:#181f33;line-height:24px;font-size:16px}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.main-container-phone ::ng-deep .item{padding:8px!important}.main-container-phone ::ng-deep .dropdown{border:unset!important}"]}]}],"members":{"dropdownHeight":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":3}}]}],"dropdownWidth":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3}}]}],"inputHeight":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"dropdownData":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":14,"character":3}}]}],"dropdownSelectedItem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"defaultCountryCode":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":16,"character":3}}]}],"label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":17,"character":3}}]}],"inputPlaceholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":18,"character":3}}]}],"inputFormControl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":19,"character":3}}]}],"onDropdownSelection":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":20,"character":3}}]}],"onInvalidPhoneNumber":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":21,"character":3}}]}],"dropdownListWidth":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":22,"character":3}}]}],"dropdownListHeight":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":23,"character":3}}]}],"searchEnabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":24,"character":3}}]}],"inputType":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":25,"character":3}}]}],"searchLabel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":26,"character":3}}]}],"phoneValidator":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":27,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor"}],"ngOnInit":[{"__symbolic":"method"}],"handleDropdownSelection":[{"__symbolic":"method"}],"loadCountryCodes":[{"__symbolic":"method"}],"validatePhoneNumber":[{"__symbolic":"method"}]}},"PhoneInputModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":10,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"PhoneInputComponent"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":12,"character":12},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":12,"character":25},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":12,"character":46},{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"OverlayModule","line":12,"character":59},{"__symbolic":"reference","module":"@angular/cdk-experimental/scrolling","name":"ScrollingModule","line":12,"character":74},{"__symbolic":"reference","module":"mis-crystal-design-system/dropdown","name":"DropdownModule","line":12,"character":91}],"exports":[{"__symbolic":"reference","name":"PhoneInputComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"PhoneInputModule"},"providers":[]}}}}},"origins":{"PhoneInputComponent":"./phone-input.component","PhoneInputModule":"./phone-input.module"},"importAs":"mis-crystal-design-system/phone-input"}
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
import { EventEmitter, OnInit } from "@angular/core";
|
|
2
2
|
import { FormControl } from "@angular/forms";
|
|
3
|
+
import { CountryCode } from 'libphonenumber-js';
|
|
3
4
|
import { DropdownItem } from "mis-crystal-design-system/dropdown";
|
|
4
5
|
export declare class PhoneInputComponent implements OnInit {
|
|
5
6
|
dropdownHeight?: string;
|
|
6
7
|
dropdownWidth?: string;
|
|
7
|
-
inputHeight?:
|
|
8
|
+
inputHeight?: any;
|
|
8
9
|
dropdownData: DropdownItem[];
|
|
9
10
|
dropdownSelectedItem: DropdownItem;
|
|
11
|
+
defaultCountryCode?: string;
|
|
10
12
|
label: string;
|
|
11
13
|
inputPlaceholder: string;
|
|
12
14
|
inputFormControl: FormControl;
|
|
13
15
|
onDropdownSelection: EventEmitter<any>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
onInvalidPhoneNumber: EventEmitter<string>;
|
|
17
|
+
dropdownListWidth: string;
|
|
18
|
+
dropdownListHeight: string;
|
|
16
19
|
searchEnabled: boolean;
|
|
17
20
|
inputType: string;
|
|
18
21
|
searchLabel: string;
|
|
22
|
+
phoneValidator?: boolean;
|
|
23
|
+
countryCodes: DropdownItem[];
|
|
24
|
+
countryCode: CountryCode | undefined;
|
|
25
|
+
selectedCountryName: string;
|
|
19
26
|
constructor();
|
|
20
27
|
ngOnInit(): void;
|
|
21
28
|
handleDropdownSelection(item: DropdownItem): void;
|
|
29
|
+
loadCountryCodes(): void;
|
|
30
|
+
validatePhoneNumber(phoneNumber: string, countryCode: string): void;
|
|
22
31
|
}
|