@zambon-dev/ui 1.5.0 → 1.6.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,17 +1,20 @@
1
1
  import * as i0 from "@angular/core";
2
- import { ApplicationRef, Component, EventEmitter, Inject, Injectable, InjectionToken, Injector, Input, NgModule, Output, ViewChild, afterEveryRender, computed, effect, forwardRef, inject, input, model, output, runInInjectionContext, signal, viewChild } from "@angular/core";
2
+ import { ApplicationRef, Component, DestroyRef, ElementRef, EventEmitter, Inject, Injectable, InjectionToken, Injector, Input, NgModule, Output, PLATFORM_ID, ViewChild, afterEveryRender, computed, effect, forwardRef, inject, input, model, output, runInInjectionContext, signal, viewChild } from "@angular/core";
3
3
  import { toObservable, toSignal } from "@angular/core/rxjs-interop";
4
4
  import * as i2 from "@zambon-dev/ui/library";
5
- import { ButtonComponent as ButtonComponent$1, DataGridConfigsProvider, DataGridDataset, DataProviderService, DateValidators, DisplayControls, FormService, GroupContainerComponent, ModalComponent, MultiEditorComponent, MultiEditorDataset, MultiSelectComponent, MultiSelectResultDataset, RibbonButtonComponent, RibbonComponent, RibbonGroupChild, RibbonGroupComponent, RouterFormatter } from "@zambon-dev/ui/library";
5
+ import { BaseComponent, ButtonComponent as ButtonComponent$1, DataGridConfigsProvider, DataGridDataset, DataProviderService, DateValidators, DisplayControls, FormInputGroupComponent, FormService, GroupContainerComponent, LocaleService, ModalComponent, MultiEditorComponent, MultiEditorDataset, MultiSelectComponent, MultiSelectResultDataset, RibbonButtonComponent, RibbonComponent, RibbonGroupChild, RibbonGroupComponent, RouterFormatter } from "@zambon-dev/ui/library";
6
6
  import { ReplaySubject, Subject, catchError, combineLatest, filter, isObservable, map, of, skip, startWith, switchMap, take, takeUntil, tap, throwError } from "rxjs";
7
7
  import { __decorate } from "tslib";
8
8
  import * as i1$1 from "@angular/common";
9
- import { NgClass, NgTemplateOutlet } from "@angular/common";
9
+ import { NgClass, NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
10
10
  import * as i2$1 from "@angular/router";
11
11
  import { ActivatedRoute, NavigationEnd, Router, RouterModule } from "@angular/router";
12
12
  import { TranslateLoader, TranslatePipe, TranslateService, provideTranslateService } from "@ngx-translate/core";
13
13
  import * as i1 from "@angular/forms";
14
- import { ControlContainer, FormBuilder, FormGroupDirective } from "@angular/forms";
14
+ import { ControlContainer, FormBuilder, FormGroupDirective, FormGroupName } from "@angular/forms";
15
+ import { LiveAnnouncer } from "@angular/cdk/a11y";
16
+ import { createGlobalPositionStrategy, createNoopScrollStrategy, createOverlayRef } from "@angular/cdk/overlay";
17
+ import { ComponentPortal } from "@angular/cdk/portal";
15
18
  import { HttpBackend, HttpErrorResponse } from "@angular/common/http";
16
19
  import { MultiTranslateHttpLoader } from "ngx-translate-multi-http-loader";
17
20
  const ADMINISTRATIVE_MASTER_ACTION = "AdministrativeMaster";
@@ -4865,6 +4868,741 @@ i0.ɵɵngDeclareClassMetadata({
4865
4868
  }]
4866
4869
  }]
4867
4870
  });
4871
+ const SIZE_UNITS = [
4872
+ "byte",
4873
+ "kilobyte",
4874
+ "megabyte",
4875
+ "gigabyte"
4876
+ ];
4877
+ let nextId = 0;
4878
+ var FileUploadComponent = class FileUploadComponent extends BaseComponent {
4879
+ accept = input("", ...ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []);
4880
+ controlName = input.required(...ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []);
4881
+ label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
4882
+ maxFileSize = input(...ngDevMode ? [void 0, { debugName: "maxFileSize" }] : /* istanbul ignore next */ []);
4883
+ maxFiles = input(...ngDevMode ? [void 0, { debugName: "maxFiles" }] : /* istanbul ignore next */ []);
4884
+ multiple = input(false, ...ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []);
4885
+ notes = input("", ...ngDevMode ? [{ debugName: "notes" }] : /* istanbul ignore next */ []);
4886
+ progress = input(...ngDevMode ? [void 0, { debugName: "progress" }] : /* istanbul ignore next */ []);
4887
+ validations = input({}, ...ngDevMode ? [{ debugName: "validations" }] : /* istanbul ignore next */ []);
4888
+ filesAdded = output();
4889
+ fileRemoved = output();
4890
+ filesRejected = output();
4891
+ formGroupDirective = inject(FormGroupDirective);
4892
+ formGroupName = inject(FormGroupName, { optional: true });
4893
+ formService = inject(FormService);
4894
+ hintId = `framework-file-upload-hint-${nextId++}`;
4895
+ isDragOver = signal(false, ...ngDevMode ? [{ debugName: "isDragOver" }] : /* istanbul ignore next */ []);
4896
+ rejections = signal([], ...ngDevMode ? [{ debugName: "rejections" }] : /* istanbul ignore next */ []);
4897
+ locale = inject(LocaleService).locale;
4898
+ formChanged = signal(0, ...ngDevMode ? [{ debugName: "formChanged" }] : /* istanbul ignore next */ []);
4899
+ acceptText = computed(() => this.accept().split(",").map((token) => token.trim()).filter(Boolean).join(", "), ...ngDevMode ? [{ debugName: "acceptText" }] : /* istanbul ignore next */ []);
4900
+ files = computed(() => {
4901
+ this.formChanged();
4902
+ const value = this.formControl?.value;
4903
+ if (Array.isArray(value)) return value;
4904
+ return value ? [value] : [];
4905
+ }, ...ngDevMode ? [{ debugName: "files" }] : /* istanbul ignore next */ []);
4906
+ isEditable = computed(() => {
4907
+ this.formChanged();
4908
+ const isFormEnabled = this.formGroupDirective.form?.enabled ?? false;
4909
+ const isEditMode = this.formService.isEditMode;
4910
+ return isFormEnabled || isEditMode;
4911
+ }, ...ngDevMode ? [{ debugName: "isEditable" }] : /* istanbul ignore next */ []);
4912
+ isInvalid = computed(() => {
4913
+ this.formChanged();
4914
+ return !!this.formControl?.invalid && !!this.formControl?.touched;
4915
+ }, ...ngDevMode ? [{ debugName: "isInvalid" }] : /* istanbul ignore next */ []);
4916
+ fileLimit = computed(() => this.multiple() ? this.maxFiles() : 1, ...ngDevMode ? [{ debugName: "fileLimit" }] : /* istanbul ignore next */ []);
4917
+ get formControl() {
4918
+ return this.controlName() ? this.formGroup?.get(this.controlName()) : null;
4919
+ }
4920
+ get formGroup() {
4921
+ let formGroup = this.formGroupDirective.form;
4922
+ for (const group of this.formGroupName?.path ?? []) formGroup = formGroup?.get(group);
4923
+ return formGroup;
4924
+ }
4925
+ constructor() {
4926
+ super();
4927
+ }
4928
+ ngOnInit() {
4929
+ this.formGroupDirective.form?.events.pipe(takeUntil(this.destroy$)).subscribe(() => this.formChanged.update((count) => count + 1));
4930
+ this.formControl?.valueChanges.pipe(takeUntil(this.destroy$)).subscribe(() => this.rejections.set([]));
4931
+ }
4932
+ onDragLeave(event) {
4933
+ const zone = event.currentTarget;
4934
+ const target = event.relatedTarget;
4935
+ if (!target || !zone.contains(target)) this.isDragOver.set(false);
4936
+ }
4937
+ onDragOver(event) {
4938
+ event.preventDefault();
4939
+ if (event.dataTransfer) event.dataTransfer.dropEffect = "copy";
4940
+ this.isDragOver.set(true);
4941
+ }
4942
+ onDrop(event) {
4943
+ event.preventDefault();
4944
+ this.isDragOver.set(false);
4945
+ this.addFiles(Array.from(event.dataTransfer?.files ?? []));
4946
+ }
4947
+ onInputChange(event) {
4948
+ const fileInput = event.target;
4949
+ this.addFiles(Array.from(fileInput.files ?? []));
4950
+ fileInput.value = "";
4951
+ }
4952
+ onKeyDown(event, fileInput) {
4953
+ event.preventDefault();
4954
+ fileInput.click();
4955
+ }
4956
+ onRemoveClick(file) {
4957
+ const control = this.formControl;
4958
+ if (!control) return;
4959
+ const remaining = this.files().filter((entry) => entry !== file);
4960
+ control.setValue(this.multiple() ? remaining : null);
4961
+ control.markAsDirty();
4962
+ control.markAsTouched();
4963
+ this.fileRemoved.emit(file);
4964
+ }
4965
+ addFiles(candidates) {
4966
+ const control = this.formControl;
4967
+ if (!control || !this.isEditable() || candidates.length === 0) return;
4968
+ const current = this.multiple() ? this.files() : [];
4969
+ const limit = this.fileLimit();
4970
+ const maxFileSize = this.maxFileSize();
4971
+ const accepted = [];
4972
+ const rejected = [];
4973
+ for (const file of candidates) if (!this.matchesAccept(file)) rejected.push({
4974
+ file,
4975
+ reason: "fileType"
4976
+ });
4977
+ else if (maxFileSize !== void 0 && file.size > maxFileSize) rejected.push({
4978
+ file,
4979
+ reason: "fileSize"
4980
+ });
4981
+ else if ([...current, ...accepted].some((entry) => this.isSameFile(entry, file))) continue;
4982
+ else if (limit !== void 0 && current.length + accepted.length >= limit) rejected.push({
4983
+ file,
4984
+ reason: "maxFiles"
4985
+ });
4986
+ else accepted.push(file);
4987
+ if (accepted.length > 0) {
4988
+ control.setValue(this.multiple() ? [...current, ...accepted] : accepted[0]);
4989
+ control.markAsDirty();
4990
+ }
4991
+ control.markAsTouched();
4992
+ this.rejections.set(rejected);
4993
+ if (rejected.length > 0) this.filesRejected.emit(rejected);
4994
+ if (accepted.length > 0) this.filesAdded.emit(accepted);
4995
+ }
4996
+ formatSize(bytes) {
4997
+ let value = bytes;
4998
+ let unit = 0;
4999
+ while (value >= 1024 && unit < SIZE_UNITS.length - 1) {
5000
+ value /= 1024;
5001
+ unit++;
5002
+ }
5003
+ const options = {
5004
+ maximumFractionDigits: unit === 0 ? 0 : 1,
5005
+ style: "unit",
5006
+ unit: SIZE_UNITS[unit],
5007
+ unitDisplay: "short"
5008
+ };
5009
+ try {
5010
+ return new Intl.NumberFormat(this.locale(), options).format(value);
5011
+ } catch {
5012
+ return new Intl.NumberFormat(void 0, options).format(value);
5013
+ }
5014
+ }
5015
+ progressOf(file) {
5016
+ const value = this.progress()?.[file.name];
5017
+ if (value === void 0 || value === null || Number.isNaN(value)) return;
5018
+ return Math.min(100, Math.max(0, value));
5019
+ }
5020
+ rejectionKey(reason) {
5021
+ switch (reason) {
5022
+ case "fileSize": return "FileUpload-Rejected-FileSize";
5023
+ case "fileType": return "FileUpload-Rejected-FileType";
5024
+ default: return "FileUpload-Rejected-MaxFiles";
5025
+ }
5026
+ }
5027
+ isSameFile(a, b) {
5028
+ return a === b || a.name === b.name && a.size === b.size && a.lastModified === b.lastModified;
5029
+ }
5030
+ matchesAccept(file) {
5031
+ const tokens = this.accept().split(",").map((token) => token.trim().toLowerCase()).filter((token) => token.length > 0);
5032
+ if (tokens.length === 0) return true;
5033
+ const name = file.name.toLowerCase();
5034
+ const type = (file.type ?? "").toLowerCase();
5035
+ return tokens.some((token) => {
5036
+ if (token.startsWith(".")) return name.endsWith(token);
5037
+ if (token.endsWith("/*")) return type.startsWith(token.slice(0, -1));
5038
+ return type === token;
5039
+ });
5040
+ }
5041
+ static ɵfac = i0.ɵɵngDeclareFactory({
5042
+ minVersion: "12.0.0",
5043
+ version: "22.2.0",
5044
+ ngImport: i0,
5045
+ type: FileUploadComponent,
5046
+ deps: [],
5047
+ target: i0.ɵɵFactoryTarget.Component
5048
+ });
5049
+ static ɵcmp = i0.ɵɵngDeclareComponent({
5050
+ minVersion: "17.0.0",
5051
+ version: "22.2.0",
5052
+ type: FileUploadComponent,
5053
+ isStandalone: true,
5054
+ selector: "framework-file-upload",
5055
+ inputs: {
5056
+ accept: {
5057
+ classPropertyName: "accept",
5058
+ publicName: "accept",
5059
+ isSignal: true,
5060
+ isRequired: false,
5061
+ transformFunction: null
5062
+ },
5063
+ controlName: {
5064
+ classPropertyName: "controlName",
5065
+ publicName: "controlName",
5066
+ isSignal: true,
5067
+ isRequired: true,
5068
+ transformFunction: null
5069
+ },
5070
+ label: {
5071
+ classPropertyName: "label",
5072
+ publicName: "label",
5073
+ isSignal: true,
5074
+ isRequired: false,
5075
+ transformFunction: null
5076
+ },
5077
+ maxFileSize: {
5078
+ classPropertyName: "maxFileSize",
5079
+ publicName: "maxFileSize",
5080
+ isSignal: true,
5081
+ isRequired: false,
5082
+ transformFunction: null
5083
+ },
5084
+ maxFiles: {
5085
+ classPropertyName: "maxFiles",
5086
+ publicName: "maxFiles",
5087
+ isSignal: true,
5088
+ isRequired: false,
5089
+ transformFunction: null
5090
+ },
5091
+ multiple: {
5092
+ classPropertyName: "multiple",
5093
+ publicName: "multiple",
5094
+ isSignal: true,
5095
+ isRequired: false,
5096
+ transformFunction: null
5097
+ },
5098
+ notes: {
5099
+ classPropertyName: "notes",
5100
+ publicName: "notes",
5101
+ isSignal: true,
5102
+ isRequired: false,
5103
+ transformFunction: null
5104
+ },
5105
+ progress: {
5106
+ classPropertyName: "progress",
5107
+ publicName: "progress",
5108
+ isSignal: true,
5109
+ isRequired: false,
5110
+ transformFunction: null
5111
+ },
5112
+ validations: {
5113
+ classPropertyName: "validations",
5114
+ publicName: "validations",
5115
+ isSignal: true,
5116
+ isRequired: false,
5117
+ transformFunction: null
5118
+ }
5119
+ },
5120
+ outputs: {
5121
+ filesAdded: "filesAdded",
5122
+ fileRemoved: "fileRemoved",
5123
+ filesRejected: "filesRejected"
5124
+ },
5125
+ usesInheritance: true,
5126
+ ngImport: i0,
5127
+ template: "<lib-form-input-group\n [controlName]=\"controlName()\"\n [label]=\"label()\"\n [notes]=\"notes()\"\n [template]=\"template\"\n [validations]=\"validations()\"\n>\n</lib-form-input-group>\n\n<ng-template #template>\n <div class=\"file-upload\">\n @if (isEditable()) {\n <!-- The zone is the browse button: Enter and Space open the native picker, like a click. -->\n <div\n class=\"drop-zone\"\n role=\"button\"\n tabindex=\"0\"\n [attr.aria-describedby]=\"hintId\"\n [class.drag-over]=\"isDragOver()\"\n [class.invalid]=\"isInvalid()\"\n (click)=\"fileInput.click()\"\n (dragenter)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (dragover)=\"onDragOver($event)\"\n (drop)=\"onDrop($event)\"\n (keydown.enter)=\"onKeyDown($event, fileInput)\"\n (keydown.space)=\"onKeyDown($event, fileInput)\"\n >\n <i class=\"fa-solid fa-cloud-arrow-up icon\" aria-hidden=\"true\"></i>\n <span class=\"prompt\">\n {{ (multiple() ? 'FileUpload-Prompt-Multiple' : 'FileUpload-Prompt') | translate }}\n <span class=\"browse\">{{ 'FileUpload-Browse' | translate }}</span>\n </span>\n <span class=\"hint\" [attr.id]=\"hintId\">\n @if (accept()) {\n <span>{{ 'FileUpload-Accept' | translate: { types: acceptText() } }}</span>\n }\n @if (maxFileSize() !== undefined) {\n <span>{{ 'FileUpload-MaxFileSize' | translate: { size: formatSize(maxFileSize()!) } }}</span>\n }\n @if (multiple() && maxFiles() !== undefined) {\n <span>{{ 'FileUpload-MaxFiles' | translate: { count: maxFiles() } }}</span>\n }\n </span>\n </div>\n <input\n #fileInput\n class=\"native-input\"\n type=\"file\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [attr.accept]=\"accept() || null\"\n [multiple]=\"multiple()\"\n (change)=\"onInputChange($event)\"\n />\n\n <!-- A live region around a plain list: role=\"status\" on the <ul> itself would drop its list\n meaning, and every item would then fail the listitem rule. -->\n <div role=\"status\">\n <ul class=\"rejections\">\n @for (rejection of rejections(); track $index) {\n <li>\n {{\n rejectionKey(rejection.reason)\n | translate\n : {\n name: rejection.file.name,\n size: maxFileSize() !== undefined ? formatSize(maxFileSize()!) : '',\n count: fileLimit(),\n }\n }}\n </li>\n }\n </ul>\n </div>\n }\n\n @if (files().length > 0) {\n <ul class=\"file-list\">\n @for (file of files(); track $index) {\n <li class=\"file\">\n <i class=\"fa-regular fa-file icon\" aria-hidden=\"true\"></i>\n <span class=\"name\" [attr.title]=\"file.name\">{{ file.name }}</span>\n <span class=\"size\">{{ formatSize(file.size) }}</span>\n @if (isEditable()) {\n <button\n class=\"remove\"\n type=\"button\"\n [attr.aria-label]=\"'FileUpload-Remove' | translate: { name: file.name }\"\n [attr.title]=\"'FileUpload-Remove' | translate: { name: file.name }\"\n (click)=\"onRemoveClick(file)\"\n >\n <i class=\"fa-solid fa-xmark\" aria-hidden=\"true\"></i>\n </button>\n }\n @let percent = progressOf(file);\n @if (percent !== undefined) {\n <div\n class=\"progress\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-label]=\"'FileUpload-Progress' | translate: { name: file.name }\"\n [attr.aria-valuenow]=\"percent\"\n >\n <div class=\"bar\" [style.width.%]=\"percent\"></div>\n </div>\n }\n </li>\n }\n </ul>\n } @else if (!isEditable()) {\n <span class=\"value\">{{ 'FileUpload-Empty' | translate }}</span>\n }\n </div>\n</ng-template>\n",
5128
+ styles: ["@layer properties;:host{grid-column:span 2 / span 2;display:grid;grid-template-columns:subgrid}.file-upload{display:flex;min-width:0px;flex-direction:column;gap:calc(var(--spacing, .25rem) * 2)}.drop-zone{display:flex;cursor:pointer;flex-direction:column;align-items:center;justify-content:center;gap:var(--spacing, .25rem);padding-inline:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 4);text-align:center;border-style:var(--tw-border-style);border-width:2px;--tw-border-style: dashed;border-style:dashed;transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function, cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration, var(--default-transition-duration, .15s));border-color:var(--color-line-strong);border-radius:var(--radius-field);color:var(--color-content-secondary)}.drop-zone:hover{background-color:var(--state-hover)}.drop-zone:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(var(--focus-ring-width) + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-outline-style: none;outline-style:none;--tw-ring-color: var(--color-focus-ring)}@media(forced-colors:active){.drop-zone:focus-visible{outline:2px solid transparent;outline-offset:2px}}.drop-zone.drag-over{border-color:var(--color-accent);background-color:var(--state-selected)}.drop-zone.invalid{border-color:var(--color-danger)}.drop-zone .icon{font-size:var(--text-2xl, 1.5rem);line-height:var(--tw-leading, var(--text-2xl--line-height, calc(2 / 1.5)));color:var(--color-content-subtle)}.drop-zone .prompt{overflow-wrap:break-word;font-size:var(--text-ui)}.drop-zone .browse{text-decoration-line:underline;color:var(--color-accent-strong);font-weight:var(--font-weight-emphasis)}.drop-zone .hint{display:flex;flex-wrap:wrap;justify-content:center;column-gap:calc(var(--spacing, .25rem) * 3);overflow-wrap:break-word;font-size:var(--text-caption);color:var(--color-content-subtle)}.native-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border-width:0}.rejections{display:flex;flex-direction:column;gap:calc(var(--spacing, .25rem) * .5);overflow-wrap:break-word;font-size:var(--text-caption);color:var(--color-danger)}.rejections:empty{display:none}.file-list{display:flex;flex-direction:column;gap:var(--spacing, .25rem)}.file{display:grid;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2);padding-inline:calc(var(--spacing, .25rem) * 2);padding-block:var(--spacing, .25rem);grid-template-columns:auto minmax(0,1fr) auto auto;border:1px solid var(--color-line);border-radius:var(--radius-field);background-color:var(--color-surface-inset);color:var(--color-content-primary)}.file .icon{color:var(--color-content-subtle)}.file .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file .size{white-space:nowrap;font-size:var(--text-caption);color:var(--color-content-secondary)}.file .remove{display:flex;height:calc(var(--spacing, .25rem) * 6);width:calc(var(--spacing, .25rem) * 6);cursor:pointer;align-items:center;justify-content:center;--tw-border-style: none;border-style:none;background-color:transparent;padding:0;border-radius:var(--radius-control);color:var(--color-content-subtle)}.file .remove:hover{color:var(--color-content-primary);background-color:var(--state-hover)}.file .remove:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(var(--focus-ring-width) + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-outline-style: none;outline-style:none;--tw-ring-color: var(--color-focus-ring)}@media(forced-colors:active){.file .remove:focus-visible{outline:2px solid transparent;outline-offset:2px}}.file .progress{grid-column:1 / -1;margin-top:var(--spacing, .25rem);height:calc(var(--spacing, .25rem) * 1.5);overflow:hidden;border-radius:calc(infinity * 1px);background-color:var(--color-line)}.file .progress .bar{height:100%;border-radius:calc(infinity * 1px);transition-property:width;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function, cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration, var(--default-transition-duration, .15s));background-color:var(--color-accent)}.value{display:block;padding-block:var(--spacing, .25rem);color:var(--color-content-secondary)}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"],
5129
+ dependencies: [{
5130
+ kind: "component",
5131
+ type: FormInputGroupComponent,
5132
+ selector: "lib-form-input-group",
5133
+ inputs: [
5134
+ "autofocus",
5135
+ "alignContent",
5136
+ "controlName",
5137
+ "fixedValue",
5138
+ "format",
5139
+ "label",
5140
+ "isDisabled",
5141
+ "isFullHeight",
5142
+ "maxLength",
5143
+ "min",
5144
+ "notes",
5145
+ "readOnly",
5146
+ "rows",
5147
+ "showLabel",
5148
+ "step",
5149
+ "template",
5150
+ "type",
5151
+ "validations"
5152
+ ]
5153
+ }, {
5154
+ kind: "pipe",
5155
+ type: TranslatePipe,
5156
+ name: "translate"
5157
+ }]
5158
+ });
5159
+ };
5160
+ i0.ɵɵngDeclareClassMetadata({
5161
+ minVersion: "12.0.0",
5162
+ version: "22.2.0",
5163
+ ngImport: i0,
5164
+ type: FileUploadComponent,
5165
+ decorators: [{
5166
+ type: Component,
5167
+ args: [{
5168
+ selector: "framework-file-upload",
5169
+ imports: [FormInputGroupComponent, TranslatePipe],
5170
+ template: "<lib-form-input-group\n [controlName]=\"controlName()\"\n [label]=\"label()\"\n [notes]=\"notes()\"\n [template]=\"template\"\n [validations]=\"validations()\"\n>\n</lib-form-input-group>\n\n<ng-template #template>\n <div class=\"file-upload\">\n @if (isEditable()) {\n <!-- The zone is the browse button: Enter and Space open the native picker, like a click. -->\n <div\n class=\"drop-zone\"\n role=\"button\"\n tabindex=\"0\"\n [attr.aria-describedby]=\"hintId\"\n [class.drag-over]=\"isDragOver()\"\n [class.invalid]=\"isInvalid()\"\n (click)=\"fileInput.click()\"\n (dragenter)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (dragover)=\"onDragOver($event)\"\n (drop)=\"onDrop($event)\"\n (keydown.enter)=\"onKeyDown($event, fileInput)\"\n (keydown.space)=\"onKeyDown($event, fileInput)\"\n >\n <i class=\"fa-solid fa-cloud-arrow-up icon\" aria-hidden=\"true\"></i>\n <span class=\"prompt\">\n {{ (multiple() ? 'FileUpload-Prompt-Multiple' : 'FileUpload-Prompt') | translate }}\n <span class=\"browse\">{{ 'FileUpload-Browse' | translate }}</span>\n </span>\n <span class=\"hint\" [attr.id]=\"hintId\">\n @if (accept()) {\n <span>{{ 'FileUpload-Accept' | translate: { types: acceptText() } }}</span>\n }\n @if (maxFileSize() !== undefined) {\n <span>{{ 'FileUpload-MaxFileSize' | translate: { size: formatSize(maxFileSize()!) } }}</span>\n }\n @if (multiple() && maxFiles() !== undefined) {\n <span>{{ 'FileUpload-MaxFiles' | translate: { count: maxFiles() } }}</span>\n }\n </span>\n </div>\n <input\n #fileInput\n class=\"native-input\"\n type=\"file\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [attr.accept]=\"accept() || null\"\n [multiple]=\"multiple()\"\n (change)=\"onInputChange($event)\"\n />\n\n <!-- A live region around a plain list: role=\"status\" on the <ul> itself would drop its list\n meaning, and every item would then fail the listitem rule. -->\n <div role=\"status\">\n <ul class=\"rejections\">\n @for (rejection of rejections(); track $index) {\n <li>\n {{\n rejectionKey(rejection.reason)\n | translate\n : {\n name: rejection.file.name,\n size: maxFileSize() !== undefined ? formatSize(maxFileSize()!) : '',\n count: fileLimit(),\n }\n }}\n </li>\n }\n </ul>\n </div>\n }\n\n @if (files().length > 0) {\n <ul class=\"file-list\">\n @for (file of files(); track $index) {\n <li class=\"file\">\n <i class=\"fa-regular fa-file icon\" aria-hidden=\"true\"></i>\n <span class=\"name\" [attr.title]=\"file.name\">{{ file.name }}</span>\n <span class=\"size\">{{ formatSize(file.size) }}</span>\n @if (isEditable()) {\n <button\n class=\"remove\"\n type=\"button\"\n [attr.aria-label]=\"'FileUpload-Remove' | translate: { name: file.name }\"\n [attr.title]=\"'FileUpload-Remove' | translate: { name: file.name }\"\n (click)=\"onRemoveClick(file)\"\n >\n <i class=\"fa-solid fa-xmark\" aria-hidden=\"true\"></i>\n </button>\n }\n @let percent = progressOf(file);\n @if (percent !== undefined) {\n <div\n class=\"progress\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-label]=\"'FileUpload-Progress' | translate: { name: file.name }\"\n [attr.aria-valuenow]=\"percent\"\n >\n <div class=\"bar\" [style.width.%]=\"percent\"></div>\n </div>\n }\n </li>\n }\n </ul>\n } @else if (!isEditable()) {\n <span class=\"value\">{{ 'FileUpload-Empty' | translate }}</span>\n }\n </div>\n</ng-template>\n",
5171
+ styles: ["@layer properties;:host{grid-column:span 2 / span 2;display:grid;grid-template-columns:subgrid}.file-upload{display:flex;min-width:0px;flex-direction:column;gap:calc(var(--spacing, .25rem) * 2)}.drop-zone{display:flex;cursor:pointer;flex-direction:column;align-items:center;justify-content:center;gap:var(--spacing, .25rem);padding-inline:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 4);text-align:center;border-style:var(--tw-border-style);border-width:2px;--tw-border-style: dashed;border-style:dashed;transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function, cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration, var(--default-transition-duration, .15s));border-color:var(--color-line-strong);border-radius:var(--radius-field);color:var(--color-content-secondary)}.drop-zone:hover{background-color:var(--state-hover)}.drop-zone:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(var(--focus-ring-width) + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-outline-style: none;outline-style:none;--tw-ring-color: var(--color-focus-ring)}@media(forced-colors:active){.drop-zone:focus-visible{outline:2px solid transparent;outline-offset:2px}}.drop-zone.drag-over{border-color:var(--color-accent);background-color:var(--state-selected)}.drop-zone.invalid{border-color:var(--color-danger)}.drop-zone .icon{font-size:var(--text-2xl, 1.5rem);line-height:var(--tw-leading, var(--text-2xl--line-height, calc(2 / 1.5)));color:var(--color-content-subtle)}.drop-zone .prompt{overflow-wrap:break-word;font-size:var(--text-ui)}.drop-zone .browse{text-decoration-line:underline;color:var(--color-accent-strong);font-weight:var(--font-weight-emphasis)}.drop-zone .hint{display:flex;flex-wrap:wrap;justify-content:center;column-gap:calc(var(--spacing, .25rem) * 3);overflow-wrap:break-word;font-size:var(--text-caption);color:var(--color-content-subtle)}.native-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border-width:0}.rejections{display:flex;flex-direction:column;gap:calc(var(--spacing, .25rem) * .5);overflow-wrap:break-word;font-size:var(--text-caption);color:var(--color-danger)}.rejections:empty{display:none}.file-list{display:flex;flex-direction:column;gap:var(--spacing, .25rem)}.file{display:grid;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2);padding-inline:calc(var(--spacing, .25rem) * 2);padding-block:var(--spacing, .25rem);grid-template-columns:auto minmax(0,1fr) auto auto;border:1px solid var(--color-line);border-radius:var(--radius-field);background-color:var(--color-surface-inset);color:var(--color-content-primary)}.file .icon{color:var(--color-content-subtle)}.file .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file .size{white-space:nowrap;font-size:var(--text-caption);color:var(--color-content-secondary)}.file .remove{display:flex;height:calc(var(--spacing, .25rem) * 6);width:calc(var(--spacing, .25rem) * 6);cursor:pointer;align-items:center;justify-content:center;--tw-border-style: none;border-style:none;background-color:transparent;padding:0;border-radius:var(--radius-control);color:var(--color-content-subtle)}.file .remove:hover{color:var(--color-content-primary);background-color:var(--state-hover)}.file .remove:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(var(--focus-ring-width) + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-outline-style: none;outline-style:none;--tw-ring-color: var(--color-focus-ring)}@media(forced-colors:active){.file .remove:focus-visible{outline:2px solid transparent;outline-offset:2px}}.file .progress{grid-column:1 / -1;margin-top:var(--spacing, .25rem);height:calc(var(--spacing, .25rem) * 1.5);overflow:hidden;border-radius:calc(infinity * 1px);background-color:var(--color-line)}.file .progress .bar{height:100%;border-radius:calc(infinity * 1px);transition-property:width;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function, cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration, var(--default-transition-duration, .15s));background-color:var(--color-accent)}.value{display:block;padding-block:var(--spacing, .25rem);color:var(--color-content-secondary)}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"]
5172
+ }]
5173
+ }],
5174
+ ctorParameters: () => [],
5175
+ propDecorators: {
5176
+ accept: [{
5177
+ type: i0.Input,
5178
+ args: [{
5179
+ isSignal: true,
5180
+ alias: "accept",
5181
+ required: false
5182
+ }]
5183
+ }],
5184
+ controlName: [{
5185
+ type: i0.Input,
5186
+ args: [{
5187
+ isSignal: true,
5188
+ alias: "controlName",
5189
+ required: true
5190
+ }]
5191
+ }],
5192
+ label: [{
5193
+ type: i0.Input,
5194
+ args: [{
5195
+ isSignal: true,
5196
+ alias: "label",
5197
+ required: false
5198
+ }]
5199
+ }],
5200
+ maxFileSize: [{
5201
+ type: i0.Input,
5202
+ args: [{
5203
+ isSignal: true,
5204
+ alias: "maxFileSize",
5205
+ required: false
5206
+ }]
5207
+ }],
5208
+ maxFiles: [{
5209
+ type: i0.Input,
5210
+ args: [{
5211
+ isSignal: true,
5212
+ alias: "maxFiles",
5213
+ required: false
5214
+ }]
5215
+ }],
5216
+ multiple: [{
5217
+ type: i0.Input,
5218
+ args: [{
5219
+ isSignal: true,
5220
+ alias: "multiple",
5221
+ required: false
5222
+ }]
5223
+ }],
5224
+ notes: [{
5225
+ type: i0.Input,
5226
+ args: [{
5227
+ isSignal: true,
5228
+ alias: "notes",
5229
+ required: false
5230
+ }]
5231
+ }],
5232
+ progress: [{
5233
+ type: i0.Input,
5234
+ args: [{
5235
+ isSignal: true,
5236
+ alias: "progress",
5237
+ required: false
5238
+ }]
5239
+ }],
5240
+ validations: [{
5241
+ type: i0.Input,
5242
+ args: [{
5243
+ isSignal: true,
5244
+ alias: "validations",
5245
+ required: false
5246
+ }]
5247
+ }],
5248
+ filesAdded: [{
5249
+ type: i0.Output,
5250
+ args: ["filesAdded"]
5251
+ }],
5252
+ fileRemoved: [{
5253
+ type: i0.Output,
5254
+ args: ["fileRemoved"]
5255
+ }],
5256
+ filesRejected: [{
5257
+ type: i0.Output,
5258
+ args: ["filesRejected"]
5259
+ }]
5260
+ }
5261
+ });
5262
+ const ICONS = {
5263
+ error: "fa-solid fa-circle-exclamation",
5264
+ info: "fa-solid fa-circle-info",
5265
+ success: "fa-solid fa-circle-check",
5266
+ warning: "fa-solid fa-triangle-exclamation"
5267
+ };
5268
+ var ToastComponent = class ToastComponent {
5269
+ toast = input.required(...ngDevMode ? [{ debugName: "toast" }] : /* istanbul ignore next */ []);
5270
+ closed = output();
5271
+ pausedChange = output();
5272
+ elementRef = inject(ElementRef);
5273
+ isFocused = signal(false, ...ngDevMode ? [{ debugName: "isFocused" }] : /* istanbul ignore next */ []);
5274
+ isHovered = signal(false, ...ngDevMode ? [{ debugName: "isHovered" }] : /* istanbul ignore next */ []);
5275
+ iconClass = computed(() => ICONS[this.toast().intent], ...ngDevMode ? [{ debugName: "iconClass" }] : /* istanbul ignore next */ []);
5276
+ isPaused = computed(() => this.isHovered() || this.isFocused(), ...ngDevMode ? [{ debugName: "isPaused" }] : /* istanbul ignore next */ []);
5277
+ onFocusOut(event) {
5278
+ const next = event.relatedTarget;
5279
+ if (next instanceof Node && this.elementRef.nativeElement.contains(next)) return;
5280
+ this.setFocused(false);
5281
+ }
5282
+ setFocused(value) {
5283
+ this.update(this.isFocused, value);
5284
+ }
5285
+ setHovered(value) {
5286
+ this.update(this.isHovered, value);
5287
+ }
5288
+ update(target, value) {
5289
+ const wasPaused = this.isPaused();
5290
+ target.set(value);
5291
+ const paused = this.isPaused();
5292
+ if (paused !== wasPaused) this.pausedChange.emit(paused);
5293
+ }
5294
+ static ɵfac = i0.ɵɵngDeclareFactory({
5295
+ minVersion: "12.0.0",
5296
+ version: "22.2.0",
5297
+ ngImport: i0,
5298
+ type: ToastComponent,
5299
+ deps: [],
5300
+ target: i0.ɵɵFactoryTarget.Component
5301
+ });
5302
+ static ɵcmp = i0.ɵɵngDeclareComponent({
5303
+ minVersion: "17.0.0",
5304
+ version: "22.2.0",
5305
+ type: ToastComponent,
5306
+ isStandalone: true,
5307
+ selector: "framework-toast",
5308
+ inputs: { toast: {
5309
+ classPropertyName: "toast",
5310
+ publicName: "toast",
5311
+ isSignal: true,
5312
+ isRequired: true,
5313
+ transformFunction: null
5314
+ } },
5315
+ outputs: {
5316
+ closed: "closed",
5317
+ pausedChange: "pausedChange"
5318
+ },
5319
+ host: {
5320
+ listeners: {
5321
+ "mouseenter": "setHovered(true)",
5322
+ "mouseleave": "setHovered(false)",
5323
+ "focusin": "setFocused(true)",
5324
+ "focusout": "onFocusOut($event)"
5325
+ },
5326
+ properties: { "attr.data-intent": "toast().intent" },
5327
+ classAttribute: "framework-toast"
5328
+ },
5329
+ ngImport: i0,
5330
+ template: "<i class=\"toast-icon\" [class]=\"iconClass()\" aria-hidden=\"true\"></i>\n<div class=\"toast-body\">\n @if (toast().title; as title) {\n <p class=\"toast-title\">{{ title | translate: toast().params }}</p>\n }\n <p class=\"toast-message\">{{ toast().message | translate: toast().params }}</p>\n</div>\n<button type=\"button\" class=\"toast-close\" [attr.aria-label]=\"'Toast-Close' | translate\" (click)=\"closed.emit()\">\n <i class=\"fa-solid fa-xmark\" aria-hidden=\"true\"></i>\n</button>\n",
5331
+ styles: ["@layer properties;:host{--toast-intent-color: var(--color-info);display:flex;align-items:flex-start;gap:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 3);padding-right:calc(var(--spacing, .25rem) * 2);padding-left:calc(var(--spacing, .25rem) * 4);border-style:var(--tw-border-style);border-width:1px;border-left-style:var(--tw-border-style);border-left-width:4px;pointer-events:auto;border-color:var(--color-line);border-left-color:var(--toast-intent-color);border-radius:var(--radius-control);background-color:var(--color-surface-solid);color:var(--color-content-primary);box-shadow:var(--shadow-overlay);font-size:var(--text-body);animation:toast-enter var(--duration-short) var(--ease-emphasized)}:host([data-intent=success]){--toast-intent-color: var(--color-success)}:host([data-intent=error]){--toast-intent-color: var(--color-danger)}:host([data-intent=warning]){--toast-intent-color: var(--color-warning)}.toast-icon{margin-top:calc(var(--spacing, .25rem) * .5);flex-shrink:0;color:var(--toast-intent-color);font-size:var(--text-ui)}.toast-body{min-width:0px;flex:1;overflow-wrap:anywhere}.toast-title{font-weight:var(--font-weight-emphasis)}.toast-message{white-space:pre-line}.toast-close{margin-block:calc(var(--spacing, .25rem) * -1);display:flex;width:calc(var(--spacing, .25rem) * 8);height:calc(var(--spacing, .25rem) * 8);flex-shrink:0;cursor:pointer;align-items:center;justify-content:center;border-radius:var(--radius-control);color:var(--color-content-secondary)}.toast-close:hover{background-color:var(--state-hover)}.toast-close:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(var(--focus-ring-width) + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-outline-style: none;outline-style:none;--tw-ring-color: var(--color-focus-ring)}@media(forced-colors:active){.toast-close:focus-visible{outline:2px solid transparent;outline-offset:2px}}@keyframes toast-enter{0%{opacity:0;transform:translateY(.5rem)}}@media(prefers-reduced-motion:reduce){:host{animation:none}}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"],
5332
+ dependencies: [{
5333
+ kind: "pipe",
5334
+ type: TranslatePipe,
5335
+ name: "translate"
5336
+ }]
5337
+ });
5338
+ };
5339
+ i0.ɵɵngDeclareClassMetadata({
5340
+ minVersion: "12.0.0",
5341
+ version: "22.2.0",
5342
+ ngImport: i0,
5343
+ type: ToastComponent,
5344
+ decorators: [{
5345
+ type: Component,
5346
+ args: [{
5347
+ selector: "framework-toast",
5348
+ imports: [TranslatePipe],
5349
+ host: {
5350
+ class: "framework-toast",
5351
+ "[attr.data-intent]": "toast().intent",
5352
+ "(mouseenter)": "setHovered(true)",
5353
+ "(mouseleave)": "setHovered(false)",
5354
+ "(focusin)": "setFocused(true)",
5355
+ "(focusout)": "onFocusOut($event)"
5356
+ },
5357
+ template: "<i class=\"toast-icon\" [class]=\"iconClass()\" aria-hidden=\"true\"></i>\n<div class=\"toast-body\">\n @if (toast().title; as title) {\n <p class=\"toast-title\">{{ title | translate: toast().params }}</p>\n }\n <p class=\"toast-message\">{{ toast().message | translate: toast().params }}</p>\n</div>\n<button type=\"button\" class=\"toast-close\" [attr.aria-label]=\"'Toast-Close' | translate\" (click)=\"closed.emit()\">\n <i class=\"fa-solid fa-xmark\" aria-hidden=\"true\"></i>\n</button>\n",
5358
+ styles: ["@layer properties;:host{--toast-intent-color: var(--color-info);display:flex;align-items:flex-start;gap:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 3);padding-right:calc(var(--spacing, .25rem) * 2);padding-left:calc(var(--spacing, .25rem) * 4);border-style:var(--tw-border-style);border-width:1px;border-left-style:var(--tw-border-style);border-left-width:4px;pointer-events:auto;border-color:var(--color-line);border-left-color:var(--toast-intent-color);border-radius:var(--radius-control);background-color:var(--color-surface-solid);color:var(--color-content-primary);box-shadow:var(--shadow-overlay);font-size:var(--text-body);animation:toast-enter var(--duration-short) var(--ease-emphasized)}:host([data-intent=success]){--toast-intent-color: var(--color-success)}:host([data-intent=error]){--toast-intent-color: var(--color-danger)}:host([data-intent=warning]){--toast-intent-color: var(--color-warning)}.toast-icon{margin-top:calc(var(--spacing, .25rem) * .5);flex-shrink:0;color:var(--toast-intent-color);font-size:var(--text-ui)}.toast-body{min-width:0px;flex:1;overflow-wrap:anywhere}.toast-title{font-weight:var(--font-weight-emphasis)}.toast-message{white-space:pre-line}.toast-close{margin-block:calc(var(--spacing, .25rem) * -1);display:flex;width:calc(var(--spacing, .25rem) * 8);height:calc(var(--spacing, .25rem) * 8);flex-shrink:0;cursor:pointer;align-items:center;justify-content:center;border-radius:var(--radius-control);color:var(--color-content-secondary)}.toast-close:hover{background-color:var(--state-hover)}.toast-close:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(var(--focus-ring-width) + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-outline-style: none;outline-style:none;--tw-ring-color: var(--color-focus-ring)}@media(forced-colors:active){.toast-close:focus-visible{outline:2px solid transparent;outline-offset:2px}}@keyframes toast-enter{0%{opacity:0;transform:translateY(.5rem)}}@media(prefers-reduced-motion:reduce){:host{animation:none}}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"]
5359
+ }]
5360
+ }],
5361
+ propDecorators: {
5362
+ toast: [{
5363
+ type: i0.Input,
5364
+ args: [{
5365
+ isSignal: true,
5366
+ alias: "toast",
5367
+ required: true
5368
+ }]
5369
+ }],
5370
+ closed: [{
5371
+ type: i0.Output,
5372
+ args: ["closed"]
5373
+ }],
5374
+ pausedChange: [{
5375
+ type: i0.Output,
5376
+ args: ["pausedChange"]
5377
+ }]
5378
+ }
5379
+ });
5380
+ const TOAST_MAX_VISIBLE = 5;
5381
+ const TOAST_DEFAULT_DURATIONS = {
5382
+ error: 0,
5383
+ info: 5e3,
5384
+ success: 5e3,
5385
+ warning: 5e3
5386
+ };
5387
+ const TOAST_STACK_SOURCE = new InjectionToken("TOAST_STACK_SOURCE");
5388
+ var ToastStackComponent = class ToastStackComponent {
5389
+ source = inject(TOAST_STACK_SOURCE);
5390
+ static ɵfac = i0.ɵɵngDeclareFactory({
5391
+ minVersion: "12.0.0",
5392
+ version: "22.2.0",
5393
+ ngImport: i0,
5394
+ type: ToastStackComponent,
5395
+ deps: [],
5396
+ target: i0.ɵɵFactoryTarget.Component
5397
+ });
5398
+ static ɵcmp = i0.ɵɵngDeclareComponent({
5399
+ minVersion: "17.0.0",
5400
+ version: "22.2.0",
5401
+ type: ToastStackComponent,
5402
+ isStandalone: true,
5403
+ selector: "framework-toast-stack",
5404
+ host: { classAttribute: "framework-toast-stack" },
5405
+ ngImport: i0,
5406
+ template: `
5407
+ @for (toast of source.toasts(); track toast.id) {
5408
+ <framework-toast
5409
+ [toast]="toast"
5410
+ (closed)="source.dismiss(toast.id)"
5411
+ (pausedChange)="$event ? source.pause(toast.id) : source.resume(toast.id)"
5412
+ />
5413
+ }
5414
+ `,
5415
+ isInline: true,
5416
+ styles: [":host{display:flex;flex-direction:column;gap:.5rem;box-sizing:border-box;padding:1.5rem;width:min(27rem,100%);margin-left:auto;max-height:calc(100vh + 1rem);overflow-y:auto;pointer-events:none}\n"],
5417
+ dependencies: [{
5418
+ kind: "component",
5419
+ type: ToastComponent,
5420
+ selector: "framework-toast",
5421
+ inputs: ["toast"],
5422
+ outputs: ["closed", "pausedChange"]
5423
+ }]
5424
+ });
5425
+ };
5426
+ i0.ɵɵngDeclareClassMetadata({
5427
+ minVersion: "12.0.0",
5428
+ version: "22.2.0",
5429
+ ngImport: i0,
5430
+ type: ToastStackComponent,
5431
+ decorators: [{
5432
+ type: Component,
5433
+ args: [{
5434
+ selector: "framework-toast-stack",
5435
+ imports: [ToastComponent],
5436
+ template: `
5437
+ @for (toast of source.toasts(); track toast.id) {
5438
+ <framework-toast
5439
+ [toast]="toast"
5440
+ (closed)="source.dismiss(toast.id)"
5441
+ (pausedChange)="$event ? source.pause(toast.id) : source.resume(toast.id)"
5442
+ />
5443
+ }
5444
+ `,
5445
+ host: { class: "framework-toast-stack" },
5446
+ styles: [":host{display:flex;flex-direction:column;gap:.5rem;box-sizing:border-box;padding:1.5rem;width:min(27rem,100%);margin-left:auto;max-height:calc(100vh + 1rem);overflow-y:auto;pointer-events:none}\n"]
5447
+ }]
5448
+ }]
5449
+ });
5450
+ var ToastService = class ToastService {
5451
+ announcer = inject(LiveAnnouncer);
5452
+ injector = inject(Injector);
5453
+ translate = inject(TranslateService, { optional: true });
5454
+ isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
5455
+ nextId = 1;
5456
+ pendingAnnouncement;
5457
+ overlayRef;
5458
+ state = signal([], ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
5459
+ timers = /* @__PURE__ */ new Map();
5460
+ toasts = this.state.asReadonly();
5461
+ constructor() {
5462
+ inject(DestroyRef).onDestroy(() => {
5463
+ this.timers.forEach((timer) => clearTimeout(timer.handle));
5464
+ this.timers.clear();
5465
+ this.overlayRef?.dispose();
5466
+ this.overlayRef = void 0;
5467
+ });
5468
+ }
5469
+ dismiss(id) {
5470
+ this.clearTimer(id);
5471
+ this.state.update((toasts) => toasts.filter((toast) => toast.id !== id));
5472
+ }
5473
+ dismissAll() {
5474
+ this.timers.forEach((timer) => clearTimeout(timer.handle));
5475
+ this.timers.clear();
5476
+ this.state.set([]);
5477
+ }
5478
+ error(message, options) {
5479
+ return this.showIntent("error", message, options);
5480
+ }
5481
+ info(message, options) {
5482
+ return this.showIntent("info", message, options);
5483
+ }
5484
+ pause(id) {
5485
+ const timer = this.timers.get(id);
5486
+ if (!timer?.handle) return;
5487
+ clearTimeout(timer.handle);
5488
+ timer.handle = void 0;
5489
+ timer.remaining = Math.max(0, timer.remaining - (Date.now() - timer.startedAt));
5490
+ }
5491
+ resume(id) {
5492
+ const timer = this.timers.get(id);
5493
+ if (!timer || timer.handle) return;
5494
+ this.startTimer(id, timer.remaining);
5495
+ }
5496
+ show(options) {
5497
+ const intent = options.intent ?? "info";
5498
+ const toast = {
5499
+ duration: Math.max(0, options.duration ?? TOAST_DEFAULT_DURATIONS[intent]),
5500
+ id: this.nextId++,
5501
+ intent,
5502
+ message: options.message,
5503
+ params: options.params,
5504
+ title: options.title
5505
+ };
5506
+ const next = [...this.state(), toast];
5507
+ next.splice(0, Math.max(0, next.length - 5)).forEach((old) => this.clearTimer(old.id));
5508
+ this.state.set(next);
5509
+ if (toast.duration > 0) this.startTimer(toast.id, toast.duration);
5510
+ this.ensureContainer();
5511
+ this.announce(toast);
5512
+ return toast.id;
5513
+ }
5514
+ success(message, options) {
5515
+ return this.showIntent("success", message, options);
5516
+ }
5517
+ warning(message, options) {
5518
+ return this.showIntent("warning", message, options);
5519
+ }
5520
+ announce(toast) {
5521
+ if (!this.isBrowser) return;
5522
+ const text = [toast.title, toast.message].filter((key) => !!key).map((key) => this.translate?.instant(key, toast.params) ?? key).join(". ");
5523
+ if (this.pendingAnnouncement) {
5524
+ this.pendingAnnouncement.texts.push(text);
5525
+ this.pendingAnnouncement.isAssertive ||= toast.intent === "error";
5526
+ return;
5527
+ }
5528
+ this.pendingAnnouncement = {
5529
+ texts: [text],
5530
+ isAssertive: toast.intent === "error"
5531
+ };
5532
+ queueMicrotask(() => {
5533
+ const pending = this.pendingAnnouncement;
5534
+ this.pendingAnnouncement = void 0;
5535
+ if (pending) this.announcer.announce(pending.texts.join(" "), pending.isAssertive ? "assertive" : "polite");
5536
+ });
5537
+ }
5538
+ clearTimer(id) {
5539
+ clearTimeout(this.timers.get(id)?.handle);
5540
+ this.timers.delete(id);
5541
+ }
5542
+ ensureContainer() {
5543
+ if (this.overlayRef || !this.isBrowser) return;
5544
+ this.overlayRef = createOverlayRef(this.injector, {
5545
+ panelClass: "framework-toast-pane",
5546
+ width: "calc(100% + 1rem)",
5547
+ minWidth: "calc(100% + 1rem)",
5548
+ maxWidth: "none",
5549
+ positionStrategy: createGlobalPositionStrategy(this.injector).bottom("-0.5rem").right("-0.5rem"),
5550
+ scrollStrategy: createNoopScrollStrategy()
5551
+ });
5552
+ const portalInjector = Injector.create({
5553
+ parent: this.injector,
5554
+ providers: [{
5555
+ provide: TOAST_STACK_SOURCE,
5556
+ useValue: this
5557
+ }]
5558
+ });
5559
+ this.overlayRef.attach(new ComponentPortal(ToastStackComponent, null, portalInjector));
5560
+ this.overlayRef.overlayElement.style.pointerEvents = "none";
5561
+ }
5562
+ showIntent(intent, message, options) {
5563
+ return this.show({
5564
+ ...options,
5565
+ intent,
5566
+ message
5567
+ });
5568
+ }
5569
+ startTimer(id, delay) {
5570
+ const timer = this.timers.get(id) ?? {
5571
+ remaining: delay,
5572
+ startedAt: 0
5573
+ };
5574
+ timer.remaining = delay;
5575
+ timer.startedAt = Date.now();
5576
+ timer.handle = setTimeout(() => this.dismiss(id), delay);
5577
+ this.timers.set(id, timer);
5578
+ }
5579
+ static ɵfac = i0.ɵɵngDeclareFactory({
5580
+ minVersion: "12.0.0",
5581
+ version: "22.2.0",
5582
+ ngImport: i0,
5583
+ type: ToastService,
5584
+ deps: [],
5585
+ target: i0.ɵɵFactoryTarget.Injectable
5586
+ });
5587
+ static ɵprov = i0.ɵɵngDeclareInjectable({
5588
+ minVersion: "12.0.0",
5589
+ version: "22.2.0",
5590
+ ngImport: i0,
5591
+ type: ToastService,
5592
+ providedIn: "root"
5593
+ });
5594
+ };
5595
+ i0.ɵɵngDeclareClassMetadata({
5596
+ minVersion: "12.0.0",
5597
+ version: "22.2.0",
5598
+ ngImport: i0,
5599
+ type: ToastService,
5600
+ decorators: [{
5601
+ type: Injectable,
5602
+ args: [{ providedIn: "root" }]
5603
+ }],
5604
+ ctorParameters: () => []
5605
+ });
4868
5606
  const APP_CONFIG = new InjectionToken("Manually constructed AppConfig", {
4869
5607
  providedIn: "root",
4870
5608
  factory: () => new AppConfig("")
@@ -6072,6 +6810,6 @@ i0.ɵɵngDeclareClassMetadata({
6072
6810
  args: ["modal"]
6073
6811
  }] }
6074
6812
  });
6075
- export { APP_CONFIG, AppConfig, AuthService, BackendFormValidationHelper, BaseButton, BaseFormViewButton, ButtonComponent, ButtonConfirmComponent, ButtonDeleteComponent, ButtonEditComponent, ButtonEditLegacyComponent, ButtonExportComponent, ButtonFiltersComponent, ButtonNewComponent, ButtonNewLegacyComponent, ButtonOpenRecordComponent, ButtonOpenRecordLegacyComponent, ButtonRefreshComponent, ButtonSaveComponent, ButtonSaveLegacyComponent, ButtonViewsComponent, ButtonViewsLegacyComponent, ChildList, ChildListLegacy, ConfirmModalComponent, CustomReuseStrategy, DateValidators, DefaultDetailsTabViewComponent, DefaultTabViewComponent, ErrorModalComponent, FRAMEWORK_VIEW_TYPE, FormView, FrameworkButtonsModule, FrameworkComponentsModule, FrameworkGridConfigsProvider, FrameworkModalsModule, FrameworkModule, FrameworkViewType, FrameworkViewsModule, LegacySubViewForm, LegacyTabViewDetails, LegacyTabViewList, ListView, MaxExportRows, ModalBase, MultiEditorLegacyModal, MultiEditorModal, MultiSelectModal, RouteHelper, Tab, TabBreadcrumbsComponent, TabService, TabViewBase, TabViewList, TabViewService, TabsComponent, ViewBase, ViewModal, ZAMBON_FRAMEWORK_I18N_ASSET, ZAMBON_FRAMEWORK_I18N_ASSET_PATH, ZAMBON_FRAMEWORK_I18N_RESOURCES, createZambonFrameworkTranslateLoader, provideZambonFrameworkTranslateLoader, provideZambonFrameworkTranslateService };
6813
+ export { APP_CONFIG, AppConfig, AuthService, BackendFormValidationHelper, BaseButton, BaseFormViewButton, ButtonComponent, ButtonConfirmComponent, ButtonDeleteComponent, ButtonEditComponent, ButtonEditLegacyComponent, ButtonExportComponent, ButtonFiltersComponent, ButtonNewComponent, ButtonNewLegacyComponent, ButtonOpenRecordComponent, ButtonOpenRecordLegacyComponent, ButtonRefreshComponent, ButtonSaveComponent, ButtonSaveLegacyComponent, ButtonViewsComponent, ButtonViewsLegacyComponent, ChildList, ChildListLegacy, ConfirmModalComponent, CustomReuseStrategy, DateValidators, DefaultDetailsTabViewComponent, DefaultTabViewComponent, ErrorModalComponent, FRAMEWORK_VIEW_TYPE, FileUploadComponent, FormView, FrameworkButtonsModule, FrameworkComponentsModule, FrameworkGridConfigsProvider, FrameworkModalsModule, FrameworkModule, FrameworkViewType, FrameworkViewsModule, LegacySubViewForm, LegacyTabViewDetails, LegacyTabViewList, ListView, MaxExportRows, ModalBase, MultiEditorLegacyModal, MultiEditorModal, MultiSelectModal, RouteHelper, TOAST_DEFAULT_DURATIONS, TOAST_MAX_VISIBLE, Tab, TabBreadcrumbsComponent, TabService, TabViewBase, TabViewList, TabViewService, TabsComponent, ToastComponent, ToastService, ViewBase, ViewModal, ZAMBON_FRAMEWORK_I18N_ASSET, ZAMBON_FRAMEWORK_I18N_ASSET_PATH, ZAMBON_FRAMEWORK_I18N_RESOURCES, createZambonFrameworkTranslateLoader, provideZambonFrameworkTranslateLoader, provideZambonFrameworkTranslateService };
6076
6814
 
6077
6815
  //# sourceMappingURL=zambon-dev-ui-framework.mjs.map