cps-ui-kit 21.7.0 → 21.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import * as i2 from '@angular/common';
2
2
  import { DOCUMENT, CommonModule, isPlatformBrowser } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { InjectionToken, inject, Input, Inject, Component, EventEmitter, Output, ElementRef, SecurityContext, HostListener, Directive, Pipe, PLATFORM_ID, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, Self, Optional, HostBinding, input, computed, numberAttribute, Injectable, ChangeDetectorRef, ViewChildren, TemplateRef, ContentChildren, Host, ContentChild, RendererStyleFlags2, createComponent, createEnvironmentInjector, SkipSelf, signal } from '@angular/core';
4
+ import { InjectionToken, inject, Input, Inject, Component, EventEmitter, Output, input, computed, ElementRef, SecurityContext, HostListener, Directive, Pipe, PLATFORM_ID, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, Self, Optional, HostBinding, numberAttribute, booleanAttribute, Injectable, ChangeDetectorRef, ViewChildren, TemplateRef, ContentChildren, Host, ContentChild, RendererStyleFlags2, createComponent, createEnvironmentInjector, SkipSelf, signal } from '@angular/core';
5
5
  import * as i1$2 from '@angular/forms';
6
6
  import { Validators, FormsModule, FormBuilder, ReactiveFormsModule } from '@angular/forms';
7
7
  import { Subject, takeUntil, debounceTime, distinctUntilChanged, take, catchError, of, Subscription, fromEvent } from 'rxjs';
@@ -72,6 +72,11 @@ const getComputedLabel = (context) => {
72
72
  }
73
73
  return parts.length > 0 ? parts.join(' ') : null;
74
74
  };
75
+ const focusElement = (element) => {
76
+ if (element) {
77
+ setTimeout(() => element.focus());
78
+ }
79
+ };
75
80
 
76
81
  const isSameDomain = (styleSheet, _window) => {
77
82
  if (!styleSheet.href) {
@@ -452,69 +457,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
452
457
  * @group Components
453
458
  */
454
459
  class CpsProgressLinearComponent {
455
- // eslint-disable-next-line no-useless-constructor
456
- constructor(document) {
457
- this.document = document;
460
+ constructor() {
458
461
  /**
459
462
  * Width of the progress bar, of type number denoting pixels or string.
460
463
  * @group Props
464
+ * @default 100%
461
465
  */
462
- this.width = '100%';
466
+ this.width = input('100%', ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
463
467
  /**
464
468
  * Height of the progress bar, of type number denoting pixels or string.
465
469
  * @group Props
470
+ * @default 0.5rem
466
471
  */
467
- this.height = '0.5rem';
472
+ this.height = input('0.5rem', ...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
468
473
  /**
469
474
  * Color of the progress bar.
470
475
  * @group Props
476
+ * @default var(--cps-accent-primary)
471
477
  */
472
- this.color = 'var(--cps-accent-primary)';
478
+ this.color = input('var(--cps-accent-primary)', ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
473
479
  /**
474
480
  * Background color of the progress bar.
475
481
  * @group Props
482
+ * @default white
476
483
  */
477
- this.bgColor = 'white';
484
+ this.bgColor = input('white', ...(ngDevMode ? [{ debugName: "bgColor" }] : /* istanbul ignore next */ []));
478
485
  /**
479
486
  * Option to control the opacity of the progress bar.
480
487
  * @group Props
488
+ * @default 1
481
489
  */
482
- this.opacity = 1;
490
+ this.opacity = input(1, ...(ngDevMode ? [{ debugName: "opacity" }] : /* istanbul ignore next */ []));
483
491
  /**
484
492
  * Border radius of the progress bar, of type number denoting pixels or string.
485
493
  * @group Props
494
+ * @default 0
486
495
  */
487
- this.radius = 0;
488
- }
489
- ngOnInit() {
490
- this.width = convertSize(this.width);
491
- this.height = convertSize(this.height);
492
- this.radius = convertSize(this.radius);
493
- this.color = getCSSColor(this.color, this.document);
494
- this.bgColor = getCSSColor(this.bgColor, this.document);
495
- }
496
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CpsProgressLinearComponent, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component }); }
497
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.8", type: CpsProgressLinearComponent, isStandalone: true, selector: "cps-progress-linear", inputs: { width: "width", height: "height", color: "color", bgColor: "bgColor", opacity: "opacity", radius: "radius" }, ngImport: i0, template: "<div\n class=\"cps-progress-linear\"\n [ngStyle]=\"{\n 'max-width': width,\n height: height,\n 'border-radius': radius,\n background: bgColor\n }\">\n <div\n class=\"cps-progress-linear-line inc\"\n [style.background]=\"color\"\n [style.opacity]=\"opacity\"></div>\n <div\n class=\"cps-progress-linear-line dec\"\n [style.background]=\"color\"\n [style.opacity]=\"opacity\"></div>\n</div>\n", styles: [":host{width:100%}:host .cps-progress-linear{position:relative;overflow-x:hidden}:host .cps-progress-linear-line{position:absolute;height:inherit;left:-5%;top:0}:host .cps-progress-linear .inc{animation:increase 2s infinite}:host .cps-progress-linear .dec{animation:decrease 2s .5s infinite}@keyframes increase{0%{left:-5%;width:5%}to{left:130%;width:100%}}@keyframes decrease{0%{left:-80%;width:80%}to{left:110%;width:10%}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
496
+ this.radius = input(0, ...(ngDevMode ? [{ debugName: "radius" }] : /* istanbul ignore next */ []));
497
+ this.document = inject(DOCUMENT);
498
+ this.cvtWidth = computed(() => convertSize(this.width()), ...(ngDevMode ? [{ debugName: "cvtWidth" }] : /* istanbul ignore next */ []));
499
+ this.cvtHeight = computed(() => convertSize(this.height()), ...(ngDevMode ? [{ debugName: "cvtHeight" }] : /* istanbul ignore next */ []));
500
+ this.cvtRadius = computed(() => convertSize(this.radius()), ...(ngDevMode ? [{ debugName: "cvtRadius" }] : /* istanbul ignore next */ []));
501
+ this.cssColor = computed(() => getCSSColor(this.color(), this.document), ...(ngDevMode ? [{ debugName: "cssColor" }] : /* istanbul ignore next */ []));
502
+ this.cssBgColor = computed(() => getCSSColor(this.bgColor(), this.document), ...(ngDevMode ? [{ debugName: "cssBgColor" }] : /* istanbul ignore next */ []));
503
+ }
504
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CpsProgressLinearComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
505
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: CpsProgressLinearComponent, isStandalone: true, selector: "cps-progress-linear", inputs: { width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, bgColor: { classPropertyName: "bgColor", publicName: "bgColor", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div\n class=\"cps-progress-linear\"\n [style.max-width]=\"cvtWidth()\"\n [style.height]=\"cvtHeight()\"\n [style.border-radius]=\"cvtRadius()\"\n [style.background]=\"cssBgColor()\">\n <div\n class=\"cps-progress-linear-line inc\"\n [style.background]=\"cssColor()\"\n [style.opacity]=\"opacity()\"></div>\n <div\n class=\"cps-progress-linear-line dec\"\n [style.background]=\"cssColor()\"\n [style.opacity]=\"opacity()\"></div>\n</div>\n", styles: [":host{width:100%}:host .cps-progress-linear{position:relative;overflow-x:hidden}:host .cps-progress-linear-line{position:absolute;height:inherit;left:-5%;top:0}:host .cps-progress-linear .inc{animation:increase 2s infinite}:host .cps-progress-linear .dec{animation:decrease 2s .5s infinite}@keyframes increase{0%{left:-5%;width:5%}to{left:130%;width:100%}}@keyframes decrease{0%{left:-80%;width:80%}to{left:110%;width:10%}}\n"] }); }
498
506
  }
499
507
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CpsProgressLinearComponent, decorators: [{
500
508
  type: Component,
501
- args: [{ imports: [CommonModule], selector: 'cps-progress-linear', template: "<div\n class=\"cps-progress-linear\"\n [ngStyle]=\"{\n 'max-width': width,\n height: height,\n 'border-radius': radius,\n background: bgColor\n }\">\n <div\n class=\"cps-progress-linear-line inc\"\n [style.background]=\"color\"\n [style.opacity]=\"opacity\"></div>\n <div\n class=\"cps-progress-linear-line dec\"\n [style.background]=\"color\"\n [style.opacity]=\"opacity\"></div>\n</div>\n", styles: [":host{width:100%}:host .cps-progress-linear{position:relative;overflow-x:hidden}:host .cps-progress-linear-line{position:absolute;height:inherit;left:-5%;top:0}:host .cps-progress-linear .inc{animation:increase 2s infinite}:host .cps-progress-linear .dec{animation:decrease 2s .5s infinite}@keyframes increase{0%{left:-5%;width:5%}to{left:130%;width:100%}}@keyframes decrease{0%{left:-80%;width:80%}to{left:110%;width:10%}}\n"] }]
502
- }], ctorParameters: () => [{ type: Document, decorators: [{
503
- type: Inject,
504
- args: [DOCUMENT]
505
- }] }], propDecorators: { width: [{
506
- type: Input
507
- }], height: [{
508
- type: Input
509
- }], color: [{
510
- type: Input
511
- }], bgColor: [{
512
- type: Input
513
- }], opacity: [{
514
- type: Input
515
- }], radius: [{
516
- type: Input
517
- }] } });
509
+ args: [{ selector: 'cps-progress-linear', template: "<div\n class=\"cps-progress-linear\"\n [style.max-width]=\"cvtWidth()\"\n [style.height]=\"cvtHeight()\"\n [style.border-radius]=\"cvtRadius()\"\n [style.background]=\"cssBgColor()\">\n <div\n class=\"cps-progress-linear-line inc\"\n [style.background]=\"cssColor()\"\n [style.opacity]=\"opacity()\"></div>\n <div\n class=\"cps-progress-linear-line dec\"\n [style.background]=\"cssColor()\"\n [style.opacity]=\"opacity()\"></div>\n</div>\n", styles: [":host{width:100%}:host .cps-progress-linear{position:relative;overflow-x:hidden}:host .cps-progress-linear-line{position:absolute;height:inherit;left:-5%;top:0}:host .cps-progress-linear .inc{animation:increase 2s infinite}:host .cps-progress-linear .dec{animation:decrease 2s .5s infinite}@keyframes increase{0%{left:-5%;width:5%}to{left:130%;width:100%}}@keyframes decrease{0%{left:-80%;width:80%}to{left:110%;width:10%}}\n"] }]
510
+ }], propDecorators: { width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], bgColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "bgColor", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], radius: [{ type: i0.Input, args: [{ isSignal: true, alias: "radius", required: false }] }] } });
518
511
 
519
512
  /**
520
513
  * CpsTooltipDirective provides advisory information for a target element.
@@ -3931,21 +3924,25 @@ class CpsDividerComponent {
3931
3924
  /**
3932
3925
  * Determines whether the divider is vertically aligned.
3933
3926
  * @group Props
3927
+ * @default false
3934
3928
  */
3935
3929
  this.vertical = input(false, ...(ngDevMode ? [{ debugName: "vertical" }] : /* istanbul ignore next */ []));
3936
3930
  /**
3937
3931
  * Color of the divider.
3938
3932
  * @group Props
3933
+ * @default line-mid
3939
3934
  */
3940
3935
  this.color = input('line-mid', ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
3941
3936
  /**
3942
3937
  * Type of the divider.
3943
3938
  * @group Props
3939
+ * @default solid
3944
3940
  */
3945
3941
  this.type = input('solid', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
3946
3942
  /**
3947
3943
  * Thickness of the divider, a number denoting pixels or a string.
3948
3944
  * @group Props
3945
+ * @default 1px
3949
3946
  */
3950
3947
  this.thickness = input('1px', ...(ngDevMode ? [{ debugName: "thickness" }] : /* istanbul ignore next */ []));
3951
3948
  this.borderTop = computed(() => {
@@ -4196,15 +4193,20 @@ class CpsFileUploadComponent {
4196
4193
  */
4197
4194
  this.fileDesc = 'Any file';
4198
4195
  /**
4199
- * Width of the component, a number denoting pixels or a string.
4196
+ * Aria label for the component, used for accessibility.
4200
4197
  * @group Props
4201
4198
  */
4202
- this.width = '100%';
4199
+ this.ariaLabel = 'Upload file';
4203
4200
  /**
4204
4201
  * Expected file info block, explaining some extra stuff about file.
4205
4202
  * @group Props
4206
4203
  */
4207
4204
  this.fileInfo = '';
4205
+ /**
4206
+ * Whether the component is disabled.
4207
+ * @group Props
4208
+ */
4209
+ this.disabled = false;
4208
4210
  /**
4209
4211
  * Callback for uploaded file processing.
4210
4212
  * @group Props
@@ -4220,6 +4222,12 @@ class CpsFileUploadComponent {
4220
4222
  * @group Props
4221
4223
  */
4222
4224
  this.fileNameTooltipOffset = 12;
4225
+ /**
4226
+ * Width of the component, a number denoting pixels or a string.
4227
+ * @group Props
4228
+ * @default 100%
4229
+ */
4230
+ this.width = input('100%', ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
4223
4231
  /**
4224
4232
  * Callback to invoke when file is uploaded.
4225
4233
  * @param {File} File
@@ -4232,6 +4240,24 @@ class CpsFileUploadComponent {
4232
4240
  * @group Emits
4233
4241
  */
4234
4242
  this.fileUploadFailed = new EventEmitter();
4243
+ /**
4244
+ * Callback to invoke when file is processed.
4245
+ * @param {File} File
4246
+ * @group Emits
4247
+ */
4248
+ this.fileProcessed = new EventEmitter();
4249
+ /**
4250
+ * Callback to invoke when file processing fails.
4251
+ * @param {string} - file name
4252
+ * @group Emits
4253
+ */
4254
+ this.fileProcessingFailed = new EventEmitter();
4255
+ /**
4256
+ * Callback to invoke when file processing is cancelled.
4257
+ * @param {string} - file name
4258
+ * @group Emits
4259
+ */
4260
+ this.fileProcessingCancelled = new EventEmitter();
4235
4261
  /**
4236
4262
  * Callback to invoke when uploaded file is removed.
4237
4263
  * @param {string} - file name
@@ -4241,18 +4267,60 @@ class CpsFileUploadComponent {
4241
4267
  this.isDragoverFile = false;
4242
4268
  this.extensionsString = '';
4243
4269
  this.extensionsStringAsterisks = '';
4244
- this.cvtWidth = '';
4270
+ this.cvtWidth = computed(() => convertSize(this.width()), ...(ngDevMode ? [{ debugName: "cvtWidth" }] : /* istanbul ignore next */ []));
4245
4271
  this.isProcessingFile = false;
4272
+ this.errorMessage = '';
4273
+ this.dragCounter = 0;
4274
+ this.cancelProcessing$ = new Subject();
4246
4275
  }
4247
4276
  ngOnInit() {
4248
4277
  this.updateExtensionsString();
4249
- this.cvtWidth = convertSize(this.width);
4278
+ }
4279
+ ngOnDestroy() {
4280
+ this.cancelProcessing$.next();
4281
+ this.cancelProcessing$.complete();
4250
4282
  }
4251
4283
  ngOnChanges(changes) {
4252
4284
  if (changes.extensions) {
4253
4285
  this.updateExtensionsString();
4254
4286
  }
4255
4287
  }
4288
+ resetState() {
4289
+ this.cancelFileProcessing();
4290
+ this.errorMessage = '';
4291
+ this.dragCounter = 0;
4292
+ this.isDragoverFile = false;
4293
+ }
4294
+ openFilePicker() {
4295
+ if (this.isProcessingFile)
4296
+ return;
4297
+ this.fileInput?.nativeElement.click();
4298
+ }
4299
+ onDragEnter() {
4300
+ this.dragCounter++;
4301
+ this.isDragoverFile = true;
4302
+ }
4303
+ onDragLeave() {
4304
+ this.dragCounter--;
4305
+ if (this.dragCounter <= 0) {
4306
+ this.isDragoverFile = false;
4307
+ this.dragCounter = 0;
4308
+ }
4309
+ }
4310
+ onDragEnd() {
4311
+ this.dragCounter = 0;
4312
+ this.isDragoverFile = false;
4313
+ }
4314
+ onDragOver(event) {
4315
+ event.preventDefault();
4316
+ this.isDragoverFile = true;
4317
+ }
4318
+ onDrop(event) {
4319
+ event.preventDefault();
4320
+ this.dragCounter = 0;
4321
+ this.isDragoverFile = false;
4322
+ this.tryUploadFile(event);
4323
+ }
4256
4324
  updateExtensionsString() {
4257
4325
  this.extensions = this.extensions.map((ext) => ext.startsWith('.') ? ext.toLowerCase() : '.' + ext.toLowerCase());
4258
4326
  this.extensionsString = this.extensions.join(', ');
@@ -4263,7 +4331,10 @@ class CpsFileUploadComponent {
4263
4331
  tryUploadFile(event) {
4264
4332
  event.preventDefault();
4265
4333
  event.stopPropagation();
4334
+ if (this.isProcessingFile)
4335
+ return;
4266
4336
  this.isDragoverFile = false;
4337
+ this.errorMessage = '';
4267
4338
  let file;
4268
4339
  if (event.type === 'drop') {
4269
4340
  file = event.dataTransfer?.files.item(0) ?? undefined;
@@ -4275,6 +4346,7 @@ class CpsFileUploadComponent {
4275
4346
  file = files.item(0) ?? undefined;
4276
4347
  }
4277
4348
  if (!this._isFileExtensionValid(file)) {
4349
+ this.errorMessage = 'Unsupported file type';
4278
4350
  this.fileUploadFailed.emit(file?.name ?? '');
4279
4351
  return;
4280
4352
  }
@@ -4284,23 +4356,53 @@ class CpsFileUploadComponent {
4284
4356
  if (this.fileProcessingCallback) {
4285
4357
  this.isProcessingFile = true;
4286
4358
  this.fileProcessingCallback(this.uploadedFile)
4287
- .pipe(take(1), catchError(() => {
4359
+ .pipe(take(1), takeUntil(this.cancelProcessing$), catchError(() => {
4288
4360
  return of(false);
4289
4361
  }))
4290
4362
  .subscribe((res) => {
4291
- if (!res)
4292
- this.removeUploadedFile();
4293
4363
  this.isProcessingFile = false;
4364
+ if (res) {
4365
+ this.fileProcessed.emit(this.uploadedFile);
4366
+ }
4367
+ else {
4368
+ this.errorMessage = 'File processing failed';
4369
+ this.fileProcessingFailed.emit(this.uploadedFile?.name ?? '');
4370
+ this.removeUploadedFile();
4371
+ }
4294
4372
  });
4295
4373
  }
4296
4374
  }
4297
4375
  }
4376
+ onRemoveUploadedFile(event) {
4377
+ event.preventDefault();
4378
+ event.stopPropagation();
4379
+ this.removeUploadedFile();
4380
+ focusElement(this.dropzoneButton?.nativeElement);
4381
+ }
4382
+ onCancelFileProcessing(event) {
4383
+ event.preventDefault();
4384
+ event.stopPropagation();
4385
+ this.cancelFileProcessing();
4386
+ focusElement(this.dropzoneButton?.nativeElement);
4387
+ }
4388
+ cancelFileProcessing() {
4389
+ this.cancelProcessing$.next();
4390
+ this.isProcessingFile = false;
4391
+ const name = this.uploadedFile?.name;
4392
+ if (name) {
4393
+ this.fileProcessingCancelled.emit(name);
4394
+ }
4395
+ this.removeUploadedFile();
4396
+ }
4298
4397
  removeUploadedFile() {
4299
- const name = this.uploadedFile?.name ?? '';
4398
+ const name = this.uploadedFile?.name;
4300
4399
  this.uploadedFile = undefined;
4301
- this.uploadedFileRemoved.emit(name);
4302
- if (this.fileInput) {
4303
- this.fileInput.nativeElement.value = '';
4400
+ if (name) {
4401
+ this.uploadedFileRemoved.emit(name);
4402
+ }
4403
+ const inputEl = this.fileInput?.nativeElement;
4404
+ if (inputEl) {
4405
+ inputEl.value = '';
4304
4406
  }
4305
4407
  }
4306
4408
  _isFileExtensionValid(file) {
@@ -4309,14 +4411,10 @@ class CpsFileUploadComponent {
4309
4411
  if (this.extensions.length < 1)
4310
4412
  return true;
4311
4413
  const fileNameLowerCase = file.name.toLowerCase();
4312
- for (const ext of this.extensions) {
4313
- if (fileNameLowerCase.endsWith(ext))
4314
- return true;
4315
- }
4316
- return false;
4414
+ return this.extensions.some((ext) => fileNameLowerCase.endsWith(ext));
4317
4415
  }
4318
4416
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CpsFileUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4319
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: CpsFileUploadComponent, isStandalone: true, selector: "cps-file-upload", inputs: { extensions: "extensions", fileDesc: "fileDesc", width: "width", fileInfo: "fileInfo", fileProcessingCallback: "fileProcessingCallback", fileNameTooltipPosition: "fileNameTooltipPosition", fileNameTooltipOffset: ["fileNameTooltipOffset", "fileNameTooltipOffset", numberAttribute] }, outputs: { fileUploaded: "fileUploaded", fileUploadFailed: "fileUploadFailed", uploadedFileRemoved: "uploadedFileRemoved" }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"cps-file-upload\" [ngStyle]=\"{ width: cvtWidth }\">\n <div\n class=\"cps-file-upload-dropzone\"\n [ngClass]=\"{\n 'dragged-over': isDragoverFile,\n 'with-uploads': uploadedFile?.name\n }\"\n (dragend)=\"isDragoverFile = false\"\n (dragenter)=\"isDragoverFile = true\"\n (dragleave)=\"isDragoverFile = false\"\n (dragover)=\"isDragoverFile = true\"\n (mouseleave)=\"isDragoverFile = false\"\n (drop)=\"tryUploadFile($event)\">\n <input\n #fileInput\n (change)=\"tryUploadFile($event)\"\n type=\"file\"\n [accept]=\"extensionsString\"\n title=\"\" />\n <cps-icon icon=\"export\" size=\"large\" color=\"text-darkest\"></cps-icon>\n <div class=\"cps-file-upload-dropzone-title\">\n Drag&Drop or choose a file to upload\n </div>\n @if (fileDesc || extensionsStringAsterisks) {\n <span class=\"cps-file-upload-dropzone-file-desc\"\n >{{ fileDesc }}\n {{\n extensionsStringAsterisks ? '(' + extensionsStringAsterisks + ')' : ''\n }}</span\n >\n }\n @if (fileInfo) {\n <div class=\"cps-file-upload-dropzone-content\">\n <cps-icon color=\"calm\" icon=\"info-circle\" size=\"xsmall\"></cps-icon>\n {{ fileInfo }}\n </div>\n }\n @if (isProcessingFile && uploadedFile) {\n <cps-progress-linear\n height=\"3\"\n radius=\"4\"\n opacity=\"0.3\"\n class=\"cps-file-upload-progress-bar\"\n bgColor=\"transparent\">\n </cps-progress-linear>\n }\n </div>\n @if (uploadedFile) {\n <div class=\"cps-file-upload-uploaded-files\">\n <div class=\"cps-file-upload-uploaded-file\">\n <div class=\"cps-file-upload-uploaded-file-title\">\n <cps-icon\n class=\"cps-file-upload-uploaded-file-status-icon\"\n [icon]=\"isProcessingFile ? 'pending' : 'toast-success'\"\n [color]=\"isProcessingFile ? 'warn' : 'success'\">\n </cps-icon>\n <div\n class=\"cps-file-upload-uploaded-file-name\"\n cpsTooltip=\"{{ uploadedFile.name }}\"\n [tooltipPosition]=\"fileNameTooltipPosition\"\n [tooltipOffset]=\"fileNameTooltipOffset\"\n tooltipOpenOn=\"hover\">\n {{ uploadedFile.name }}\n </div>\n </div>\n @if (!isProcessingFile) {\n <cps-icon\n class=\"cps-file-upload-uploaded-file-remove-icon\"\n icon=\"remove\"\n color=\"error\"\n (click)=\"removeUploadedFile()\">\n </cps-icon>\n }\n </div>\n </div>\n }\n</div>\n", styles: [":host{display:flex}:host .cps-file-upload .cps-file-upload-dropzone{font-family:Source Sans Pro,sans-serif;min-height:20px;padding:2rem;text-align:center;border:2px dashed var(--cps-color-calm);position:relative;border-radius:1rem}:host .cps-file-upload .cps-file-upload-dropzone:hover{background-color:var(--cps-color-highlight-hover)}:host .cps-file-upload .cps-file-upload-dropzone:active{background-color:var(--cps-color-highlight-selected)}:host .cps-file-upload .cps-file-upload-dropzone.dragged-over{background-color:var(--cps-color-highlight-selected)}:host .cps-file-upload .cps-file-upload-dropzone.with-uploads{border-bottom-right-radius:0;border-bottom-left-radius:0;border-bottom:1px dashed var(--cps-color-calm)}:host .cps-file-upload .cps-file-upload-dropzone input{cursor:pointer;opacity:0;position:absolute;width:100%;height:100%;top:0;left:0}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-dropzone-title{font-size:16px;margin:8px 0;color:var(--cps-color-calm);font-weight:600}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-dropzone-file-desc{font-size:18px;color:var(--cps-color-text-dark)}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-dropzone-content{margin-top:16px;font-size:1rem}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-progress-bar{position:absolute;bottom:-2px;left:0}:host .cps-file-upload .cps-file-upload-uploaded-files{border-bottom:2px dashed var(--cps-color-calm);border-left:2px dashed var(--cps-color-calm);border-right:2px dashed var(--cps-color-calm);border-bottom-right-radius:16px;border-bottom-left-radius:16px;background-color:var(--cps-color-highlight-hover)}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file{cursor:default;display:flex;align-items:center;justify-content:space-between;padding:8px 12px}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-title{display:flex;align-items:center;flex:1;min-width:0}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-title .cps-file-upload-uploaded-file-name{color:var(--cps-color-text-darkest);font-size:20px;margin:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:calc(100% - 60px)}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon{cursor:pointer;flex-shrink:0;margin-left:8px}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:hover ::ng-deep .cps-icon{color:var(--cps-color-error-darken1)!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: CpsIconComponent, selector: "cps-icon", inputs: ["icon", "size", "color"] }, { kind: "component", type: CpsProgressLinearComponent, selector: "cps-progress-linear", inputs: ["width", "height", "color", "bgColor", "opacity", "radius"] }, { kind: "directive", type: CpsTooltipDirective, selector: "[cpsTooltip]", inputs: ["cpsTooltip", "tooltipOpenDelay", "tooltipCloseDelay", "tooltipOpenOn", "tooltipPosition", "tooltipPersistent", "tooltipDisabled", "tooltipMaxWidth", "tooltipContentClass", "tooltipOffset"] }] }); }
4417
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: CpsFileUploadComponent, isStandalone: true, selector: "cps-file-upload", inputs: { extensions: { classPropertyName: "extensions", publicName: "extensions", isSignal: false, isRequired: false, transformFunction: null }, fileDesc: { classPropertyName: "fileDesc", publicName: "fileDesc", isSignal: false, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: false, isRequired: false, transformFunction: null }, fileInfo: { classPropertyName: "fileInfo", publicName: "fileInfo", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, fileProcessingCallback: { classPropertyName: "fileProcessingCallback", publicName: "fileProcessingCallback", isSignal: false, isRequired: false, transformFunction: null }, fileNameTooltipPosition: { classPropertyName: "fileNameTooltipPosition", publicName: "fileNameTooltipPosition", isSignal: false, isRequired: false, transformFunction: null }, fileNameTooltipOffset: { classPropertyName: "fileNameTooltipOffset", publicName: "fileNameTooltipOffset", isSignal: false, isRequired: false, transformFunction: numberAttribute }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fileUploaded: "fileUploaded", fileUploadFailed: "fileUploadFailed", fileProcessed: "fileProcessed", fileProcessingFailed: "fileProcessingFailed", fileProcessingCancelled: "fileProcessingCancelled", uploadedFileRemoved: "uploadedFileRemoved" }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }, { propertyName: "dropzoneButton", first: true, predicate: ["dropzoneButton"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\n class=\"cps-file-upload\"\n [class.disabled]=\"disabled\"\n [style.width]=\"cvtWidth()\">\n <div class=\"sr-only\" aria-live=\"polite\" aria-atomic=\"true\">\n @if (errorMessage) {\n {{ errorMessage }}\n } @else if (uploadedFile) {\n @if (isProcessingFile) {\n File is being processed\n } @else {\n File successfully uploaded\n }\n }\n </div>\n <button\n #dropzoneButton\n type=\"button\"\n class=\"cps-file-upload-dropzone\"\n [ngClass]=\"{\n 'dragged-over': isDragoverFile,\n 'with-bottom-section': uploadedFile?.name || errorMessage\n }\"\n [disabled]=\"disabled\"\n [class.processing]=\"isProcessingFile\"\n (click)=\"openFilePicker()\"\n (dragend)=\"onDragEnd()\"\n (dragenter)=\"onDragEnter()\"\n (dragleave)=\"onDragLeave()\"\n (dragover)=\"onDragOver($event)\"\n (drop)=\"onDrop($event)\"\n [attr.aria-label]=\"ariaLabel\">\n <input\n #fileInput\n (change)=\"tryUploadFile($event)\"\n type=\"file\"\n [accept]=\"extensionsString\"\n hidden />\n <cps-icon\n icon=\"export\"\n size=\"large\"\n [color]=\"disabled ? 'text-mild' : 'text-darkest'\"></cps-icon>\n <div class=\"cps-file-upload-dropzone-title\">\n Drag&Drop or choose a file to upload\n </div>\n @if (fileDesc || extensionsStringAsterisks) {\n <span class=\"cps-file-upload-dropzone-file-desc\"\n >{{ fileDesc }}\n {{\n extensionsStringAsterisks ? '(' + extensionsStringAsterisks + ')' : ''\n }}</span\n >\n }\n @if (fileInfo) {\n <div class=\"cps-file-upload-dropzone-content\">\n <cps-icon\n [color]=\"disabled ? 'text-mild' : 'info'\"\n icon=\"info-circle\"\n size=\"xsmall\"></cps-icon>\n {{ fileInfo }}\n </div>\n }\n @if (isProcessingFile && uploadedFile) {\n <cps-progress-linear\n height=\"0.1875rem\"\n radius=\"0.25rem\"\n opacity=\"0.3\"\n [color]=\"disabled ? 'text-mild' : 'calm'\"\n class=\"cps-file-upload-progress-bar\"\n bgColor=\"transparent\">\n </cps-progress-linear>\n }\n </button>\n @if (errorMessage) {\n <div class=\"cps-file-upload-error\">\n <cps-icon\n icon=\"toast-error\"\n [color]=\"disabled ? 'text-light' : 'error'\"></cps-icon>\n <span>{{ errorMessage }}</span>\n </div>\n }\n @if (uploadedFile) {\n <div class=\"cps-file-upload-uploaded-files\">\n <div class=\"cps-file-upload-uploaded-file\">\n <div class=\"cps-file-upload-uploaded-file-title\">\n <cps-icon\n class=\"cps-file-upload-uploaded-file-status-icon\"\n [icon]=\"isProcessingFile ? 'pending' : 'toast-success'\"\n [color]=\"\n disabled ? 'text-light' : isProcessingFile ? 'warn' : 'success'\n \">\n </cps-icon>\n <div\n class=\"cps-file-upload-uploaded-file-name\"\n cpsTooltip=\"{{ uploadedFile.name }}\"\n [tooltipPosition]=\"fileNameTooltipPosition\"\n [tooltipOffset]=\"fileNameTooltipOffset\"\n tooltipOpenOn=\"hover\">\n {{ uploadedFile.name }}\n </div>\n </div>\n @if (!disabled) {\n @if (isProcessingFile) {\n <cps-icon\n role=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"'Cancel file processing'\"\n class=\"cps-file-upload-uploaded-file-cancel-process-icon\"\n icon=\"close-x\"\n color=\"error\"\n (click)=\"onCancelFileProcessing($event)\"\n (keydown.enter)=\"onCancelFileProcessing($event)\"\n (keydown.space)=\"onCancelFileProcessing($event)\">\n </cps-icon>\n } @else {\n <cps-icon\n role=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"'Remove uploaded file'\"\n class=\"cps-file-upload-uploaded-file-remove-icon\"\n icon=\"remove\"\n color=\"error\"\n (click)=\"onRemoveUploadedFile($event)\"\n (keydown.enter)=\"onRemoveUploadedFile($event)\"\n (keydown.space)=\"onRemoveUploadedFile($event)\">\n </cps-icon>\n }\n }\n </div>\n </div>\n }\n</div>\n", styles: [":host{display:flex}:host .cps-file-upload{min-width:0;position:relative}:host .cps-file-upload .cps-file-upload-dropzone{background:transparent;font-family:Source Sans Pro,sans-serif;min-height:1.25rem;padding:2rem;text-align:center;border:.125rem dashed var(--cps-color-calm);position:relative;border-radius:1rem;display:block;width:100%;box-sizing:border-box;cursor:pointer;-webkit-user-select:none;user-select:none}:host .cps-file-upload .cps-file-upload-dropzone:hover{background-color:var(--cps-color-highlight-hover)}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible{outline:none;position:relative}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:before,:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:after{content:\"\";position:absolute;border-radius:inherit}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:before{inset:-.25rem;border:.0625rem solid var(--cps-color-calm)}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:after{inset:-.375rem;border:.0625rem solid var(--cps-color-calm-highlighten)}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:not(.processing){outline:none;position:relative}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:not(.processing):before,:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:not(.processing):after{content:\"\";position:absolute;border-radius:inherit}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:not(.processing):before{inset:-.25rem;border:.0625rem solid var(--cps-color-calm)}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:not(.processing):after{inset:-.375rem;border:.0625rem solid var(--cps-color-calm-highlighten)}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:not(.processing){background-color:var(--cps-color-highlight-hover)}:host .cps-file-upload .cps-file-upload-dropzone:active:not(.processing){background-color:var(--cps-color-highlight-selected)}:host .cps-file-upload .cps-file-upload-dropzone.processing{pointer-events:none;cursor:default}:host .cps-file-upload .cps-file-upload-dropzone.dragged-over{background-color:var(--cps-color-highlight-selected)}:host .cps-file-upload .cps-file-upload-dropzone.with-bottom-section{border-bottom-right-radius:0;border-bottom-left-radius:0;border-bottom:.0625rem dashed var(--cps-color-calm)}:host .cps-file-upload .cps-file-upload-dropzone input{cursor:pointer;opacity:0;position:absolute;inset:0;width:100%;height:100%}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-dropzone-title{font-size:1rem;margin:.5rem 0;color:var(--cps-color-calm);font-weight:600}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-dropzone-file-desc{font-size:1.125rem;color:var(--cps-color-text-dark)}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-dropzone-content{margin-top:1rem;font-size:1rem;color:var(--cps-color-text-dark)}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-progress-bar{position:absolute;bottom:-.125rem;left:0}:host .cps-file-upload .cps-file-upload-uploaded-files{border-bottom:.125rem dashed var(--cps-color-calm);border-left:.125rem dashed var(--cps-color-calm);border-right:.125rem dashed var(--cps-color-calm);border-bottom-right-radius:1rem;border-bottom-left-radius:1rem;background-color:var(--cps-color-highlight-hover)}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file{cursor:default;display:flex;align-items:center;justify-content:space-between;padding:.5rem .75rem}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-title{display:flex;align-items:center;flex:1;min-width:0}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-title .cps-file-upload-uploaded-file-name{color:var(--cps-color-text-darkest);font-size:1.25rem;margin:0 .5rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:calc(100% - 3.75rem)}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon{cursor:pointer;flex-shrink:0;margin-left:.5rem}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:focus,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:focus{outline:none}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:focus-visible,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:focus-visible{outline:none;position:relative}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:focus-visible:before,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:focus-visible:after,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:focus-visible:before,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:focus-visible:after{content:\"\";position:absolute;border-radius:.375rem}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:focus-visible:before,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:focus-visible:before{inset:-.125rem;border:.0625rem solid var(--cps-color-calm)}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:focus-visible:after,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:focus-visible:after{inset:-.25rem;border:.0625rem solid var(--cps-color-calm-highlighten)}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:hover ::ng-deep .cps-icon,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:hover ::ng-deep .cps-icon{color:var(--cps-color-error-darken1)!important}:host .cps-file-upload .cps-file-upload-error{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;overflow:hidden;border-bottom:.125rem dashed var(--cps-color-calm);border-left:.125rem dashed var(--cps-color-calm);border-right:.125rem dashed var(--cps-color-calm);border-bottom-right-radius:1rem;border-bottom-left-radius:1rem;background-color:var(--cps-color-highlight-hover);color:var(--cps-color-error);font-size:1.25rem}:host .cps-file-upload .cps-file-upload-error span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host .cps-file-upload.disabled{pointer-events:none}:host .cps-file-upload.disabled .cps-file-upload-dropzone{border-color:var(--cps-color-line-darkest);cursor:not-allowed}:host .cps-file-upload.disabled .cps-file-upload-dropzone .cps-file-upload-dropzone-title{color:var(--cps-color-text-mild)}:host .cps-file-upload.disabled .cps-file-upload-dropzone .cps-file-upload-dropzone-file-desc{color:var(--cps-color-text-mild)}:host .cps-file-upload.disabled .cps-file-upload-dropzone .cps-file-upload-dropzone-content{color:var(--cps-color-text-mild)}:host .cps-file-upload.disabled .cps-file-upload-uploaded-files{border-color:var(--cps-color-line-darkest);background-color:var(--cps-color-bg-disabled)}:host .cps-file-upload.disabled .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-title .cps-file-upload-uploaded-file-name{color:var(--cps-color-text-mild)}:host .cps-file-upload.disabled .cps-file-upload-error{border-color:var(--cps-color-line-darkest);background-color:var(--cps-color-bg-disabled);color:var(--cps-color-text-mild)}:host .cps-file-upload .sr-only{position:absolute;width:.0625rem;height:.0625rem;padding:0;margin:-.0625rem;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: CpsIconComponent, selector: "cps-icon", inputs: ["icon", "size", "color"] }, { kind: "component", type: CpsProgressLinearComponent, selector: "cps-progress-linear", inputs: ["width", "height", "color", "bgColor", "opacity", "radius"] }, { kind: "directive", type: CpsTooltipDirective, selector: "[cpsTooltip]", inputs: ["cpsTooltip", "tooltipOpenDelay", "tooltipCloseDelay", "tooltipOpenOn", "tooltipPosition", "tooltipPersistent", "tooltipDisabled", "tooltipMaxWidth", "tooltipContentClass", "tooltipOffset"] }] }); }
4320
4418
  }
4321
4419
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CpsFileUploadComponent, decorators: [{
4322
4420
  type: Component,
@@ -4325,15 +4423,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
4325
4423
  CpsIconComponent,
4326
4424
  CpsProgressLinearComponent,
4327
4425
  CpsTooltipDirective
4328
- ], template: "<div class=\"cps-file-upload\" [ngStyle]=\"{ width: cvtWidth }\">\n <div\n class=\"cps-file-upload-dropzone\"\n [ngClass]=\"{\n 'dragged-over': isDragoverFile,\n 'with-uploads': uploadedFile?.name\n }\"\n (dragend)=\"isDragoverFile = false\"\n (dragenter)=\"isDragoverFile = true\"\n (dragleave)=\"isDragoverFile = false\"\n (dragover)=\"isDragoverFile = true\"\n (mouseleave)=\"isDragoverFile = false\"\n (drop)=\"tryUploadFile($event)\">\n <input\n #fileInput\n (change)=\"tryUploadFile($event)\"\n type=\"file\"\n [accept]=\"extensionsString\"\n title=\"\" />\n <cps-icon icon=\"export\" size=\"large\" color=\"text-darkest\"></cps-icon>\n <div class=\"cps-file-upload-dropzone-title\">\n Drag&Drop or choose a file to upload\n </div>\n @if (fileDesc || extensionsStringAsterisks) {\n <span class=\"cps-file-upload-dropzone-file-desc\"\n >{{ fileDesc }}\n {{\n extensionsStringAsterisks ? '(' + extensionsStringAsterisks + ')' : ''\n }}</span\n >\n }\n @if (fileInfo) {\n <div class=\"cps-file-upload-dropzone-content\">\n <cps-icon color=\"calm\" icon=\"info-circle\" size=\"xsmall\"></cps-icon>\n {{ fileInfo }}\n </div>\n }\n @if (isProcessingFile && uploadedFile) {\n <cps-progress-linear\n height=\"3\"\n radius=\"4\"\n opacity=\"0.3\"\n class=\"cps-file-upload-progress-bar\"\n bgColor=\"transparent\">\n </cps-progress-linear>\n }\n </div>\n @if (uploadedFile) {\n <div class=\"cps-file-upload-uploaded-files\">\n <div class=\"cps-file-upload-uploaded-file\">\n <div class=\"cps-file-upload-uploaded-file-title\">\n <cps-icon\n class=\"cps-file-upload-uploaded-file-status-icon\"\n [icon]=\"isProcessingFile ? 'pending' : 'toast-success'\"\n [color]=\"isProcessingFile ? 'warn' : 'success'\">\n </cps-icon>\n <div\n class=\"cps-file-upload-uploaded-file-name\"\n cpsTooltip=\"{{ uploadedFile.name }}\"\n [tooltipPosition]=\"fileNameTooltipPosition\"\n [tooltipOffset]=\"fileNameTooltipOffset\"\n tooltipOpenOn=\"hover\">\n {{ uploadedFile.name }}\n </div>\n </div>\n @if (!isProcessingFile) {\n <cps-icon\n class=\"cps-file-upload-uploaded-file-remove-icon\"\n icon=\"remove\"\n color=\"error\"\n (click)=\"removeUploadedFile()\">\n </cps-icon>\n }\n </div>\n </div>\n }\n</div>\n", styles: [":host{display:flex}:host .cps-file-upload .cps-file-upload-dropzone{font-family:Source Sans Pro,sans-serif;min-height:20px;padding:2rem;text-align:center;border:2px dashed var(--cps-color-calm);position:relative;border-radius:1rem}:host .cps-file-upload .cps-file-upload-dropzone:hover{background-color:var(--cps-color-highlight-hover)}:host .cps-file-upload .cps-file-upload-dropzone:active{background-color:var(--cps-color-highlight-selected)}:host .cps-file-upload .cps-file-upload-dropzone.dragged-over{background-color:var(--cps-color-highlight-selected)}:host .cps-file-upload .cps-file-upload-dropzone.with-uploads{border-bottom-right-radius:0;border-bottom-left-radius:0;border-bottom:1px dashed var(--cps-color-calm)}:host .cps-file-upload .cps-file-upload-dropzone input{cursor:pointer;opacity:0;position:absolute;width:100%;height:100%;top:0;left:0}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-dropzone-title{font-size:16px;margin:8px 0;color:var(--cps-color-calm);font-weight:600}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-dropzone-file-desc{font-size:18px;color:var(--cps-color-text-dark)}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-dropzone-content{margin-top:16px;font-size:1rem}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-progress-bar{position:absolute;bottom:-2px;left:0}:host .cps-file-upload .cps-file-upload-uploaded-files{border-bottom:2px dashed var(--cps-color-calm);border-left:2px dashed var(--cps-color-calm);border-right:2px dashed var(--cps-color-calm);border-bottom-right-radius:16px;border-bottom-left-radius:16px;background-color:var(--cps-color-highlight-hover)}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file{cursor:default;display:flex;align-items:center;justify-content:space-between;padding:8px 12px}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-title{display:flex;align-items:center;flex:1;min-width:0}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-title .cps-file-upload-uploaded-file-name{color:var(--cps-color-text-darkest);font-size:20px;margin:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:calc(100% - 60px)}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon{cursor:pointer;flex-shrink:0;margin-left:8px}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:hover ::ng-deep .cps-icon{color:var(--cps-color-error-darken1)!important}\n"] }]
4426
+ ], template: "<div\n class=\"cps-file-upload\"\n [class.disabled]=\"disabled\"\n [style.width]=\"cvtWidth()\">\n <div class=\"sr-only\" aria-live=\"polite\" aria-atomic=\"true\">\n @if (errorMessage) {\n {{ errorMessage }}\n } @else if (uploadedFile) {\n @if (isProcessingFile) {\n File is being processed\n } @else {\n File successfully uploaded\n }\n }\n </div>\n <button\n #dropzoneButton\n type=\"button\"\n class=\"cps-file-upload-dropzone\"\n [ngClass]=\"{\n 'dragged-over': isDragoverFile,\n 'with-bottom-section': uploadedFile?.name || errorMessage\n }\"\n [disabled]=\"disabled\"\n [class.processing]=\"isProcessingFile\"\n (click)=\"openFilePicker()\"\n (dragend)=\"onDragEnd()\"\n (dragenter)=\"onDragEnter()\"\n (dragleave)=\"onDragLeave()\"\n (dragover)=\"onDragOver($event)\"\n (drop)=\"onDrop($event)\"\n [attr.aria-label]=\"ariaLabel\">\n <input\n #fileInput\n (change)=\"tryUploadFile($event)\"\n type=\"file\"\n [accept]=\"extensionsString\"\n hidden />\n <cps-icon\n icon=\"export\"\n size=\"large\"\n [color]=\"disabled ? 'text-mild' : 'text-darkest'\"></cps-icon>\n <div class=\"cps-file-upload-dropzone-title\">\n Drag&Drop or choose a file to upload\n </div>\n @if (fileDesc || extensionsStringAsterisks) {\n <span class=\"cps-file-upload-dropzone-file-desc\"\n >{{ fileDesc }}\n {{\n extensionsStringAsterisks ? '(' + extensionsStringAsterisks + ')' : ''\n }}</span\n >\n }\n @if (fileInfo) {\n <div class=\"cps-file-upload-dropzone-content\">\n <cps-icon\n [color]=\"disabled ? 'text-mild' : 'info'\"\n icon=\"info-circle\"\n size=\"xsmall\"></cps-icon>\n {{ fileInfo }}\n </div>\n }\n @if (isProcessingFile && uploadedFile) {\n <cps-progress-linear\n height=\"0.1875rem\"\n radius=\"0.25rem\"\n opacity=\"0.3\"\n [color]=\"disabled ? 'text-mild' : 'calm'\"\n class=\"cps-file-upload-progress-bar\"\n bgColor=\"transparent\">\n </cps-progress-linear>\n }\n </button>\n @if (errorMessage) {\n <div class=\"cps-file-upload-error\">\n <cps-icon\n icon=\"toast-error\"\n [color]=\"disabled ? 'text-light' : 'error'\"></cps-icon>\n <span>{{ errorMessage }}</span>\n </div>\n }\n @if (uploadedFile) {\n <div class=\"cps-file-upload-uploaded-files\">\n <div class=\"cps-file-upload-uploaded-file\">\n <div class=\"cps-file-upload-uploaded-file-title\">\n <cps-icon\n class=\"cps-file-upload-uploaded-file-status-icon\"\n [icon]=\"isProcessingFile ? 'pending' : 'toast-success'\"\n [color]=\"\n disabled ? 'text-light' : isProcessingFile ? 'warn' : 'success'\n \">\n </cps-icon>\n <div\n class=\"cps-file-upload-uploaded-file-name\"\n cpsTooltip=\"{{ uploadedFile.name }}\"\n [tooltipPosition]=\"fileNameTooltipPosition\"\n [tooltipOffset]=\"fileNameTooltipOffset\"\n tooltipOpenOn=\"hover\">\n {{ uploadedFile.name }}\n </div>\n </div>\n @if (!disabled) {\n @if (isProcessingFile) {\n <cps-icon\n role=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"'Cancel file processing'\"\n class=\"cps-file-upload-uploaded-file-cancel-process-icon\"\n icon=\"close-x\"\n color=\"error\"\n (click)=\"onCancelFileProcessing($event)\"\n (keydown.enter)=\"onCancelFileProcessing($event)\"\n (keydown.space)=\"onCancelFileProcessing($event)\">\n </cps-icon>\n } @else {\n <cps-icon\n role=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"'Remove uploaded file'\"\n class=\"cps-file-upload-uploaded-file-remove-icon\"\n icon=\"remove\"\n color=\"error\"\n (click)=\"onRemoveUploadedFile($event)\"\n (keydown.enter)=\"onRemoveUploadedFile($event)\"\n (keydown.space)=\"onRemoveUploadedFile($event)\">\n </cps-icon>\n }\n }\n </div>\n </div>\n }\n</div>\n", styles: [":host{display:flex}:host .cps-file-upload{min-width:0;position:relative}:host .cps-file-upload .cps-file-upload-dropzone{background:transparent;font-family:Source Sans Pro,sans-serif;min-height:1.25rem;padding:2rem;text-align:center;border:.125rem dashed var(--cps-color-calm);position:relative;border-radius:1rem;display:block;width:100%;box-sizing:border-box;cursor:pointer;-webkit-user-select:none;user-select:none}:host .cps-file-upload .cps-file-upload-dropzone:hover{background-color:var(--cps-color-highlight-hover)}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible{outline:none;position:relative}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:before,:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:after{content:\"\";position:absolute;border-radius:inherit}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:before{inset:-.25rem;border:.0625rem solid var(--cps-color-calm)}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:after{inset:-.375rem;border:.0625rem solid var(--cps-color-calm-highlighten)}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:not(.processing){outline:none;position:relative}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:not(.processing):before,:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:not(.processing):after{content:\"\";position:absolute;border-radius:inherit}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:not(.processing):before{inset:-.25rem;border:.0625rem solid var(--cps-color-calm)}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:not(.processing):after{inset:-.375rem;border:.0625rem solid var(--cps-color-calm-highlighten)}:host .cps-file-upload .cps-file-upload-dropzone:focus-visible:not(.processing){background-color:var(--cps-color-highlight-hover)}:host .cps-file-upload .cps-file-upload-dropzone:active:not(.processing){background-color:var(--cps-color-highlight-selected)}:host .cps-file-upload .cps-file-upload-dropzone.processing{pointer-events:none;cursor:default}:host .cps-file-upload .cps-file-upload-dropzone.dragged-over{background-color:var(--cps-color-highlight-selected)}:host .cps-file-upload .cps-file-upload-dropzone.with-bottom-section{border-bottom-right-radius:0;border-bottom-left-radius:0;border-bottom:.0625rem dashed var(--cps-color-calm)}:host .cps-file-upload .cps-file-upload-dropzone input{cursor:pointer;opacity:0;position:absolute;inset:0;width:100%;height:100%}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-dropzone-title{font-size:1rem;margin:.5rem 0;color:var(--cps-color-calm);font-weight:600}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-dropzone-file-desc{font-size:1.125rem;color:var(--cps-color-text-dark)}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-dropzone-content{margin-top:1rem;font-size:1rem;color:var(--cps-color-text-dark)}:host .cps-file-upload .cps-file-upload-dropzone .cps-file-upload-progress-bar{position:absolute;bottom:-.125rem;left:0}:host .cps-file-upload .cps-file-upload-uploaded-files{border-bottom:.125rem dashed var(--cps-color-calm);border-left:.125rem dashed var(--cps-color-calm);border-right:.125rem dashed var(--cps-color-calm);border-bottom-right-radius:1rem;border-bottom-left-radius:1rem;background-color:var(--cps-color-highlight-hover)}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file{cursor:default;display:flex;align-items:center;justify-content:space-between;padding:.5rem .75rem}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-title{display:flex;align-items:center;flex:1;min-width:0}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-title .cps-file-upload-uploaded-file-name{color:var(--cps-color-text-darkest);font-size:1.25rem;margin:0 .5rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:calc(100% - 3.75rem)}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon{cursor:pointer;flex-shrink:0;margin-left:.5rem}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:focus,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:focus{outline:none}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:focus-visible,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:focus-visible{outline:none;position:relative}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:focus-visible:before,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:focus-visible:after,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:focus-visible:before,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:focus-visible:after{content:\"\";position:absolute;border-radius:.375rem}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:focus-visible:before,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:focus-visible:before{inset:-.125rem;border:.0625rem solid var(--cps-color-calm)}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:focus-visible:after,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:focus-visible:after{inset:-.25rem;border:.0625rem solid var(--cps-color-calm-highlighten)}:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-remove-icon:hover ::ng-deep .cps-icon,:host .cps-file-upload .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-cancel-process-icon:hover ::ng-deep .cps-icon{color:var(--cps-color-error-darken1)!important}:host .cps-file-upload .cps-file-upload-error{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;overflow:hidden;border-bottom:.125rem dashed var(--cps-color-calm);border-left:.125rem dashed var(--cps-color-calm);border-right:.125rem dashed var(--cps-color-calm);border-bottom-right-radius:1rem;border-bottom-left-radius:1rem;background-color:var(--cps-color-highlight-hover);color:var(--cps-color-error);font-size:1.25rem}:host .cps-file-upload .cps-file-upload-error span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host .cps-file-upload.disabled{pointer-events:none}:host .cps-file-upload.disabled .cps-file-upload-dropzone{border-color:var(--cps-color-line-darkest);cursor:not-allowed}:host .cps-file-upload.disabled .cps-file-upload-dropzone .cps-file-upload-dropzone-title{color:var(--cps-color-text-mild)}:host .cps-file-upload.disabled .cps-file-upload-dropzone .cps-file-upload-dropzone-file-desc{color:var(--cps-color-text-mild)}:host .cps-file-upload.disabled .cps-file-upload-dropzone .cps-file-upload-dropzone-content{color:var(--cps-color-text-mild)}:host .cps-file-upload.disabled .cps-file-upload-uploaded-files{border-color:var(--cps-color-line-darkest);background-color:var(--cps-color-bg-disabled)}:host .cps-file-upload.disabled .cps-file-upload-uploaded-files .cps-file-upload-uploaded-file .cps-file-upload-uploaded-file-title .cps-file-upload-uploaded-file-name{color:var(--cps-color-text-mild)}:host .cps-file-upload.disabled .cps-file-upload-error{border-color:var(--cps-color-line-darkest);background-color:var(--cps-color-bg-disabled);color:var(--cps-color-text-mild)}:host .cps-file-upload .sr-only{position:absolute;width:.0625rem;height:.0625rem;padding:0;margin:-.0625rem;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"] }]
4329
4427
  }], propDecorators: { extensions: [{
4330
4428
  type: Input
4331
4429
  }], fileDesc: [{
4332
4430
  type: Input
4333
- }], width: [{
4431
+ }], ariaLabel: [{
4334
4432
  type: Input
4335
4433
  }], fileInfo: [{
4336
4434
  type: Input
4435
+ }], disabled: [{
4436
+ type: Input,
4437
+ args: [{ transform: booleanAttribute }]
4337
4438
  }], fileProcessingCallback: [{
4338
4439
  type: Input
4339
4440
  }], fileNameTooltipPosition: [{
@@ -4341,15 +4442,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
4341
4442
  }], fileNameTooltipOffset: [{
4342
4443
  type: Input,
4343
4444
  args: [{ transform: numberAttribute }]
4344
- }], fileUploaded: [{
4445
+ }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], fileUploaded: [{
4345
4446
  type: Output
4346
4447
  }], fileUploadFailed: [{
4347
4448
  type: Output
4449
+ }], fileProcessed: [{
4450
+ type: Output
4451
+ }], fileProcessingFailed: [{
4452
+ type: Output
4453
+ }], fileProcessingCancelled: [{
4454
+ type: Output
4348
4455
  }], uploadedFileRemoved: [{
4349
4456
  type: Output
4350
4457
  }], fileInput: [{
4351
4458
  type: ViewChild,
4352
4459
  args: ['fileInput']
4460
+ }], dropzoneButton: [{
4461
+ type: ViewChild,
4462
+ args: ['dropzoneButton']
4353
4463
  }] } });
4354
4464
 
4355
4465
  /**