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,426 @@
1
+ import { Fragment, h, } from "@stencil/core";
2
+ import { hasSlotContent, loc } from "../../utils/index";
3
+ export class Q2FilePicker {
4
+ constructor() {
5
+ this.queuedFiles = [];
6
+ this.dimDropZone = (e) => {
7
+ this.disableEvent(e);
8
+ this.isDropZoneHighlighted = false;
9
+ };
10
+ this.grabDroppedFiles = (e) => {
11
+ this.disableEvent(e);
12
+ this.isDropZoneHighlighted = false;
13
+ const droppedFiles = Array.from(e.dataTransfer.files);
14
+ const filesObject = this.buildFilesObject(droppedFiles);
15
+ this.emitChange(filesObject);
16
+ this.value = filesObject;
17
+ };
18
+ this.grabSelectedFiles = (e) => {
19
+ const selectedFiles = Array.from(e.target.files);
20
+ const filesObject = this.buildFilesObject(selectedFiles);
21
+ this.emitChange(filesObject);
22
+ this.value = filesObject;
23
+ };
24
+ this.highlightDropZone = (e) => {
25
+ this.disableEvent(e);
26
+ this.isDropZoneHighlighted = true;
27
+ };
28
+ // #endregion
29
+ // #region Render Methods
30
+ this.render = () => {
31
+ return (h("div", { class: "file-picker" }, (this.hasLabel || this.hasDescription) && (h("div", { class: "heading" }, this.hasLabel && (h("label", { class: "label", htmlFor: "file-field", "test-id": "label" }, !!this.label ? loc(this.label) : this.hasLabelSlotContent ? h("slot", { name: "label" }) : '')), this.hasDescription && (h("div", { class: "description", id: "description", "test-id": "description" }, !!this.description ? (loc(this.description)) : this.hasDescriptionSlotContent ? (h("slot", { name: "description" })) : (''))))), (this.variant === 'browse-drop' && (h("div", { class: this.dropZoneClasses, onDragEnter: this.disableEvent, onDragLeave: this.dimDropZone, onDragOver: this.highlightDropZone, onDrop: this.grabDroppedFiles, ref: el => (this.dropZone = el !== null && el !== void 0 ? el : this.dropZone), "test-id": "drop-zone" }, (this.areFilesUploading && (h(Fragment, null, h("q2-loading", { class: "loading" }), h("p", { class: "drop-zone-text" }, loc('tecton.element.filePicker.uploadingEllipsis'))))) || (h(Fragment, null, h("q2-icon", { type: "upload" }), h("p", { class: "drop-zone-text" }, h("q2-link", { label: loc('tecton.element.filePicker.browse'), onTctClick: () => this.launchFileBrowser(), variant: "inline", "test-id": "browse-link" }), loc('tecton.element.filePicker.orDragFilesHere', [this.maxFiles]))))))) || (h("div", { class: "browse", "test-id": "browse" }, h("q2-btn", { disabled: this.areFilesUploading, intent: "workflow-primary", loading: this.areFilesUploading, onClick: () => this.launchFileBrowser(), size: "medium", "test-id": "browse-button" }, h("q2-icon", { type: "paperclip" }), h("span", null, loc('tecton.element.filePicker.attachFiles', [this.maxFiles]))))), h("input", { "aria-describedby": (!!this.description && 'description') || undefined, class: "sr", id: "file-field", onChange: this.grabSelectedFiles, ref: el => (this.browseButtonInput = el !== null && el !== void 0 ? el : this.browseButtonInput), type: "file", "test-id": "file-input", multiple: true }), h("div", { class: "file-list-container" }, h("q2-list", { class: "file-list" }, this.displayedFiles.map(file => (h("q2-item", { class: this.getFileItemClasses(file.file.name), key: file.file.name, onAnimationEnd: this.getAnimationendHandlerToRemoveFileItem(file.file.name) }, h("div", { slot: "bullet" }, file.status === 'invalid-type' ||
32
+ file.status === 'over-size-limit' ||
33
+ file.status === 'failed' ||
34
+ file.status === 'over-max-files-limit' ? (h("q2-icon", { class: "icon-error", type: "error" })) : file.status === 'in-progress' ? (h("q2-loading", { class: "file-item-loading" })) : (h("q2-icon", { class: "icon-success", type: "success" }))), h("div", { slot: "header" }, file.file.name), h("div", { slot: "body" }, this.getFileItemStatusMessage(file.status, file.file.size)), h("div", { slot: "action" }, h("q2-btn", { intent: "neutral-text", onClick: this.getClickHandlerToRemoveFileItem(file.file.name) }, h("q2-icon", { type: "close" }))))))))));
35
+ };
36
+ this.areFilesUploading = false;
37
+ this.displayedFiles = [];
38
+ this.isDropZoneHighlighted = false;
39
+ this.refreshCounter = 0;
40
+ this.description = undefined;
41
+ this.fileTypes = [];
42
+ this.label = undefined;
43
+ this.maxFiles = Infinity;
44
+ this.maxFileSize = Infinity;
45
+ this.status = [];
46
+ this.value = { invalidFiles: [], validFiles: [] };
47
+ this.variant = 'browse';
48
+ }
49
+ // #endregion
50
+ // #region Watchers
51
+ updateFileList(newValue) {
52
+ newValue.forEach(statusItem => {
53
+ const matchingQueuedFileIndex = this.queuedFiles.findIndex(file => file.name === statusItem.name);
54
+ if (matchingQueuedFileIndex > -1) {
55
+ const matchingFile = this.queuedFiles.splice(matchingQueuedFileIndex, 1)[0];
56
+ this.displayedFiles = [{ file: matchingFile, status: statusItem.status }, ...this.displayedFiles];
57
+ }
58
+ else {
59
+ const matchingDisplayedFileIndex = this.displayedFiles.findIndex(file => file.file.name === statusItem.name);
60
+ if (matchingDisplayedFileIndex > -1) {
61
+ this.displayedFiles[matchingDisplayedFileIndex].status = statusItem.status;
62
+ this.disableLoaderIfAllFilesUploaded();
63
+ }
64
+ }
65
+ });
66
+ }
67
+ // #endregion
68
+ // #region Local Methods
69
+ get dropZoneClasses() {
70
+ const classes = ['drop-zone'];
71
+ if (this.isDropZoneHighlighted) {
72
+ classes.push('drop-zone-highlighted');
73
+ }
74
+ return classes.join(' ');
75
+ }
76
+ get fileTypesArray() {
77
+ return Array.isArray(this.fileTypes) ? this.fileTypes : this.fileTypes.split(',');
78
+ }
79
+ get hasDescription() {
80
+ return !!this.description || this.hasDescriptionSlotContent;
81
+ }
82
+ get hasDescriptionSlotContent() {
83
+ return hasSlotContent(this.el, 'description');
84
+ }
85
+ get hasLabel() {
86
+ return !!this.label || this.hasLabelSlotContent;
87
+ }
88
+ get hasLabelSlotContent() {
89
+ return hasSlotContent(this.el, 'label');
90
+ }
91
+ buildFilesObject(filesToUpload) {
92
+ const invalidFiles = [];
93
+ invalidFiles.push(...this.extractFilesOfInvalidTypes(filesToUpload));
94
+ invalidFiles.push(...this.extractFilesOverSizeLimit(filesToUpload));
95
+ invalidFiles.push(...this.extractFilesOverMaxFilesLimit(filesToUpload));
96
+ this.displayedFiles = [...invalidFiles];
97
+ if (filesToUpload.length === 0) {
98
+ this.areFilesUploading = false;
99
+ }
100
+ else {
101
+ this.queuedFiles = filesToUpload;
102
+ }
103
+ return { invalidFiles, validFiles: filesToUpload };
104
+ }
105
+ disableEvent(event) {
106
+ event.preventDefault();
107
+ event.stopPropagation();
108
+ }
109
+ disableLoaderIfAllFilesUploaded() {
110
+ if (this.queuedFiles.length === 0 && !this.displayedFiles.some(file => file.status === 'in-progress')) {
111
+ this.areFilesUploading = false;
112
+ }
113
+ }
114
+ emitChange(filesObject) {
115
+ this.areFilesUploading = filesObject.validFiles.length > 0;
116
+ this.tctChange.emit(filesObject);
117
+ }
118
+ extractFilesOfInvalidTypes(files) {
119
+ const invalidFiles = [];
120
+ if (this.fileTypesArray.length === 0)
121
+ return invalidFiles;
122
+ files.forEach(file => {
123
+ const fileExtension = file.name.split('.').pop().toLowerCase();
124
+ if (!this.fileTypesArray.includes(fileExtension)) {
125
+ invalidFiles.push({ file, status: 'invalid-type' });
126
+ }
127
+ });
128
+ // Remove invalid files from the files array
129
+ invalidFiles.forEach(invalidFile => {
130
+ const index = files.indexOf(invalidFile.file);
131
+ if (index > -1) {
132
+ files.splice(index, 1);
133
+ }
134
+ });
135
+ return invalidFiles;
136
+ }
137
+ extractFilesOverMaxFilesLimit(files) {
138
+ const filesOverMaxFilesLimit = [];
139
+ if (this.maxFiles === Infinity)
140
+ return filesOverMaxFilesLimit;
141
+ if (files.length > this.maxFiles) {
142
+ const excessFiles = files.splice(this.maxFiles);
143
+ excessFiles.forEach(file => {
144
+ filesOverMaxFilesLimit.push({ file, status: 'over-max-files-limit' });
145
+ });
146
+ }
147
+ return filesOverMaxFilesLimit;
148
+ }
149
+ extractFilesOverSizeLimit(files) {
150
+ const filesOverSizeLimit = [];
151
+ if (this.maxFileSize === Infinity)
152
+ return filesOverSizeLimit;
153
+ files.forEach(file => {
154
+ if (file.size > this.maxFileSize) {
155
+ filesOverSizeLimit.push({ file, status: 'over-size-limit' });
156
+ }
157
+ });
158
+ // Remove files over size limit from the files array
159
+ filesOverSizeLimit.forEach(overSizeFile => {
160
+ const index = files.indexOf(overSizeFile.file);
161
+ if (index > -1) {
162
+ files.splice(index, 1);
163
+ }
164
+ });
165
+ return filesOverSizeLimit;
166
+ }
167
+ forceRerender() {
168
+ this.refreshCounter += 1; // Triggers re-render
169
+ }
170
+ getAnimationendHandlerToRemoveFileItem(fileName) {
171
+ return (e) => {
172
+ if (e.animationName === 'shrinkToCenterFadeOut') {
173
+ this.displayedFiles = this.displayedFiles.filter(file => file.file.name !== fileName);
174
+ }
175
+ };
176
+ }
177
+ getClickHandlerToRemoveFileItem(fileName) {
178
+ return () => {
179
+ const fileToDelete = this.displayedFiles.find(file => file.file.name === fileName);
180
+ if (fileToDelete) {
181
+ fileToDelete.toBeRemoved = true;
182
+ this.forceRerender();
183
+ }
184
+ };
185
+ }
186
+ getFileItemClasses(fileName) {
187
+ const classes = ['file-item'];
188
+ const matchingFile = this.displayedFiles.find(file => file.file.name === fileName);
189
+ if (matchingFile === null || matchingFile === void 0 ? void 0 : matchingFile.toBeRemoved) {
190
+ classes.push('fade-out');
191
+ }
192
+ else {
193
+ classes.push('fade-in');
194
+ }
195
+ return classes.join(' ');
196
+ }
197
+ getFileItemStatusMessage(status, size) {
198
+ switch (status) {
199
+ case 'invalid-type':
200
+ return loc('tecton.element.filePicker.unsupportedFileType');
201
+ case 'over-size-limit':
202
+ return loc('tecton.element.filePicker.sizeExceedsLimit');
203
+ case 'over-max-files-limit':
204
+ return loc('tecton.element.filePicker.overMaxFilesLimit');
205
+ case 'in-progress':
206
+ return loc('tecton.element.filePicker.uploadingEllipsis');
207
+ case 'failed':
208
+ return loc('tecton.element.filePicker.uploadFailed');
209
+ case 'uploaded':
210
+ default:
211
+ return loc('tecton.element.filePicker.fileSize', [(size / (1000 * 1000)).toFixed(2)]);
212
+ }
213
+ }
214
+ launchFileBrowser() {
215
+ this.browseButtonInput.dispatchEvent(new MouseEvent('click'));
216
+ }
217
+ static get is() { return "q2-file-picker"; }
218
+ static get encapsulation() { return "shadow"; }
219
+ static get originalStyleUrls() {
220
+ return {
221
+ "$": ["q2-file-picker.scss"]
222
+ };
223
+ }
224
+ static get styleUrls() {
225
+ return {
226
+ "$": ["q2-file-picker.css"]
227
+ };
228
+ }
229
+ static get properties() {
230
+ return {
231
+ "description": {
232
+ "type": "string",
233
+ "mutable": false,
234
+ "complexType": {
235
+ "original": "string",
236
+ "resolved": "string",
237
+ "references": {}
238
+ },
239
+ "required": false,
240
+ "optional": false,
241
+ "docs": {
242
+ "tags": [{
243
+ "name": "localizable",
244
+ "text": undefined
245
+ }],
246
+ "text": "A description of the field. This is announced by screen readers when the field is focused."
247
+ },
248
+ "attribute": "description",
249
+ "reflect": true
250
+ },
251
+ "fileTypes": {
252
+ "type": "string",
253
+ "mutable": false,
254
+ "complexType": {
255
+ "original": "string[] | string",
256
+ "resolved": "string | string[]",
257
+ "references": {}
258
+ },
259
+ "required": false,
260
+ "optional": false,
261
+ "docs": {
262
+ "tags": [],
263
+ "text": "An array of strings representing the allowed file types based on file extension.\nExample: ['jpg', 'png', 'pdf']"
264
+ },
265
+ "attribute": "file-types",
266
+ "reflect": true,
267
+ "defaultValue": "[]"
268
+ },
269
+ "label": {
270
+ "type": "string",
271
+ "mutable": false,
272
+ "complexType": {
273
+ "original": "string",
274
+ "resolved": "string",
275
+ "references": {}
276
+ },
277
+ "required": false,
278
+ "optional": false,
279
+ "docs": {
280
+ "tags": [{
281
+ "name": "localizable",
282
+ "text": undefined
283
+ }],
284
+ "text": "The label for the field. This is announced by screen readers when the field is focused."
285
+ },
286
+ "attribute": "label",
287
+ "reflect": true
288
+ },
289
+ "maxFiles": {
290
+ "type": "number",
291
+ "mutable": false,
292
+ "complexType": {
293
+ "original": "number",
294
+ "resolved": "number",
295
+ "references": {}
296
+ },
297
+ "required": false,
298
+ "optional": false,
299
+ "docs": {
300
+ "tags": [],
301
+ "text": "The maximum number of files that can be selected."
302
+ },
303
+ "attribute": "max-files",
304
+ "reflect": true,
305
+ "defaultValue": "Infinity"
306
+ },
307
+ "maxFileSize": {
308
+ "type": "number",
309
+ "mutable": false,
310
+ "complexType": {
311
+ "original": "number",
312
+ "resolved": "number",
313
+ "references": {}
314
+ },
315
+ "required": false,
316
+ "optional": false,
317
+ "docs": {
318
+ "tags": [],
319
+ "text": "The maximum size (in bytes) of any file that can be selected."
320
+ },
321
+ "attribute": "max-file-size",
322
+ "reflect": true,
323
+ "defaultValue": "Infinity"
324
+ },
325
+ "status": {
326
+ "type": "unknown",
327
+ "mutable": false,
328
+ "complexType": {
329
+ "original": "{ name: string; status: 'in-progress' | 'failed' | 'uploaded' }[]",
330
+ "resolved": "{ name: string; status: \"in-progress\" | \"failed\" | \"uploaded\"; }[]",
331
+ "references": {}
332
+ },
333
+ "required": false,
334
+ "optional": false,
335
+ "docs": {
336
+ "tags": [],
337
+ "text": "An array of objects representing the status of the files being uploaded.\nEach object should have a `name` property (the file name) and a `status`\nproperty (the status of the file) that equals either 'in-progress',\n'failed' or 'uploaded'."
338
+ },
339
+ "defaultValue": "[]"
340
+ },
341
+ "value": {
342
+ "type": "unknown",
343
+ "mutable": true,
344
+ "complexType": {
345
+ "original": "FilesObject",
346
+ "resolved": "{ invalidFiles: { file: File; status: \"invalid-type\" | \"over-size-limit\" | \"over-max-files-limit\" | \"in-progress\" | \"failed\" | \"uploaded\"; }[]; validFiles: File[]; }",
347
+ "references": {
348
+ "FilesObject": {
349
+ "location": "local",
350
+ "path": "/builds/q2e/development/tecton/tecton/packages/q2-tecton-elements/src/components/q2-file-picker/q2-file-picker.tsx",
351
+ "id": "src/components/q2-file-picker/q2-file-picker.tsx::FilesObject"
352
+ }
353
+ }
354
+ },
355
+ "required": false,
356
+ "optional": false,
357
+ "docs": {
358
+ "tags": [{
359
+ "name": "readonly",
360
+ "text": undefined
361
+ }],
362
+ "text": "Returns an array of File objects representing the files selected by the\nuser. If no files are selected, the value is an empty array."
363
+ },
364
+ "defaultValue": "{ invalidFiles: [], validFiles: [] }"
365
+ },
366
+ "variant": {
367
+ "type": "string",
368
+ "mutable": false,
369
+ "complexType": {
370
+ "original": "'browse' | 'browse-drop'",
371
+ "resolved": "\"browse\" | \"browse-drop\"",
372
+ "references": {}
373
+ },
374
+ "required": false,
375
+ "optional": false,
376
+ "docs": {
377
+ "tags": [],
378
+ "text": "Determines if the file picker is a browse button or a drop zone with a\nbrowse link."
379
+ },
380
+ "attribute": "variant",
381
+ "reflect": true,
382
+ "defaultValue": "'browse'"
383
+ }
384
+ };
385
+ }
386
+ static get states() {
387
+ return {
388
+ "areFilesUploading": {},
389
+ "displayedFiles": {},
390
+ "isDropZoneHighlighted": {},
391
+ "refreshCounter": {}
392
+ };
393
+ }
394
+ static get events() {
395
+ return [{
396
+ "method": "tctChange",
397
+ "name": "tctChange",
398
+ "bubbles": true,
399
+ "cancelable": true,
400
+ "composed": true,
401
+ "docs": {
402
+ "tags": [],
403
+ "text": ""
404
+ },
405
+ "complexType": {
406
+ "original": "FilesObject",
407
+ "resolved": "{ invalidFiles: { file: File; status: \"invalid-type\" | \"over-size-limit\" | \"over-max-files-limit\" | \"in-progress\" | \"failed\" | \"uploaded\"; }[]; validFiles: File[]; }",
408
+ "references": {
409
+ "FilesObject": {
410
+ "location": "local",
411
+ "path": "/builds/q2e/development/tecton/tecton/packages/q2-tecton-elements/src/components/q2-file-picker/q2-file-picker.tsx",
412
+ "id": "src/components/q2-file-picker/q2-file-picker.tsx::FilesObject"
413
+ }
414
+ }
415
+ }
416
+ }];
417
+ }
418
+ static get elementRef() { return "el"; }
419
+ static get watchers() {
420
+ return [{
421
+ "propName": "status",
422
+ "methodName": "updateFileList"
423
+ }];
424
+ }
425
+ }
426
+ //# sourceMappingURL=q2-file-picker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"q2-file-picker.js","sourceRoot":"","sources":["../../../src/components/q2-file-picker/q2-file-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EAET,OAAO,EACP,KAAK,EAEL,QAAQ,EACR,CAAC,EACD,IAAI,EACJ,KA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4IJ","sourcesContent":["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"]}
@@ -0,0 +1,11 @@
1
+ import { evaluateA11y, setup } from "../../../utils/helpers";
2
+ describe('q2-legend', () => {
3
+ describe('[A11y] guideline compliance', () => {
4
+ it('Does not have accessibility violations', async () => {
5
+ const page = await setup({ html: `<q2-file-picker label="Label" description="Description" />` });
6
+ const hasViolations = await evaluateA11y(page);
7
+ expect(hasViolations).toBe(false);
8
+ });
9
+ });
10
+ });
11
+ //# sourceMappingURL=q2-file-picker-test.e2e.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"q2-file-picker-test.e2e.js","sourceRoot":"","sources":["../../../../src/components/q2-file-picker/test/q2-file-picker-test.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEtD,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACvB,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACzC,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;YACpD,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,EAAE,IAAI,EAAE,4DAA4D,EAAE,CAAC,CAAC;YACjG,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;YAE/C,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { evaluateA11y, setup } from '@/utils/helpers';\n\ndescribe('q2-legend', () => {\n describe('[A11y] guideline compliance', () => {\n it('Does not have accessibility violations', async () => {\n const page = await setup({ html: `<q2-file-picker label=\"Label\" description=\"Description\" />` });\n const hasViolations = await evaluateA11y(page);\n\n expect(hasViolations).toBe(false);\n });\n });\n});\n"]}