@uploadcare/file-uploader 1.15.0-alpha.3 → 1.15.0-alpha.5

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 (60) hide show
  1. package/abstract/ActivityBlock.d.ts.map +1 -1
  2. package/abstract/ActivityBlock.js +3 -0
  3. package/abstract/UploaderBlock.js +1 -1
  4. package/blocks/Config/Config.d.ts +1 -1
  5. package/blocks/Config/Config.d.ts.map +1 -1
  6. package/blocks/Config/initialConfig.js +3 -3
  7. package/blocks/Config/normalizeConfigValue.d.ts +2 -1
  8. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
  9. package/blocks/Config/normalizeConfigValue.js +18 -109
  10. package/blocks/Config/validatorsType.d.ts +37 -0
  11. package/blocks/Config/validatorsType.d.ts.map +1 -0
  12. package/blocks/Config/validatorsType.js +134 -0
  13. package/blocks/DropArea/DropArea.d.ts +1 -0
  14. package/blocks/DropArea/DropArea.d.ts.map +1 -1
  15. package/blocks/DropArea/DropArea.js +20 -2
  16. package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
  17. package/blocks/ExternalSource/ExternalSource.js +0 -1
  18. package/blocks/FileItem/FileItem.d.ts.map +1 -1
  19. package/blocks/FileItem/FileItem.js +12 -13
  20. package/blocks/FileItem/file-item.css +24 -0
  21. package/blocks/Modal/Modal.d.ts +0 -2
  22. package/blocks/Modal/Modal.d.ts.map +1 -1
  23. package/blocks/Modal/Modal.js +0 -2
  24. package/blocks/ProgressBar/progress-bar.css +1 -0
  25. package/blocks/SimpleBtn/SimpleBtn.js +1 -1
  26. package/blocks/Thumb/Thumb.d.ts +24 -0
  27. package/blocks/Thumb/Thumb.d.ts.map +1 -0
  28. package/blocks/Thumb/Thumb.js +45 -0
  29. package/blocks/Thumb/thumb.css +4 -0
  30. package/blocks/UploadList/UploadList.d.ts +2 -0
  31. package/blocks/UploadList/UploadList.d.ts.map +1 -1
  32. package/blocks/UploadList/UploadList.js +3 -1
  33. package/blocks/themes/uc-basic/common.css +1 -1
  34. package/blocks/themes/uc-basic/index.css +1 -0
  35. package/index.d.ts +1 -0
  36. package/index.js +1 -0
  37. package/index.ssr.d.ts +51 -0
  38. package/index.ssr.d.ts.map +1 -1
  39. package/index.ssr.js +72 -12
  40. package/package.json +1 -1
  41. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +3 -1
  42. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
  43. package/solutions/file-uploader/minimal/FileUploaderMinimal.js +63 -13
  44. package/solutions/file-uploader/minimal/index.css +15 -14
  45. package/solutions/file-uploader/minimal/index.d.ts +1 -16
  46. package/solutions/file-uploader/minimal/index.js +1 -18
  47. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +1 -3
  48. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
  49. package/solutions/file-uploader/regular/FileUploaderRegular.js +1 -15
  50. package/types/exported.d.ts +4 -3
  51. package/web/file-uploader.iife.min.js +4 -4
  52. package/web/file-uploader.min.js +4 -4
  53. package/web/uc-basic.min.css +1 -1
  54. package/web/uc-cloud-image-editor.min.js +4 -4
  55. package/web/uc-file-uploader-inline.min.css +1 -1
  56. package/web/uc-file-uploader-inline.min.js +4 -4
  57. package/web/uc-file-uploader-minimal.min.css +1 -1
  58. package/web/uc-file-uploader-minimal.min.js +4 -4
  59. package/web/uc-file-uploader-regular.min.css +1 -1
  60. package/web/uc-file-uploader-regular.min.js +4 -4
@@ -0,0 +1,45 @@
1
+ //@ts-check
2
+
3
+ import { UploaderBlock } from '../../abstract/UploaderBlock.js';
4
+
5
+ export class Thumb extends UploaderBlock {
6
+ constructor() {
7
+ super();
8
+
9
+ this.init$ = {
10
+ ...this.init$,
11
+ thumbUrl: '',
12
+ badgeIcon: '',
13
+ };
14
+ }
15
+
16
+ initCallback() {
17
+ super.initCallback();
18
+
19
+ this.defineAccessor('thumbUrl', (/** @type {string} */ val) => (this.$.thumbUrl = val));
20
+ this.defineAccessor('badgeIcon', (/** @type {string} */ val) => (this.$.badgeIcon = val));
21
+
22
+ this.setAttribute('role', 'img');
23
+ }
24
+
25
+ connectedCallback() {
26
+ super.connectedCallback();
27
+ }
28
+ }
29
+
30
+ Thumb.template = /* html */ `
31
+ <slot>
32
+ <div class="uc-thumb" set="style.backgroundImage: thumbUrl">
33
+ <div class="uc-badge">
34
+ <uc-icon set="@name: badgeIcon"></uc-icon>
35
+ </div>
36
+ </div>
37
+ </slot>
38
+ `;
39
+
40
+ Thumb.bindAttributes({
41
+ // @ts-expect-error TODO: fix types inside symbiote
42
+ thumbUrl: null,
43
+ // @ts-expect-error TODO: fix types inside symbiote
44
+ badgeIcon: null,
45
+ });
@@ -0,0 +1,4 @@
1
+ uc-thumb {
2
+ width: 100%;
3
+ height: 100%;
4
+ }
@@ -1,3 +1,4 @@
1
+ /** @typedef {'grid' | 'list'} FilesViewMode */
1
2
  /**
2
3
  * @typedef {{
3
4
  * total: number;
@@ -48,6 +49,7 @@ export class UploadList extends UploaderBlock {
48
49
  export namespace UploadList {
49
50
  let template: string;
50
51
  }
52
+ export type FilesViewMode = 'grid' | 'list';
51
53
  export type Summary = {
52
54
  total: number;
53
55
  succeed: number;
@@ -1 +1 @@
1
- {"version":3,"file":"UploadList.d.ts","sourceRoot":"","sources":["UploadList.js"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AAEH;IAKE,4BAAoD;IAKlD;;;;;;;;;;;;;;;;;;;;;;;;;;MA0BC;IAGH,eAAe;IACf,yCASQ;IAER,eAAe;IACf,4BAuCC;IAED;;;OAGG;IACH,uBAmBC;CAwEF;;;;sBApMY;IACZ,KAAS,EAAE,MAAM,CAAC;IAClB,OAAW,EAAE,MAAM,CAAC;IACpB,SAAa,EAAE,MAAM,CAAC;IACtB,MAAU,EAAE,MAAM,CAAC;CAChB;8BAV0B,iCAAiC"}
1
+ {"version":3,"file":"UploadList.d.ts","sourceRoot":"","sources":["UploadList.js"],"names":[],"mappings":"AAMA,+CAA+C;AAE/C;;;;;;;GAOG;AAEH;IAKE,4BAAoD;IAKlD;;;;;;;;;;;;;;;;;;;;;;;;;;MA0BC;IAGH,eAAe;IACf,yCASQ;IAER,eAAe;IACf,4BAuCC;IAED;;;OAGG;IACH,uBAmBC;CAwEF;;;;4BAvMa,MAAM,GAAG,MAAM;sBAGhB;IACZ,KAAS,EAAE,MAAM,CAAC;IAClB,OAAW,EAAE,MAAM,CAAC;IACpB,SAAa,EAAE,MAAM,CAAC;IACtB,MAAU,EAAE,MAAM,CAAC;CAChB;8BAZ0B,iCAAiC"}
@@ -4,6 +4,8 @@ import { UploaderBlock } from '../../abstract/UploaderBlock.js';
4
4
  import { EventType } from '../UploadCtxProvider/EventEmitter.js';
5
5
  import { throttle } from '../utils/throttle.js';
6
6
 
7
+ /** @typedef {'grid' | 'list'} FilesViewMode */
8
+
7
9
  /**
8
10
  * @typedef {{
9
11
  * total: number;
@@ -149,7 +151,7 @@ export class UploadList extends UploaderBlock {
149
151
  }
150
152
  });
151
153
 
152
- this.subConfigValue('displayUploadList', (mode) => {
154
+ this.subConfigValue('filesViewMode', (mode) => {
153
155
  this.setAttribute('mode', mode);
154
156
  });
155
157
 
@@ -13,7 +13,7 @@
13
13
  display: none !important;
14
14
  }
15
15
 
16
- :where([uc-wgt-common]) [activity]:not([active]) {
16
+ :where([uc-wgt-common]) [activity]:not([active], .active) {
17
17
  display: none;
18
18
  }
19
19
 
@@ -31,6 +31,7 @@
31
31
  @import url('../../CloudImageEditorActivity/index.css');
32
32
  @import url('../../Select/select.css');
33
33
  @import url('../../Spinner/spinner.css');
34
+ @import url('../../Thumb/thumb.css');
34
35
 
35
36
  /* POST RESET */
36
37
  @import url('post-reset.css');
package/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export { ActivityHeader } from "./blocks/ActivityHeader/ActivityHeader.js";
28
28
  export { Select } from "./blocks/Select/Select.js";
29
29
  export { Copyright } from "./blocks/Copyright/Copyright.js";
30
30
  export { Spinner } from "./blocks/Spinner/Spinner.js";
31
+ export { Thumb } from "./blocks/Thumb/Thumb.js";
31
32
  export { FileUploaderRegular } from "./solutions/file-uploader/regular/FileUploaderRegular.js";
32
33
  export { FileUploaderMinimal } from "./solutions/file-uploader/minimal/FileUploaderMinimal.js";
33
34
  export { FileUploaderInline } from "./solutions/file-uploader/inline/FileUploaderInline.js";
package/index.js CHANGED
@@ -33,6 +33,7 @@ export { ActivityHeader } from './blocks/ActivityHeader/ActivityHeader.js';
33
33
  export { Select } from './blocks/Select/Select.js';
34
34
  export { Copyright } from './blocks/Copyright/Copyright.js';
35
35
  export { Spinner } from './blocks/Spinner/Spinner.js';
36
+ export { Thumb } from './blocks/Thumb/Thumb.js';
36
37
 
37
38
  // Solutions:
38
39
  export { FileUploaderRegular } from './solutions/file-uploader/regular/FileUploaderRegular.js';
package/index.ssr.d.ts CHANGED
@@ -765,6 +765,57 @@ export const StartFrom: {
765
765
  is: string;
766
766
  bindAttributes: () => void;
767
767
  };
768
+ export const Thumb: {
769
+ new (): {};
770
+ template: string;
771
+ observedAttributes: string[];
772
+ extSrcList: {
773
+ FACEBOOK: string;
774
+ DROPBOX: string;
775
+ GDRIVE: string;
776
+ GPHOTOS: string;
777
+ FLICKR: string;
778
+ VK: string;
779
+ EVERNOTE: string;
780
+ BOX: string;
781
+ ONEDRIVE: string;
782
+ HUDDLE: string;
783
+ };
784
+ sourceTypes: {
785
+ LOCAL: string;
786
+ DROP_AREA: string;
787
+ CAMERA: string;
788
+ EXTERNAL: string;
789
+ API: string;
790
+ URL: string;
791
+ DRAW: string;
792
+ MOBILE_VIDEO_CAMERA: string;
793
+ MOBILE_PHOTO_CAMERA: string;
794
+ FACEBOOK: string;
795
+ DROPBOX: string;
796
+ GDRIVE: string;
797
+ GPHOTOS: string;
798
+ FLICKR: string;
799
+ VK: string;
800
+ EVERNOTE: string;
801
+ BOX: string;
802
+ ONEDRIVE: string;
803
+ HUDDLE: string;
804
+ };
805
+ activities: {
806
+ START_FROM: string;
807
+ CAMERA: string;
808
+ DRAW: string;
809
+ UPLOAD_LIST: string;
810
+ URL: string;
811
+ CLOUD_IMG_EDIT: string;
812
+ EXTERNAL: string;
813
+ };
814
+ reg: () => void;
815
+ styleAttrs: any[];
816
+ is: string;
817
+ bindAttributes: () => void;
818
+ };
768
819
  export const UID: {
769
820
  new (): {};
770
821
  generate: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.ssr.d.ts","sourceRoot":"","sources":["index.ssr.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAcE;AACF;;;;;;;;;;;;;;;EAcE;AACF;;;;;EAIE;AACF;;;;;;EAKE;AACF;;;;;;;;EAgBE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4IE;AACF;;;;;;;;EAuCE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CE;AACF;;;;;;;;EAuCE;AACF;;;;;;;EA4GE;AACF;;;;;;;EAaE;AACF;;;;;;;EAME;AACF;;;;;;;;;;;;;;;;EAeE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEE;AACF;;;;;;;EAWE;AACF;;;;;;;EAWE;AACF;;;;;;;EASE;AACF;;;;;;EAKE;AACF;;;;;;;EAWE;AACF;;;;;;;EAME;AACF;;;;;;;EAWE;AACF;;;;;;;EA2IE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0EE;;;;;;;;;;;;;AAaF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoFE;AACF;;;;;;EAKE;AACF;;;;;;EAKE;AACF;;;;;;;EAME;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CE;AACF;;;;;;;;EAWE;AACF;;;;;;EAwBE;AACF;;;;;;;EAUE;AACF;;;;;;;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EAuGE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EE;AACK,yCAAiC;AACjC,qCAA6B;AAC7B,6CAAqC;AACrC,oCAA4B"}
package/index.ssr.js CHANGED
@@ -377,9 +377,9 @@ export const Config = class {
377
377
  "enable-audio-recording",
378
378
  "enable-video-recording",
379
379
  "max-video-recording-duration",
380
- "display-upload-list",
381
- "enable-file-name",
382
- "use-preview-image",
380
+ "files-view-mode",
381
+ "grid-show-file-names",
382
+ "cloud-image-editor-auto-open",
383
383
  "multiplemin",
384
384
  "multiplemax",
385
385
  "confirmupload",
@@ -425,9 +425,9 @@ export const Config = class {
425
425
  "enableaudiorecording",
426
426
  "enablevideorecording",
427
427
  "maxvideorecordingduration",
428
- "displayuploadlist",
429
- "enablefilename",
430
- "usepreviewimage",
428
+ "filesviewmode",
429
+ "gridshowfilenames",
430
+ "cloudimageeditorautoopen",
431
431
  ];
432
432
  static reg = () => {};
433
433
  static styleAttrs = [];
@@ -491,6 +491,7 @@ export const DropArea = class {
491
491
  "text",
492
492
  "fullscreen",
493
493
  "disabled",
494
+ "initflow",
494
495
  ];
495
496
  static extSrcList = {
496
497
  FACEBOOK: "facebook",
@@ -839,11 +840,8 @@ export const ExternalUploadSource = {
839
840
  export const FileItem = class {
840
841
  static template = `
841
842
  <div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused">
842
- <div class="uc-thumb" set="style.backgroundImage: thumbUrl">
843
- <div class="uc-badge">
844
- <uc-icon set="@name: badgeIcon"></uc-icon>
845
- </div>
846
- </div>
843
+ <uc-thumb set="thumbUrl:thumbUrl;badgeIcon:badgeIcon"></uc-thumb>
844
+
847
845
  <div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;">
848
846
  <span class="uc-file-name" set="@hidden: isFileName">{{itemName}}</span>
849
847
  <span class="uc-file-error" set="@hidden: !errorText;">{{errorText}}</span>
@@ -870,7 +868,11 @@ export const FileItem = class {
870
868
  <uc-icon name="upload"></uc-icon>
871
869
  </button>
872
870
  </div>
873
- <uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible;"> </uc-progress-bar>
871
+ <uc-progress-bar
872
+ class="uc-progress-bar"
873
+ set="value: progressValue; visible: progressVisible; @hasFileName: !isFileName"
874
+ >
875
+ </uc-progress-bar>
874
876
  </div>
875
877
  `;
876
878
  static activeInstances = {};
@@ -1287,6 +1289,64 @@ export const StartFrom = class {
1287
1289
  static is = `sym-1`;
1288
1290
  static bindAttributes = () => {};
1289
1291
  };
1292
+ export const Thumb = class {
1293
+ static template = `
1294
+ <slot>
1295
+ <div class="uc-thumb" set="style.backgroundImage: thumbUrl">
1296
+ <div class="uc-badge">
1297
+ <uc-icon set="@name: badgeIcon"></uc-icon>
1298
+ </div>
1299
+ </div>
1300
+ </slot>
1301
+ `;
1302
+ static observedAttributes = ["thumbUrl", "badgeIcon"];
1303
+ static extSrcList = {
1304
+ FACEBOOK: "facebook",
1305
+ DROPBOX: "dropbox",
1306
+ GDRIVE: "gdrive",
1307
+ GPHOTOS: "gphotos",
1308
+ FLICKR: "flickr",
1309
+ VK: "vk",
1310
+ EVERNOTE: "evernote",
1311
+ BOX: "box",
1312
+ ONEDRIVE: "onedrive",
1313
+ HUDDLE: "huddle",
1314
+ };
1315
+ static sourceTypes = {
1316
+ LOCAL: "local",
1317
+ DROP_AREA: "drop-area",
1318
+ CAMERA: "camera",
1319
+ EXTERNAL: "external",
1320
+ API: "js-api",
1321
+ URL: "url",
1322
+ DRAW: "draw",
1323
+ MOBILE_VIDEO_CAMERA: "mobile-video-camera",
1324
+ MOBILE_PHOTO_CAMERA: "mobile-photo-camera",
1325
+ FACEBOOK: "facebook",
1326
+ DROPBOX: "dropbox",
1327
+ GDRIVE: "gdrive",
1328
+ GPHOTOS: "gphotos",
1329
+ FLICKR: "flickr",
1330
+ VK: "vk",
1331
+ EVERNOTE: "evernote",
1332
+ BOX: "box",
1333
+ ONEDRIVE: "onedrive",
1334
+ HUDDLE: "huddle",
1335
+ };
1336
+ static activities = {
1337
+ START_FROM: "start-from",
1338
+ CAMERA: "camera",
1339
+ DRAW: "draw",
1340
+ UPLOAD_LIST: "upload-list",
1341
+ URL: "url",
1342
+ CLOUD_IMG_EDIT: "cloud-image-edit",
1343
+ EXTERNAL: "external",
1344
+ };
1345
+ static reg = () => {};
1346
+ static styleAttrs = [];
1347
+ static is = `sym-1`;
1348
+ static bindAttributes = () => {};
1349
+ };
1290
1350
  export const UID = class {
1291
1351
  static generate = () => {};
1292
1352
  static apply = () => {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uploadcare/file-uploader",
3
- "version": "1.15.0-alpha.3",
3
+ "version": "1.15.0-alpha.5",
4
4
  "description": "Building blocks for Uploadcare products integration",
5
5
  "keywords": [
6
6
  "web components",
@@ -1,11 +1,13 @@
1
1
  export class FileUploaderMinimal extends SolutionBlock {
2
2
  init$: {
3
3
  singleUpload: boolean;
4
+ isHiddenStartFrom: boolean;
5
+ classUploadList: string;
4
6
  '*commonProgress': number;
5
7
  '*uploadList': never[];
6
8
  '*uploadQueue': import("@uploadcare/upload-client").Queue;
7
9
  '*collectionErrors': any[];
8
- '*collectionState': import("../inline/index.js").OutputCollectionState<import("../inline/index.js").OutputCollectionStatus, "maybe-has-group"> | null;
10
+ '*collectionState': import("./index.js").OutputCollectionState<import("./index.js").OutputCollectionStatus, "maybe-has-group"> | null;
9
11
  '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
10
12
  '*uploadTrigger': Set<string>;
11
13
  '*secureUploadsManager': import("../../../abstract/SecureUploadsManager.js").SecureUploadsManager | null;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAIA;IAMI;;;;;;;;;;;;;;;MAGC;CAsDJ;;;;8BAlE6B,oCAAoC"}
1
+ {"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAKA;IAMI;;;;;;;;;;;;;;;;;MAKC;CAiFJ;;;;8BA/F6B,oCAAoC"}
@@ -1,3 +1,4 @@
1
+ //@ts-check
1
2
  import { ActivityBlock } from '../../../abstract/ActivityBlock.js';
2
3
  import { SolutionBlock } from '../../../abstract/SolutionBlock.js';
3
4
  import { ModalEvents } from '../../../abstract/ModalManager.js';
@@ -11,6 +12,8 @@ export class FileUploaderMinimal extends SolutionBlock {
11
12
  this.init$ = {
12
13
  ...this.init$,
13
14
  singleUpload: false,
15
+ isHiddenStartFrom: false,
16
+ classUploadList: '',
14
17
  };
15
18
  }
16
19
 
@@ -20,6 +23,10 @@ export class FileUploaderMinimal extends SolutionBlock {
20
23
  /** @type {import('../../../abstract/UploaderBlock.js').UploaderBlock} */
21
24
  const uBlock = this.ref.uBlock;
22
25
  this.sub('*currentActivity', (val) => {
26
+ if (val === ActivityBlock.activities.UPLOAD_LIST) {
27
+ this.modalManager.closeAll();
28
+ }
29
+
23
30
  if (!val) {
24
31
  this.$['*currentActivity'] = uBlock.initActivity || ActivityBlock.activities.START_FROM;
25
32
  }
@@ -29,23 +36,20 @@ export class FileUploaderMinimal extends SolutionBlock {
29
36
  if (list?.length > 0) {
30
37
  this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
31
38
  } else {
39
+ this.set$({
40
+ classUploadList: '',
41
+ });
32
42
  this.$['*currentActivity'] = uBlock.initActivity || ActivityBlock.activities.START_FROM;
33
43
  }
34
44
  });
35
45
 
36
- this.subConfigValue('sourceList', (sourceList) => {
37
- if (sourceList !== 'local') {
38
- this.cfg.sourceList = 'local';
39
- }
40
- });
41
-
42
46
  this.subConfigValue('confirmUpload', (confirmUpload) => {
43
47
  if (confirmUpload !== false) {
44
48
  this.cfg.confirmUpload = false;
45
49
  }
46
50
  });
47
51
 
48
- this.subConfigValue('displayUploadList', (mode) => {
52
+ this.subConfigValue('filesViewMode', (mode) => {
49
53
  this.setAttribute('mode', mode);
50
54
  });
51
55
 
@@ -59,20 +63,66 @@ export class FileUploaderMinimal extends SolutionBlock {
59
63
  this.$.singleUpload = !multiple;
60
64
  });
61
65
 
62
- this.modalManager.subscribe(ModalEvents.CLOSE, (e) => {
63
- if (e.id === ActivityBlock.activities.CLOUD_IMG_EDIT) {
64
- this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
66
+ this.modalManager.subscribe(ModalEvents.OPEN, () => {
67
+ if (this.$['*currentActivity'] === ActivityBlock.activities.UPLOAD_LIST) {
68
+ this.set$({
69
+ classUploadList: 'active',
70
+ isHiddenStartFrom: true,
71
+ });
65
72
  }
66
73
  });
74
+
75
+ this.modalManager.subscribe(
76
+ ModalEvents.CLOSE,
77
+ (
78
+ /**
79
+ * @type {{
80
+ * id: import('../../../abstract/ModalManager.js').ModalId;
81
+ * modal: import('../../../abstract/ModalManager.js').ModalNode;
82
+ * }}
83
+ */ e,
84
+ ) => {
85
+ if (e.id === this.$['*currentActivity']) {
86
+ this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
87
+ this.set$({
88
+ isHiddenStartFrom: false,
89
+ });
90
+ }
91
+
92
+ if (e.id === ActivityBlock.activities.CLOUD_IMG_EDIT) {
93
+ this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
94
+ }
95
+ },
96
+ );
67
97
  }
68
98
  }
69
99
 
70
100
  FileUploaderMinimal.template = /* HTML */ `
71
- <uc-start-from>
72
- <uc-drop-area set="@single:singleUpload" tabindex="0" clickable l10n="choose-file"></uc-drop-area>
101
+ <uc-start-from set="@hidden: isHiddenStartFrom">
102
+ <uc-drop-area set="@single:singleUpload;" initflow clickable tabindex="0" l10n="choose-file"></uc-drop-area>
73
103
  <uc-copyright></uc-copyright>
74
104
  </uc-start-from>
75
- <uc-upload-list ref="uBlock"></uc-upload-list>
105
+ <uc-upload-list set="@class:classUploadList" ref="uBlock"></uc-upload-list>
106
+
107
+ <uc-modal id="start-from" strokes block-body-scrolling>
108
+ <uc-start-from>
109
+ <uc-drop-area with-icon clickable></uc-drop-area>
110
+ <uc-source-list role="list" wrap></uc-source-list>
111
+ <button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button>
112
+ </uc-start-from>
113
+ </uc-modal>
114
+
115
+ <uc-modal id="camera" strokes block-body-scrolling>
116
+ <uc-camera-source></uc-camera-source>
117
+ </uc-modal>
118
+
119
+ <uc-modal id="url" strokes block-body-scrolling>
120
+ <uc-url-source></uc-url-source>
121
+ </uc-modal>
122
+
123
+ <uc-modal id="external" strokes block-body-scrolling>
124
+ <uc-external-source></uc-external-source>
125
+ </uc-modal>
76
126
 
77
127
  <uc-modal id="cloud-image-edit" strokes block-body-scrolling>
78
128
  <uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>
@@ -1,13 +1,18 @@
1
- @import url('../../../blocks/themes/uc-basic/config.css');
1
+ @import url('../../../blocks/themes/uc-basic/index.css');
2
+
3
+ /* @import url('../../../blocks/themes/uc-basic/config.css'); */
2
4
 
3
5
  /* COMMON STYLES */
4
- @import url('../../../blocks/themes/uc-basic/common.css');
6
+
7
+ /* @import url('../../../blocks/themes/uc-basic/common.css'); */
5
8
 
6
9
  /* THEME */
7
- @import url('../../../blocks/themes/uc-basic/theme.css');
10
+
11
+ /* @import url('../../../blocks/themes/uc-basic/theme.css'); */
8
12
 
9
13
  /* BLOCKS: */
10
- @import url('../../../blocks/StartFrom/start-from.css');
14
+
15
+ /* @import url('../../../blocks/StartFrom/start-from.css');
11
16
  @import url('../../../blocks/DropArea/drop-area.css');
12
17
  @import url('../../../blocks/UploadList/upload-list.css');
13
18
  @import url('../../../blocks/FileItem/file-item.css');
@@ -16,7 +21,7 @@
16
21
  @import url('../../../blocks/Copyright/copyright.css');
17
22
  @import url('../../../blocks/Modal/modal.css');
18
23
  @import url('../../../blocks/CloudImageEditor/index.css');
19
- @import url('../../../blocks/CloudImageEditorActivity/index.css');
24
+ @import url('../../../blocks/CloudImageEditorActivity/index.css'); */
20
25
 
21
26
  /* ICONS: */
22
27
  :where([uc-file-uploader-minimal]) {
@@ -27,7 +32,7 @@
27
32
  display: block;
28
33
  }
29
34
 
30
- [uc-file-uploader-minimal] uc-start-from .uc-content {
35
+ [uc-file-uploader-minimal] > uc-start-from .uc-content {
31
36
  display: flex;
32
37
  flex-direction: column;
33
38
  gap: 4px;
@@ -37,7 +42,7 @@
37
42
  background-color: transparent;
38
43
  }
39
44
 
40
- :where([uc-file-uploader-minimal] uc-drop-area) {
45
+ :where([uc-file-uploader-minimal] > uc-start-from uc-drop-area) {
41
46
  display: flex;
42
47
  position: relative;
43
48
  align-items: center;
@@ -50,12 +55,12 @@
50
55
  border-radius: calc(var(--uc-radius) * 1.75);
51
56
  }
52
57
 
53
- :where(.uc-contrast) :where([uc-file-uploader-minimal] uc-drop-area) {
58
+ :where(.uc-contrast) :where([uc-file-uploader-minimal] > uc-start-from uc-drop-area) {
54
59
  background-color: transparent;
55
60
  }
56
61
 
57
62
  /* hack to make transparent :hover colors work in any conditions */
58
- :where([uc-file-uploader-minimal] uc-drop-area)::before {
63
+ :where([uc-file-uploader-minimal] > uc-start-from uc-drop-area)::before {
59
64
  content: '';
60
65
  z-index: -1;
61
66
  width: 100%;
@@ -64,7 +69,7 @@
64
69
  background-color: var(--uc-background);
65
70
  }
66
71
 
67
- :where([uc-file-uploader-minimal]:has([single]) uc-drop-area) {
72
+ :where([uc-file-uploader-minimal]:has([single]) > uc-start-from uc-drop-area) {
68
73
  aspect-ratio: var(--uc-grid-aspect-ratio);
69
74
  }
70
75
 
@@ -118,10 +123,6 @@
118
123
  display: flex;
119
124
  }
120
125
 
121
- [uc-file-uploader-minimal] uc-file-item .uc-edit-btn {
122
- /* display: none; */
123
- }
124
-
125
126
  [uc-file-uploader-minimal] uc-file-item uc-progress-bar {
126
127
  top: 0 !important;
127
128
  height: 100% !important;
@@ -1,17 +1,2 @@
1
- export { defineComponents } from "../../../abstract/defineComponents.js";
2
- export { defineLocale } from "../../../abstract/localeRegistry.js";
3
- export { FileUploaderMinimal } from "./FileUploaderMinimal.js";
4
- export { StartFrom } from "../../../blocks/StartFrom/StartFrom.js";
5
- export { DropArea } from "../../../blocks/DropArea/DropArea.js";
6
- export { UploadList } from "../../../blocks/UploadList/UploadList.js";
7
- export { FileItem } from "../../../blocks/FileItem/FileItem.js";
8
- export { Icon } from "../../../blocks/Icon/Icon.js";
9
- export { ProgressBar } from "../../../blocks/ProgressBar/ProgressBar.js";
10
- export { Copyright } from "../../../blocks/Copyright/Copyright.js";
11
- export { FormInput } from "../../../blocks/FormInput/FormInput.js";
12
- export { Config } from "../../../blocks/Config/Config.js";
13
- export { UploadCtxProvider } from "../../../blocks/UploadCtxProvider/UploadCtxProvider.js";
14
- export { Modal } from "../../../blocks/Modal/Modal.js";
15
- export * from "../../../blocks/CloudImageEditor/index.js";
16
- export { CloudImageEditorActivity } from "../../../blocks/CloudImageEditorActivity/CloudImageEditorActivity.js";
1
+ export * from "../../../index.js";
17
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,18 +1 @@
1
- export { defineComponents } from '../../../abstract/defineComponents.js';
2
- export { defineLocale } from '../../../abstract/localeRegistry.js';
3
- export { FileUploaderMinimal } from './FileUploaderMinimal.js';
4
- export { StartFrom } from '../../../blocks/StartFrom/StartFrom.js';
5
- export { DropArea } from '../../../blocks/DropArea/DropArea.js';
6
- export { UploadList } from '../../../blocks/UploadList/UploadList.js';
7
- export { FileItem } from '../../../blocks/FileItem/FileItem.js';
8
- export { Icon } from '../../../blocks/Icon/Icon.js';
9
- export { ProgressBar } from '../../../blocks/ProgressBar/ProgressBar.js';
10
- export { Copyright } from '../../../blocks/Copyright/Copyright.js';
11
- export { FormInput } from '../../../blocks/FormInput/FormInput.js';
12
- export { Config } from '../../../blocks/Config/Config.js';
13
- export { UploadCtxProvider } from '../../../blocks/UploadCtxProvider/UploadCtxProvider.js';
14
-
15
- export { Modal } from '../../../blocks/Modal/Modal.js';
16
-
17
- export * from '../../../blocks/CloudImageEditor/index.js';
18
- export { CloudImageEditorActivity } from '../../../blocks/CloudImageEditorActivity/CloudImageEditorActivity.js';
1
+ export * from '../../../index.js';
@@ -1,7 +1,7 @@
1
1
  export class FileUploaderRegular extends SolutionBlock {
2
2
  init$: {
3
3
  isHidden: boolean;
4
- /** @param {unknown} value */ '*commonProgress': number;
4
+ '*commonProgress': number;
5
5
  '*uploadList': never[];
6
6
  '*uploadQueue': import("@uploadcare/upload-client").Queue;
7
7
  '*collectionErrors': any[];
@@ -15,8 +15,6 @@ export class FileUploaderRegular extends SolutionBlock {
15
15
  '*historyBack': null;
16
16
  '*closeModal': () => void;
17
17
  };
18
- /** @private */
19
- private _lastModalActive;
20
18
  }
21
19
  export namespace FileUploaderRegular {
22
20
  let template: string;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploaderRegular.d.ts","sourceRoot":"","sources":["FileUploaderRegular.js"],"names":[],"mappings":"AAKA;IAMI;;QAWE,6BAA6B;;;;;;;;;;;;;MAR9B;IAoBG,eAAe;IACf,yBAAmC;CAK1C;;;;8BAvC6B,oCAAoC"}
1
+ {"version":3,"file":"FileUploaderRegular.d.ts","sourceRoot":"","sources":["FileUploaderRegular.js"],"names":[],"mappings":"AAIA;IAMI;;;;;;;;;;;;;;;MAGC;CAaJ;;;;8BAzB6B,oCAAoC"}
@@ -1,7 +1,6 @@
1
1
  // @ts-check
2
2
  import { SolutionBlock } from '../../../abstract/SolutionBlock.js';
3
- import { asBoolean } from '../../../blocks/Config/normalizeConfigValue.js';
4
- import { EventType } from '../../../blocks/UploadCtxProvider/EventEmitter.js';
3
+ import { asBoolean } from '../../../blocks/Config/validatorsType.js';
5
4
 
6
5
  export class FileUploaderRegular extends SolutionBlock {
7
6
  static styleAttrs = [...super.styleAttrs, 'uc-file-uploader-regular'];
@@ -24,19 +23,6 @@ export class FileUploaderRegular extends SolutionBlock {
24
23
  this.set$({ isHidden: asBoolean(value) });
25
24
  },
26
25
  );
27
-
28
- this.sub(
29
- '*modalActive',
30
- (modalActive) => {
31
- if (this._lastModalActive !== modalActive) {
32
- this.emit(modalActive ? EventType.MODAL_OPEN : EventType.MODAL_CLOSE, undefined, { debounce: true });
33
- }
34
-
35
- /** @private */
36
- this._lastModalActive = modalActive;
37
- },
38
- false,
39
- );
40
26
  }
41
27
  }
42
28