dap-design-system 0.63.1 → 0.63.2

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.
@@ -11,7 +11,7 @@ var E = (u, e, t) => e in u ? C(u, e, { enumerable: !0, configurable: !0, writab
11
11
  return u;
12
12
  }, T = (u, e) => B(u, P(e));
13
13
  var v = (u, e, t) => new Promise((i, s) => {
14
- var l = (h) => {
14
+ var n = (h) => {
15
15
  try {
16
16
  d(t.next(h));
17
17
  } catch (c) {
@@ -23,21 +23,21 @@ var v = (u, e, t) => new Promise((i, s) => {
23
23
  } catch (c) {
24
24
  s(c);
25
25
  }
26
- }, d = (h) => h.done ? i(h.value) : Promise.resolve(h.value).then(l, r);
26
+ }, d = (h) => h.done ? i(h.value) : Promise.resolve(h.value).then(n, r);
27
27
  d((t = t.apply(u, e)).next());
28
28
  });
29
29
  import { clsx as L } from "../../node_modules/clsx/dist/clsx.js";
30
30
  import { unsafeCSS as R, css as O, nothing as m, html as g } from "lit";
31
- import { query as H, property as n, state as y } from "lit/decorators.js";
31
+ import { query as H, property as l, state as y } from "lit/decorators.js";
32
32
  import { ifDefined as _ } from "lit/directives/if-defined.js";
33
33
  import { HttpError as $, FileError as w } from "../../common/errors.js";
34
34
  import { GenericFormElement as q } from "../../internal/mixin/genericFormElement.js";
35
- import { formLabelTemplate as M } from "../../internal/templates/formLabel.js";
35
+ import { formLabelTemplate as A } from "../../internal/templates/formLabel.js";
36
36
  import "../../localization/localization.js";
37
- import N from "../button/button.component.js";
38
- import V from "../feedback/feedback.component.js";
39
- import j from "../form/form-label/form-label.component.js";
40
- import A from "../icon/icon.component.js";
37
+ import M from "../button/button.component.js";
38
+ import N from "../feedback/feedback.component.js";
39
+ import V from "../form/form-label/form-label.component.js";
40
+ import j from "../icon/icon.component.js";
41
41
  import J from "../icon-button/icon-button.component.js";
42
42
  import W from "../modal/modal.component.js";
43
43
  import K from "../tooltip/tooltip.component.js";
@@ -45,8 +45,8 @@ import X from "../typography/typography.component.js";
45
45
  import G from "./file-input.scss.js";
46
46
  import k, { t as D } from "../../node_modules/i18next/dist/esm/i18next.js";
47
47
  var Q = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, a = (u, e, t, i) => {
48
- for (var s = i > 1 ? void 0 : i ? Y(e, t) : e, l = u.length - 1, r; l >= 0; l--)
49
- (r = u[l]) && (s = (i ? r(e, t, s) : r(s)) || s);
48
+ for (var s = i > 1 ? void 0 : i ? Y(e, t) : e, n = u.length - 1, r; n >= 0; n--)
49
+ (r = u[n]) && (s = (i ? r(e, t, s) : r(s)) || s);
50
50
  return i && s && Q(e, t, s), s;
51
51
  };
52
52
  const z = class z extends q {
@@ -85,9 +85,9 @@ const z = class z extends q {
85
85
  validateFiles(e) {
86
86
  const t = [], i = this.keepValue ? this._files.length : 0;
87
87
  if (this.maxFiles && e.length + i > this.maxFiles)
88
- for (const l of e)
88
+ for (const n of e)
89
89
  t.push({
90
- file: l,
90
+ file: n,
91
91
  meta: {
92
92
  maxFiles: this.maxFiles,
93
93
  totalFiles: e.length + i
@@ -98,33 +98,33 @@ const z = class z extends q {
98
98
  type: "maxFiles"
99
99
  });
100
100
  let s = 0;
101
- for (const l of e)
102
- this.validateFileType(l) || t.push({
103
- file: l,
101
+ for (const n of e)
102
+ this.validateFileType(n) || t.push({
103
+ file: n,
104
104
  meta: {
105
105
  type: this.accept,
106
- fileType: l.type
106
+ fileType: n.type
107
107
  },
108
108
  message: this.fileTypeErrorText || D("fileInput.error.fileType", {
109
109
  type: this.accept
110
110
  }),
111
111
  type: "fileType"
112
- }), this.maxSizePerFile && l.size > this.maxSizePerFile && t.push({
113
- file: l,
112
+ }), this.maxSizePerFile && n.size > this.maxSizePerFile && t.push({
113
+ file: n,
114
114
  meta: {
115
115
  maxSizePerFile: this.maxSizePerFile,
116
- fileSize: l.size
116
+ fileSize: n.size
117
117
  },
118
118
  message: this.maxSizePerFileErrorText || D("fileInput.error.perFileSize", {
119
119
  size: Math.round(this.maxSizePerFile / 1024 / 1024)
120
120
  }),
121
121
  type: "maxSizePerFile"
122
- }), s += l.size, this.maxFileSize && s > this.maxFileSize && t.push({
123
- file: l,
122
+ }), s += n.size, this.maxFileSize && s > this.maxFileSize && t.push({
123
+ file: n,
124
124
  meta: {
125
125
  maxFileSize: this.maxFileSize,
126
126
  totalSize: s,
127
- fileSize: l.size
127
+ fileSize: n.size
128
128
  },
129
129
  message: this.maxFileSizeErrorText || D("fileInput.error.fileSize", {
130
130
  size: Math.round(this.maxFileSize / 1024 / 1024)
@@ -284,9 +284,9 @@ const z = class z extends q {
284
284
  return;
285
285
  }
286
286
  const i = new XMLHttpRequest();
287
- return i.withCredentials = this.withCredentials, new Promise((s, l) => {
287
+ return i.withCredentials = this.withCredentials, new Promise((s, n) => {
288
288
  i.onload = () => {
289
- i.status >= 200 && i.status < 300 ? s() : l(
289
+ i.status >= 200 && i.status < 300 ? s() : n(
290
290
  new $(
291
291
  `HTTP error! status: ${i.status}`,
292
292
  i.response,
@@ -294,7 +294,7 @@ const z = class z extends q {
294
294
  )
295
295
  );
296
296
  }, i.onerror = () => {
297
- l(new Error("Network error during file deletion"));
297
+ n(new Error("Network error during file deletion"));
298
298
  };
299
299
  let r = this.deleteUrl;
300
300
  if (r = r.replace(
@@ -339,8 +339,8 @@ const z = class z extends q {
339
339
  const t = e.length;
340
340
  let i = 0;
341
341
  for (const s of e) {
342
- const l = new FormData();
343
- l.append(this.uploadProperty, s);
342
+ const n = new FormData();
343
+ n.append(this.uploadProperty, s);
344
344
  try {
345
345
  let r;
346
346
  this._uploadingFiles.add(s.name), this._uploadProgress = T(F({}, this._uploadProgress), { [s.name]: 0 }), this.emit("dds-upload-start", { file: s });
@@ -380,7 +380,7 @@ const z = class z extends q {
380
380
  }
381
381
  }, d.onerror = () => {
382
382
  this.fileList && (r = this.setFileLoadingState(s, !1)), b(new Error("Network error"));
383
- }, d.send(l);
383
+ }, d.send(n);
384
384
  }), c = JSON.parse(h);
385
385
  this.fileList && (r = this.setFileLoadingState(s, !1)), this._uploadingFiles.delete(s.name), this._activeUploads.delete(s.name);
386
386
  const p = F({}, this._uploadProgress);
@@ -426,14 +426,14 @@ const z = class z extends q {
426
426
  handleFileList(e) {
427
427
  var s;
428
428
  const t = [...this._files];
429
- this.keepValue && ((s = this._files) != null && s.length) ? (Object.values(e).forEach((l) => {
429
+ this.keepValue && ((s = this._files) != null && s.length) ? (Object.values(e).forEach((n) => {
430
430
  !!this._files.find(
431
- (d) => this.checkFileEquality(d, l)
432
- ) || t.push(l);
431
+ (d) => this.checkFileEquality(d, n)
432
+ ) || t.push(n);
433
433
  }), this._files = t) : this._files = e ? Object.values(e) : [];
434
434
  const i = new DataTransfer();
435
- this._files.forEach((l) => {
436
- i.items.add(l);
435
+ this._files.forEach((n) => {
436
+ i.items.add(n);
437
437
  }), this.input.files = i.files, this.autoupload && this.uploadFiles(this._files);
438
438
  }
439
439
  onChange(e) {
@@ -467,10 +467,10 @@ const z = class z extends q {
467
467
  return;
468
468
  }
469
469
  }
470
- const s = i ? Array.from(i) : [], l = this.calculateNewFileList(i), r = /* @__PURE__ */ new Set();
470
+ const s = i ? Array.from(i) : [], n = this.calculateNewFileList(i), r = /* @__PURE__ */ new Set();
471
471
  if (this.emit(
472
472
  "dds-file-change",
473
- { newFiles: s, files: l, canceledFiles: r, currentFiles: this._files },
473
+ { newFiles: s, files: n, canceledFiles: r, currentFiles: this._files },
474
474
  { cancelable: !0 }
475
475
  ).defaultPrevented) {
476
476
  this.input.value = "";
@@ -523,15 +523,15 @@ const z = class z extends q {
523
523
  return;
524
524
  }
525
525
  }
526
- const i = t ? Array.from(t) : [], s = this.calculateNewFileList(t != null ? t : null), l = /* @__PURE__ */ new Set();
526
+ const i = t ? Array.from(t) : [], s = this.calculateNewFileList(t != null ? t : null), n = /* @__PURE__ */ new Set();
527
527
  if (!this.emit(
528
528
  "dds-file-change",
529
- { newFiles: i, files: s, canceledFiles: l, currentFiles: this._files },
529
+ { newFiles: i, files: s, canceledFiles: n, currentFiles: this._files },
530
530
  { cancelable: !0 }
531
531
  ).defaultPrevented)
532
- if (l.size > 0 && t) {
532
+ if (n.size > 0 && t) {
533
533
  const h = Array.from(t).filter(
534
- (p) => !l.has(p)
534
+ (p) => !n.has(p)
535
535
  ), c = new DataTransfer();
536
536
  h.forEach((p) => c.items.add(p)), this.handleFileList(c.files), this.setValidity(), this.emit("dds-files-accepted", { files: this._files });
537
537
  } else
@@ -542,7 +542,7 @@ const z = class z extends q {
542
542
  const e = this.showBrowseButton === "true" && !this.autoupload, t = e || !this.showDropzone;
543
543
  return g`
544
544
  <div class="label-container">
545
- ${M({
545
+ ${A({
546
546
  label: this.label,
547
547
  id: "label",
548
548
  htmlFor: "input",
@@ -628,7 +628,7 @@ const z = class z extends q {
628
628
  { "input--disabled": this.disabled }
629
629
  )}
630
630
  role="region"
631
- aria-label="File upload area">
631
+ aria-label=${this.regionAriaLabel || this.localize.t("fileInput.uploadArea")}>
632
632
  <div class="input__holder" aria-describedby="drop-instructions">
633
633
  <input
634
634
  id="input"
@@ -662,7 +662,6 @@ const z = class z extends q {
662
662
  @dragover=${this.showDropzone ? m : this.onDragover}
663
663
  @drop=${this.showDropzone ? m : this.onDrop}
664
664
  aria-label="${this.browseButtonLabel || this.localize.t("fileInput.browse")}${this.showDropzone ? "" : ` - ${this.localize.t("fileInput.dragDropArea")}`}"
665
- role="button"
666
665
  >${this.browseButtonLabel || this.localize.t("fileInput.browse")}</dap-ds-button
667
666
  >` : m}
668
667
  ${this.showUploadButton === "true" && !this.autoupload ? g`
@@ -684,12 +683,12 @@ const z = class z extends q {
684
683
  </span>
685
684
  ${!this.fileList && this._uploadingFiles.size > 0 ? g`
686
685
  <div class="upload-progress" part="upload-progress">
687
- ${Array.from(this._uploadingFiles).map((l) => {
688
- const r = this._uploadProgress[l] || 0;
686
+ ${Array.from(this._uploadingFiles).map((n) => {
687
+ const r = this._uploadProgress[n] || 0;
689
688
  return g`
690
689
  <div class="upload-progress__item">
691
690
  <dap-ds-typography variant="caption">
692
- ${l} - ${Math.round(r)}%
691
+ ${n} - ${Math.round(r)}%
693
692
  </dap-ds-typography>
694
693
  <div class="upload-progress__bar">
695
694
  <div
@@ -733,14 +732,14 @@ const z = class z extends q {
733
732
  }
734
733
  };
735
734
  z.tagName = "dap-ds-file-input", z.dependencies = {
736
- "dap-ds-form-label": j,
735
+ "dap-ds-form-label": V,
737
736
  "dap-ds-tooltip": K,
738
737
  "dap-ds-icon-button": J,
739
- "dap-ds-icon": A,
738
+ "dap-ds-icon": j,
740
739
  "dap-ds-typography": X,
741
- "dap-ds-button": N,
740
+ "dap-ds-button": M,
742
741
  "dap-ds-modal": W,
743
- "dap-ds-feedback": V
742
+ "dap-ds-feedback": N
744
743
  }, z.styles = O`
745
744
  ${R(G)}
746
745
  `;
@@ -749,118 +748,121 @@ a([
749
748
  H("#input")
750
749
  ], o.prototype, "input", 2);
751
750
  a([
752
- n()
751
+ l()
753
752
  ], o.prototype, "uploadButtonLabel", 2);
754
753
  a([
755
- n()
754
+ l()
756
755
  ], o.prototype, "browseButtonLabel", 2);
757
756
  a([
758
- n()
757
+ l()
759
758
  ], o.prototype, "browseButtonTestId", 2);
760
759
  a([
761
- n()
760
+ l()
762
761
  ], o.prototype, "uploadButtonTestId", 2);
763
762
  a([
764
- n({ type: Boolean })
763
+ l({ type: Boolean })
765
764
  ], o.prototype, "showDropzone", 2);
766
765
  a([
767
- n()
766
+ l()
768
767
  ], o.prototype, "dropzoneText", 2);
769
768
  a([
770
- n({ type: Boolean })
769
+ l({ type: Boolean })
771
770
  ], o.prototype, "showFileList", 2);
772
771
  a([
773
- n({ type: Boolean })
772
+ l({ type: Boolean })
774
773
  ], o.prototype, "confirmRemove", 2);
775
774
  a([
776
- n({ type: String })
775
+ l({ type: String })
777
776
  ], o.prototype, "showUploadButton", 2);
778
777
  a([
779
- n({ type: String })
778
+ l({ type: String })
780
779
  ], o.prototype, "showBrowseButton", 2);
781
780
  a([
782
- n()
781
+ l()
783
782
  ], o.prototype, "accept", 2);
784
783
  a([
785
- n({ type: Boolean })
784
+ l({ type: Boolean })
786
785
  ], o.prototype, "multiple", 2);
787
786
  a([
788
- n({ type: Boolean })
787
+ l({ type: Boolean })
789
788
  ], o.prototype, "keepValue", 2);
790
789
  a([
791
- n()
790
+ l()
792
791
  ], o.prototype, "uploadUrl", 2);
793
792
  a([
794
- n({ type: Boolean })
793
+ l({ type: Boolean })
795
794
  ], o.prototype, "autoupload", 2);
796
795
  a([
797
- n()
796
+ l()
798
797
  ], o.prototype, "uploadProperty", 2);
799
798
  a([
800
- n()
799
+ l()
801
800
  ], o.prototype, "uploadMethod", 2);
802
801
  a([
803
- n()
802
+ l()
804
803
  ], o.prototype, "deleteUrl", 2);
805
804
  a([
806
- n()
805
+ l()
807
806
  ], o.prototype, "deleteMethod", 2);
808
807
  a([
809
- n({ type: Boolean })
808
+ l({ type: Boolean })
810
809
  ], o.prototype, "withCredentials", 2);
811
810
  a([
812
- n()
811
+ l()
813
812
  ], o.prototype, "uploadHeaders", 2);
814
813
  a([
815
- n()
814
+ l()
816
815
  ], o.prototype, "deleteHeaders", 2);
817
816
  a([
818
- n({ attribute: !1 })
817
+ l({ attribute: !1 })
819
818
  ], o.prototype, "fileList", 2);
820
819
  a([
821
- n({ type: Number })
820
+ l({ type: Number })
822
821
  ], o.prototype, "maxFiles", 2);
823
822
  a([
824
- n({ type: Number })
823
+ l({ type: Number })
825
824
  ], o.prototype, "maxFileSize", 2);
826
825
  a([
827
- n({ type: Number })
826
+ l({ type: Number })
828
827
  ], o.prototype, "maxSizePerFile", 2);
829
828
  a([
830
- n({ type: String })
829
+ l({ type: String })
831
830
  ], o.prototype, "maxFileSizeErrorText", 2);
832
831
  a([
833
- n({ type: String })
832
+ l({ type: String })
834
833
  ], o.prototype, "maxSizePerFileErrorText", 2);
835
834
  a([
836
- n({ type: String })
835
+ l({ type: String })
837
836
  ], o.prototype, "maxFileAmountErrorText", 2);
838
837
  a([
839
- n({ type: String })
838
+ l({ type: String })
840
839
  ], o.prototype, "fileTypeErrorText", 2);
841
840
  a([
842
- n()
841
+ l()
843
842
  ], o.prototype, "removeButtonLabel", 2);
844
843
  a([
845
- n()
844
+ l()
846
845
  ], o.prototype, "cancelButtonLabel", 2);
847
846
  a([
848
- n({ type: String })
847
+ l({ type: String })
849
848
  ], o.prototype, "removeButtonDanger", 2);
850
849
  a([
851
- n({ type: String })
850
+ l({ type: String })
852
851
  ], o.prototype, "showThumbnail", 2);
853
852
  a([
854
- n()
853
+ l()
855
854
  ], o.prototype, "dropzoneAriaLabel", 2);
856
855
  a([
857
- n({ type: String })
856
+ l()
857
+ ], o.prototype, "regionAriaLabel", 2);
858
+ a([
859
+ l({ type: String })
858
860
  ], o.prototype, "dropzoneFocusable", 2);
859
861
  a([
860
- n({ type: String })
862
+ l({ type: String })
861
863
  ], o.prototype, "thumbnailSize", 2);
862
864
  a([
863
- n({ type: Array, attribute: !1 })
865
+ l({ type: Array, attribute: !1 })
864
866
  ], o.prototype, "files", 1);
865
867
  a([
866
868
  y()