nw-style-guide 21.1.0 → 21.1.1

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.
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { HostBinding, Input, Directive, inject, Renderer2, ChangeDetectorRef, EventEmitter, ContentChildren, ViewChild, Output, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { debounceTime } from 'rxjs/operators';
4
4
  import { fromEvent } from 'rxjs';
5
- import { NgIf, NgStyle, NgClass, NgFor } from '@angular/common';
5
+ import { NgStyle, NgClass } from '@angular/common';
6
6
 
7
7
  class CarouselSlideDirective {
8
8
  constructor() {
@@ -112,40 +112,42 @@ class CarouselComponent {
112
112
  this._slidesSub.unsubscribe();
113
113
  }
114
114
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CarouselComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
115
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.8", type: CarouselComponent, isStandalone: true, selector: "nw-carousel", inputs: { showPageIndicator: "showPageIndicator", showPagination: "showPagination", showMask: "showMask", maskColor: "maskColor", containerClass: "containerClass", currPage: "currPage", noResultsText: "noResultsText" }, outputs: { currPageChange: "currPageChange" }, queries: [{ propertyName: "slides", predicate: CarouselSlideDirective }], viewQueries: [{ propertyName: "carousel", first: true, predicate: ["carousel"], descendants: true, static: true }], exportAs: ["nw-carousel"], usesOnChanges: true, ngImport: i0, template: `
115
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: CarouselComponent, isStandalone: true, selector: "nw-carousel", inputs: { showPageIndicator: "showPageIndicator", showPagination: "showPagination", showMask: "showMask", maskColor: "maskColor", containerClass: "containerClass", currPage: "currPage", noResultsText: "noResultsText" }, outputs: { currPageChange: "currPageChange" }, queries: [{ propertyName: "slides", predicate: CarouselSlideDirective }], viewQueries: [{ propertyName: "carousel", first: true, predicate: ["carousel"], descendants: true, static: true }], exportAs: ["nw-carousel"], usesOnChanges: true, ngImport: i0, template: `
116
116
  <div class="carousel-container">
117
- <div
118
- class="pagination-container"
119
- *ngIf="showPagination && !isFirstPage">
120
- <button
121
- class="btn btn-carousel btn-carousel-prev"
122
- (click)="prev()"></button>
123
- </div>
117
+ @if (showPagination && !isFirstPage) {
118
+ <div class="pagination-container">
119
+ <button
120
+ class="btn btn-carousel btn-carousel-prev"
121
+ (click)="prev()"></button>
122
+ </div>
123
+ }
124
124
 
125
125
  <ng-content select=".pagination-left"></ng-content>
126
126
 
127
127
  <div class="carousel-content">
128
- <div
129
- class="pagination-masks"
130
- *ngIf="showMask && pages.length > 1">
131
- <div
132
- class="collapse-expand-grid-container collapse-expand-container-start"
133
- *ngIf="!isFirstPage"
134
- animate.leave="collapse-animation">
135
- <div
136
- class="pagination-mask pagination-mask-start"
137
- [ngStyle]="maskStyles"></div>
138
- </div>
128
+ @if (showMask && pages.length > 1) {
129
+ <div class="pagination-masks">
130
+ @if (!isFirstPage) {
131
+ <div
132
+ class="collapse-expand-grid-container collapse-expand-container-start"
133
+ animate.leave="collapse-animation">
134
+ <div
135
+ class="pagination-mask pagination-mask-start"
136
+ [ngStyle]="maskStyles"></div>
137
+ </div>
138
+ }
139
139
 
140
- <div
141
- class="collapse-expand-grid-container collapse-expand-container-end"
142
- *ngIf="!isLastPage"
143
- animate.leave="collapse-animation">
144
- <div
145
- class="pagination-mask pagination-mask-end"
146
- [ngStyle]="maskStyles"></div>
140
+ @if (!isFirstPage) {
141
+ <div
142
+ class="collapse-expand-grid-container collapse-expand-container-end"
143
+ animate.leave="collapse-animation">
144
+ <div
145
+ class="pagination-mask pagination-mask-end"
146
+ [ngStyle]="maskStyles"></div>
147
+ </div>
148
+ }
147
149
  </div>
148
- </div>
150
+ }
149
151
 
150
152
  <div
151
153
  class="carousel"
@@ -153,38 +155,37 @@ class CarouselComponent {
153
155
  [ngClass]="containerClass">
154
156
  <ng-content></ng-content>
155
157
 
156
- <p
157
- *ngIf="slides.length === 0"
158
- class="nw-text text-center">
159
- {{ noResultsText }}
160
- </p>
158
+ @if (slides.length === 0) {
159
+ <p class="nw-text text-center">{{ noResultsText }}</p>
160
+ }
161
161
  </div>
162
162
  </div>
163
163
 
164
- <div
165
- class="pagination-container"
166
- *ngIf="showPagination && !isLastPage">
167
- <button
168
- class="btn btn-carousel btn-carousel-next"
169
- (click)="next()"></button>
170
- </div>
164
+ @if (showPagination && !isLastPage) {
165
+ <div class="pagination-container">
166
+ <button
167
+ class="btn btn-carousel btn-carousel-next"
168
+ (click)="next()"></button>
169
+ </div>
170
+ }
171
171
 
172
172
  <ng-content select=".pagination-right"></ng-content>
173
173
  </div>
174
174
 
175
- <div
176
- class="page-indicators"
177
- *ngIf="showPageIndicator && pages.length > 1">
178
- <a
179
- href="javascript:;"
180
- class="page-indicator"
181
- *ngFor="let page of pages"
182
- [class.active]="page === currPage"
183
- (click)="goToPage(page)"></a>
184
- </div>
175
+ @if (showPageIndicator && pages.length > 1) {
176
+ <div class="page-indicators">
177
+ @for (page of pages; track page) {
178
+ <a
179
+ href="javascript:;"
180
+ class="page-indicator"
181
+ [class.active]="page === currPage"
182
+ (click)="goToPage(page)"></a>
183
+ }
184
+ </div>
185
+ }
185
186
 
186
187
  <ng-content select=".pagination-indicators"></ng-content>
187
- `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
188
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
188
189
  }
189
190
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CarouselComponent, decorators: [{
190
191
  type: Component,
@@ -192,38 +193,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
192
193
  selector: 'nw-carousel',
193
194
  template: `
194
195
  <div class="carousel-container">
195
- <div
196
- class="pagination-container"
197
- *ngIf="showPagination && !isFirstPage">
198
- <button
199
- class="btn btn-carousel btn-carousel-prev"
200
- (click)="prev()"></button>
201
- </div>
196
+ @if (showPagination && !isFirstPage) {
197
+ <div class="pagination-container">
198
+ <button
199
+ class="btn btn-carousel btn-carousel-prev"
200
+ (click)="prev()"></button>
201
+ </div>
202
+ }
202
203
 
203
204
  <ng-content select=".pagination-left"></ng-content>
204
205
 
205
206
  <div class="carousel-content">
206
- <div
207
- class="pagination-masks"
208
- *ngIf="showMask && pages.length > 1">
209
- <div
210
- class="collapse-expand-grid-container collapse-expand-container-start"
211
- *ngIf="!isFirstPage"
212
- animate.leave="collapse-animation">
213
- <div
214
- class="pagination-mask pagination-mask-start"
215
- [ngStyle]="maskStyles"></div>
216
- </div>
207
+ @if (showMask && pages.length > 1) {
208
+ <div class="pagination-masks">
209
+ @if (!isFirstPage) {
210
+ <div
211
+ class="collapse-expand-grid-container collapse-expand-container-start"
212
+ animate.leave="collapse-animation">
213
+ <div
214
+ class="pagination-mask pagination-mask-start"
215
+ [ngStyle]="maskStyles"></div>
216
+ </div>
217
+ }
217
218
 
218
- <div
219
- class="collapse-expand-grid-container collapse-expand-container-end"
220
- *ngIf="!isLastPage"
221
- animate.leave="collapse-animation">
222
- <div
223
- class="pagination-mask pagination-mask-end"
224
- [ngStyle]="maskStyles"></div>
219
+ @if (!isFirstPage) {
220
+ <div
221
+ class="collapse-expand-grid-container collapse-expand-container-end"
222
+ animate.leave="collapse-animation">
223
+ <div
224
+ class="pagination-mask pagination-mask-end"
225
+ [ngStyle]="maskStyles"></div>
226
+ </div>
227
+ }
225
228
  </div>
226
- </div>
229
+ }
227
230
 
228
231
  <div
229
232
  class="carousel"
@@ -231,41 +234,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
231
234
  [ngClass]="containerClass">
232
235
  <ng-content></ng-content>
233
236
 
234
- <p
235
- *ngIf="slides.length === 0"
236
- class="nw-text text-center">
237
- {{ noResultsText }}
238
- </p>
237
+ @if (slides.length === 0) {
238
+ <p class="nw-text text-center">{{ noResultsText }}</p>
239
+ }
239
240
  </div>
240
241
  </div>
241
242
 
242
- <div
243
- class="pagination-container"
244
- *ngIf="showPagination && !isLastPage">
245
- <button
246
- class="btn btn-carousel btn-carousel-next"
247
- (click)="next()"></button>
248
- </div>
243
+ @if (showPagination && !isLastPage) {
244
+ <div class="pagination-container">
245
+ <button
246
+ class="btn btn-carousel btn-carousel-next"
247
+ (click)="next()"></button>
248
+ </div>
249
+ }
249
250
 
250
251
  <ng-content select=".pagination-right"></ng-content>
251
252
  </div>
252
253
 
253
- <div
254
- class="page-indicators"
255
- *ngIf="showPageIndicator && pages.length > 1">
256
- <a
257
- href="javascript:;"
258
- class="page-indicator"
259
- *ngFor="let page of pages"
260
- [class.active]="page === currPage"
261
- (click)="goToPage(page)"></a>
262
- </div>
254
+ @if (showPageIndicator && pages.length > 1) {
255
+ <div class="page-indicators">
256
+ @for (page of pages; track page) {
257
+ <a
258
+ href="javascript:;"
259
+ class="page-indicator"
260
+ [class.active]="page === currPage"
261
+ (click)="goToPage(page)"></a>
262
+ }
263
+ </div>
264
+ }
263
265
 
264
266
  <ng-content select=".pagination-indicators"></ng-content>
265
267
  `,
266
268
  changeDetection: ChangeDetectionStrategy.OnPush,
267
269
  exportAs: 'nw-carousel',
268
- imports: [NgIf, NgStyle, NgClass, NgFor]
270
+ imports: [NgStyle, NgClass]
269
271
  }]
270
272
  }], propDecorators: { showPageIndicator: [{
271
273
  type: Input
@@ -1 +1 @@
1
- {"version":3,"file":"nw-style-guide-carousel.mjs","sources":["../../../projects/nw-style-guide/carousel/carousel-slide.directive.ts","../../../projects/nw-style-guide/carousel/carousel.component.ts","../../../projects/nw-style-guide/carousel/public-api.ts","../../../projects/nw-style-guide/carousel/nw-style-guide-carousel.ts"],"sourcesContent":["import { Directive, Input, HostBinding } from '@angular/core';\n\n@Directive({\n selector: '[nwCarouselSlide]',\n exportAs: 'nw-carousel-slide'\n})\nexport class CarouselSlideDirective {\n @HostBinding('style.scroll-snap-align')\n @Input()\n snapAlign: 'none' | 'start' | 'end' | 'center' = 'start';\n}\n","import {\n Component,\n ChangeDetectionStrategy,\n Input,\n ElementRef,\n ViewChild,\n Renderer2,\n ChangeDetectorRef,\n AfterViewInit,\n OnDestroy,\n OnInit,\n Output,\n EventEmitter,\n OnChanges,\n SimpleChanges,\n ContentChildren,\n QueryList,\n AfterContentInit,\n inject\n} from '@angular/core';\nimport { debounceTime } from 'rxjs/operators';\nimport { CarouselSlideDirective } from './carousel-slide.directive';\nimport { Subscription, fromEvent } from 'rxjs';\nimport { NgIf, NgStyle, NgClass, NgFor } from '@angular/common';\n\n@Component({\n selector: 'nw-carousel',\n template: `\n <div class=\"carousel-container\">\n <div\n class=\"pagination-container\"\n *ngIf=\"showPagination && !isFirstPage\">\n <button\n class=\"btn btn-carousel btn-carousel-prev\"\n (click)=\"prev()\"></button>\n </div>\n\n <ng-content select=\".pagination-left\"></ng-content>\n\n <div class=\"carousel-content\">\n <div\n class=\"pagination-masks\"\n *ngIf=\"showMask && pages.length > 1\">\n <div\n class=\"collapse-expand-grid-container collapse-expand-container-start\"\n *ngIf=\"!isFirstPage\"\n animate.leave=\"collapse-animation\">\n <div\n class=\"pagination-mask pagination-mask-start\"\n [ngStyle]=\"maskStyles\"></div>\n </div>\n\n <div\n class=\"collapse-expand-grid-container collapse-expand-container-end\"\n *ngIf=\"!isLastPage\"\n animate.leave=\"collapse-animation\">\n <div\n class=\"pagination-mask pagination-mask-end\"\n [ngStyle]=\"maskStyles\"></div>\n </div>\n </div>\n\n <div\n class=\"carousel\"\n #carousel\n [ngClass]=\"containerClass\">\n <ng-content></ng-content>\n\n <p\n *ngIf=\"slides.length === 0\"\n class=\"nw-text text-center\">\n {{ noResultsText }}\n </p>\n </div>\n </div>\n\n <div\n class=\"pagination-container\"\n *ngIf=\"showPagination && !isLastPage\">\n <button\n class=\"btn btn-carousel btn-carousel-next\"\n (click)=\"next()\"></button>\n </div>\n\n <ng-content select=\".pagination-right\"></ng-content>\n </div>\n\n <div\n class=\"page-indicators\"\n *ngIf=\"showPageIndicator && pages.length > 1\">\n <a\n href=\"javascript:;\"\n class=\"page-indicator\"\n *ngFor=\"let page of pages\"\n [class.active]=\"page === currPage\"\n (click)=\"goToPage(page)\"></a>\n </div>\n\n <ng-content select=\".pagination-indicators\"></ng-content>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n exportAs: 'nw-carousel',\n imports: [NgIf, NgStyle, NgClass, NgFor]\n})\nexport class CarouselComponent implements OnInit, AfterViewInit, AfterContentInit, OnChanges, OnDestroy {\n private _renderer = inject(Renderer2);\n private _cdRef = inject(ChangeDetectorRef);\n\n @Input() showPageIndicator: boolean = true;\n @Input() showPagination: boolean = true;\n @Input() showMask: boolean = true;\n @Input() maskColor: string = '#ffffff';\n @Input() containerClass: string;\n @Input() currPage: number = 0;\n @Input() noResultsText: string = 'No results';\n\n @Output() currPageChange: EventEmitter<number> = new EventEmitter();\n\n @ViewChild('carousel', { static: true }) carousel: ElementRef;\n\n @ContentChildren(CarouselSlideDirective) slides: QueryList<CarouselSlideDirective>;\n\n public pages: number[] = [];\n\n private _windowResizeSub: Subscription;\n private _slidesSub: Subscription;\n\n ngOnInit() {\n this.subscribeToWindowResize();\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes.currPage && changes.currPage.previousValue !== changes.currPage.currentValue) {\n this._setScrollPosition(this.currPage);\n }\n }\n\n ngAfterViewInit() {\n this.updatePages();\n\n if (this.currPage !== 0) {\n this._setScrollPosition(this.currPage);\n }\n }\n\n ngAfterContentInit() {\n this._slidesSub = this.slides.changes.subscribe(res => {\n this.updatePages();\n });\n }\n\n next() {\n this.goToPage(Math.min(this.pages.length - 1, this.currPage + 1));\n }\n\n prev() {\n this.goToPage(Math.max(0, this.currPage - 1));\n }\n\n goToPage(page: number) {\n this.currPage = page;\n this.currPageChange.emit(this.currPage);\n\n this._setScrollPosition(page);\n }\n\n private _setScrollPosition(page: number): void {\n const carouselWidth: number = this.carouselNativeElement.clientWidth;\n const newScrollPosition: number = page * carouselWidth;\n\n this._renderer.setProperty(this.carouselNativeElement, 'scrollLeft', newScrollPosition);\n }\n\n getPages() {\n const estimatedPages: number = +(\n this.carouselNativeElement.scrollWidth / this.carouselNativeElement.clientWidth\n ).toFixed(1);\n const numOfPages: number = Math.ceil(estimatedPages);\n\n return [...Array(numOfPages).fill(1)].map((_, i) => i);\n }\n\n updatePages(): void {\n this.pages = this.getPages();\n this._cdRef.detectChanges();\n }\n\n get carouselNativeElement(): HTMLDivElement {\n return this.carousel.nativeElement as HTMLDivElement;\n }\n\n get isFirstPage(): boolean {\n return this.currPage === 0;\n }\n\n get isLastPage(): boolean {\n return this.currPage === this.pages[this.pages.length - 1];\n }\n\n get maskStyles() {\n return {\n '-webkit-mask-image': `linear-gradient(to left, rgba(0,0,0,0), ${this.maskColor})`,\n 'background-color': `${this.maskColor}`\n };\n }\n\n get maskGradient() {\n return `linear-gradient(to left, rgba(0,0,0,0), ${this.maskColor})`;\n }\n\n subscribeToWindowResize() {\n this._windowResizeSub = fromEvent(window, 'resize')\n .pipe(debounceTime(100))\n .subscribe(_ => {\n this.goToPage(0);\n this.updatePages();\n });\n }\n\n ngOnDestroy() {\n this._windowResizeSub.unsubscribe();\n this._slidesSub.unsubscribe();\n }\n}\n","export { CarouselComponent } from './carousel.component';\nexport { CarouselSlideDirective } from './carousel-slide.directive';\n\nimport { CarouselComponent } from './carousel.component';\nimport { CarouselSlideDirective } from './carousel-slide.directive';\n\n/**\n * Export cooperating directives\n * https://v17.angular.io/guide/standalone-components#standalone-components-for-library-authors\n */\nexport const CAROUSEL_DIRECTIVES = [CarouselComponent, CarouselSlideDirective] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAMa,sBAAsB,CAAA;AAJnC,IAAA,WAAA,GAAA;QAOI,IAAA,CAAA,SAAS,GAAwC,OAAO;AAC3D,IAAA;8GAJY,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAtB,sBAAsB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,WAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,yBAAA,EAAA,gBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAJlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,QAAQ,EAAE;AACb,iBAAA;;sBAEI,WAAW;uBAAC,yBAAyB;;sBACrC;;;MCgGQ,iBAAiB,CAAA;AA/E9B,IAAA,WAAA,GAAA;AAgFY,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAEjC,IAAA,CAAA,iBAAiB,GAAY,IAAI;QACjC,IAAA,CAAA,cAAc,GAAY,IAAI;QAC9B,IAAA,CAAA,QAAQ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AO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK;AAC1C,iBAAA;;sBAKI;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBAEA;;sBAEA,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;sBAEtC,eAAe;uBAAC,sBAAsB;;;AClH3C;;;AAGG;MACU,mBAAmB,GAAG,CAAC,iBAAiB,EAAE,sBAAsB;;ACV7E;;AAEG;;;;"}
1
+ {"version":3,"file":"nw-style-guide-carousel.mjs","sources":["../../../projects/nw-style-guide/carousel/carousel-slide.directive.ts","../../../projects/nw-style-guide/carousel/carousel.component.ts","../../../projects/nw-style-guide/carousel/public-api.ts","../../../projects/nw-style-guide/carousel/nw-style-guide-carousel.ts"],"sourcesContent":["import { Directive, Input, HostBinding } from '@angular/core';\n\n@Directive({\n selector: '[nwCarouselSlide]',\n exportAs: 'nw-carousel-slide'\n})\nexport class CarouselSlideDirective {\n @HostBinding('style.scroll-snap-align')\n @Input()\n snapAlign: 'none' | 'start' | 'end' | 'center' = 'start';\n}\n","import {\n Component,\n ChangeDetectionStrategy,\n Input,\n ElementRef,\n ViewChild,\n Renderer2,\n ChangeDetectorRef,\n AfterViewInit,\n OnDestroy,\n OnInit,\n Output,\n EventEmitter,\n OnChanges,\n SimpleChanges,\n ContentChildren,\n QueryList,\n AfterContentInit,\n inject\n} from '@angular/core';\nimport { debounceTime } from 'rxjs/operators';\nimport { CarouselSlideDirective } from './carousel-slide.directive';\nimport { Subscription, fromEvent } from 'rxjs';\nimport { NgStyle, NgClass } from '@angular/common';\n\n@Component({\n selector: 'nw-carousel',\n template: `\n <div class=\"carousel-container\">\n @if (showPagination && !isFirstPage) {\n <div class=\"pagination-container\">\n <button\n class=\"btn btn-carousel btn-carousel-prev\"\n (click)=\"prev()\"></button>\n </div>\n }\n\n <ng-content select=\".pagination-left\"></ng-content>\n\n <div class=\"carousel-content\">\n @if (showMask && pages.length > 1) {\n <div class=\"pagination-masks\">\n @if (!isFirstPage) {\n <div\n class=\"collapse-expand-grid-container collapse-expand-container-start\"\n animate.leave=\"collapse-animation\">\n <div\n class=\"pagination-mask pagination-mask-start\"\n [ngStyle]=\"maskStyles\"></div>\n </div>\n }\n\n @if (!isFirstPage) {\n <div\n class=\"collapse-expand-grid-container collapse-expand-container-end\"\n animate.leave=\"collapse-animation\">\n <div\n class=\"pagination-mask pagination-mask-end\"\n [ngStyle]=\"maskStyles\"></div>\n </div>\n }\n </div>\n }\n\n <div\n class=\"carousel\"\n #carousel\n [ngClass]=\"containerClass\">\n <ng-content></ng-content>\n\n @if (slides.length === 0) {\n <p class=\"nw-text text-center\">{{ noResultsText }}</p>\n }\n </div>\n </div>\n\n @if (showPagination && !isLastPage) {\n <div class=\"pagination-container\">\n <button\n class=\"btn btn-carousel btn-carousel-next\"\n (click)=\"next()\"></button>\n </div>\n }\n\n <ng-content select=\".pagination-right\"></ng-content>\n </div>\n\n @if (showPageIndicator && pages.length > 1) {\n <div class=\"page-indicators\">\n @for (page of pages; track page) {\n <a\n href=\"javascript:;\"\n class=\"page-indicator\"\n [class.active]=\"page === currPage\"\n (click)=\"goToPage(page)\"></a>\n }\n </div>\n }\n\n <ng-content select=\".pagination-indicators\"></ng-content>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n exportAs: 'nw-carousel',\n imports: [NgStyle, NgClass]\n})\nexport class CarouselComponent implements OnInit, AfterViewInit, AfterContentInit, OnChanges, OnDestroy {\n private _renderer = inject(Renderer2);\n private _cdRef = inject(ChangeDetectorRef);\n\n @Input() showPageIndicator: boolean = true;\n @Input() showPagination: boolean = true;\n @Input() showMask: boolean = true;\n @Input() maskColor: string = '#ffffff';\n @Input() containerClass: string;\n @Input() currPage: number = 0;\n @Input() noResultsText: string = 'No results';\n\n @Output() currPageChange: EventEmitter<number> = new EventEmitter();\n\n @ViewChild('carousel', { static: true }) carousel: ElementRef;\n\n @ContentChildren(CarouselSlideDirective) slides: QueryList<CarouselSlideDirective>;\n\n public pages: number[] = [];\n\n private _windowResizeSub: Subscription;\n private _slidesSub: Subscription;\n\n ngOnInit() {\n this.subscribeToWindowResize();\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes.currPage && changes.currPage.previousValue !== changes.currPage.currentValue) {\n this._setScrollPosition(this.currPage);\n }\n }\n\n ngAfterViewInit() {\n this.updatePages();\n\n if (this.currPage !== 0) {\n this._setScrollPosition(this.currPage);\n }\n }\n\n ngAfterContentInit() {\n this._slidesSub = this.slides.changes.subscribe(res => {\n this.updatePages();\n });\n }\n\n next() {\n this.goToPage(Math.min(this.pages.length - 1, this.currPage + 1));\n }\n\n prev() {\n this.goToPage(Math.max(0, this.currPage - 1));\n }\n\n goToPage(page: number) {\n this.currPage = page;\n this.currPageChange.emit(this.currPage);\n\n this._setScrollPosition(page);\n }\n\n private _setScrollPosition(page: number): void {\n const carouselWidth: number = this.carouselNativeElement.clientWidth;\n const newScrollPosition: number = page * carouselWidth;\n\n this._renderer.setProperty(this.carouselNativeElement, 'scrollLeft', newScrollPosition);\n }\n\n getPages() {\n const estimatedPages: number = +(\n this.carouselNativeElement.scrollWidth / this.carouselNativeElement.clientWidth\n ).toFixed(1);\n const numOfPages: number = Math.ceil(estimatedPages);\n\n return [...Array(numOfPages).fill(1)].map((_, i) => i);\n }\n\n updatePages(): void {\n this.pages = this.getPages();\n this._cdRef.detectChanges();\n }\n\n get carouselNativeElement(): HTMLDivElement {\n return this.carousel.nativeElement as HTMLDivElement;\n }\n\n get isFirstPage(): boolean {\n return this.currPage === 0;\n }\n\n get isLastPage(): boolean {\n return this.currPage === this.pages[this.pages.length - 1];\n }\n\n get maskStyles() {\n return {\n '-webkit-mask-image': `linear-gradient(to left, rgba(0,0,0,0), ${this.maskColor})`,\n 'background-color': `${this.maskColor}`\n };\n }\n\n get maskGradient() {\n return `linear-gradient(to left, rgba(0,0,0,0), ${this.maskColor})`;\n }\n\n subscribeToWindowResize() {\n this._windowResizeSub = fromEvent(window, 'resize')\n .pipe(debounceTime(100))\n .subscribe(_ => {\n this.goToPage(0);\n this.updatePages();\n });\n }\n\n ngOnDestroy() {\n this._windowResizeSub.unsubscribe();\n this._slidesSub.unsubscribe();\n }\n}\n","export { CarouselComponent } from './carousel.component';\nexport { CarouselSlideDirective } from './carousel-slide.directive';\n\nimport { CarouselComponent } from './carousel.component';\nimport { CarouselSlideDirective } from './carousel-slide.directive';\n\n/**\n * Export cooperating directives\n * https://v17.angular.io/guide/standalone-components#standalone-components-for-library-authors\n */\nexport const CAROUSEL_DIRECTIVES = [CarouselComponent, CarouselSlideDirective] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAMa,sBAAsB,CAAA;AAJnC,IAAA,WAAA,GAAA;QAOI,IAAA,CAAA,SAAS,GAAwC,OAAO;AAC3D,IAAA;8GAJY,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAtB,sBAAsB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,WAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,yBAAA,EAAA,gBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAJlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,QAAQ,EAAE;AACb,iBAAA;;sBAEI,WAAW;uBAAC,yBAAyB;;sBACrC;;;MCiGQ,iBAAiB,CAAA;AAhF9B,IAAA,WAAA,GAAA;AAiFY,QAAA,IAAA,CAAA,SAAS,G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ACA;;sBACA;;sBAEA;;sBAEA,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;sBAEtC,eAAe;uBAAC,sBAAsB;;;ACnH3C;;;AAGG;MACU,mBAAmB,GAAG,CAAC,iBAAiB,EAAE,sBAAsB;;ACV7E;;AAEG;;;;"}
@@ -2,7 +2,6 @@ import * as i0 from '@angular/core';
2
2
  import { inject, ChangeDetectorRef, EventEmitter, ViewChild, Output, Input, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
5
- import { NgFor } from '@angular/common';
6
5
 
7
6
  class EmailInputComponent {
8
7
  constructor() {
@@ -178,7 +177,7 @@ class EmailInputComponent {
178
177
  this._valueChangesSub.unsubscribe();
179
178
  }
180
179
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
181
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.8", type: EmailInputComponent, isStandalone: true, selector: "nw-email-input", inputs: { emails: "emails", inputId: "inputId", placeholder: "placeholder", persistentPlaceholder: "persistentPlaceholder", blacklist: "blacklist" }, outputs: { updated: "updated" }, viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, static: true }, { propertyName: "container", first: true, predicate: ["container"], descendants: true, static: true }], exportAs: ["nw-email-input"], ngImport: i0, template: `
180
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailInputComponent, isStandalone: true, selector: "nw-email-input", inputs: { emails: "emails", inputId: "inputId", placeholder: "placeholder", persistentPlaceholder: "persistentPlaceholder", blacklist: "blacklist" }, outputs: { updated: "updated" }, viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, static: true }, { propertyName: "container", first: true, predicate: ["container"], descendants: true, static: true }], exportAs: ["nw-email-input"], ngImport: i0, template: `
182
181
  <div
183
182
  class="emails-container form-control input-lg"
184
183
  #container
@@ -186,19 +185,20 @@ class EmailInputComponent {
186
185
  (click)="onContainerClick($event)"
187
186
  (paste)="onPaste($event)"
188
187
  [attr.data-placeholder-text]="placeholder">
189
- <div
190
- class="pill pill-sm"
191
- *ngFor="let email of emails; let last = last"
192
- [class.invalid]="!isValid(email)"
193
- [class.selected]="last && isPillSelected">
194
- <span class="pill-label">{{ email }}</span>
195
- <button
196
- type="button"
197
- class="close"
198
- (click)="removeEmail(email)">
199
- ×
200
- </button>
201
- </div>
188
+ @for (email of emails; track email; let last = $last) {
189
+ <div
190
+ class="pill pill-sm"
191
+ [class.invalid]="!isValid(email)"
192
+ [class.selected]="last && isPillSelected">
193
+ <span class="pill-label">{{ email }}</span>
194
+ <button
195
+ type="button"
196
+ class="close"
197
+ (click)="removeEmail(email)">
198
+ ×
199
+ </button>
200
+ </div>
201
+ }
202
202
 
203
203
  <div
204
204
  class="input-container"
@@ -217,7 +217,7 @@ class EmailInputComponent {
217
217
  (blur)="onBlur()" />
218
218
  </div>
219
219
  </div>
220
- `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
220
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
221
221
  }
222
222
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailInputComponent, decorators: [{
223
223
  type: Component,
@@ -231,19 +231,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
231
231
  (click)="onContainerClick($event)"
232
232
  (paste)="onPaste($event)"
233
233
  [attr.data-placeholder-text]="placeholder">
234
- <div
235
- class="pill pill-sm"
236
- *ngFor="let email of emails; let last = last"
237
- [class.invalid]="!isValid(email)"
238
- [class.selected]="last && isPillSelected">
239
- <span class="pill-label">{{ email }}</span>
240
- <button
241
- type="button"
242
- class="close"
243
- (click)="removeEmail(email)">
244
- ×
245
- </button>
246
- </div>
234
+ @for (email of emails; track email; let last = $last) {
235
+ <div
236
+ class="pill pill-sm"
237
+ [class.invalid]="!isValid(email)"
238
+ [class.selected]="last && isPillSelected">
239
+ <span class="pill-label">{{ email }}</span>
240
+ <button
241
+ type="button"
242
+ class="close"
243
+ (click)="removeEmail(email)">
244
+ ×
245
+ </button>
246
+ </div>
247
+ }
247
248
 
248
249
  <div
249
250
  class="input-container"
@@ -265,7 +266,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
265
266
  `,
266
267
  changeDetection: ChangeDetectionStrategy.OnPush,
267
268
  exportAs: 'nw-email-input',
268
- imports: [NgFor, ReactiveFormsModule]
269
+ imports: [ReactiveFormsModule]
269
270
  }]
270
271
  }], propDecorators: { emails: [{
271
272
  type: Input
@@ -1 +1 @@
1
- {"version":3,"file":"nw-style-guide-email-input.mjs","sources":["../../../projects/nw-style-guide/email-input/email-input.component.ts","../../../projects/nw-style-guide/email-input/nw-style-guide-email-input.ts"],"sourcesContent":["import {\n Component,\n OnInit,\n ViewChild,\n ElementRef,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnDestroy,\n Input,\n Output,\n EventEmitter,\n inject\n} from '@angular/core';\nimport { FormControl, Validators, ReactiveFormsModule } from '@angular/forms';\nimport { IValidationChange } from './models/IValidationChange';\nimport { Subscription } from 'rxjs';\nimport { NgFor } from '@angular/common';\n\n@Component({\n selector: 'nw-email-input',\n template: `\n <div\n class=\"emails-container form-control input-lg\"\n #container\n [class.show-placeholder]=\"emails.length < 1 && emailInputControl.value.length < 1\"\n (click)=\"onContainerClick($event)\"\n (paste)=\"onPaste($event)\"\n [attr.data-placeholder-text]=\"placeholder\">\n <div\n class=\"pill pill-sm\"\n *ngFor=\"let email of emails; let last = last\"\n [class.invalid]=\"!isValid(email)\"\n [class.selected]=\"last && isPillSelected\">\n <span class=\"pill-label\">{{ email }}</span>\n <button\n type=\"button\"\n class=\"close\"\n (click)=\"removeEmail(email)\">\n ×\n </button>\n </div>\n\n <div\n class=\"input-container\"\n [class.persistent-placeholder]=\"persistentPlaceholder\">\n <!-- pill-hidden is an invisble element that controls the width of the input -->\n <div class=\"pill pill-sm pill-hidden\">{{ emailInputControl.value }}</div>\n <input\n type=\"text\"\n #inputEl\n [id]=\"inputId\"\n [formControl]=\"emailInputControl\"\n (keydown)=\"onKeydown($event)\"\n (keydown.tab)=\"onTab($event)\"\n (keyup.backspace)=\"onBackspace()\"\n [placeholder]=\"persistentPlaceholder\"\n (blur)=\"onBlur()\" />\n </div>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n exportAs: 'nw-email-input',\n imports: [NgFor, ReactiveFormsModule]\n})\nexport class EmailInputComponent implements OnInit, OnDestroy {\n private _cdRef = inject(ChangeDetectorRef);\n\n @Input() emails: string[] = [];\n /**\n * Applied to the HTMLInputElement. Mostly useful for label using the \"for\" attribute\n */\n @Input() inputId: string = '';\n @Input() placeholder: string = '';\n @Input() persistentPlaceholder: string = '';\n /**\n * A list of strings or RegExp to be matched against the inputted list of emails. Any emails that\n * match entries in the blacklist will be marked as invalid\n */\n @Input() blacklist: (string | RegExp)[] = [];\n\n @Output() updated: EventEmitter<IValidationChange> = new EventEmitter();\n\n @ViewChild('inputEl', { static: true }) inputEl: ElementRef;\n @ViewChild('container', { static: true }) container: ElementRef;\n\n public emailInputControl: FormControl<string> = new FormControl('', Validators.email);\n public isPillSelected: boolean = false;\n\n private _validationFormControl: FormControl<string> = new FormControl();\n private _submitKeys: string[] = [',', 'Enter', ' ', ';'];\n private _valueChangesSub: Subscription;\n\n ngOnInit() {\n this._subscribeToValueChanges();\n this._emitValidationChange();\n }\n\n private _subscribeToValueChanges() {\n this._valueChangesSub = this.emailInputControl.valueChanges.subscribe(value => {\n if (value.length > 0) {\n this.isPillSelected = false;\n this._cdRef.detectChanges();\n }\n });\n }\n\n removeEmail(email: string) {\n const index = this.emails.indexOf(email, 0);\n\n if (index > -1) {\n this.emails = this.emails.filter(value => value !== email);\n this._emitValidationChange();\n }\n }\n\n onBlur() {\n this.isPillSelected = false;\n this._addEmail();\n }\n\n onKeydown(event: KeyboardEvent): void {\n const index = this._submitKeys.indexOf(event.key, 0);\n\n if (index > -1) {\n event.preventDefault();\n this._addEmail();\n this.focus();\n }\n\n if (event.key === 'Escape') {\n event.stopPropagation();\n this.emailInputControl.setValue('');\n (this.inputEl.nativeElement as HTMLInputElement).blur();\n }\n }\n\n onTab(event: KeyboardEvent) {\n /**\n * If the input has a value, add it as an entry.\n *\n * Otherwise, allow the default tab behaviour\n */\n if (this.emailInputControl.value.length > 0) {\n event.preventDefault();\n this._addEmail();\n this.focus();\n }\n }\n\n isValid(email: string): boolean {\n this._validationFormControl.setValue(email);\n const isBlacklisted = this.blacklist.some(item => {\n /**\n * If item in blacklist is a string, create a regular expression to match the full\n * case-insenstive string\n */\n if (typeof item === 'string') {\n return email.match(new RegExp(`^${item}$`, 'i'));\n }\n return email.match(item);\n });\n\n return Validators.email(this._validationFormControl) === null && !isBlacklisted;\n }\n\n onContainerClick(event: MouseEvent) {\n /**\n * We're only interested in this event if it originates from the container element.\n *\n * We don't care about events that bubble up from child elements.\n */\n if (event.target === this.container.nativeElement) {\n this.focus();\n }\n }\n\n onPaste(event: ClipboardEvent) {\n if (event.clipboardData) {\n event.preventDefault();\n\n this.emailInputControl.markAsDirty();\n\n const selectionStart: number = (this.inputEl.nativeElement as HTMLInputElement).selectionStart;\n const selectionEnd: number = (this.inputEl.nativeElement as HTMLInputElement).selectionEnd;\n const controlValue: string = this.emailInputControl.value as string;\n\n let pastedData: string = event.clipboardData.getData('text');\n\n /**\n * We need to check if the input already has a value when the user pasted\n */\n if (this.emailInputControl.value.length) {\n /**\n * The user has selected text in the input\n */\n if (selectionStart !== selectionEnd) {\n const newValue: string = controlValue.slice(0, selectionStart) + controlValue.slice(selectionEnd);\n pastedData = newValue.slice(0, selectionStart) + pastedData + newValue.slice(selectionStart);\n } else {\n pastedData =\n controlValue.slice(0, selectionStart) + pastedData + controlValue.slice(selectionStart);\n }\n }\n\n const items: string[] = pastedData\n .split(/\\s+/)\n .map(item => item.split(/,|;/g))\n .reduce((acc, curr) => acc.concat(curr), [])\n .filter(item => item);\n\n const lastEmail: string = items[items.length - 1];\n\n if (this.isValid(lastEmail)) {\n // Use Set to remove duplicate emails\n this.emails = Array.from(new Set(this.emails.concat(items)));\n this.emailInputControl.setValue('');\n } else {\n items.pop();\n // Use Set to remove duplicate emails\n this.emails = Array.from(new Set(this.emails.concat(items)));\n this.emailInputControl.setValue(lastEmail);\n }\n this._emitValidationChange();\n }\n }\n\n private _addEmail() {\n const email: string = this.emailInputControl.value.trim();\n\n // We only want to add the entry if it hasn't already been added\n if (email.length && this.emails.indexOf(email) === -1) {\n this.emails = this.emails.concat(this.emailInputControl.value.trim());\n this._emitValidationChange();\n }\n this.emailInputControl.setValue('');\n }\n\n focus() {\n (this.inputEl.nativeElement as HTMLInputElement).focus();\n }\n\n onBackspace() {\n if (this.emailInputControl.value.length < 1 && this.emails.length > 0) {\n if (this.isPillSelected) {\n this.removeEmail(this.emails[this.emails.length - 1]);\n } else {\n this.isPillSelected = true;\n }\n }\n }\n\n private _emitValidationChange() {\n /**\n * isValid is based on the entered emails and does not include the current value of the form control\n */\n const isValid: boolean = this.emails.length > 0 && this.emails.every(email => this.isValid(email));\n\n this.updated.emit({\n isValid: isValid,\n emails: this.emails,\n control: this.emailInputControl\n });\n }\n\n ngOnDestroy() {\n this._valueChangesSub.unsubscribe();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAgEa,mBAAmB,CAAA;AA9ChC,IAAA,WAAA,GAAA;AA+CY,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAEjC,IAAA,CAAA,MAAM,GAAa,EAAE;AAC9B;;AAEG;QACM,IAAA,CAAA,OAAO,GAAW,EAAE;QACpB,IAAA,CAAA,WAAW,GAAW,EAAE;QACxB,IAAA,CAAA,qBAAqB,GAAW,EAAE;AAC3C;;;AAGG;QACM,IAAA,CAAA,SAAS,GAAwB,EAAE;AAElC,QAAA,IAAA,CAAA,OAAO,GAAoC,IAAI,YAAY,EAAE;QAKhE,IAAA,CAAA,iBAAiB,GAAwB,IAAI,WAAW,CAAC,EAAE,EAAE,UAAU,CAAC,KAAK,CAAC;QAC9E,IAAA,CAAA,cAAc,GAAY,KAAK;AAE9B,QAAA,IAAA,CAAA,sBAAsB,GAAwB,IAAI,WAAW,EAAE;QAC/D,IAAA,CAAA,WAAW,GAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAA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C1B,oBAAA,OAAO,EAAE,CAAC,KAAK,EAAE,mBAAmB;AACvC,iBAAA;;sBAII;;sBAIA;;sBACA;;sBACA;;sBAKA;;sBAEA;;sBAEA,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;sBACrC,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;;ACnF5C;;AAEG;;;;"}
1
+ {"version":3,"file":"nw-style-guide-email-input.mjs","sources":["../../../projects/nw-style-guide/email-input/email-input.component.ts","../../../projects/nw-style-guide/email-input/nw-style-guide-email-input.ts"],"sourcesContent":["import {\n Component,\n OnInit,\n ViewChild,\n ElementRef,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnDestroy,\n Input,\n Output,\n EventEmitter,\n inject\n} from '@angular/core';\nimport { FormControl, Validators, ReactiveFormsModule } from '@angular/forms';\nimport { IValidationChange } from './models/IValidationChange';\nimport { Subscription } from 'rxjs';\n\n@Component({\n selector: 'nw-email-input',\n template: `\n <div\n class=\"emails-container form-control input-lg\"\n #container\n [class.show-placeholder]=\"emails.length < 1 && emailInputControl.value.length < 1\"\n (click)=\"onContainerClick($event)\"\n (paste)=\"onPaste($event)\"\n [attr.data-placeholder-text]=\"placeholder\">\n @for (email of emails; track email; let last = $last) {\n <div\n class=\"pill pill-sm\"\n [class.invalid]=\"!isValid(email)\"\n [class.selected]=\"last && isPillSelected\">\n <span class=\"pill-label\">{{ email }}</span>\n <button\n type=\"button\"\n class=\"close\"\n (click)=\"removeEmail(email)\">\n ×\n </button>\n </div>\n }\n\n <div\n class=\"input-container\"\n [class.persistent-placeholder]=\"persistentPlaceholder\">\n <!-- pill-hidden is an invisble element that controls the width of the input -->\n <div class=\"pill pill-sm pill-hidden\">{{ emailInputControl.value }}</div>\n <input\n type=\"text\"\n #inputEl\n [id]=\"inputId\"\n [formControl]=\"emailInputControl\"\n (keydown)=\"onKeydown($event)\"\n (keydown.tab)=\"onTab($event)\"\n (keyup.backspace)=\"onBackspace()\"\n [placeholder]=\"persistentPlaceholder\"\n (blur)=\"onBlur()\" />\n </div>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n exportAs: 'nw-email-input',\n imports: [ReactiveFormsModule]\n})\nexport class EmailInputComponent implements OnInit, OnDestroy {\n private _cdRef = inject(ChangeDetectorRef);\n\n @Input() emails: string[] = [];\n /**\n * Applied to the HTMLInputElement. Mostly useful for label using the \"for\" attribute\n */\n @Input() inputId: string = '';\n @Input() placeholder: string = '';\n @Input() persistentPlaceholder: string = '';\n /**\n * A list of strings or RegExp to be matched against the inputted list of emails. Any emails that\n * match entries in the blacklist will be marked as invalid\n */\n @Input() blacklist: (string | RegExp)[] = [];\n\n @Output() updated: EventEmitter<IValidationChange> = new EventEmitter();\n\n @ViewChild('inputEl', { static: true }) inputEl: ElementRef;\n @ViewChild('container', { static: true }) container: ElementRef;\n\n public emailInputControl: FormControl<string> = new FormControl('', Validators.email);\n public isPillSelected: boolean = false;\n\n private _validationFormControl: FormControl<string> = new FormControl();\n private _submitKeys: string[] = [',', 'Enter', ' ', ';'];\n private _valueChangesSub: Subscription;\n\n ngOnInit() {\n this._subscribeToValueChanges();\n this._emitValidationChange();\n }\n\n private _subscribeToValueChanges() {\n this._valueChangesSub = this.emailInputControl.valueChanges.subscribe(value => {\n if (value.length > 0) {\n this.isPillSelected = false;\n this._cdRef.detectChanges();\n }\n });\n }\n\n removeEmail(email: string) {\n const index = this.emails.indexOf(email, 0);\n\n if (index > -1) {\n this.emails = this.emails.filter(value => value !== email);\n this._emitValidationChange();\n }\n }\n\n onBlur() {\n this.isPillSelected = false;\n this._addEmail();\n }\n\n onKeydown(event: KeyboardEvent): void {\n const index = this._submitKeys.indexOf(event.key, 0);\n\n if (index > -1) {\n event.preventDefault();\n this._addEmail();\n this.focus();\n }\n\n if (event.key === 'Escape') {\n event.stopPropagation();\n this.emailInputControl.setValue('');\n (this.inputEl.nativeElement as HTMLInputElement).blur();\n }\n }\n\n onTab(event: KeyboardEvent) {\n /**\n * If the input has a value, add it as an entry.\n *\n * Otherwise, allow the default tab behaviour\n */\n if (this.emailInputControl.value.length > 0) {\n event.preventDefault();\n this._addEmail();\n this.focus();\n }\n }\n\n isValid(email: string): boolean {\n this._validationFormControl.setValue(email);\n const isBlacklisted = this.blacklist.some(item => {\n /**\n * If item in blacklist is a string, create a regular expression to match the full\n * case-insenstive string\n */\n if (typeof item === 'string') {\n return email.match(new RegExp(`^${item}$`, 'i'));\n }\n return email.match(item);\n });\n\n return Validators.email(this._validationFormControl) === null && !isBlacklisted;\n }\n\n onContainerClick(event: MouseEvent) {\n /**\n * We're only interested in this event if it originates from the container element.\n *\n * We don't care about events that bubble up from child elements.\n */\n if (event.target === this.container.nativeElement) {\n this.focus();\n }\n }\n\n onPaste(event: ClipboardEvent) {\n if (event.clipboardData) {\n event.preventDefault();\n\n this.emailInputControl.markAsDirty();\n\n const selectionStart: number = (this.inputEl.nativeElement as HTMLInputElement).selectionStart;\n const selectionEnd: number = (this.inputEl.nativeElement as HTMLInputElement).selectionEnd;\n const controlValue: string = this.emailInputControl.value as string;\n\n let pastedData: string = event.clipboardData.getData('text');\n\n /**\n * We need to check if the input already has a value when the user pasted\n */\n if (this.emailInputControl.value.length) {\n /**\n * The user has selected text in the input\n */\n if (selectionStart !== selectionEnd) {\n const newValue: string = controlValue.slice(0, selectionStart) + controlValue.slice(selectionEnd);\n pastedData = newValue.slice(0, selectionStart) + pastedData + newValue.slice(selectionStart);\n } else {\n pastedData =\n controlValue.slice(0, selectionStart) + pastedData + controlValue.slice(selectionStart);\n }\n }\n\n const items: string[] = pastedData\n .split(/\\s+/)\n .map(item => item.split(/,|;/g))\n .reduce((acc, curr) => acc.concat(curr), [])\n .filter(item => item);\n\n const lastEmail: string = items[items.length - 1];\n\n if (this.isValid(lastEmail)) {\n // Use Set to remove duplicate emails\n this.emails = Array.from(new Set(this.emails.concat(items)));\n this.emailInputControl.setValue('');\n } else {\n items.pop();\n // Use Set to remove duplicate emails\n this.emails = Array.from(new Set(this.emails.concat(items)));\n this.emailInputControl.setValue(lastEmail);\n }\n this._emitValidationChange();\n }\n }\n\n private _addEmail() {\n const email: string = this.emailInputControl.value.trim();\n\n // We only want to add the entry if it hasn't already been added\n if (email.length && this.emails.indexOf(email) === -1) {\n this.emails = this.emails.concat(this.emailInputControl.value.trim());\n this._emitValidationChange();\n }\n this.emailInputControl.setValue('');\n }\n\n focus() {\n (this.inputEl.nativeElement as HTMLInputElement).focus();\n }\n\n onBackspace() {\n if (this.emailInputControl.value.length < 1 && this.emails.length > 0) {\n if (this.isPillSelected) {\n this.removeEmail(this.emails[this.emails.length - 1]);\n } else {\n this.isPillSelected = true;\n }\n }\n }\n\n private _emitValidationChange() {\n /**\n * isValid is based on the entered emails and does not include the current value of the form control\n */\n const isValid: boolean = this.emails.length > 0 && this.emails.every(email => this.isValid(email));\n\n this.updated.emit({\n isValid: isValid,\n emails: this.emails,\n control: this.emailInputControl\n });\n }\n\n ngOnDestroy() {\n this._valueChangesSub.unsubscribe();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAgEa,mBAAmB,CAAA;AA/ChC,IAAA,WAAA,GAAA;AAgDY,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAEjC,IAAA,CAAA,MAAM,GAAa,EAAE;AAC9B;;AAEG;QACM,IAAA,CAAA,OAAO,GAAW,EAAE;QACpB,IAAA,CAAA,WAAW,GAAW,EAAE;QACxB,IAAA,CAAA,qBAAqB,GAAW,EAAE;AAC3C;;;AAGG;QACM,IAAA,CAAA,SAAS,GAAwB,EAAE;AAElC,QAAA,IAAA,CAAA,OAAO,GAAoC,IAAI,YAAY,EAAE;QAKhE,IAAA,CAAA,iBAAiB,GAAwB,IAAI,WAAW,CAAC,EAAE,EAAE,UAAU,CAAC,KA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BAAgB;AAC1B,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCT,IAAA,CAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,QAAQ,EAAE,gBAAgB;oBAC1B,OAAO,EAAE,CAAC,mBAAmB;AAChC,iBAAA;;sBAII;;sBAIA;;sBACA;;sBACA;;sBAKA;;sBAEA;;sBAEA,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;sBACrC,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;;ACnF5C;;AAEG;;;;"}
@@ -1,7 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, inject, ChangeDetectorRef, Input, ChangeDetectionStrategy, Component, TemplateRef, ViewContainerRef, Directive } from '@angular/core';
3
3
  import { Subject, Observable } from 'rxjs';
4
- import { NgIf } from '@angular/common';
5
4
  import { filter, takeUntil } from 'rxjs/operators';
6
5
 
7
6
  const _window = () => {
@@ -74,25 +73,26 @@ class HotspotComponent {
74
73
  this._cdRef.detectChanges();
75
74
  }
76
75
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: HotspotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
77
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.8", type: HotspotComponent, isStandalone: true, selector: "nw-hotspot", inputs: { position: "position", id: "id" }, ngImport: i0, template: `
78
- <div
79
- animate.leave="fade-out"
80
- *ngIf="isOpen"
81
- class="hotspot hotspot-{{ position }}"></div>
82
- `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
76
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: HotspotComponent, isStandalone: true, selector: "nw-hotspot", inputs: { position: "position", id: "id" }, ngImport: i0, template: `
77
+ @if (isOpen) {
78
+ <div
79
+ animate.leave="fade-out"
80
+ class="hotspot hotspot-{{ position }}"></div>
81
+ }
82
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
83
83
  }
84
84
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: HotspotComponent, decorators: [{
85
85
  type: Component,
86
86
  args: [{
87
87
  selector: 'nw-hotspot',
88
88
  template: `
89
- <div
90
- animate.leave="fade-out"
91
- *ngIf="isOpen"
92
- class="hotspot hotspot-{{ position }}"></div>
89
+ @if (isOpen) {
90
+ <div
91
+ animate.leave="fade-out"
92
+ class="hotspot hotspot-{{ position }}"></div>
93
+ }
93
94
  `,
94
- changeDetection: ChangeDetectionStrategy.OnPush,
95
- imports: [NgIf]
95
+ changeDetection: ChangeDetectionStrategy.OnPush
96
96
  }]
97
97
  }], propDecorators: { position: [{
98
98
  type: Input