@xsmusices/ui 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7104,7 +7104,12 @@ var UPLOAD_IMAGE$1 = {
7104
7104
  HINT: "JPG, PNG o GIF. Haz clic aquí para elegir.",
7105
7105
  SELECT_BUTTON: "Seleccionar",
7106
7106
  CHANGE_BUTTON: "Cambiar",
7107
- REMOVE_BUTTON: "Borrar"
7107
+ REMOVE_BUTTON: "Borrar",
7108
+ MODE_FILE: "Archivo",
7109
+ MODE_URL: "URL",
7110
+ URL_PLACEHOLDER: "Pega la URL de la imagen (https://…)",
7111
+ URL_APPLY: "Aplicar",
7112
+ URL_INVALID: "La URL no es válida. Debe empezar por http:// o https://"
7108
7113
  };
7109
7114
  var es$n = {
7110
7115
  UPLOAD_IMAGE: UPLOAD_IMAGE$1
@@ -7115,7 +7120,12 @@ var UPLOAD_IMAGE = {
7115
7120
  HINT: "JPG, PNG or GIF. Click here to choose.",
7116
7121
  SELECT_BUTTON: "Select",
7117
7122
  CHANGE_BUTTON: "Change",
7118
- REMOVE_BUTTON: "Delete"
7123
+ REMOVE_BUTTON: "Delete",
7124
+ MODE_FILE: "File",
7125
+ MODE_URL: "URL",
7126
+ URL_PLACEHOLDER: "Paste the image URL (https://…)",
7127
+ URL_APPLY: "Apply",
7128
+ URL_INVALID: "Invalid URL. It must start with http:// or https://"
7119
7129
  };
7120
7130
  var en$n = {
7121
7131
  UPLOAD_IMAGE: UPLOAD_IMAGE
@@ -7125,6 +7135,9 @@ class XSFormlyUploadImageComponent extends XSFormlyBaseComponent {
7125
7135
  fileInput = viewChild('fileInput', ...(ngDevMode ? [{ debugName: "fileInput" }] : []));
7126
7136
  previewUrl;
7127
7137
  isDragging = false;
7138
+ mode = 'file';
7139
+ urlInput = '';
7140
+ urlError = '';
7128
7141
  valueChangesSub = new Subscription();
7129
7142
  translateService = inject(XSTranslateService);
7130
7143
  changeDetectorRef = inject(ChangeDetectorRef);
@@ -7148,6 +7161,21 @@ class XSFormlyUploadImageComponent extends XSFormlyBaseComponent {
7148
7161
  get removeButtonLabel() {
7149
7162
  return this.xsTranslateService.translate('UPLOAD_IMAGE.REMOVE_BUTTON');
7150
7163
  }
7164
+ get modeFileLabel() {
7165
+ return this.xsTranslateService.translate('UPLOAD_IMAGE.MODE_FILE');
7166
+ }
7167
+ get modeUrlLabel() {
7168
+ return this.xsTranslateService.translate('UPLOAD_IMAGE.MODE_URL');
7169
+ }
7170
+ get urlPlaceholder() {
7171
+ return this.xsTranslateService.translate('UPLOAD_IMAGE.URL_PLACEHOLDER');
7172
+ }
7173
+ get urlApplyLabel() {
7174
+ return this.xsTranslateService.translate('UPLOAD_IMAGE.URL_APPLY');
7175
+ }
7176
+ get urlInvalidMessage() {
7177
+ return this.xsTranslateService.translate('UPLOAD_IMAGE.URL_INVALID');
7178
+ }
7151
7179
  get isFieldDisabled() {
7152
7180
  return !!this.props['disabled'] || !!this.control?.disabled;
7153
7181
  }
@@ -7156,6 +7184,7 @@ class XSFormlyUploadImageComponent extends XSFormlyBaseComponent {
7156
7184
  const initial = this.control.value;
7157
7185
  if (initial) {
7158
7186
  this.syncPreview(initial);
7187
+ this.syncMode(initial);
7159
7188
  }
7160
7189
  else if (this.props?.['currentImageUrl']) {
7161
7190
  this.previewUrl = this.props['currentImageUrl'];
@@ -7164,6 +7193,7 @@ class XSFormlyUploadImageComponent extends XSFormlyBaseComponent {
7164
7193
  if (value instanceof File ||
7165
7194
  (typeof value === 'string' && value)) {
7166
7195
  this.syncPreview(value);
7196
+ this.syncMode(value);
7167
7197
  }
7168
7198
  else if (!value) {
7169
7199
  this.revokeOldUrl();
@@ -7221,6 +7251,48 @@ class XSFormlyUploadImageComponent extends XSFormlyBaseComponent {
7221
7251
  this.control.markAsTouched();
7222
7252
  this.control.markAsDirty();
7223
7253
  }
7254
+ isHttpUrl(value) {
7255
+ return /^https?:\/\/.+/i.test(value.trim());
7256
+ }
7257
+ syncMode(value) {
7258
+ if (typeof value === 'string' &&
7259
+ this.isHttpUrl(value) &&
7260
+ this.mode !== 'url') {
7261
+ this.mode = 'url';
7262
+ this.urlInput = value;
7263
+ }
7264
+ }
7265
+ setMode(mode) {
7266
+ if (this.isFieldDisabled)
7267
+ return;
7268
+ this.mode = mode;
7269
+ if (mode === 'url') {
7270
+ const current = this.control.value;
7271
+ if (typeof current === 'string' && current) {
7272
+ this.urlInput = current;
7273
+ }
7274
+ this.urlError = '';
7275
+ }
7276
+ this.changeDetectorRef.markForCheck();
7277
+ }
7278
+ onUrlInput(event) {
7279
+ const input = event.target;
7280
+ this.urlInput = input.value;
7281
+ }
7282
+ applyUrl() {
7283
+ if (this.isFieldDisabled)
7284
+ return;
7285
+ const url = this.urlInput.trim();
7286
+ if (!this.isHttpUrl(url)) {
7287
+ this.urlError = this.urlInvalidMessage;
7288
+ this.changeDetectorRef.markForCheck();
7289
+ return;
7290
+ }
7291
+ this.urlError = '';
7292
+ this.control.setValue(url);
7293
+ this.control.markAsTouched();
7294
+ this.control.markAsDirty();
7295
+ }
7224
7296
  clearFile(event) {
7225
7297
  event.preventDefault();
7226
7298
  event.stopPropagation();
@@ -7228,9 +7300,13 @@ class XSFormlyUploadImageComponent extends XSFormlyBaseComponent {
7228
7300
  return;
7229
7301
  this.revokeOldUrl();
7230
7302
  this.previewUrl = undefined;
7303
+ this.urlInput = '';
7304
+ this.urlError = '';
7231
7305
  this.control.setValue(null);
7232
7306
  this.control.markAsTouched();
7233
- this.fileInput().nativeElement.value = '';
7307
+ const fileEl = this.fileInput()?.nativeElement;
7308
+ if (fileEl)
7309
+ fileEl.value = '';
7234
7310
  }
7235
7311
  revokeOldUrl() {
7236
7312
  if (this.previewUrl && this.previewUrl.startsWith('blob:')) {
@@ -7243,7 +7319,7 @@ class XSFormlyUploadImageComponent extends XSFormlyBaseComponent {
7243
7319
  this.revokeOldUrl();
7244
7320
  }
7245
7321
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyUploadImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
7246
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyUploadImageComponent, isStandalone: true, selector: "xs-formly-upload-image", viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"xs-uploader-container flex flex-col mb-4\"\n id=\"xs-upload-image-root-{{ id }}\"\n>\n <xs-formly-label\n [for]=\"'xs-upload-image-input-' + id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [elementId]=\"'xs-upload-image-label-' + id\"\n />\n\n <div\n class=\"mt-2 relative h-52 w-full overflow-hidden rounded-xl bg-zinc-900/50 transition-all duration-300 hover:border-zinc-600\"\n [class.border-zinc-400]=\"isDragging\"\n id=\"xs-upload-image-dropzone-{{ id }}\"\n >\n <input\n #fileInput\n id=\"xs-upload-image-input-{{ id }}\"\n type=\"file\"\n accept=\"image/*\"\n (change)=\"onFileChange($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave) = \"isDragging = false\"\n (drop)=\"onDrop($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-describedby]=\"errorMessage ? 'xs-upload-image-error-message-' + id : null\"\n class=\"absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0\"\n />\n\n <div\n class=\"absolute inset-0 z-20 pointer-events-none flex h-full w-full items-center justify-center\"\n id=\"xs-upload-image-preview-container-{{ id }}\"\n >\n @if (previewUrl) {\n <div\n class=\"relative h-full w-full pointer-events-auto\"\n id=\"xs-upload-image-preview-wrapper-{{ id }}\"\n >\n <xs-image\n [src]=\"previewUrl\"\n [customClass]=\"'h-full w-full object-cover transition-all duration-500 group-hover:scale-105'\"\n id=\"xs-upload-image-preview-image-{{ id }}\"\n ></xs-image>\n\n <div\n class=\"absolute inset-0 flex items-center justify-center gap-3 bg-black/60 opacity-0 backdrop-blur-[2px] transition-opacity duration-300 hover:opacity-100 focus-within:opacity-100\"\n >\n <button\n type=\"button\"\n (click)=\"openFilePicker()\"\n [disabled]=\"isFieldDisabled\"\n class=\"z-30 flex h-10 items-center px-4 rounded-full bg-white text-black text-xs font-bold shadow-2xl transition-all hover:scale-105 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-change-button-{{ id }}\"\n >\n {{ changeButtonLabel }}\n </button>\n <button\n type=\"button\"\n (click)=\"clearFile($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-label]=\"removeButtonLabel\"\n class=\"z-30 flex h-10 w-10 items-center justify-center rounded-full bg-red-600 text-white shadow-2xl transition-all hover:bg-red-500 hover:scale-110 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-clear-button-{{ id }}\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n </div>\n </div>\n } @else {\n <div\n class=\"flex flex-col items-center gap-4\"\n id=\"xs-upload-image-empty-state-{{ id }}\"\n >\n <div\n class=\"flex h-14 w-14 items-center justify-center rounded-2xl bg-zinc-900 text-zinc-600 shadow-[inset_0_1px_1px_rgba(255,255,255,0.05)] transition-colors group-hover:text-zinc-400\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <rect\n width=\"18\"\n height=\"18\"\n x=\"3\"\n y=\"3\"\n rx=\"2\"\n ry=\"2\"\n />\n <circle cx=\"9\" cy=\"9\" r=\"2\" />\n <path\n d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\"\n />\n </svg>\n </div>\n <div class=\"text-center\">\n <p\n class=\"text-[11px] font-bold text-zinc-300 uppercase tracking-tight\"\n id=\"xs-upload-image-select-title-{{ id }}\"\n >\n {{ selectTitle }}\n </p>\n <p\n class=\"text-[9px] text-zinc-600 uppercase tracking-widest mt-1\"\n id=\"xs-upload-image-hint-text-{{ id }}\"\n >\n {{ hintText }}\n </p>\n </div>\n </div>\n }\n </div>\n </div>\n\n @if (errorMessage) {\n <div\n class=\"flex items-center gap-2 px-1 animate-in\"\n id=\"xs-upload-image-error-wrapper-{{ id }}\"\n >\n <span\n class=\"h-1 w-1 rounded-full bg-red-500 shadow-[0_0_8px_#ef4444]\"\n ></span>\n <p\n class=\"text-[9px] font-black uppercase text-red-500 tracking-tighter\"\n id=\"xs-upload-image-error-message-{{ id }}\"\n >\n {{ errorMessage }}\n </p>\n </div>\n }\n</div>\n", styles: [":host{display:block}.animate-in{animation:fadeIn .25s ease-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSImageComponent, selector: "xs-image", inputs: ["config", "viewTransitionName", "src", "alt", "width", "height", "size", "rounded", "objectFit", "clickable", "item", "typeItem", "imageType", "fallbackSrc", "loading", "priority", "customClass", "generateAvatar"], outputs: ["onClick", "onLoad", "onError"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
7322
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyUploadImageComponent, isStandalone: true, selector: "xs-formly-upload-image", viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"xs-uploader-container flex flex-col mb-4\"\n id=\"xs-upload-image-root-{{ id }}\"\n>\n <xs-formly-label\n [for]=\"'xs-upload-image-input-' + id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [elementId]=\"'xs-upload-image-label-' + id\"\n />\n\n <div\n class=\"mt-2 flex gap-2\"\n id=\"xs-upload-image-mode-toggle-{{ id }}\"\n >\n <button\n type=\"button\"\n (click)=\"setMode('file')\"\n [disabled]=\"isFieldDisabled\"\n [class.bg-white]=\"mode === 'file'\"\n [class.text-black]=\"mode === 'file'\"\n [class.bg-zinc-900]=\"mode !== 'file'\"\n [class.text-zinc-400]=\"mode !== 'file'\"\n class=\"rounded-full px-4 py-1 text-[11px] font-bold uppercase tracking-tight transition-all hover:scale-105 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50\"\n id=\"xs-upload-image-mode-file-{{ id }}\"\n >\n {{ modeFileLabel }}\n </button>\n <button\n type=\"button\"\n (click)=\"setMode('url')\"\n [disabled]=\"isFieldDisabled\"\n [class.bg-white]=\"mode === 'url'\"\n [class.text-black]=\"mode === 'url'\"\n [class.bg-zinc-900]=\"mode !== 'url'\"\n [class.text-zinc-400]=\"mode !== 'url'\"\n class=\"rounded-full px-4 py-1 text-[11px] font-bold uppercase tracking-tight transition-all hover:scale-105 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50\"\n id=\"xs-upload-image-mode-url-{{ id }}\"\n >\n {{ modeUrlLabel }}\n </button>\n </div>\n\n @if (mode === 'file') {\n <div\n class=\"mt-2 relative h-52 w-full overflow-hidden rounded-xl bg-zinc-900/50 transition-all duration-300 hover:border-zinc-600\"\n [class.border-zinc-400]=\"isDragging\"\n id=\"xs-upload-image-dropzone-{{ id }}\"\n >\n <input\n #fileInput\n id=\"xs-upload-image-input-{{ id }}\"\n type=\"file\"\n accept=\"image/*\"\n (change)=\"onFileChange($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"isDragging = false\"\n (drop)=\"onDrop($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-describedby]=\"\n errorMessage\n ? 'xs-upload-image-error-message-' + id\n : null\n \"\n class=\"absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0\"\n />\n\n <div\n class=\"absolute inset-0 z-20 pointer-events-none flex h-full w-full items-center justify-center\"\n id=\"xs-upload-image-preview-container-{{ id }}\"\n >\n @if (previewUrl) {\n <div\n class=\"relative h-full w-full pointer-events-auto\"\n id=\"xs-upload-image-preview-wrapper-{{ id }}\"\n >\n <xs-image\n [src]=\"previewUrl\"\n [customClass]=\"'h-full w-full object-cover transition-all duration-500 group-hover:scale-105'\"\n id=\"xs-upload-image-preview-image-{{ id }}\"\n ></xs-image>\n\n <div\n class=\"absolute inset-0 flex items-center justify-center gap-3 bg-black/60 opacity-0 backdrop-blur-[2px] transition-opacity duration-300 hover:opacity-100 focus-within:opacity-100\"\n >\n <button\n type=\"button\"\n (click)=\"openFilePicker()\"\n [disabled]=\"isFieldDisabled\"\n class=\"z-30 flex h-10 items-center px-4 rounded-full bg-white text-black text-xs font-bold shadow-2xl transition-all hover:scale-105 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-change-button-{{ id }}\"\n >\n {{ changeButtonLabel }}\n </button>\n <button\n type=\"button\"\n (click)=\"clearFile($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-label]=\"removeButtonLabel\"\n class=\"z-30 flex h-10 w-10 items-center justify-center rounded-full bg-red-600 text-white shadow-2xl transition-all hover:bg-red-500 hover:scale-110 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-clear-button-{{ id }}\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n </div>\n </div>\n } @else {\n <div\n class=\"flex flex-col items-center gap-4\"\n id=\"xs-upload-image-empty-state-{{ id }}\"\n >\n <div\n class=\"flex h-14 w-14 items-center justify-center rounded-2xl bg-zinc-900 text-zinc-600 shadow-[inset_0_1px_1px_rgba(255,255,255,0.05)] transition-colors group-hover:text-zinc-400\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <rect\n width=\"18\"\n height=\"18\"\n x=\"3\"\n y=\"3\"\n rx=\"2\"\n ry=\"2\"\n />\n <circle cx=\"9\" cy=\"9\" r=\"2\" />\n <path\n d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\"\n />\n </svg>\n </div>\n <div class=\"text-center\">\n <p\n class=\"text-[11px] font-bold text-zinc-300 uppercase tracking-tight\"\n id=\"xs-upload-image-select-title-{{ id }}\"\n >\n {{ selectTitle }}\n </p>\n <p\n class=\"text-[9px] text-zinc-600 uppercase tracking-widest mt-1\"\n id=\"xs-upload-image-hint-text-{{ id }}\"\n >\n {{ hintText }}\n </p>\n </div>\n </div>\n }\n </div>\n </div>\n } @else {\n <div\n class=\"mt-2 flex gap-2\"\n id=\"xs-upload-image-url-row-{{ id }}\"\n >\n <input\n id=\"xs-upload-image-url-input-{{ id }}\"\n type=\"url\"\n [value]=\"urlInput\"\n (input)=\"onUrlInput($event)\"\n (keydown.enter)=\"applyUrl()\"\n [placeholder]=\"urlPlaceholder\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-describedby]=\"\n urlError ? 'xs-upload-image-url-error-' + id : null\n \"\n class=\"w-full rounded-xl border border-zinc-800 bg-zinc-900/50 px-3 py-2 text-sm text-zinc-200 outline-none placeholder:text-zinc-600 focus:border-zinc-600 disabled:cursor-not-allowed disabled:opacity-50\"\n />\n <button\n type=\"button\"\n (click)=\"applyUrl()\"\n [disabled]=\"isFieldDisabled\"\n class=\"shrink-0 rounded-full bg-white px-4 py-2 text-[11px] font-bold uppercase tracking-tight text-black transition-all hover:scale-105 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50\"\n id=\"xs-upload-image-url-apply-{{ id }}\"\n >\n {{ urlApplyLabel }}\n </button>\n </div>\n\n @if (urlError) {\n <p\n class=\"mt-1 px-1 text-[9px] font-black uppercase text-red-500 tracking-tighter\"\n id=\"xs-upload-image-url-error-{{ id }}\"\n >\n {{ urlError }}\n </p>\n }\n\n @if (previewUrl) {\n <div\n class=\"mt-2 relative h-52 w-full overflow-hidden rounded-xl bg-zinc-900/50\"\n id=\"xs-upload-image-url-preview-{{ id }}\"\n >\n <xs-image\n [src]=\"previewUrl\"\n [customClass]=\"'h-full w-full object-cover'\"\n id=\"xs-upload-image-url-preview-image-{{ id }}\"\n ></xs-image>\n\n <div\n class=\"absolute inset-0 flex items-center justify-center gap-3 bg-black/60 opacity-0 backdrop-blur-[2px] transition-opacity duration-300 hover:opacity-100 focus-within:opacity-100\"\n >\n <button\n type=\"button\"\n (click)=\"clearFile($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-label]=\"removeButtonLabel\"\n class=\"z-30 flex h-10 items-center px-4 rounded-full bg-red-600 text-white text-xs font-bold shadow-2xl transition-all hover:bg-red-500 hover:scale-110 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-url-clear-button-{{ id }}\"\n >\n {{ removeButtonLabel }}\n </button>\n </div>\n </div>\n }\n }\n\n @if (errorMessage) {\n <div\n class=\"flex items-center gap-2 px-1 animate-in\"\n id=\"xs-upload-image-error-wrapper-{{ id }}\"\n >\n <span\n class=\"h-1 w-1 rounded-full bg-red-500 shadow-[0_0_8px_#ef4444]\"\n ></span>\n <p\n class=\"text-[9px] font-black uppercase text-red-500 tracking-tighter\"\n id=\"xs-upload-image-error-message-{{ id }}\"\n >\n {{ errorMessage }}\n </p>\n </div>\n }\n</div>\n", styles: [":host{display:block}.animate-in{animation:fadeIn .25s ease-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSImageComponent, selector: "xs-image", inputs: ["config", "viewTransitionName", "src", "alt", "width", "height", "size", "rounded", "objectFit", "clickable", "item", "typeItem", "imageType", "fallbackSrc", "loading", "priority", "customClass", "generateAvatar"], outputs: ["onClick", "onLoad", "onError"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
7247
7323
  }
7248
7324
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyUploadImageComponent, decorators: [{
7249
7325
  type: Component,
@@ -7252,7 +7328,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
7252
7328
  ReactiveFormsModule,
7253
7329
  XSImageComponent,
7254
7330
  XSFormlyLabelComponent,
7255
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"xs-uploader-container flex flex-col mb-4\"\n id=\"xs-upload-image-root-{{ id }}\"\n>\n <xs-formly-label\n [for]=\"'xs-upload-image-input-' + id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [elementId]=\"'xs-upload-image-label-' + id\"\n />\n\n <div\n class=\"mt-2 relative h-52 w-full overflow-hidden rounded-xl bg-zinc-900/50 transition-all duration-300 hover:border-zinc-600\"\n [class.border-zinc-400]=\"isDragging\"\n id=\"xs-upload-image-dropzone-{{ id }}\"\n >\n <input\n #fileInput\n id=\"xs-upload-image-input-{{ id }}\"\n type=\"file\"\n accept=\"image/*\"\n (change)=\"onFileChange($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave) = \"isDragging = false\"\n (drop)=\"onDrop($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-describedby]=\"errorMessage ? 'xs-upload-image-error-message-' + id : null\"\n class=\"absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0\"\n />\n\n <div\n class=\"absolute inset-0 z-20 pointer-events-none flex h-full w-full items-center justify-center\"\n id=\"xs-upload-image-preview-container-{{ id }}\"\n >\n @if (previewUrl) {\n <div\n class=\"relative h-full w-full pointer-events-auto\"\n id=\"xs-upload-image-preview-wrapper-{{ id }}\"\n >\n <xs-image\n [src]=\"previewUrl\"\n [customClass]=\"'h-full w-full object-cover transition-all duration-500 group-hover:scale-105'\"\n id=\"xs-upload-image-preview-image-{{ id }}\"\n ></xs-image>\n\n <div\n class=\"absolute inset-0 flex items-center justify-center gap-3 bg-black/60 opacity-0 backdrop-blur-[2px] transition-opacity duration-300 hover:opacity-100 focus-within:opacity-100\"\n >\n <button\n type=\"button\"\n (click)=\"openFilePicker()\"\n [disabled]=\"isFieldDisabled\"\n class=\"z-30 flex h-10 items-center px-4 rounded-full bg-white text-black text-xs font-bold shadow-2xl transition-all hover:scale-105 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-change-button-{{ id }}\"\n >\n {{ changeButtonLabel }}\n </button>\n <button\n type=\"button\"\n (click)=\"clearFile($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-label]=\"removeButtonLabel\"\n class=\"z-30 flex h-10 w-10 items-center justify-center rounded-full bg-red-600 text-white shadow-2xl transition-all hover:bg-red-500 hover:scale-110 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-clear-button-{{ id }}\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n </div>\n </div>\n } @else {\n <div\n class=\"flex flex-col items-center gap-4\"\n id=\"xs-upload-image-empty-state-{{ id }}\"\n >\n <div\n class=\"flex h-14 w-14 items-center justify-center rounded-2xl bg-zinc-900 text-zinc-600 shadow-[inset_0_1px_1px_rgba(255,255,255,0.05)] transition-colors group-hover:text-zinc-400\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <rect\n width=\"18\"\n height=\"18\"\n x=\"3\"\n y=\"3\"\n rx=\"2\"\n ry=\"2\"\n />\n <circle cx=\"9\" cy=\"9\" r=\"2\" />\n <path\n d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\"\n />\n </svg>\n </div>\n <div class=\"text-center\">\n <p\n class=\"text-[11px] font-bold text-zinc-300 uppercase tracking-tight\"\n id=\"xs-upload-image-select-title-{{ id }}\"\n >\n {{ selectTitle }}\n </p>\n <p\n class=\"text-[9px] text-zinc-600 uppercase tracking-widest mt-1\"\n id=\"xs-upload-image-hint-text-{{ id }}\"\n >\n {{ hintText }}\n </p>\n </div>\n </div>\n }\n </div>\n </div>\n\n @if (errorMessage) {\n <div\n class=\"flex items-center gap-2 px-1 animate-in\"\n id=\"xs-upload-image-error-wrapper-{{ id }}\"\n >\n <span\n class=\"h-1 w-1 rounded-full bg-red-500 shadow-[0_0_8px_#ef4444]\"\n ></span>\n <p\n class=\"text-[9px] font-black uppercase text-red-500 tracking-tighter\"\n id=\"xs-upload-image-error-message-{{ id }}\"\n >\n {{ errorMessage }}\n </p>\n </div>\n }\n</div>\n", styles: [":host{display:block}.animate-in{animation:fadeIn .25s ease-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}\n"] }]
7331
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"xs-uploader-container flex flex-col mb-4\"\n id=\"xs-upload-image-root-{{ id }}\"\n>\n <xs-formly-label\n [for]=\"'xs-upload-image-input-' + id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [elementId]=\"'xs-upload-image-label-' + id\"\n />\n\n <div\n class=\"mt-2 flex gap-2\"\n id=\"xs-upload-image-mode-toggle-{{ id }}\"\n >\n <button\n type=\"button\"\n (click)=\"setMode('file')\"\n [disabled]=\"isFieldDisabled\"\n [class.bg-white]=\"mode === 'file'\"\n [class.text-black]=\"mode === 'file'\"\n [class.bg-zinc-900]=\"mode !== 'file'\"\n [class.text-zinc-400]=\"mode !== 'file'\"\n class=\"rounded-full px-4 py-1 text-[11px] font-bold uppercase tracking-tight transition-all hover:scale-105 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50\"\n id=\"xs-upload-image-mode-file-{{ id }}\"\n >\n {{ modeFileLabel }}\n </button>\n <button\n type=\"button\"\n (click)=\"setMode('url')\"\n [disabled]=\"isFieldDisabled\"\n [class.bg-white]=\"mode === 'url'\"\n [class.text-black]=\"mode === 'url'\"\n [class.bg-zinc-900]=\"mode !== 'url'\"\n [class.text-zinc-400]=\"mode !== 'url'\"\n class=\"rounded-full px-4 py-1 text-[11px] font-bold uppercase tracking-tight transition-all hover:scale-105 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50\"\n id=\"xs-upload-image-mode-url-{{ id }}\"\n >\n {{ modeUrlLabel }}\n </button>\n </div>\n\n @if (mode === 'file') {\n <div\n class=\"mt-2 relative h-52 w-full overflow-hidden rounded-xl bg-zinc-900/50 transition-all duration-300 hover:border-zinc-600\"\n [class.border-zinc-400]=\"isDragging\"\n id=\"xs-upload-image-dropzone-{{ id }}\"\n >\n <input\n #fileInput\n id=\"xs-upload-image-input-{{ id }}\"\n type=\"file\"\n accept=\"image/*\"\n (change)=\"onFileChange($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"isDragging = false\"\n (drop)=\"onDrop($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-describedby]=\"\n errorMessage\n ? 'xs-upload-image-error-message-' + id\n : null\n \"\n class=\"absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0\"\n />\n\n <div\n class=\"absolute inset-0 z-20 pointer-events-none flex h-full w-full items-center justify-center\"\n id=\"xs-upload-image-preview-container-{{ id }}\"\n >\n @if (previewUrl) {\n <div\n class=\"relative h-full w-full pointer-events-auto\"\n id=\"xs-upload-image-preview-wrapper-{{ id }}\"\n >\n <xs-image\n [src]=\"previewUrl\"\n [customClass]=\"'h-full w-full object-cover transition-all duration-500 group-hover:scale-105'\"\n id=\"xs-upload-image-preview-image-{{ id }}\"\n ></xs-image>\n\n <div\n class=\"absolute inset-0 flex items-center justify-center gap-3 bg-black/60 opacity-0 backdrop-blur-[2px] transition-opacity duration-300 hover:opacity-100 focus-within:opacity-100\"\n >\n <button\n type=\"button\"\n (click)=\"openFilePicker()\"\n [disabled]=\"isFieldDisabled\"\n class=\"z-30 flex h-10 items-center px-4 rounded-full bg-white text-black text-xs font-bold shadow-2xl transition-all hover:scale-105 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-change-button-{{ id }}\"\n >\n {{ changeButtonLabel }}\n </button>\n <button\n type=\"button\"\n (click)=\"clearFile($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-label]=\"removeButtonLabel\"\n class=\"z-30 flex h-10 w-10 items-center justify-center rounded-full bg-red-600 text-white shadow-2xl transition-all hover:bg-red-500 hover:scale-110 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-clear-button-{{ id }}\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n </div>\n </div>\n } @else {\n <div\n class=\"flex flex-col items-center gap-4\"\n id=\"xs-upload-image-empty-state-{{ id }}\"\n >\n <div\n class=\"flex h-14 w-14 items-center justify-center rounded-2xl bg-zinc-900 text-zinc-600 shadow-[inset_0_1px_1px_rgba(255,255,255,0.05)] transition-colors group-hover:text-zinc-400\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <rect\n width=\"18\"\n height=\"18\"\n x=\"3\"\n y=\"3\"\n rx=\"2\"\n ry=\"2\"\n />\n <circle cx=\"9\" cy=\"9\" r=\"2\" />\n <path\n d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\"\n />\n </svg>\n </div>\n <div class=\"text-center\">\n <p\n class=\"text-[11px] font-bold text-zinc-300 uppercase tracking-tight\"\n id=\"xs-upload-image-select-title-{{ id }}\"\n >\n {{ selectTitle }}\n </p>\n <p\n class=\"text-[9px] text-zinc-600 uppercase tracking-widest mt-1\"\n id=\"xs-upload-image-hint-text-{{ id }}\"\n >\n {{ hintText }}\n </p>\n </div>\n </div>\n }\n </div>\n </div>\n } @else {\n <div\n class=\"mt-2 flex gap-2\"\n id=\"xs-upload-image-url-row-{{ id }}\"\n >\n <input\n id=\"xs-upload-image-url-input-{{ id }}\"\n type=\"url\"\n [value]=\"urlInput\"\n (input)=\"onUrlInput($event)\"\n (keydown.enter)=\"applyUrl()\"\n [placeholder]=\"urlPlaceholder\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-describedby]=\"\n urlError ? 'xs-upload-image-url-error-' + id : null\n \"\n class=\"w-full rounded-xl border border-zinc-800 bg-zinc-900/50 px-3 py-2 text-sm text-zinc-200 outline-none placeholder:text-zinc-600 focus:border-zinc-600 disabled:cursor-not-allowed disabled:opacity-50\"\n />\n <button\n type=\"button\"\n (click)=\"applyUrl()\"\n [disabled]=\"isFieldDisabled\"\n class=\"shrink-0 rounded-full bg-white px-4 py-2 text-[11px] font-bold uppercase tracking-tight text-black transition-all hover:scale-105 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50\"\n id=\"xs-upload-image-url-apply-{{ id }}\"\n >\n {{ urlApplyLabel }}\n </button>\n </div>\n\n @if (urlError) {\n <p\n class=\"mt-1 px-1 text-[9px] font-black uppercase text-red-500 tracking-tighter\"\n id=\"xs-upload-image-url-error-{{ id }}\"\n >\n {{ urlError }}\n </p>\n }\n\n @if (previewUrl) {\n <div\n class=\"mt-2 relative h-52 w-full overflow-hidden rounded-xl bg-zinc-900/50\"\n id=\"xs-upload-image-url-preview-{{ id }}\"\n >\n <xs-image\n [src]=\"previewUrl\"\n [customClass]=\"'h-full w-full object-cover'\"\n id=\"xs-upload-image-url-preview-image-{{ id }}\"\n ></xs-image>\n\n <div\n class=\"absolute inset-0 flex items-center justify-center gap-3 bg-black/60 opacity-0 backdrop-blur-[2px] transition-opacity duration-300 hover:opacity-100 focus-within:opacity-100\"\n >\n <button\n type=\"button\"\n (click)=\"clearFile($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-label]=\"removeButtonLabel\"\n class=\"z-30 flex h-10 items-center px-4 rounded-full bg-red-600 text-white text-xs font-bold shadow-2xl transition-all hover:bg-red-500 hover:scale-110 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-url-clear-button-{{ id }}\"\n >\n {{ removeButtonLabel }}\n </button>\n </div>\n </div>\n }\n }\n\n @if (errorMessage) {\n <div\n class=\"flex items-center gap-2 px-1 animate-in\"\n id=\"xs-upload-image-error-wrapper-{{ id }}\"\n >\n <span\n class=\"h-1 w-1 rounded-full bg-red-500 shadow-[0_0_8px_#ef4444]\"\n ></span>\n <p\n class=\"text-[9px] font-black uppercase text-red-500 tracking-tighter\"\n id=\"xs-upload-image-error-message-{{ id }}\"\n >\n {{ errorMessage }}\n </p>\n </div>\n }\n</div>\n", styles: [":host{display:block}.animate-in{animation:fadeIn .25s ease-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}\n"] }]
7256
7332
  }], ctorParameters: () => [], propDecorators: { fileInput: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }] } });
7257
7333
 
7258
7334
  class XSFormlyJsonComponent extends XSFormlyBaseComponent {