@uploadcare/file-uploader 1.14.0 → 1.15.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/abstract/ActivityBlock.d.ts.map +1 -1
  2. package/abstract/ActivityBlock.js +10 -15
  3. package/abstract/Block.d.ts +6 -0
  4. package/abstract/Block.d.ts.map +1 -1
  5. package/abstract/Block.js +15 -0
  6. package/abstract/CTX.d.ts.map +1 -1
  7. package/abstract/CTX.js +3 -1
  8. package/abstract/ModalManager.d.ts +113 -0
  9. package/abstract/ModalManager.d.ts.map +1 -0
  10. package/abstract/ModalManager.js +220 -0
  11. package/abstract/UploaderBlock.d.ts +1 -0
  12. package/abstract/UploaderBlock.d.ts.map +1 -1
  13. package/abstract/UploaderBlock.js +24 -8
  14. package/abstract/UploaderPublicApi.d.ts.map +1 -1
  15. package/abstract/UploaderPublicApi.js +12 -7
  16. package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
  17. package/blocks/CameraSource/CameraSource.js +1 -0
  18. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts.map +1 -1
  19. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js +2 -0
  20. package/blocks/Config/Config.d.ts +1 -1
  21. package/blocks/Config/Config.d.ts.map +1 -1
  22. package/blocks/Config/initialConfig.d.ts.map +1 -1
  23. package/blocks/Config/initialConfig.js +4 -0
  24. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
  25. package/blocks/Config/normalizeConfigValue.js +4 -0
  26. package/blocks/DropArea/DropArea.d.ts.map +1 -1
  27. package/blocks/DropArea/DropArea.js +2 -1
  28. package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
  29. package/blocks/ExternalSource/ExternalSource.js +3 -1
  30. package/blocks/FileItem/FileItem.d.ts +2 -0
  31. package/blocks/FileItem/FileItem.d.ts.map +1 -1
  32. package/blocks/FileItem/FileItem.js +18 -3
  33. package/blocks/FileItem/file-item.css +60 -0
  34. package/blocks/Modal/Modal.d.ts.map +1 -1
  35. package/blocks/Modal/Modal.js +26 -17
  36. package/blocks/SourceBtn/SourceBtn.d.ts +4 -1
  37. package/blocks/SourceBtn/SourceBtn.d.ts.map +1 -1
  38. package/blocks/SourceBtn/SourceBtn.js +5 -1
  39. package/blocks/StartFrom/StartFrom.js +1 -1
  40. package/blocks/UploadList/UploadList.d.ts.map +1 -1
  41. package/blocks/UploadList/UploadList.js +14 -1
  42. package/blocks/UploadList/upload-list.css +23 -0
  43. package/blocks/UrlSource/UrlSource.d.ts.map +1 -1
  44. package/blocks/UrlSource/UrlSource.js +1 -0
  45. package/blocks/themes/uc-basic/theme.css +12 -0
  46. package/index.ssr.d.ts.map +1 -1
  47. package/index.ssr.js +18 -3
  48. package/package.json +4 -2
  49. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +16 -0
  50. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
  51. package/solutions/file-uploader/minimal/FileUploaderMinimal.js +35 -1
  52. package/solutions/file-uploader/minimal/index.css +24 -1
  53. package/solutions/file-uploader/minimal/index.d.ts +3 -0
  54. package/solutions/file-uploader/minimal/index.js +5 -0
  55. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +2 -2
  56. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
  57. package/solutions/file-uploader/regular/FileUploaderRegular.js +16 -1
  58. package/types/exported.d.ts +6 -0
  59. package/web/file-uploader.iife.min.js +4 -4
  60. package/web/file-uploader.min.js +4 -4
  61. package/web/uc-basic.min.css +1 -1
  62. package/web/uc-cloud-image-editor.min.css +1 -1
  63. package/web/uc-cloud-image-editor.min.js +4 -4
  64. package/web/uc-file-uploader-inline.min.css +1 -1
  65. package/web/uc-file-uploader-inline.min.js +4 -4
  66. package/web/uc-file-uploader-minimal.min.css +1 -1
  67. package/web/uc-file-uploader-minimal.min.js +4 -3
  68. package/web/uc-file-uploader-regular.min.css +1 -1
  69. package/web/uc-file-uploader-regular.min.js +4 -4
@@ -1,9 +1,19 @@
1
1
  import { ActivityBlock } from '../../../abstract/ActivityBlock.js';
2
2
  import { SolutionBlock } from '../../../abstract/SolutionBlock.js';
3
+ import { ModalEvents } from '../../../abstract/ModalManager.js';
3
4
 
4
5
  export class FileUploaderMinimal extends SolutionBlock {
5
6
  static styleAttrs = [...super.styleAttrs, 'uc-file-uploader-minimal'];
6
7
 
8
+ constructor() {
9
+ super();
10
+
11
+ this.init$ = {
12
+ ...this.init$,
13
+ singleUpload: false,
14
+ };
15
+ }
16
+
7
17
  initCallback() {
8
18
  super.initCallback();
9
19
 
@@ -34,13 +44,37 @@ export class FileUploaderMinimal extends SolutionBlock {
34
44
  this.cfg.confirmUpload = false;
35
45
  }
36
46
  });
47
+
48
+ this.subConfigValue('displayUploadList', (mode) => {
49
+ this.setAttribute('mode', mode);
50
+ });
51
+
52
+ this.subConfigValue('multiple', (multiple) => {
53
+ if (multiple) {
54
+ this.style.removeProperty('--uc-grid-col');
55
+ } else {
56
+ this.style.setProperty('--uc-grid-col', '1');
57
+ }
58
+
59
+ this.$.singleUpload = !multiple;
60
+ });
61
+
62
+ this.modalManager.subscribe(ModalEvents.CLOSE, (e) => {
63
+ if (e.id === ActivityBlock.activities.CLOUD_IMG_EDIT) {
64
+ this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
65
+ }
66
+ });
37
67
  }
38
68
  }
39
69
 
40
70
  FileUploaderMinimal.template = /* HTML */ `
41
71
  <uc-start-from>
42
- <uc-drop-area tabindex="0" clickable l10n="choose-file"></uc-drop-area>
72
+ <uc-drop-area set="@single:singleUpload" tabindex="0" clickable l10n="choose-file"></uc-drop-area>
43
73
  <uc-copyright></uc-copyright>
44
74
  </uc-start-from>
45
75
  <uc-upload-list ref="uBlock"></uc-upload-list>
76
+
77
+ <uc-modal id="cloud-image-edit" strokes block-body-scrolling>
78
+ <uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>
79
+ </uc-modal>
46
80
  `;
@@ -14,6 +14,9 @@
14
14
  @import url('../../../blocks/Icon/icon.css');
15
15
  @import url('../../../blocks/ProgressBar/progress-bar.css');
16
16
  @import url('../../../blocks/Copyright/copyright.css');
17
+ @import url('../../../blocks/Modal/modal.css');
18
+ @import url('../../../blocks/CloudImageEditor/index.css');
19
+ @import url('../../../blocks/CloudImageEditorActivity/index.css');
17
20
 
18
21
  /* ICONS: */
19
22
  :where([uc-file-uploader-minimal]) {
@@ -61,6 +64,10 @@
61
64
  background-color: var(--uc-background);
62
65
  }
63
66
 
67
+ :where([uc-file-uploader-minimal]:has([single]) uc-drop-area) {
68
+ aspect-ratio: var(--uc-grid-aspect-ratio);
69
+ }
70
+
64
71
  [uc-file-uploader-minimal] uc-upload-list uc-activity-header {
65
72
  display: none;
66
73
  }
@@ -112,7 +119,7 @@
112
119
  }
113
120
 
114
121
  [uc-file-uploader-minimal] uc-file-item .uc-edit-btn {
115
- display: none;
122
+ /* display: none; */
116
123
  }
117
124
 
118
125
  [uc-file-uploader-minimal] uc-file-item uc-progress-bar {
@@ -139,3 +146,19 @@
139
146
  [uc-file-uploader-minimal] uc-copyright .uc-credits {
140
147
  position: static;
141
148
  }
149
+
150
+ [uc-file-uploader-minimal][mode='grid'] uc-upload-list .uc-toolbar .uc-add-more-btn {
151
+ display: none;
152
+ }
153
+
154
+ [uc-file-uploader-minimal][mode='grid'] uc-upload-list .uc-files .uc-add-more-btn {
155
+ display: flex;
156
+ }
157
+
158
+ [uc-file-uploader-minimal][mode='grid'] uc-upload-list .uc-files .uc-add-more-btn > span {
159
+ display: none;
160
+ }
161
+
162
+ [uc-file-uploader-minimal][mode='grid'] uc-upload-list .uc-files .uc-add-more-btn > uc-icon {
163
+ display: flex;
164
+ }
@@ -11,4 +11,7 @@ export { Copyright } from "../../../blocks/Copyright/Copyright.js";
11
11
  export { FormInput } from "../../../blocks/FormInput/FormInput.js";
12
12
  export { Config } from "../../../blocks/Config/Config.js";
13
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";
14
17
  //# sourceMappingURL=index.d.ts.map
@@ -11,3 +11,8 @@ export { Copyright } from '../../../blocks/Copyright/Copyright.js';
11
11
  export { FormInput } from '../../../blocks/FormInput/FormInput.js';
12
12
  export { Config } from '../../../blocks/Config/Config.js';
13
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,12 +1,12 @@
1
1
  export class FileUploaderRegular extends SolutionBlock {
2
2
  init$: {
3
3
  isHidden: boolean;
4
- '*commonProgress': number;
4
+ /** @param {unknown} value */ '*commonProgress': number;
5
5
  '*uploadList': never[];
6
6
  '*uploadQueue': import("@uploadcare/upload-client").Queue;
7
7
  '*collectionErrors': any[];
8
8
  '*collectionState': import("./index.js").OutputCollectionState<import("./index.js").OutputCollectionStatus, "maybe-has-group"> | null;
9
- '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null; /** @private */
9
+ '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
10
10
  '*uploadTrigger': Set<string>;
11
11
  '*secureUploadsManager': import("../../../abstract/SecureUploadsManager.js").SecureUploadsManager | null;
12
12
  '*currentActivity': null;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploaderRegular.d.ts","sourceRoot":"","sources":["FileUploaderRegular.js"],"names":[],"mappings":"AAKA;IAMI;;;;;;;kFAuBI,eAAe;;;;;;;;MApBlB;IAoBG,eAAe;IACf,yBAAmC;CAK1C;;;;8BAvC6B,oCAAoC"}
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"}
@@ -43,17 +43,32 @@ export class FileUploaderRegular extends SolutionBlock {
43
43
  FileUploaderRegular.template = /* HTML */ `
44
44
  <uc-simple-btn set="@hidden: isHidden"></uc-simple-btn>
45
45
 
46
- <uc-modal strokes block-body-scrolling>
46
+ <uc-modal id="start-from" strokes block-body-scrolling>
47
47
  <uc-start-from>
48
48
  <uc-drop-area with-icon clickable></uc-drop-area>
49
49
  <uc-source-list role="list" wrap></uc-source-list>
50
50
  <button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button>
51
51
  <uc-copyright></uc-copyright>
52
52
  </uc-start-from>
53
+ </uc-modal>
54
+
55
+ <uc-modal id="upload-list" strokes block-body-scrolling>
53
56
  <uc-upload-list></uc-upload-list>
57
+ </uc-modal>
58
+
59
+ <uc-modal id="camera" strokes block-body-scrolling>
54
60
  <uc-camera-source></uc-camera-source>
61
+ </uc-modal>
62
+
63
+ <uc-modal id="url" strokes block-body-scrolling>
55
64
  <uc-url-source></uc-url-source>
65
+ </uc-modal>
66
+
67
+ <uc-modal id="external" strokes block-body-scrolling>
56
68
  <uc-external-source></uc-external-source>
69
+ </uc-modal>
70
+
71
+ <uc-modal id="cloud-image-edit" strokes block-body-scrolling>
57
72
  <uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>
58
73
  </uc-modal>
59
74
  `;
@@ -278,6 +278,12 @@ export type ConfigType = {
278
278
  * the following properties from MediaRecorderOptions
279
279
  */
280
280
  mediaRecorderOptions: MediaRecorderOptions | null;
281
+
282
+ displayUploadList: string;
283
+
284
+ enableFileName: boolean;
285
+
286
+ usePreviewImage: boolean;
281
287
  };
282
288
  export type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
283
289
  export type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;