q2-tecton-elements 1.52.2 → 1.53.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.
Files changed (96) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/q2-file-picker.cjs.entry.js +236 -0
  3. package/dist/cjs/q2-file-picker.cjs.entry.js.map +1 -0
  4. package/dist/cjs/q2-item_3.cjs.entry.js +250 -0
  5. package/dist/cjs/q2-item_3.cjs.entry.js.map +1 -0
  6. package/dist/cjs/q2-pill.cjs.entry.js +7 -3
  7. package/dist/cjs/q2-pill.cjs.entry.js.map +1 -1
  8. package/dist/cjs/q2-select.cjs.entry.js +3 -2
  9. package/dist/cjs/q2-select.cjs.entry.js.map +1 -1
  10. package/dist/cjs/q2-tag.cjs.entry.js +3 -1
  11. package/dist/cjs/q2-tag.cjs.entry.js.map +1 -1
  12. package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
  13. package/dist/collection/collection-manifest.json +1 -0
  14. package/dist/collection/components/q2-file-picker/q2-file-picker.css +288 -0
  15. package/dist/collection/components/q2-file-picker/q2-file-picker.js +426 -0
  16. package/dist/collection/components/q2-file-picker/q2-file-picker.js.map +1 -0
  17. package/dist/collection/components/q2-file-picker/test/q2-file-picker-test.e2e.js +11 -0
  18. package/dist/collection/components/q2-file-picker/test/q2-file-picker-test.e2e.js.map +1 -0
  19. package/dist/collection/components/q2-file-picker/test/q2-file-picker-test.spec.js +435 -0
  20. package/dist/collection/components/q2-file-picker/test/q2-file-picker-test.spec.js.map +1 -0
  21. package/dist/collection/components/q2-item/q2-item.css +3 -0
  22. package/dist/collection/components/q2-list/q2-list.css +6 -0
  23. package/dist/collection/components/q2-pill/q2-pill.js +7 -3
  24. package/dist/collection/components/q2-pill/q2-pill.js.map +1 -1
  25. package/dist/collection/components/q2-pill/test/q2-pill-test.e2e.js +108 -0
  26. package/dist/collection/components/q2-pill/test/q2-pill-test.e2e.js.map +1 -1
  27. package/dist/collection/components/q2-select/q2-select.js +3 -2
  28. package/dist/collection/components/q2-select/q2-select.js.map +1 -1
  29. package/dist/collection/components/q2-tag/q2-tag.js +3 -1
  30. package/dist/collection/components/q2-tag/q2-tag.js.map +1 -1
  31. package/dist/components/index.js +2 -0
  32. package/dist/components/index.js.map +1 -1
  33. package/dist/components/q2-file-picker.d.ts +11 -0
  34. package/dist/components/q2-file-picker.js +301 -0
  35. package/dist/components/q2-file-picker.js.map +1 -0
  36. package/dist/components/q2-item.js +1 -130
  37. package/dist/components/q2-item.js.map +1 -1
  38. package/dist/{esm/q2-item.entry.js → components/q2-item2.js} +29 -11
  39. package/dist/components/q2-item2.js.map +1 -0
  40. package/dist/components/q2-link.js +1 -86
  41. package/dist/components/q2-link.js.map +1 -1
  42. package/dist/{esm/q2-link.entry.js → components/q2-link2.js} +39 -9
  43. package/dist/components/q2-link2.js.map +1 -0
  44. package/dist/components/q2-list.js +1 -94
  45. package/dist/components/q2-list.js.map +1 -1
  46. package/dist/{esm/q2-list.entry.js → components/q2-list2.js} +30 -11
  47. package/dist/components/q2-list2.js.map +1 -0
  48. package/dist/components/q2-pill.js +7 -3
  49. package/dist/components/q2-pill.js.map +1 -1
  50. package/dist/components/q2-select2.js +3 -2
  51. package/dist/components/q2-select2.js.map +1 -1
  52. package/dist/components/q2-tag.js +3 -1
  53. package/dist/components/q2-tag.js.map +1 -1
  54. package/dist/esm/loader.js +1 -1
  55. package/dist/esm/q2-file-picker.entry.js +232 -0
  56. package/dist/esm/q2-file-picker.entry.js.map +1 -0
  57. package/dist/esm/q2-item_3.entry.js +244 -0
  58. package/dist/esm/q2-item_3.entry.js.map +1 -0
  59. package/dist/esm/q2-pill.entry.js +7 -3
  60. package/dist/esm/q2-pill.entry.js.map +1 -1
  61. package/dist/esm/q2-select.entry.js +3 -2
  62. package/dist/esm/q2-select.entry.js.map +1 -1
  63. package/dist/esm/q2-tag.entry.js +3 -1
  64. package/dist/esm/q2-tag.entry.js.map +1 -1
  65. package/dist/esm/q2-tecton-elements.js +1 -1
  66. package/dist/q2-tecton-elements/q2-file-picker.entry.js +338 -0
  67. package/dist/q2-tecton-elements/q2-file-picker.entry.js.map +1 -0
  68. package/dist/q2-tecton-elements/q2-item_3.entry.js +331 -0
  69. package/dist/q2-tecton-elements/q2-item_3.entry.js.map +1 -0
  70. package/dist/q2-tecton-elements/q2-pill.entry.js +22 -18
  71. package/dist/q2-tecton-elements/q2-pill.entry.js.map +1 -1
  72. package/dist/q2-tecton-elements/q2-select.entry.js +6 -5
  73. package/dist/q2-tecton-elements/q2-select.entry.js.map +1 -1
  74. package/dist/q2-tecton-elements/q2-tag.entry.js +36 -34
  75. package/dist/q2-tecton-elements/q2-tag.entry.js.map +1 -1
  76. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  77. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js.map +1 -1
  78. package/dist/types/components/q2-file-picker/q2-file-picker.d.ts +98 -0
  79. package/dist/types/components/q2-pill/q2-pill.d.ts +1 -1
  80. package/dist/types/components.d.ts +101 -0
  81. package/package.json +3 -3
  82. package/dist/cjs/q2-item.cjs.entry.js +0 -120
  83. package/dist/cjs/q2-item.cjs.entry.js.map +0 -1
  84. package/dist/cjs/q2-link.cjs.entry.js +0 -64
  85. package/dist/cjs/q2-link.cjs.entry.js.map +0 -1
  86. package/dist/cjs/q2-list.cjs.entry.js +0 -83
  87. package/dist/cjs/q2-list.cjs.entry.js.map +0 -1
  88. package/dist/esm/q2-item.entry.js.map +0 -1
  89. package/dist/esm/q2-link.entry.js.map +0 -1
  90. package/dist/esm/q2-list.entry.js.map +0 -1
  91. package/dist/q2-tecton-elements/q2-item.entry.js +0 -158
  92. package/dist/q2-tecton-elements/q2-item.entry.js.map +0 -1
  93. package/dist/q2-tecton-elements/q2-link.entry.js +0 -83
  94. package/dist/q2-tecton-elements/q2-link.entry.js.map +0 -1
  95. package/dist/q2-tecton-elements/q2-list.entry.js +0 -100
  96. package/dist/q2-tecton-elements/q2-list.entry.js.map +0 -1
@@ -0,0 +1,338 @@
1
+ import { r as e, c as i, h as t, F as r, g as o } from "./index-7a5365e2.js";
2
+
3
+ import { l as s, e as a } from "./index-d18e2a20.js";
4
+
5
+ const n = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}@keyframes growFromCenterFadeIn{from{transform:scaleX(0.75) scaleY(0.75);opacity:0}to{transform:scaleX(1) scaleY(1);opacity:1}}@keyframes shrinkToCenterFadeOut{from{transform:scaleX(1) scaleY(1);opacity:1}to{transform:scaleX(0.75) scaleY(0.75);opacity:0}}:host{display:block}.browse{text-align:left}.drop-zone-text{color:var(--tct-file-picker-drop-zone-text-color, var(--t-gray-6, #4D4D4D));font-size:var(--tct-file-picker-drop-zone-font-size, var(--app-font-size-small, 12px));font-weight:var(--tct-file-picker-browse-link-font-weight, 700);margin-bottom:0;margin-top:var(--tct-file-picker-drop-zone-text-margin-top, var(--app-scale-2x, 10px))}.description{color:var(--tct-file-picker-description-text-color, var(--t-gray-1, #0D0D0D));font-size:var(--tct-file-picker-description-font-size, var(--app-font-size-small, 12px));font-weight:var(--tct-file-picker-description-font-weight, 400);text-align:var(--tct-file-picker-description-text-align, left)}.drop-zone{align-items:center;background-color:var(--tct-file-picker-drop-zone-background, var(--t-tertiary, #E8F5FC));border-radius:var(--tct-file-picker-drop-zone-border-radius, var(--app-border-radius-2, 6px));border-width:var(--tct-file-picker-drop-zone-border-width, 2px);border-style:var(--tct-file-picker-drop-zone-border-style, dashed);border-color:var(--tct-file-picker-drop-zone-border-color, var(--t-gray-8, #808080));color:var(--tct-file-picker-drop-zone-color, #747474);display:flex;flex-direction:column;font-size:var(--tct-file-picker-drop-zone-font-size, --app-font-size, 14px);font-weight:var(--tct-file-picker-drop-zone-font-weight, 400);height:var(--tct-file-picker-drop-zone-height, 150px);justify-content:center;padding:var(--tct-file-picker-drop-zone-padding, 20px);text-align:center;width:var(--tct-file-picker-drop-zone-width, 100%)}.drop-zone-highlighted{background-color:var(--tct-file-picker-drop-zone-highlighted-background, var(--tertiary-d-1, #BEE1F6));border-color:var(--tct-file-picker-drop-zone-highlighted-border, var(--t-gray-8, #808080))}.fade-in{animation-fill-mode:both;animation-play-state:running;animation:growFromCenterFadeIn 0.2s ease-in}.fade-out{animation:shrinkToCenterFadeOut 0.1s ease-out;animation-play-state:running;animation-fill-mode:both}.file-item{--tct-btn-neutral-text-font-color:var(--tct-file-picker-item-close-btn-color, var(--t-gray-1, #0D0D0D));--tct-btn-padding:0;--tct-item-body-color:var(--tct-file-picker-file-item-size-color, var(--t-gray-6, #4D4D4D));--tct-item-body-font-size:var(--tct-file-picker-file-item-size-font-size, var(--app-font-size-small, 12px));--tct-item-body-font-weight:var(--tct-file-picker-file-item-size-font-weight, 400);--tct-item-border-radius:var(--tct-file-picker-file-item-border-radius, var(--app-border-radius-3, 12px));--tct-item-border:var(--tct-file-picker-file-item-border-width, 1px) solid var(--tct-file-picker-file-item-border-color, var(--t-gray-8, #808080));--tct-item-header-color:var(--tct-file-picker-file-item-name-color, var(--t-gray-1, #0D0D0D));--tct-item-header-font-size:var(--tct-file-picker-file-item-name-font-size, var(--app-font-size-small, 12px));--tct-item-header-font-weight:var(--tct-file-picker-file-item-name-font-weight, 400);--tct-item-padding:var(--tct-file-picker-file-item-padding, var(--app-scale-1x, 5px) var(--app-scale-2x, 10px))}.file-item-loading{font-size:var(--tct-file-picker-file-item-loading-size, var(--app-scale-6x, 30px));margin-bottom:calc(var(--tct-file-picker-file-item-loading-margin-bottom, var(--app-scale-6x, 30px)) / 8.57);margin-left:calc(var(--tct-file-picker-file-item-loading-margin-bottom, var(--app-scale-1x, 5px)) / 2)}.file-list{--tct-list-item-gap:var(--tct-file-picker-section-gap, var(--app-scale-3x, 15px))}.file-list-container{max-height:182px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--tct-file-picker-scrollbar-color, var(--t-a11y-gray-color, #949494)) transparent}.file-picker{display:flex;flex-direction:column;gap:var(--tct-file-picker-file-item-gap, var(--app-scale-3x, 15px))}.heading{display:flex;flex-direction:column;gap:var(--tct-file-picker-heading-gap, var(--app-scale-1x, 5px));justify-content:space-between}.icon-success,.icon-error{--tct-icon-size:var(--tct-file-picker-file-item-icon-size, var(--app-scale-6x, 30px));--tct-icon-stroke-width:2px}.label{color:var(--tct-file-picker-label-color, var(--t-gray-1, #0D0D0D));font-size:var(--tct-file-picker-label-font-size, var(--app-font-size, 14px));font-weight:var(--tct-file-picker-label-font-weight, 600);text-align:var(--tct-file-picker-label-text-align, left)}.loading{font-size:var(--tct-file-picker-loading-size, var(--app-scale-6x, 25px))}.loading-file{color:var(--tct-file-picker-loading-file-color, var(--t-gray-1, #0D0D0D));font-size:var(--tct-file-picker-loading-file-font-size, var(--app-font-size-small, 12px));font-weight:var(--tct-file-picker-loading-file-font-weight, 400);margin:0}.loading-message{color:var(--tct-file-picker-loading-message-color, var(--t-gray-1, #0D0D0D));font-size:var(--tct-file-picker-loading-message-font-size, var(--app-font-size-small, 12px));font-weight:var(--tct-file-picker-loading-message-font-weight, 700);margin-bottom:var(--tct-file-picker-loading-message-margin-bottom, var(--app-scale-2x, 10px));margin-top:var(--tct-file-picker-loading-message-margin-top, var(--app-scale-2x, 10px))}";
6
+
7
+ const l = n;
8
+
9
+ const c = class {
10
+ constructor(o) {
11
+ e(this, o);
12
+ this.tctChange = i(this, "tctChange", 7);
13
+ this.queuedFiles = [];
14
+ this.dimDropZone = e => {
15
+ this.disableEvent(e);
16
+ this.isDropZoneHighlighted = false;
17
+ };
18
+ this.grabDroppedFiles = e => {
19
+ this.disableEvent(e);
20
+ this.isDropZoneHighlighted = false;
21
+ const i = Array.from(e.dataTransfer.files);
22
+ const t = this.buildFilesObject(i);
23
+ this.emitChange(t);
24
+ this.value = t;
25
+ };
26
+ this.grabSelectedFiles = e => {
27
+ const i = Array.from(e.target.files);
28
+ const t = this.buildFilesObject(i);
29
+ this.emitChange(t);
30
+ this.value = t;
31
+ };
32
+ this.highlightDropZone = e => {
33
+ this.disableEvent(e);
34
+ this.isDropZoneHighlighted = true;
35
+ };
36
+ // #endregion
37
+ // #region Render Methods
38
+ this.render = () => t("div", {
39
+ class: "file-picker"
40
+ }, (this.hasLabel || this.hasDescription) && t("div", {
41
+ class: "heading"
42
+ }, this.hasLabel && t("label", {
43
+ class: "label",
44
+ htmlFor: "file-field",
45
+ "test-id": "label"
46
+ }, !!this.label ? s(this.label) : this.hasLabelSlotContent ? t("slot", {
47
+ name: "label"
48
+ }) : ""), this.hasDescription && t("div", {
49
+ class: "description",
50
+ id: "description",
51
+ "test-id": "description"
52
+ }, !!this.description ? s(this.description) : this.hasDescriptionSlotContent ? t("slot", {
53
+ name: "description"
54
+ }) : "")), this.variant === "browse-drop" && t("div", {
55
+ class: this.dropZoneClasses,
56
+ onDragEnter: this.disableEvent,
57
+ onDragLeave: this.dimDropZone,
58
+ onDragOver: this.highlightDropZone,
59
+ onDrop: this.grabDroppedFiles,
60
+ ref: e => this.dropZone = e !== null && e !== void 0 ? e : this.dropZone,
61
+ "test-id": "drop-zone"
62
+ }, this.areFilesUploading && t(r, null, t("q2-loading", {
63
+ class: "loading"
64
+ }), t("p", {
65
+ class: "drop-zone-text"
66
+ }, s("tecton.element.filePicker.uploadingEllipsis"))) || t(r, null, t("q2-icon", {
67
+ type: "upload"
68
+ }), t("p", {
69
+ class: "drop-zone-text"
70
+ }, t("q2-link", {
71
+ label: s("tecton.element.filePicker.browse"),
72
+ onTctClick: () => this.launchFileBrowser(),
73
+ variant: "inline",
74
+ "test-id": "browse-link"
75
+ }), s("tecton.element.filePicker.orDragFilesHere", [ this.maxFiles ])))) || t("div", {
76
+ class: "browse",
77
+ "test-id": "browse"
78
+ }, t("q2-btn", {
79
+ disabled: this.areFilesUploading,
80
+ intent: "workflow-primary",
81
+ loading: this.areFilesUploading,
82
+ onClick: () => this.launchFileBrowser(),
83
+ size: "medium",
84
+ "test-id": "browse-button"
85
+ }, t("q2-icon", {
86
+ type: "paperclip"
87
+ }), t("span", null, s("tecton.element.filePicker.attachFiles", [ this.maxFiles ])))), t("input", {
88
+ "aria-describedby": !!this.description && "description" || undefined,
89
+ class: "sr",
90
+ id: "file-field",
91
+ onChange: this.grabSelectedFiles,
92
+ ref: e => this.browseButtonInput = e !== null && e !== void 0 ? e : this.browseButtonInput,
93
+ type: "file",
94
+ "test-id": "file-input",
95
+ multiple: true
96
+ }), t("div", {
97
+ class: "file-list-container"
98
+ }, t("q2-list", {
99
+ class: "file-list"
100
+ }, this.displayedFiles.map((e => t("q2-item", {
101
+ class: this.getFileItemClasses(e.file.name),
102
+ key: e.file.name,
103
+ onAnimationEnd: this.getAnimationendHandlerToRemoveFileItem(e.file.name)
104
+ }, t("div", {
105
+ slot: "bullet"
106
+ }, e.status === "invalid-type" || e.status === "over-size-limit" || e.status === "failed" || e.status === "over-max-files-limit" ? t("q2-icon", {
107
+ class: "icon-error",
108
+ type: "error"
109
+ }) : e.status === "in-progress" ? t("q2-loading", {
110
+ class: "file-item-loading"
111
+ }) : t("q2-icon", {
112
+ class: "icon-success",
113
+ type: "success"
114
+ })), t("div", {
115
+ slot: "header"
116
+ }, e.file.name), t("div", {
117
+ slot: "body"
118
+ }, this.getFileItemStatusMessage(e.status, e.file.size)), t("div", {
119
+ slot: "action"
120
+ }, t("q2-btn", {
121
+ intent: "neutral-text",
122
+ onClick: this.getClickHandlerToRemoveFileItem(e.file.name)
123
+ }, t("q2-icon", {
124
+ type: "close"
125
+ })))))))));
126
+ this.areFilesUploading = false;
127
+ this.displayedFiles = [];
128
+ this.isDropZoneHighlighted = false;
129
+ this.refreshCounter = 0;
130
+ this.description = undefined;
131
+ this.fileTypes = [];
132
+ this.label = undefined;
133
+ this.maxFiles = Infinity;
134
+ this.maxFileSize = Infinity;
135
+ this.status = [];
136
+ this.value = {
137
+ invalidFiles: [],
138
+ validFiles: []
139
+ };
140
+ this.variant = "browse";
141
+ }
142
+ // #endregion
143
+ // #region Watchers
144
+ updateFileList(e) {
145
+ e.forEach((e => {
146
+ const i = this.queuedFiles.findIndex((i => i.name === e.name));
147
+ if (i > -1) {
148
+ const t = this.queuedFiles.splice(i, 1)[0];
149
+ this.displayedFiles = [ {
150
+ file: t,
151
+ status: e.status
152
+ }, ...this.displayedFiles ];
153
+ } else {
154
+ const i = this.displayedFiles.findIndex((i => i.file.name === e.name));
155
+ if (i > -1) {
156
+ this.displayedFiles[i].status = e.status;
157
+ this.disableLoaderIfAllFilesUploaded();
158
+ }
159
+ }
160
+ }));
161
+ }
162
+ // #endregion
163
+ // #region Local Methods
164
+ get dropZoneClasses() {
165
+ const e = [ "drop-zone" ];
166
+ if (this.isDropZoneHighlighted) {
167
+ e.push("drop-zone-highlighted");
168
+ }
169
+ return e.join(" ");
170
+ }
171
+ get fileTypesArray() {
172
+ return Array.isArray(this.fileTypes) ? this.fileTypes : this.fileTypes.split(",");
173
+ }
174
+ get hasDescription() {
175
+ return !!this.description || this.hasDescriptionSlotContent;
176
+ }
177
+ get hasDescriptionSlotContent() {
178
+ return a(this.el, "description");
179
+ }
180
+ get hasLabel() {
181
+ return !!this.label || this.hasLabelSlotContent;
182
+ }
183
+ get hasLabelSlotContent() {
184
+ return a(this.el, "label");
185
+ }
186
+ buildFilesObject(e) {
187
+ const i = [];
188
+ i.push(...this.extractFilesOfInvalidTypes(e));
189
+ i.push(...this.extractFilesOverSizeLimit(e));
190
+ i.push(...this.extractFilesOverMaxFilesLimit(e));
191
+ this.displayedFiles = [ ...i ];
192
+ if (e.length === 0) {
193
+ this.areFilesUploading = false;
194
+ } else {
195
+ this.queuedFiles = e;
196
+ }
197
+ return {
198
+ invalidFiles: i,
199
+ validFiles: e
200
+ };
201
+ }
202
+ disableEvent(e) {
203
+ e.preventDefault();
204
+ e.stopPropagation();
205
+ }
206
+ disableLoaderIfAllFilesUploaded() {
207
+ if (this.queuedFiles.length === 0 && !this.displayedFiles.some((e => e.status === "in-progress"))) {
208
+ this.areFilesUploading = false;
209
+ }
210
+ }
211
+ emitChange(e) {
212
+ this.areFilesUploading = e.validFiles.length > 0;
213
+ this.tctChange.emit(e);
214
+ }
215
+ extractFilesOfInvalidTypes(e) {
216
+ const i = [];
217
+ if (this.fileTypesArray.length === 0) return i;
218
+ e.forEach((e => {
219
+ const t = e.name.split(".").pop().toLowerCase();
220
+ if (!this.fileTypesArray.includes(t)) {
221
+ i.push({
222
+ file: e,
223
+ status: "invalid-type"
224
+ });
225
+ }
226
+ }));
227
+ // Remove invalid files from the files array
228
+ i.forEach((i => {
229
+ const t = e.indexOf(i.file);
230
+ if (t > -1) {
231
+ e.splice(t, 1);
232
+ }
233
+ }));
234
+ return i;
235
+ }
236
+ extractFilesOverMaxFilesLimit(e) {
237
+ const i = [];
238
+ if (this.maxFiles === Infinity) return i;
239
+ if (e.length > this.maxFiles) {
240
+ const t = e.splice(this.maxFiles);
241
+ t.forEach((e => {
242
+ i.push({
243
+ file: e,
244
+ status: "over-max-files-limit"
245
+ });
246
+ }));
247
+ }
248
+ return i;
249
+ }
250
+ extractFilesOverSizeLimit(e) {
251
+ const i = [];
252
+ if (this.maxFileSize === Infinity) return i;
253
+ e.forEach((e => {
254
+ if (e.size > this.maxFileSize) {
255
+ i.push({
256
+ file: e,
257
+ status: "over-size-limit"
258
+ });
259
+ }
260
+ }));
261
+ // Remove files over size limit from the files array
262
+ i.forEach((i => {
263
+ const t = e.indexOf(i.file);
264
+ if (t > -1) {
265
+ e.splice(t, 1);
266
+ }
267
+ }));
268
+ return i;
269
+ }
270
+ forceRerender() {
271
+ this.refreshCounter += 1;
272
+ // Triggers re-render
273
+ }
274
+ getAnimationendHandlerToRemoveFileItem(e) {
275
+ return i => {
276
+ if (i.animationName === "shrinkToCenterFadeOut") {
277
+ this.displayedFiles = this.displayedFiles.filter((i => i.file.name !== e));
278
+ }
279
+ };
280
+ }
281
+ getClickHandlerToRemoveFileItem(e) {
282
+ return () => {
283
+ const i = this.displayedFiles.find((i => i.file.name === e));
284
+ if (i) {
285
+ i.toBeRemoved = true;
286
+ this.forceRerender();
287
+ }
288
+ };
289
+ }
290
+ getFileItemClasses(e) {
291
+ const i = [ "file-item" ];
292
+ const t = this.displayedFiles.find((i => i.file.name === e));
293
+ if (t === null || t === void 0 ? void 0 : t.toBeRemoved) {
294
+ i.push("fade-out");
295
+ } else {
296
+ i.push("fade-in");
297
+ }
298
+ return i.join(" ");
299
+ }
300
+ getFileItemStatusMessage(e, i) {
301
+ switch (e) {
302
+ case "invalid-type":
303
+ return s("tecton.element.filePicker.unsupportedFileType");
304
+
305
+ case "over-size-limit":
306
+ return s("tecton.element.filePicker.sizeExceedsLimit");
307
+
308
+ case "over-max-files-limit":
309
+ return s("tecton.element.filePicker.overMaxFilesLimit");
310
+
311
+ case "in-progress":
312
+ return s("tecton.element.filePicker.uploadingEllipsis");
313
+
314
+ case "failed":
315
+ return s("tecton.element.filePicker.uploadFailed");
316
+
317
+ case "uploaded":
318
+ default:
319
+ return s("tecton.element.filePicker.fileSize", [ (i / (1e3 * 1e3)).toFixed(2) ]);
320
+ }
321
+ }
322
+ launchFileBrowser() {
323
+ this.browseButtonInput.dispatchEvent(new MouseEvent("click"));
324
+ }
325
+ get el() {
326
+ return o(this);
327
+ }
328
+ static get watchers() {
329
+ return {
330
+ status: [ "updateFileList" ]
331
+ };
332
+ }
333
+ };
334
+
335
+ c.style = l;
336
+
337
+ export { c as q2_file_picker };
338
+ //# sourceMappingURL=q2-file-picker.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["q2FilePickerCss","Q2FilePickerStyle0","Q2FilePicker","this","queuedFiles","dimDropZone","e","disableEvent","isDropZoneHighlighted","grabDroppedFiles","droppedFiles","Array","from","dataTransfer","files","filesObject","buildFilesObject","emitChange","value","grabSelectedFiles","selectedFiles","target","highlightDropZone","render","h","class","hasLabel","hasDescription","htmlFor","label","loc","hasLabelSlotContent","name","id","description","hasDescriptionSlotContent","variant","dropZoneClasses","onDragEnter","onDragLeave","onDragOver","onDrop","ref","el","dropZone","areFilesUploading","Fragment","type","onTctClick","launchFileBrowser","maxFiles","disabled","intent","loading","onClick","size","undefined","onChange","browseButtonInput","multiple","displayedFiles","map","file","getFileItemClasses","key","onAnimationEnd","getAnimationendHandlerToRemoveFileItem","slot","status","getFileItemStatusMessage","getClickHandlerToRemoveFileItem","Infinity","invalidFiles","validFiles","updateFileList","newValue","forEach","statusItem","matchingQueuedFileIndex","findIndex","matchingFile","splice","matchingDisplayedFileIndex","disableLoaderIfAllFilesUploaded","classes","push","join","fileTypesArray","isArray","fileTypes","split","hasSlotContent","filesToUpload","extractFilesOfInvalidTypes","extractFilesOverSizeLimit","extractFilesOverMaxFilesLimit","length","event","preventDefault","stopPropagation","some","tctChange","emit","fileExtension","pop","toLowerCase","includes","invalidFile","index","indexOf","filesOverMaxFilesLimit","excessFiles","filesOverSizeLimit","maxFileSize","overSizeFile","forceRerender","refreshCounter","fileName","animationName","filter","fileToDelete","find","toBeRemoved","toFixed","dispatchEvent","MouseEvent"],"sources":["src/components/q2-file-picker/q2-file-picker.scss?tag=q2-file-picker&encapsulation=shadow","src/components/q2-file-picker/q2-file-picker.tsx"],"sourcesContent":["@import '../../styles/host.scss';\n@import '../../styles/functions';\n@import '../q2-btn/q2-btn-mixins';\n\n@keyframes growFromCenterFadeIn {\n from {\n transform: scaleX(.75) scaleY(.75);\n opacity: 0;\n }\n to {\n transform: scaleX(1) scaleY(1);\n opacity: 1;\n }\n}\n\n@keyframes shrinkToCenterFadeOut {\n from {\n transform: scaleX(1) scaleY(1);\n opacity: 1;\n }\n to {\n transform: scaleX(.75) scaleY(.75);\n opacity: 0;\n }\n}\n\n:host {\n display: block;\n}\n\n.browse {\n text-align: left;\n}\n\n.drop-zone-text {\n color: var-list(--tct-file-picker-drop-zone-text-color, --t-gray-6, #4D4D4D);\n font-size: var-list(--tct-file-picker-drop-zone-font-size, --app-font-size-small, 12px);\n font-weight: var(--tct-file-picker-browse-link-font-weight, 700);\n margin-bottom: 0;\n margin-top: var-list(--tct-file-picker-drop-zone-text-margin-top, --app-scale-2x, 10px);\n}\n\n.description {\n color: var-list(--tct-file-picker-description-text-color, --t-gray-1, #0D0D0D);\n font-size: var-list(--tct-file-picker-description-font-size, --app-font-size-small, 12px);\n font-weight: var(--tct-file-picker-description-font-weight, 400);\n text-align: var(--tct-file-picker-description-text-align, left);\n}\n\n.drop-zone {\n align-items: center;\n background-color: var-list(--tct-file-picker-drop-zone-background, --t-tertiary, #E8F5FC);\n border-radius: var-list(--tct-file-picker-drop-zone-border-radius, --app-border-radius-2, 6px);\n border-width: var(--tct-file-picker-drop-zone-border-width, 2px);\n border-style: var(--tct-file-picker-drop-zone-border-style, dashed);\n border-color: var-list(--tct-file-picker-drop-zone-border-color, --t-gray-8, #808080);\n color: var(--tct-file-picker-drop-zone-color, #747474);\n display: flex;\n flex-direction: column;\n font-size: var(--tct-file-picker-drop-zone-font-size, --app-font-size, 14px);\n font-weight: var(--tct-file-picker-drop-zone-font-weight, 400);\n height: var(--tct-file-picker-drop-zone-height, 150px);\n justify-content: center;\n padding: var(--tct-file-picker-drop-zone-padding, 20px);\n text-align: center;\n width: var(--tct-file-picker-drop-zone-width, 100%);\n}\n\n.drop-zone-highlighted {\n background-color: var-list(--tct-file-picker-drop-zone-highlighted-background, --tertiary-d-1, #BEE1F6);\n border-color: var-list(--tct-file-picker-drop-zone-highlighted-border, --t-gray-8, #808080);\n}\n\n.fade-in {\n animation-fill-mode: both;\n animation-play-state: running;\n animation: growFromCenterFadeIn 0.2s ease-in;\n}\n\n.fade-out {\n animation: shrinkToCenterFadeOut 0.1s ease-out;\n animation-play-state: running;\n animation-fill-mode: both;\n}\n\n.file-item {\n --tct-btn-neutral-text-font-color: #{var-list(--tct-file-picker-item-close-btn-color, --t-gray-1, #0D0D0D)};\n --tct-btn-padding: 0;\n --tct-item-body-color: #{var-list(--tct-file-picker-file-item-size-color, --t-gray-6, #4D4D4D)};\n --tct-item-body-font-size: #{var-list(--tct-file-picker-file-item-size-font-size, --app-font-size-small, 12px)};\n --tct-item-body-font-weight: var(--tct-file-picker-file-item-size-font-weight, 400);\n --tct-item-border-radius: #{var-list(--tct-file-picker-file-item-border-radius, --app-border-radius-3, 12px)};\n --tct-item-border: var(--tct-file-picker-file-item-border-width, 1px) solid #{var-list(--tct-file-picker-file-item-border-color, --t-gray-8, #808080)};\n --tct-item-header-color: #{var-list(--tct-file-picker-file-item-name-color, --t-gray-1, #0D0D0D)};\n --tct-item-header-font-size: #{var-list(--tct-file-picker-file-item-name-font-size, --app-font-size-small, 12px)};\n --tct-item-header-font-weight: var(--tct-file-picker-file-item-name-font-weight, 400);\n --tct-item-padding: var(--tct-file-picker-file-item-padding, var(--app-scale-1x, 5px) var(--app-scale-2x, 10px));\n}\n\n.file-item-loading {\n font-size: var-list(--tct-file-picker-file-item-loading-size, --app-scale-6x, 30px);\n // FIXME: This is a temporary fix to match the height of the closing icon which has 3.5px of padding I can't account for\n margin-bottom: calc(var-list(--tct-file-picker-file-item-loading-margin-bottom, --app-scale-6x, 30px) / 8.57);\n margin-left: calc(var-list(--tct-file-picker-file-item-loading-margin-bottom, --app-scale-1x, 5px) / 2);\n}\n\n.file-list {\n --tct-list-item-gap: #{var-list(--tct-file-picker-section-gap, --app-scale-3x, 15px)};\n}\n\n.file-list-container {\n max-height: 182px;\n overflow-y: auto;\n scrollbar-width: thin;\n scrollbar-color: #{var-list(--tct-file-picker-scrollbar-color, --t-a11y-gray-color, #949494)} transparent;\n}\n\n.file-picker {\n display: flex;\n flex-direction: column;\n gap: #{var-list(--tct-file-picker-file-item-gap, --app-scale-3x, 15px)};\n}\n\n.heading {\n display: flex;\n flex-direction: column;\n gap: #{var-list(--tct-file-picker-heading-gap, --app-scale-1x, 5px)};\n justify-content: space-between;\n}\n\n.icon-success,\n.icon-error {\n --tct-icon-size: #{var-list(--tct-file-picker-file-item-icon-size, --app-scale-6x, 30px)};\n --tct-icon-stroke-width: 2px;\n}\n\n.label {\n color: var-list(--tct-file-picker-label-color, --t-gray-1, #0D0D0D);\n font-size: var-list(--tct-file-picker-label-font-size, --app-font-size, 14px);\n font-weight: var(--tct-file-picker-label-font-weight, 600);\n text-align: var(--tct-file-picker-label-text-align, left);\n}\n\n.loading {\n font-size: var-list(--tct-file-picker-loading-size, --app-scale-6x, 25px);\n}\n\n.loading-file {\n color: var-list(--tct-file-picker-loading-file-color, --t-gray-1, #0D0D0D);\n font-size: var-list(--tct-file-picker-loading-file-font-size, --app-font-size-small, 12px);\n font-weight: var(--tct-file-picker-loading-file-font-weight, 400);\n margin: 0;\n}\n\n.loading-message {\n color: var-list(--tct-file-picker-loading-message-color, --t-gray-1, #0D0D0D);\n font-size: var-list(--tct-file-picker-loading-message-font-size, --app-font-size-small, 12px);\n font-weight: var(--tct-file-picker-loading-message-font-weight, 700);\n margin-bottom: var-list(--tct-file-picker-loading-message-margin-bottom, --app-scale-2x, 10px);\n margin-top: var-list(--tct-file-picker-loading-message-margin-top, --app-scale-2x, 10px);\n}\n","import {\n Component,\n ComponentInterface,\n Element,\n Event,\n EventEmitter,\n Fragment,\n h,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { hasSlotContent, loc } from 'src/utils';\n\ntype FileStatus = 'invalid-type' | 'over-size-limit' | 'over-max-files-limit' | 'in-progress' | 'failed' | 'uploaded';\nexport type FilesObject = {\n invalidFiles: {\n file: File;\n status: 'invalid-type' | 'over-size-limit' | 'over-max-files-limit' | 'in-progress' | 'failed' | 'uploaded';\n }[];\n validFiles: File[];\n};\n\n@Component({\n tag: 'q2-file-picker',\n styleUrl: 'q2-file-picker.scss',\n shadow: true,\n})\nexport class Q2FilePicker implements ComponentInterface {\n // #region Own Properties\n\n browseButtonInput: HTMLElement;\n dropZone: HTMLElement;\n fileItemsToBeDeleted;\n queuedFiles: File[] = [];\n\n // #endregion\n // #region Host HTML Element\n\n @Element()\n el: HTMLElement;\n\n // #endregion\n // #region State Properties\n\n @State()\n areFilesUploading: boolean = false;\n\n @State()\n displayedFiles: {\n file: File;\n status: FileStatus;\n toBeRemoved?: boolean;\n }[] = [];\n\n @State()\n isDropZoneHighlighted: boolean = false;\n\n @State()\n refreshCounter = 0;\n\n // #endregion\n // #region Public Property API\n\n /**\n * A description of the field. This is announced by screen readers when the field is focused.\n * @localizable\n */\n @Prop({ reflect: true })\n description: string;\n\n /**\n * An array of strings representing the allowed file types based on file extension.\n * Example: ['jpg', 'png', 'pdf']\n */\n @Prop({ reflect: true })\n fileTypes: string[] | string = [];\n\n /**\n * The label for the field. This is announced by screen readers when the field is focused.\n * @localizable\n */\n @Prop({ reflect: true })\n label: string;\n\n /**\n * The maximum number of files that can be selected.\n */\n @Prop({ reflect: true })\n // maxFiles: number | string = Infinity;\n maxFiles: number = Infinity;\n\n /**\n * The maximum size (in bytes) of any file that can be selected.\n */\n @Prop({ reflect: true })\n maxFileSize: number = Infinity;\n\n /**\n * An array of objects representing the status of the files being uploaded.\n * Each object should have a `name` property (the file name) and a `status`\n * property (the status of the file) that equals either 'in-progress',\n * 'failed' or 'uploaded'.\n */\n @Prop({ reflect: true })\n status: { name: string; status: 'in-progress' | 'failed' | 'uploaded' }[] = [];\n\n /**\n * Returns an array of File objects representing the files selected by the\n * user. If no files are selected, the value is an empty array.\n * @readonly\n */\n @Prop({ mutable: true })\n value: FilesObject = { invalidFiles: [], validFiles: [] }; // Ensure FilesObject is exported or imported correctly\n\n /**\n * Determines if the file picker is a browse button or a drop zone with a\n * browse link.\n */\n @Prop({ reflect: true })\n variant: 'browse' | 'browse-drop' = 'browse';\n\n // #endregion\n // #region Events\n\n @Event()\n tctChange: EventEmitter<FilesObject>;\n\n // #endregion\n // #region Watchers\n\n @Watch('status')\n updateFileList(newValue: { name: string; status: FileStatus }[]) {\n newValue.forEach(statusItem => {\n const matchingQueuedFileIndex = this.queuedFiles.findIndex(file => file.name === statusItem.name);\n if (matchingQueuedFileIndex > -1) {\n const matchingFile = this.queuedFiles.splice(matchingQueuedFileIndex, 1)[0];\n this.displayedFiles = [{ file: matchingFile, status: statusItem.status }, ...this.displayedFiles];\n } else {\n const matchingDisplayedFileIndex = this.displayedFiles.findIndex(\n file => file.file.name === statusItem.name\n );\n if (matchingDisplayedFileIndex > -1) {\n this.displayedFiles[matchingDisplayedFileIndex].status = statusItem.status;\n this.disableLoaderIfAllFilesUploaded();\n }\n }\n });\n }\n\n // #endregion\n // #region Local Methods\n\n get dropZoneClasses() {\n const classes = ['drop-zone'];\n if (this.isDropZoneHighlighted) {\n classes.push('drop-zone-highlighted');\n }\n\n return classes.join(' ');\n }\n\n get fileTypesArray() {\n return Array.isArray(this.fileTypes) ? this.fileTypes : this.fileTypes.split(',');\n }\n\n get hasDescription() {\n return !!this.description || this.hasDescriptionSlotContent;\n }\n\n get hasDescriptionSlotContent() {\n return hasSlotContent(this.el, 'description');\n }\n\n get hasLabel() {\n return !!this.label || this.hasLabelSlotContent;\n }\n\n get hasLabelSlotContent() {\n return hasSlotContent(this.el, 'label');\n }\n\n buildFilesObject(filesToUpload: File[]): FilesObject {\n const invalidFiles = [];\n invalidFiles.push(...this.extractFilesOfInvalidTypes(filesToUpload));\n invalidFiles.push(...this.extractFilesOverSizeLimit(filesToUpload));\n invalidFiles.push(...this.extractFilesOverMaxFilesLimit(filesToUpload));\n this.displayedFiles = [...invalidFiles];\n\n if (filesToUpload.length === 0) {\n this.areFilesUploading = false;\n } else {\n this.queuedFiles = filesToUpload;\n }\n\n return { invalidFiles, validFiles: filesToUpload };\n }\n\n dimDropZone = (e: DragEvent) => {\n this.disableEvent(e);\n this.isDropZoneHighlighted = false;\n };\n\n disableEvent(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n disableLoaderIfAllFilesUploaded() {\n if (this.queuedFiles.length === 0 && !this.displayedFiles.some(file => file.status === 'in-progress')) {\n this.areFilesUploading = false;\n }\n }\n\n emitChange(filesObject: FilesObject) {\n this.areFilesUploading = filesObject.validFiles.length > 0;\n this.tctChange.emit(filesObject);\n }\n\n extractFilesOfInvalidTypes(files: File[]) {\n const invalidFiles = [];\n\n if (this.fileTypesArray.length === 0) return invalidFiles;\n\n files.forEach(file => {\n const fileExtension = file.name.split('.').pop().toLowerCase();\n if (!this.fileTypesArray.includes(fileExtension)) {\n invalidFiles.push({ file, status: 'invalid-type' });\n }\n });\n\n // Remove invalid files from the files array\n invalidFiles.forEach(invalidFile => {\n const index = files.indexOf(invalidFile.file);\n if (index > -1) {\n files.splice(index, 1);\n }\n });\n\n return invalidFiles;\n }\n\n extractFilesOverMaxFilesLimit(files: File[]) {\n const filesOverMaxFilesLimit = [];\n\n if (this.maxFiles === Infinity) return filesOverMaxFilesLimit;\n\n if (files.length > this.maxFiles) {\n const excessFiles = files.splice(this.maxFiles);\n excessFiles.forEach(file => {\n filesOverMaxFilesLimit.push({ file, status: 'over-max-files-limit' });\n });\n }\n\n return filesOverMaxFilesLimit;\n }\n\n extractFilesOverSizeLimit(files: File[]) {\n const filesOverSizeLimit = [];\n\n if (this.maxFileSize === Infinity) return filesOverSizeLimit;\n\n files.forEach(file => {\n if (file.size > this.maxFileSize) {\n filesOverSizeLimit.push({ file, status: 'over-size-limit' });\n }\n });\n\n // Remove files over size limit from the files array\n filesOverSizeLimit.forEach(overSizeFile => {\n const index = files.indexOf(overSizeFile.file);\n if (index > -1) {\n files.splice(index, 1);\n }\n });\n\n return filesOverSizeLimit;\n }\n\n forceRerender() {\n this.refreshCounter += 1; // Triggers re-render\n }\n\n getAnimationendHandlerToRemoveFileItem(fileName: string) {\n return (e: AnimationEvent) => {\n if (e.animationName === 'shrinkToCenterFadeOut') {\n this.displayedFiles = this.displayedFiles.filter(file => file.file.name !== fileName);\n }\n };\n }\n\n getClickHandlerToRemoveFileItem(fileName: string) {\n return () => {\n const fileToDelete = this.displayedFiles.find(file => file.file.name === fileName);\n if (fileToDelete) {\n fileToDelete.toBeRemoved = true;\n this.forceRerender();\n }\n };\n }\n\n getFileItemClasses(fileName: string) {\n const classes = ['file-item'];\n const matchingFile = this.displayedFiles.find(file => file.file.name === fileName);\n if (matchingFile?.toBeRemoved) {\n classes.push('fade-out');\n } else {\n classes.push('fade-in');\n }\n return classes.join(' ');\n }\n\n getFileItemStatusMessage(status: FileStatus, size: number) {\n switch (status) {\n case 'invalid-type':\n return loc('tecton.element.filePicker.unsupportedFileType');\n case 'over-size-limit':\n return loc('tecton.element.filePicker.sizeExceedsLimit');\n case 'over-max-files-limit':\n return loc('tecton.element.filePicker.overMaxFilesLimit');\n case 'in-progress':\n return loc('tecton.element.filePicker.uploadingEllipsis');\n case 'failed':\n return loc('tecton.element.filePicker.uploadFailed');\n case 'uploaded':\n default:\n return loc('tecton.element.filePicker.fileSize', [(size / (1000 * 1000)).toFixed(2)]);\n }\n }\n\n grabDroppedFiles = (e: DragEvent) => {\n this.disableEvent(e);\n this.isDropZoneHighlighted = false;\n const droppedFiles = Array.from(e.dataTransfer.files);\n const filesObject = this.buildFilesObject(droppedFiles);\n\n this.emitChange(filesObject);\n this.value = filesObject;\n };\n\n grabSelectedFiles = (e: Event) => {\n const selectedFiles = Array.from((e.target as HTMLInputElement).files);\n const filesObject = this.buildFilesObject(selectedFiles);\n\n this.emitChange(filesObject);\n this.value = filesObject;\n };\n\n highlightDropZone = (e: DragEvent) => {\n this.disableEvent(e);\n this.isDropZoneHighlighted = true;\n };\n\n launchFileBrowser() {\n this.browseButtonInput.dispatchEvent(new MouseEvent('click'));\n }\n\n // #endregion\n // #region Render Methods\n\n render = () => {\n return (\n <div class=\"file-picker\">\n {(this.hasLabel || this.hasDescription) && (\n <div class=\"heading\">\n {this.hasLabel && (\n <label\n class=\"label\"\n htmlFor=\"file-field\"\n test-id=\"label\"\n >\n {!!this.label ? loc(this.label) : this.hasLabelSlotContent ? <slot name=\"label\" /> : ''}\n </label>\n )}\n {this.hasDescription && (\n <div\n class=\"description\"\n id=\"description\"\n test-id=\"description\"\n >\n {!!this.description ? (\n loc(this.description)\n ) : this.hasDescriptionSlotContent ? (\n <slot name=\"description\" />\n ) : (\n ''\n )}\n </div>\n )}\n </div>\n )}\n\n {(this.variant === 'browse-drop' && (\n <div\n class={this.dropZoneClasses}\n onDragEnter={this.disableEvent}\n onDragLeave={this.dimDropZone}\n onDragOver={this.highlightDropZone}\n onDrop={this.grabDroppedFiles}\n ref={el => (this.dropZone = el ?? this.dropZone)}\n test-id=\"drop-zone\"\n >\n {(this.areFilesUploading && (\n <Fragment>\n <q2-loading class=\"loading\"></q2-loading>\n <p class=\"drop-zone-text\">{loc('tecton.element.filePicker.uploadingEllipsis')}</p>\n </Fragment>\n )) || (\n <Fragment>\n <q2-icon type=\"upload\"></q2-icon>\n <p class=\"drop-zone-text\">\n <q2-link\n label={loc('tecton.element.filePicker.browse')}\n onTctClick={() => this.launchFileBrowser()}\n variant=\"inline\"\n test-id=\"browse-link\"\n />\n {loc('tecton.element.filePicker.orDragFilesHere', [this.maxFiles])}\n </p>\n </Fragment>\n )}\n </div>\n )) || (\n <div\n class=\"browse\"\n test-id=\"browse\"\n >\n <q2-btn\n disabled={this.areFilesUploading}\n intent=\"workflow-primary\"\n loading={this.areFilesUploading}\n onClick={() => this.launchFileBrowser()}\n size=\"medium\"\n test-id=\"browse-button\"\n >\n <q2-icon type=\"paperclip\"></q2-icon>\n <span>{loc('tecton.element.filePicker.attachFiles', [this.maxFiles])}</span>\n </q2-btn>\n </div>\n )}\n <input\n aria-describedby={(!!this.description && 'description') || undefined}\n class=\"sr\"\n id=\"file-field\"\n onChange={this.grabSelectedFiles}\n ref={el => (this.browseButtonInput = el ?? this.browseButtonInput)}\n type=\"file\"\n test-id=\"file-input\"\n multiple\n />\n <div class=\"file-list-container\">\n <q2-list class=\"file-list\">\n {this.displayedFiles.map(file => (\n <q2-item\n class={this.getFileItemClasses(file.file.name)}\n key={file.file.name}\n onAnimationEnd={this.getAnimationendHandlerToRemoveFileItem(file.file.name)}\n >\n <div slot=\"bullet\">\n {file.status === 'invalid-type' ||\n file.status === 'over-size-limit' ||\n file.status === 'failed' ||\n file.status === 'over-max-files-limit' ? (\n <q2-icon\n class=\"icon-error\"\n type=\"error\"\n ></q2-icon>\n ) : file.status === 'in-progress' ? (\n <q2-loading class=\"file-item-loading\"></q2-loading>\n ) : (\n <q2-icon\n class=\"icon-success\"\n type=\"success\"\n ></q2-icon>\n )}\n </div>\n <div slot=\"header\">{file.file.name}</div>\n <div slot=\"body\">{this.getFileItemStatusMessage(file.status, file.file.size)}</div>\n <div slot=\"action\">\n <q2-btn\n intent=\"neutral-text\"\n onClick={this.getClickHandlerToRemoveFileItem(file.file.name)}\n >\n <q2-icon type=\"close\"></q2-icon>\n </q2-btn>\n </div>\n </q2-item>\n ))}\n </q2-list>\n </div>\n </div>\n );\n };\n\n // #endregion\n}\n"],"mappings":";;;;AAAA,MAAMA,IAAkB;;AACxB,MAAAC,IAAeD;;MC2BFE,IAAY;;;;IAMrBC,KAAAC,cAAsB;IAoKtBD,KAAAE,cAAe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