@semantic-components/ui 0.66.0 → 0.68.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 (183) hide show
  1. package/esm2022/lib/components/file-upload/file-upload-dropzone.js +91 -0
  2. package/esm2022/lib/components/file-upload/file-upload-dropzone.js.map +1 -0
  3. package/esm2022/lib/components/file-upload/file-upload-item-delete.js +29 -0
  4. package/esm2022/lib/components/file-upload/file-upload-item-delete.js.map +1 -0
  5. package/esm2022/lib/components/file-upload/file-upload-item-name.js +20 -0
  6. package/esm2022/lib/components/file-upload/file-upload-item-name.js.map +1 -0
  7. package/esm2022/lib/components/file-upload/file-upload-item-preview.js +51 -0
  8. package/esm2022/lib/components/file-upload/file-upload-item-preview.js.map +1 -0
  9. package/esm2022/lib/components/file-upload/file-upload-item-progress.js +34 -0
  10. package/esm2022/lib/components/file-upload/file-upload-item-progress.js.map +1 -0
  11. package/esm2022/lib/components/file-upload/file-upload-item-size.js +37 -0
  12. package/esm2022/lib/components/file-upload/file-upload-item-size.js.map +1 -0
  13. package/esm2022/lib/components/file-upload/file-upload-item.js +29 -0
  14. package/esm2022/lib/components/file-upload/file-upload-item.js.map +1 -0
  15. package/esm2022/lib/components/file-upload/file-upload-list.js +20 -0
  16. package/esm2022/lib/components/file-upload/file-upload-list.js.map +1 -0
  17. package/esm2022/lib/components/file-upload/file-upload-trigger.js +66 -0
  18. package/esm2022/lib/components/file-upload/file-upload-trigger.js.map +1 -0
  19. package/esm2022/lib/components/file-upload/file-upload.js +118 -0
  20. package/esm2022/lib/components/file-upload/file-upload.js.map +1 -0
  21. package/esm2022/lib/components/file-upload/index.js +11 -0
  22. package/esm2022/lib/components/file-upload/index.js.map +1 -0
  23. package/esm2022/lib/components/index.js +10 -2
  24. package/esm2022/lib/components/index.js.map +1 -1
  25. package/esm2022/lib/components/menu-bar/menu-bar-item.js +12 -4
  26. package/esm2022/lib/components/menu-bar/menu-bar-item.js.map +1 -1
  27. package/esm2022/lib/components/native-select/index.js +6 -0
  28. package/esm2022/lib/components/native-select/index.js.map +1 -0
  29. package/esm2022/lib/components/native-select/native-select-container.js +20 -0
  30. package/esm2022/lib/components/native-select/native-select-container.js.map +1 -0
  31. package/esm2022/lib/components/native-select/native-select-icon.js +20 -0
  32. package/esm2022/lib/components/native-select/native-select-icon.js.map +1 -0
  33. package/esm2022/lib/components/native-select/native-select-optgroup.js +20 -0
  34. package/esm2022/lib/components/native-select/native-select-optgroup.js.map +1 -0
  35. package/esm2022/lib/components/native-select/native-select-option.js +20 -0
  36. package/esm2022/lib/components/native-select/native-select-option.js.map +1 -0
  37. package/esm2022/lib/components/native-select/native-select.js +29 -0
  38. package/esm2022/lib/components/native-select/native-select.js.map +1 -0
  39. package/esm2022/lib/components/navigation-menu/index.js +9 -0
  40. package/esm2022/lib/components/navigation-menu/index.js.map +1 -0
  41. package/esm2022/lib/components/navigation-menu/navigation-menu-content.js +37 -0
  42. package/esm2022/lib/components/navigation-menu/navigation-menu-content.js.map +1 -0
  43. package/esm2022/lib/components/navigation-menu/navigation-menu-grid.js +20 -0
  44. package/esm2022/lib/components/navigation-menu/navigation-menu-grid.js.map +1 -0
  45. package/esm2022/lib/components/navigation-menu/navigation-menu-item.js +118 -0
  46. package/esm2022/lib/components/navigation-menu/navigation-menu-item.js.map +1 -0
  47. package/esm2022/lib/components/navigation-menu/navigation-menu-link.js +22 -0
  48. package/esm2022/lib/components/navigation-menu/navigation-menu-link.js.map +1 -0
  49. package/esm2022/lib/components/navigation-menu/navigation-menu-list.js +20 -0
  50. package/esm2022/lib/components/navigation-menu/navigation-menu-list.js.map +1 -0
  51. package/esm2022/lib/components/navigation-menu/navigation-menu-portal.js +14 -0
  52. package/esm2022/lib/components/navigation-menu/navigation-menu-portal.js.map +1 -0
  53. package/esm2022/lib/components/navigation-menu/navigation-menu-trigger-icon.js +22 -0
  54. package/esm2022/lib/components/navigation-menu/navigation-menu-trigger-icon.js.map +1 -0
  55. package/esm2022/lib/components/navigation-menu/navigation-menu-trigger.js +41 -0
  56. package/esm2022/lib/components/navigation-menu/navigation-menu-trigger.js.map +1 -0
  57. package/esm2022/lib/components/navigation-menu/navigation-menu.js +32 -0
  58. package/esm2022/lib/components/navigation-menu/navigation-menu.js.map +1 -0
  59. package/esm2022/lib/components/range-slider/index.js +4 -0
  60. package/esm2022/lib/components/range-slider/index.js.map +1 -0
  61. package/esm2022/lib/components/range-slider/range-slider-max.js +38 -0
  62. package/esm2022/lib/components/range-slider/range-slider-max.js.map +1 -0
  63. package/esm2022/lib/components/range-slider/range-slider-min.js +38 -0
  64. package/esm2022/lib/components/range-slider/range-slider-min.js.map +1 -0
  65. package/esm2022/lib/components/range-slider/range-slider-thumb-base.js +24 -0
  66. package/esm2022/lib/components/range-slider/range-slider-thumb-base.js.map +1 -0
  67. package/esm2022/lib/components/range-slider/range-slider.js +62 -0
  68. package/esm2022/lib/components/range-slider/range-slider.js.map +1 -0
  69. package/esm2022/lib/components/scroll-area/index.js +2 -0
  70. package/esm2022/lib/components/scroll-area/index.js.map +1 -0
  71. package/esm2022/lib/components/scroll-area/scroll-area.js +21 -0
  72. package/esm2022/lib/components/scroll-area/scroll-area.js.map +1 -0
  73. package/esm2022/lib/components/select/index.js +5 -1
  74. package/esm2022/lib/components/select/index.js.map +1 -1
  75. package/esm2022/lib/components/select/select-group-label.js +28 -0
  76. package/esm2022/lib/components/select/select-group-label.js.map +1 -0
  77. package/esm2022/lib/components/select/select-group.js +28 -0
  78. package/esm2022/lib/components/select/select-group.js.map +1 -0
  79. package/esm2022/lib/components/select/{select-icon.js → select-item-icon.js} +7 -7
  80. package/esm2022/lib/components/select/select-item-icon.js.map +1 -0
  81. package/esm2022/lib/components/select/select-list.js +1 -5
  82. package/esm2022/lib/components/select/select-list.js.map +1 -1
  83. package/esm2022/lib/components/select/select-popup.js +32 -0
  84. package/esm2022/lib/components/select/select-popup.js.map +1 -0
  85. package/esm2022/lib/components/select/select-separator.js +22 -0
  86. package/esm2022/lib/components/select/select-separator.js.map +1 -0
  87. package/esm2022/lib/components/select/select-trigger-icon.js +4 -2
  88. package/esm2022/lib/components/select/select-trigger-icon.js.map +1 -1
  89. package/esm2022/lib/components/select/select-trigger.js +4 -7
  90. package/esm2022/lib/components/select/select-trigger.js.map +1 -1
  91. package/esm2022/lib/components/select/select.js +6 -5
  92. package/esm2022/lib/components/select/select.js.map +1 -1
  93. package/esm2022/lib/components/slider/index.js +2 -0
  94. package/esm2022/lib/components/slider/index.js.map +1 -0
  95. package/esm2022/lib/components/slider/slider.js +46 -0
  96. package/esm2022/lib/components/slider/slider.js.map +1 -0
  97. package/esm2022/lib/components/time-picker/index.js +10 -0
  98. package/esm2022/lib/components/time-picker/index.js.map +1 -0
  99. package/esm2022/lib/components/time-picker/time-picker-hours-input.js +67 -0
  100. package/esm2022/lib/components/time-picker/time-picker-hours-input.js.map +1 -0
  101. package/esm2022/lib/components/time-picker/time-picker-input.js +26 -0
  102. package/esm2022/lib/components/time-picker/time-picker-input.js.map +1 -0
  103. package/esm2022/lib/components/time-picker/time-picker-minutes-input.js +57 -0
  104. package/esm2022/lib/components/time-picker/time-picker-minutes-input.js.map +1 -0
  105. package/esm2022/lib/components/time-picker/time-picker-period-am.js +26 -0
  106. package/esm2022/lib/components/time-picker/time-picker-period-am.js.map +1 -0
  107. package/esm2022/lib/components/time-picker/time-picker-period-pm.js +26 -0
  108. package/esm2022/lib/components/time-picker/time-picker-period-pm.js.map +1 -0
  109. package/esm2022/lib/components/time-picker/time-picker-period.js +46 -0
  110. package/esm2022/lib/components/time-picker/time-picker-period.js.map +1 -0
  111. package/esm2022/lib/components/time-picker/time-picker-seconds-input.js +57 -0
  112. package/esm2022/lib/components/time-picker/time-picker-seconds-input.js.map +1 -0
  113. package/esm2022/lib/components/time-picker/time-picker-separator.js +20 -0
  114. package/esm2022/lib/components/time-picker/time-picker-separator.js.map +1 -0
  115. package/esm2022/lib/components/time-picker/time-picker.js +58 -0
  116. package/esm2022/lib/components/time-picker/time-picker.js.map +1 -0
  117. package/esm2022/lib/components/typography/heading.js +43 -0
  118. package/esm2022/lib/components/typography/heading.js.map +1 -0
  119. package/esm2022/lib/components/typography/index.js +2 -0
  120. package/esm2022/lib/components/typography/index.js.map +1 -0
  121. package/lib/components/file-upload/file-upload-dropzone.d.ts +15 -0
  122. package/lib/components/file-upload/file-upload-item-delete.d.ts +10 -0
  123. package/lib/components/file-upload/file-upload-item-name.d.ts +7 -0
  124. package/lib/components/file-upload/file-upload-item-preview.d.ts +11 -0
  125. package/lib/components/file-upload/file-upload-item-progress.d.ts +9 -0
  126. package/lib/components/file-upload/file-upload-item-size.d.ts +10 -0
  127. package/lib/components/file-upload/file-upload-item.d.ts +9 -0
  128. package/lib/components/file-upload/file-upload-list.d.ts +7 -0
  129. package/lib/components/file-upload/file-upload-trigger.d.ts +11 -0
  130. package/lib/components/file-upload/file-upload.d.ts +32 -0
  131. package/lib/components/file-upload/index.d.ts +11 -0
  132. package/lib/components/index.d.ts +10 -2
  133. package/lib/components/menu-bar/menu-bar-item.d.ts +1 -0
  134. package/lib/components/native-select/index.d.ts +5 -0
  135. package/lib/components/native-select/native-select-container.d.ts +7 -0
  136. package/lib/components/native-select/native-select-icon.d.ts +7 -0
  137. package/lib/components/native-select/native-select-optgroup.d.ts +7 -0
  138. package/lib/components/native-select/native-select-option.d.ts +7 -0
  139. package/lib/components/native-select/native-select.d.ts +12 -0
  140. package/lib/components/navigation-menu/index.d.ts +8 -0
  141. package/lib/components/navigation-menu/navigation-menu-content.d.ts +10 -0
  142. package/lib/components/navigation-menu/navigation-menu-grid.d.ts +7 -0
  143. package/lib/components/navigation-menu/navigation-menu-item.d.ts +27 -0
  144. package/lib/components/navigation-menu/navigation-menu-link.d.ts +8 -0
  145. package/lib/components/navigation-menu/navigation-menu-list.d.ts +7 -0
  146. package/lib/components/navigation-menu/navigation-menu-portal.d.ts +7 -0
  147. package/lib/components/navigation-menu/navigation-menu-trigger-icon.d.ts +8 -0
  148. package/lib/components/navigation-menu/navigation-menu-trigger.d.ts +12 -0
  149. package/lib/components/navigation-menu/navigation-menu.d.ts +10 -0
  150. package/lib/components/range-slider/index.d.ts +3 -0
  151. package/lib/components/range-slider/range-slider-max.d.ts +10 -0
  152. package/lib/components/range-slider/range-slider-min.d.ts +10 -0
  153. package/lib/components/range-slider/range-slider-thumb-base.d.ts +2 -0
  154. package/lib/components/range-slider/range-slider.d.ts +21 -0
  155. package/lib/components/scroll-area/index.d.ts +1 -0
  156. package/lib/components/scroll-area/scroll-area.d.ts +7 -0
  157. package/lib/components/select/index.d.ts +5 -1
  158. package/lib/components/select/select-group-label.d.ts +7 -0
  159. package/lib/components/select/select-group.d.ts +7 -0
  160. package/lib/components/select/select-item-icon.d.ts +7 -0
  161. package/lib/components/select/select-list.d.ts +0 -1
  162. package/lib/components/select/select-popup.d.ts +8 -0
  163. package/lib/components/select/select-separator.d.ts +7 -0
  164. package/lib/components/select/select-trigger-icon.d.ts +1 -0
  165. package/lib/components/select/select-trigger.d.ts +3 -4
  166. package/lib/components/select/select.d.ts +3 -2
  167. package/lib/components/slider/index.d.ts +1 -0
  168. package/lib/components/slider/slider.d.ts +15 -0
  169. package/lib/components/time-picker/index.d.ts +10 -0
  170. package/lib/components/time-picker/time-picker-hours-input.d.ts +14 -0
  171. package/lib/components/time-picker/time-picker-input.d.ts +9 -0
  172. package/lib/components/time-picker/time-picker-minutes-input.d.ts +12 -0
  173. package/lib/components/time-picker/time-picker-period-am.d.ts +8 -0
  174. package/lib/components/time-picker/time-picker-period-pm.d.ts +8 -0
  175. package/lib/components/time-picker/time-picker-period.d.ts +12 -0
  176. package/lib/components/time-picker/time-picker-seconds-input.d.ts +12 -0
  177. package/lib/components/time-picker/time-picker-separator.d.ts +7 -0
  178. package/lib/components/time-picker/time-picker.d.ts +26 -0
  179. package/lib/components/typography/heading.d.ts +15 -0
  180. package/lib/components/typography/index.d.ts +1 -0
  181. package/package.json +1 -1
  182. package/esm2022/lib/components/select/select-icon.js.map +0 -1
  183. package/lib/components/select/select-icon.d.ts +0 -7
@@ -0,0 +1,91 @@
1
+ import { ChangeDetectionStrategy, Component, computed, ElementRef, inject, input, signal, ViewEncapsulation, } from '@angular/core';
2
+ import { cn } from '../../utils';
3
+ import { SC_FILE_UPLOAD } from './file-upload';
4
+ import * as i0 from "@angular/core";
5
+ export class ScFileUploadDropzone {
6
+ fileUpload = inject(SC_FILE_UPLOAD);
7
+ elementRef = inject(ElementRef);
8
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
9
+ isDragging = signal(false, ...(ngDevMode ? [{ debugName: "isDragging" }] : []));
10
+ class = computed(() => cn('relative flex min-h-[150px] cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed', 'transition-colors hover:border-primary/50 hover:bg-accent/50', 'data-[dragging=true]:border-primary data-[dragging=true]:bg-accent', 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
11
+ openFilePicker() {
12
+ if (this.fileUpload.disabled())
13
+ return;
14
+ const input = this.elementRef.nativeElement.querySelector('input[type="file"]');
15
+ input?.click();
16
+ }
17
+ onFileSelect(event) {
18
+ const input = event.target;
19
+ if (input.files && input.files.length > 0) {
20
+ this.fileUpload.addFiles(input.files);
21
+ input.value = '';
22
+ }
23
+ }
24
+ onDragOver(event) {
25
+ event.preventDefault();
26
+ event.stopPropagation();
27
+ if (!this.fileUpload.disabled()) {
28
+ this.isDragging.set(true);
29
+ }
30
+ }
31
+ onDragLeave(event) {
32
+ event.preventDefault();
33
+ event.stopPropagation();
34
+ this.isDragging.set(false);
35
+ }
36
+ onDrop(event) {
37
+ event.preventDefault();
38
+ event.stopPropagation();
39
+ this.isDragging.set(false);
40
+ if (this.fileUpload.disabled())
41
+ return;
42
+ const files = event.dataTransfer?.files;
43
+ if (files && files.length > 0) {
44
+ this.fileUpload.addFiles(files);
45
+ }
46
+ }
47
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadDropzone, deps: [], target: i0.ɵɵFactoryTarget.Component });
48
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.5", type: ScFileUploadDropzone, isStandalone: true, selector: "[scFileUploadDropzone]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "file-upload-dropzone" }, listeners: { "click": "openFilePicker()", "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "class": "class()", "attr.data-dragging": "isDragging()", "attr.data-disabled": "fileUpload.disabled() || null" } }, ngImport: i0, template: `
49
+ <input
50
+ #fileInput
51
+ type="file"
52
+ class="sr-only"
53
+ [multiple]="fileUpload.multiple()"
54
+ [accept]="fileUpload.accept()"
55
+ [disabled]="fileUpload.disabled()"
56
+ (change)="onFileSelect($event)"
57
+ />
58
+ <ng-content />
59
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
60
+ }
61
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadDropzone, decorators: [{
62
+ type: Component,
63
+ args: [{
64
+ selector: '[scFileUploadDropzone]',
65
+ template: `
66
+ <input
67
+ #fileInput
68
+ type="file"
69
+ class="sr-only"
70
+ [multiple]="fileUpload.multiple()"
71
+ [accept]="fileUpload.accept()"
72
+ [disabled]="fileUpload.disabled()"
73
+ (change)="onFileSelect($event)"
74
+ />
75
+ <ng-content />
76
+ `,
77
+ host: {
78
+ 'data-slot': 'file-upload-dropzone',
79
+ '[class]': 'class()',
80
+ '[attr.data-dragging]': 'isDragging()',
81
+ '[attr.data-disabled]': 'fileUpload.disabled() || null',
82
+ '(click)': 'openFilePicker()',
83
+ '(dragover)': 'onDragOver($event)',
84
+ '(dragleave)': 'onDragLeave($event)',
85
+ '(drop)': 'onDrop($event)',
86
+ },
87
+ encapsulation: ViewEncapsulation.None,
88
+ changeDetection: ChangeDetectionStrategy.OnPush,
89
+ }]
90
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
91
+ //# sourceMappingURL=file-upload-dropzone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload-dropzone.js","sourceRoot":"","sources":["../../../../../../../libs/ui/src/lib/components/file-upload/file-upload-dropzone.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,MAAM,EACN,KAAK,EACL,MAAM,EACN,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;;AA6B/C,MAAM,OAAO,oBAAoB;IACtB,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;IAC5B,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAExC,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IACnD,UAAU,GAAG,MAAM,CAAC,KAAK,sDAAC,CAAC;IAEjB,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CACA,mHAAmH,EACnH,8DAA8D,EAC9D,oEAAoE,EACpE,gEAAgE,EAChE,IAAI,CAAC,UAAU,EAAE,CAClB,iDACF,CAAC;IAEF,cAAc;QACZ,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE;YAAE,OAAO;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,aAAa,CACvD,oBAAoB,CACD,CAAC;QACtB,KAAK,EAAE,KAAK,EAAE,CAAC;IACjB,CAAC;IAED,YAAY,CAAC,KAAY;QACvB,MAAM,KAAK,GAAG,KAAK,CA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C,QAAQ,EAAE;;;;;;;;;;;GAWT;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,sBAAsB;wBACnC,SAAS,EAAE,SAAS;wBACpB,sBAAsB,EAAE,cAAc;wBACtC,sBAAsB,EAAE,+BAA+B;wBACvD,SAAS,EAAE,kBAAkB;wBAC7B,YAAY,EAAE,oBAAoB;wBAClC,aAAa,EAAE,qBAAqB;wBACpC,QAAQ,EAAE,gBAAgB;qBAC3B;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n input,\n signal,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '../../utils';\nimport { SC_FILE_UPLOAD } from './file-upload';\n\n@Component({\n selector: '[scFileUploadDropzone]',\n template: `\n <input\n #fileInput\n type=\"file\"\n class=\"sr-only\"\n [multiple]=\"fileUpload.multiple()\"\n [accept]=\"fileUpload.accept()\"\n [disabled]=\"fileUpload.disabled()\"\n (change)=\"onFileSelect($event)\"\n />\n <ng-content />\n `,\n host: {\n 'data-slot': 'file-upload-dropzone',\n '[class]': 'class()',\n '[attr.data-dragging]': 'isDragging()',\n '[attr.data-disabled]': 'fileUpload.disabled() || null',\n '(click)': 'openFilePicker()',\n '(dragover)': 'onDragOver($event)',\n '(dragleave)': 'onDragLeave($event)',\n '(drop)': 'onDrop($event)',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScFileUploadDropzone {\n readonly fileUpload = inject(SC_FILE_UPLOAD);\n private readonly elementRef = inject(ElementRef);\n\n readonly classInput = input<string>('', { alias: 'class' });\n readonly isDragging = signal(false);\n\n protected readonly class = computed(() =>\n cn(\n 'relative flex min-h-[150px] cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed',\n 'transition-colors hover:border-primary/50 hover:bg-accent/50',\n 'data-[dragging=true]:border-primary data-[dragging=true]:bg-accent',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n this.classInput(),\n ),\n );\n\n openFilePicker(): void {\n if (this.fileUpload.disabled()) return;\n const input = this.elementRef.nativeElement.querySelector(\n 'input[type=\"file\"]',\n ) as HTMLInputElement;\n input?.click();\n }\n\n onFileSelect(event: Event): void {\n const input = event.target as HTMLInputElement;\n if (input.files && input.files.length > 0) {\n this.fileUpload.addFiles(input.files);\n input.value = '';\n }\n }\n\n onDragOver(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n if (!this.fileUpload.disabled()) {\n this.isDragging.set(true);\n }\n }\n\n onDragLeave(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.isDragging.set(false);\n }\n\n onDrop(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.isDragging.set(false);\n\n if (this.fileUpload.disabled()) return;\n\n const files = event.dataTransfer?.files;\n if (files && files.length > 0) {\n this.fileUpload.addFiles(files);\n }\n }\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import { computed, Directive, inject, input } from '@angular/core';
2
+ import { buttonVariants } from '../button';
3
+ import { cn } from '../../utils';
4
+ import { SC_FILE_UPLOAD } from './file-upload';
5
+ import * as i0 from "@angular/core";
6
+ export class ScFileUploadItemDelete {
7
+ fileUpload = inject(SC_FILE_UPLOAD);
8
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
9
+ fileId = input.required(...(ngDevMode ? [{ debugName: "fileId" }] : []));
10
+ class = computed(() => cn(buttonVariants({ variant: 'ghost', size: 'icon' }), 'text-muted-foreground', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
11
+ onClick() {
12
+ this.fileUpload.removeFile(this.fileId());
13
+ }
14
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadItemDelete, deps: [], target: i0.ɵɵFactoryTarget.Directive });
15
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.5", type: ScFileUploadItemDelete, isStandalone: true, selector: "button[scFileUploadItemDelete]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, fileId: { classPropertyName: "fileId", publicName: "fileId", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "data-slot": "file-upload-item-delete", "type": "button" }, listeners: { "click": "onClick()" }, properties: { "class": "class()" } }, ngImport: i0 });
16
+ }
17
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadItemDelete, decorators: [{
18
+ type: Directive,
19
+ args: [{
20
+ selector: 'button[scFileUploadItemDelete]',
21
+ host: {
22
+ 'data-slot': 'file-upload-item-delete',
23
+ type: 'button',
24
+ '[class]': 'class()',
25
+ '(click)': 'onClick()',
26
+ },
27
+ }]
28
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], fileId: [{ type: i0.Input, args: [{ isSignal: true, alias: "fileId", required: true }] }] } });
29
+ //# sourceMappingURL=file-upload-item-delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload-item-delete.js","sourceRoot":"","sources":["../../../../../../../libs/ui/src/lib/components/file-upload/file-upload-item-delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;;AAW/C,MAAM,OAAO,sBAAsB;IAChB,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;IAE5C,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IACnD,MAAM,GAAG,KAAK,CAAC,QAAQ,iDAAU,CAAC;IAExB,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CACA,cAAc,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAClD,uBAAuB,EACvB,IAAI,CAAC,UAAU,EAAE,CAClB,iDACF,CAAC;IAEF,OAAO;QACL,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;uGAhBU,sBAAsB;2FAAtB,sBAAsB;;2FAAtB,sBAAsB;kBATlC,SAAS;mBAAC;oBACT,QAAQ,EAAE,gCAAgC;oBAC1C,IAAI,EAAE;wBACJ,WAAW,EAAE,yBAAyB;wBACtC,IAAI,EAAE,QAAQ;wBACd,SAAS,EAAE,SAAS;wBACpB,SAAS,EAAE,WAAW;qBACvB;iBACF","sourcesContent":["import { computed, Directive, inject, input } from '@angular/core';\nimport { buttonVariants } from '../button';\nimport { cn } from '../../utils';\nimport { SC_FILE_UPLOAD } from './file-upload';\n\n@Directive({\n selector: 'button[scFileUploadItemDelete]',\n host: {\n 'data-slot': 'file-upload-item-delete',\n type: 'button',\n '[class]': 'class()',\n '(click)': 'onClick()',\n },\n})\nexport class ScFileUploadItemDelete {\n private readonly fileUpload = inject(SC_FILE_UPLOAD);\n\n readonly classInput = input<string>('', { alias: 'class' });\n readonly fileId = input.required<string>();\n\n protected readonly class = computed(() =>\n cn(\n buttonVariants({ variant: 'ghost', size: 'icon' }),\n 'text-muted-foreground',\n this.classInput(),\n ),\n );\n\n onClick(): void {\n this.fileUpload.removeFile(this.fileId());\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { computed, Directive, input } from '@angular/core';
2
+ import { cn } from '../../utils';
3
+ import * as i0 from "@angular/core";
4
+ export class ScFileUploadItemName {
5
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
6
+ class = computed(() => cn('flex-1 truncate text-sm font-medium', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
7
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadItemName, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.5", type: ScFileUploadItemName, isStandalone: true, selector: "[scFileUploadItemName]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "file-upload-item-name" }, properties: { "class": "class()" } }, ngImport: i0 });
9
+ }
10
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadItemName, decorators: [{
11
+ type: Directive,
12
+ args: [{
13
+ selector: '[scFileUploadItemName]',
14
+ host: {
15
+ 'data-slot': 'file-upload-item-name',
16
+ '[class]': 'class()',
17
+ },
18
+ }]
19
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
20
+ //# sourceMappingURL=file-upload-item-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload-item-name.js","sourceRoot":"","sources":["../../../../../../../libs/ui/src/lib/components/file-upload/file-upload-item-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;;AASjC,MAAM,OAAO,oBAAoB;IACtB,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IAEzC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CAAC,qCAAqC,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,iDAC7D,CAAC;uGALS,oBAAoB;2FAApB,oBAAoB;;2FAApB,oBAAoB;kBAPhC,SAAS;mBAAC;oBACT,QAAQ,EAAE,wBAAwB;oBAClC,IAAI,EAAE;wBACJ,WAAW,EAAE,uBAAuB;wBACpC,SAAS,EAAE,SAAS;qBACrB;iBACF","sourcesContent":["import { computed, Directive, input } from '@angular/core';\nimport { cn } from '../../utils';\n\n@Directive({\n selector: '[scFileUploadItemName]',\n host: {\n 'data-slot': 'file-upload-item-name',\n '[class]': 'class()',\n },\n})\nexport class ScFileUploadItemName {\n readonly classInput = input<string>('', { alias: 'class' });\n\n protected readonly class = computed(() =>\n cn('flex-1 truncate text-sm font-medium', this.classInput()),\n );\n}\n"]}
@@ -0,0 +1,51 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input, ViewEncapsulation, } from '@angular/core';
2
+ import { cn } from '../../utils';
3
+ import * as i0 from "@angular/core";
4
+ export class ScFileUploadItemPreview {
5
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
6
+ file = input.required(...(ngDevMode ? [{ debugName: "file" }] : []));
7
+ isImage = computed(() => this.file().file.type.startsWith('image/'), ...(ngDevMode ? [{ debugName: "isImage" }] : []));
8
+ previewUrl = computed(() => {
9
+ if (this.isImage()) {
10
+ return URL.createObjectURL(this.file().file);
11
+ }
12
+ return '';
13
+ }, ...(ngDevMode ? [{ debugName: "previewUrl" }] : []));
14
+ class = computed(() => cn('flex size-10 items-center justify-center overflow-hidden rounded bg-muted', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
15
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadItemPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
16
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: ScFileUploadItemPreview, isStandalone: true, selector: "[scFileUploadItemPreview]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, file: { classPropertyName: "file", publicName: "file", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "data-slot": "file-upload-item-preview" }, properties: { "class": "class()" } }, ngImport: i0, template: `
17
+ @if (isImage()) {
18
+ <img
19
+ [src]="previewUrl()"
20
+ [alt]="file().file.name"
21
+ class="size-full object-cover"
22
+ />
23
+ } @else {
24
+ <ng-content />
25
+ }
26
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
27
+ }
28
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadItemPreview, decorators: [{
29
+ type: Component,
30
+ args: [{
31
+ selector: '[scFileUploadItemPreview]',
32
+ template: `
33
+ @if (isImage()) {
34
+ <img
35
+ [src]="previewUrl()"
36
+ [alt]="file().file.name"
37
+ class="size-full object-cover"
38
+ />
39
+ } @else {
40
+ <ng-content />
41
+ }
42
+ `,
43
+ host: {
44
+ 'data-slot': 'file-upload-item-preview',
45
+ '[class]': 'class()',
46
+ },
47
+ encapsulation: ViewEncapsulation.None,
48
+ changeDetection: ChangeDetectionStrategy.OnPush,
49
+ }]
50
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], file: [{ type: i0.Input, args: [{ isSignal: true, alias: "file", required: true }] }] } });
51
+ //# sourceMappingURL=file-upload-item-preview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload-item-preview.js","sourceRoot":"","sources":["../../../../../../../libs/ui/src/lib/components/file-upload/file-upload-item-preview.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;;AAuBjC,MAAM,OAAO,uBAAuB;IACzB,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IACnD,IAAI,GAAG,KAAK,CAAC,QAAQ,+CAAoB,CAAC;IAEhC,OAAO,GAAG,QAAQ,CAAC,GAAG,EAAE,CACzC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,mDAC3C,CAAC;IAEiB,UAAU,GAAG,QAAQ,CAAC,GAAG,EAAE;QAC5C,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YACnB,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,sDAAC,CAAC;IAEgB,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CACA,2EAA2E,EAC3E,IAAI,CAAC,UAAU,EAAE,CAClB,iDACF,CAAC;uGApBS,uBAAuB;2FAAvB,uBAAuB,8bAlBxB;;;;;;;;;;GAUT;;2FAQU,uBAAuB;kBApBnC,SAAS;mBAAC;oBACT,QAAQ,EAAE,2BAA2B;oBACrC,QAAQ,EAAE;;;;;;;;;;GAUT;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,0BAA0B;wBACvC,SAAS,EAAE,SAAS;qBACrB;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '../../utils';\nimport { ScFileUploadFile } from './file-upload';\n\n@Component({\n selector: '[scFileUploadItemPreview]',\n template: `\n @if (isImage()) {\n <img\n [src]=\"previewUrl()\"\n [alt]=\"file().file.name\"\n class=\"size-full object-cover\"\n />\n } @else {\n <ng-content />\n }\n `,\n host: {\n 'data-slot': 'file-upload-item-preview',\n '[class]': 'class()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScFileUploadItemPreview {\n readonly classInput = input<string>('', { alias: 'class' });\n readonly file = input.required<ScFileUploadFile>();\n\n protected readonly isImage = computed(() =>\n this.file().file.type.startsWith('image/'),\n );\n\n protected readonly previewUrl = computed(() => {\n if (this.isImage()) {\n return URL.createObjectURL(this.file().file);\n }\n return '';\n });\n\n protected readonly class = computed(() =>\n cn(\n 'flex size-10 items-center justify-center overflow-hidden rounded bg-muted',\n this.classInput(),\n ),\n );\n}\n"]}
@@ -0,0 +1,34 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input, ViewEncapsulation, } from '@angular/core';
2
+ import { cn } from '../../utils';
3
+ import * as i0 from "@angular/core";
4
+ export class ScFileUploadItemProgress {
5
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
6
+ file = input.required(...(ngDevMode ? [{ debugName: "file" }] : []));
7
+ class = computed(() => cn('h-1 w-full overflow-hidden rounded-full bg-muted', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
8
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadItemProgress, deps: [], target: i0.ɵɵFactoryTarget.Component });
9
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.5", type: ScFileUploadItemProgress, isStandalone: true, selector: "[scFileUploadItemProgress]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, file: { classPropertyName: "file", publicName: "file", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "data-slot": "file-upload-item-progress" }, properties: { "class": "class()" } }, ngImport: i0, template: `
10
+ <div
11
+ class="h-full rounded-full bg-primary transition-all"
12
+ [style.width.%]="file().progress || 0"
13
+ ></div>
14
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
15
+ }
16
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadItemProgress, decorators: [{
17
+ type: Component,
18
+ args: [{
19
+ selector: '[scFileUploadItemProgress]',
20
+ template: `
21
+ <div
22
+ class="h-full rounded-full bg-primary transition-all"
23
+ [style.width.%]="file().progress || 0"
24
+ ></div>
25
+ `,
26
+ host: {
27
+ 'data-slot': 'file-upload-item-progress',
28
+ '[class]': 'class()',
29
+ },
30
+ encapsulation: ViewEncapsulation.None,
31
+ changeDetection: ChangeDetectionStrategy.OnPush,
32
+ }]
33
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], file: [{ type: i0.Input, args: [{ isSignal: true, alias: "file", required: true }] }] } });
34
+ //# sourceMappingURL=file-upload-item-progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload-item-progress.js","sourceRoot":"","sources":["../../../../../../../libs/ui/src/lib/components/file-upload/file-upload-item-progress.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;;AAkBjC,MAAM,OAAO,wBAAwB;IAC1B,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IACnD,IAAI,GAAG,KAAK,CAAC,QAAQ,+CAAoB,CAAC;IAEhC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CAAC,kDAAkD,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,iDAC1E,CAAC;uGANS,wBAAwB;2FAAxB,wBAAwB,gcAbzB;;;;;GAKT;;2FAQU,wBAAwB;kBAfpC,SAAS;mBAAC;oBACT,QAAQ,EAAE,4BAA4B;oBACtC,QAAQ,EAAE;;;;;GAKT;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,2BAA2B;wBACxC,SAAS,EAAE,SAAS;qBACrB;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '../../utils';\nimport { ScFileUploadFile } from './file-upload';\n\n@Component({\n selector: '[scFileUploadItemProgress]',\n template: `\n <div\n class=\"h-full rounded-full bg-primary transition-all\"\n [style.width.%]=\"file().progress || 0\"\n ></div>\n `,\n host: {\n 'data-slot': 'file-upload-item-progress',\n '[class]': 'class()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScFileUploadItemProgress {\n readonly classInput = input<string>('', { alias: 'class' });\n readonly file = input.required<ScFileUploadFile>();\n\n protected readonly class = computed(() =>\n cn('h-1 w-full overflow-hidden rounded-full bg-muted', this.classInput()),\n );\n}\n"]}
@@ -0,0 +1,37 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input, ViewEncapsulation, } from '@angular/core';
2
+ import { cn } from '../../utils';
3
+ import * as i0 from "@angular/core";
4
+ export class ScFileUploadItemSize {
5
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
6
+ file = input.required(...(ngDevMode ? [{ debugName: "file" }] : []));
7
+ formattedSize = computed(() => {
8
+ const bytes = this.file().file.size;
9
+ if (bytes === 0)
10
+ return '0 B';
11
+ const k = 1024;
12
+ const sizes = ['B', 'KB', 'MB', 'GB'];
13
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
14
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i];
15
+ }, ...(ngDevMode ? [{ debugName: "formattedSize" }] : []));
16
+ class = computed(() => cn('text-xs text-muted-foreground', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
17
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadItemSize, deps: [], target: i0.ɵɵFactoryTarget.Component });
18
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.5", type: ScFileUploadItemSize, isStandalone: true, selector: "[scFileUploadItemSize]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, file: { classPropertyName: "file", publicName: "file", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "data-slot": "file-upload-item-size" }, properties: { "class": "class()" } }, ngImport: i0, template: `
19
+ {{ formattedSize() }}
20
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
21
+ }
22
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadItemSize, decorators: [{
23
+ type: Component,
24
+ args: [{
25
+ selector: '[scFileUploadItemSize]',
26
+ template: `
27
+ {{ formattedSize() }}
28
+ `,
29
+ host: {
30
+ 'data-slot': 'file-upload-item-size',
31
+ '[class]': 'class()',
32
+ },
33
+ encapsulation: ViewEncapsulation.None,
34
+ changeDetection: ChangeDetectionStrategy.OnPush,
35
+ }]
36
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], file: [{ type: i0.Input, args: [{ isSignal: true, alias: "file", required: true }] }] } });
37
+ //# sourceMappingURL=file-upload-item-size.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload-item-size.js","sourceRoot":"","sources":["../../../../../../../libs/ui/src/lib/components/file-upload/file-upload-item-size.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;;AAej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eDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '../../utils';\nimport { ScFileUploadFile } from './file-upload';\n\n@Component({\n selector: '[scFileUploadItemSize]',\n template: `\n {{ formattedSize() }}\n `,\n host: {\n 'data-slot': 'file-upload-item-size',\n '[class]': 'class()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScFileUploadItemSize {\n readonly classInput = input<string>('', { alias: 'class' });\n readonly file = input.required<ScFileUploadFile>();\n\n protected readonly formattedSize = computed(() => {\n const bytes = this.file().file.size;\n if (bytes === 0) return '0 B';\n const k = 1024;\n const sizes = ['B', 'KB', 'MB', 'GB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i];\n });\n\n protected readonly class = computed(() =>\n cn('text-xs text-muted-foreground', this.classInput()),\n );\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input, ViewEncapsulation, } from '@angular/core';
2
+ import { cn } from '../../utils';
3
+ import * as i0 from "@angular/core";
4
+ export class ScFileUploadItem {
5
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
6
+ file = input.required(...(ngDevMode ? [{ debugName: "file" }] : []));
7
+ class = computed(() => cn('flex items-center gap-3 rounded-lg border bg-background p-3', 'data-[status=error]:border-destructive data-[status=error]:bg-destructive/10', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
8
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
9
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.5", type: ScFileUploadItem, isStandalone: true, selector: "[scFileUploadItem]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, file: { classPropertyName: "file", publicName: "file", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "data-slot": "file-upload-item" }, properties: { "class": "class()", "attr.data-status": "file().status" } }, ngImport: i0, template: `
10
+ <ng-content />
11
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
12
+ }
13
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadItem, decorators: [{
14
+ type: Component,
15
+ args: [{
16
+ selector: '[scFileUploadItem]',
17
+ template: `
18
+ <ng-content />
19
+ `,
20
+ host: {
21
+ 'data-slot': 'file-upload-item',
22
+ '[class]': 'class()',
23
+ '[attr.data-status]': 'file().status',
24
+ },
25
+ encapsulation: ViewEncapsulation.None,
26
+ changeDetection: ChangeDetectionStrategy.OnPush,
27
+ }]
28
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], file: [{ type: i0.Input, args: [{ isSignal: true, alias: "file", required: true }] }] } });
29
+ //# sourceMappingURL=file-upload-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload-item.js","sourceRoot":"","sources":["../../../../../../../libs/ui/src/lib/components/file-upload/file-upload-item.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;;AAgBjC,MAAM,OAAO,gBAAgB;IAClB,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IACnD,IAAI,GAAG,KAAK,CAAC,QAAQ,+CAAoB,CAAC;IAEhC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CACA,6DAA6D,EAC7D,8EAA8E,EAC9E,IAAI,CAAC,UAAU,EAAE,CAClB,iDACF,CAAC;uGAVS,gBAAgB;2FAAhB,gBAAgB,odAXjB;;GAET;;2FASU,gBAAgB;kBAb5B,SAAS;mBAAC;oBACT,QAAQ,EAAE,oBAAoB;oBAC9B,QAAQ,EAAE;;GAET;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,kBAAkB;wBAC/B,SAAS,EAAE,SAAS;wBACpB,oBAAoB,EAAE,eAAe;qBACtC;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '../../utils';\nimport { ScFileUploadFile } from './file-upload';\n\n@Component({\n selector: '[scFileUploadItem]',\n template: `\n <ng-content />\n `,\n host: {\n 'data-slot': 'file-upload-item',\n '[class]': 'class()',\n '[attr.data-status]': 'file().status',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScFileUploadItem {\n readonly classInput = input<string>('', { alias: 'class' });\n readonly file = input.required<ScFileUploadFile>();\n\n protected readonly class = computed(() =>\n cn(\n 'flex items-center gap-3 rounded-lg border bg-background p-3',\n 'data-[status=error]:border-destructive data-[status=error]:bg-destructive/10',\n this.classInput(),\n ),\n );\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { computed, Directive, input } from '@angular/core';
2
+ import { cn } from '../../utils';
3
+ import * as i0 from "@angular/core";
4
+ export class ScFileUploadList {
5
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
6
+ class = computed(() => cn('mt-4 space-y-2', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
7
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadList, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.5", type: ScFileUploadList, isStandalone: true, selector: "[scFileUploadList]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "file-upload-list" }, properties: { "class": "class()" } }, ngImport: i0 });
9
+ }
10
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadList, decorators: [{
11
+ type: Directive,
12
+ args: [{
13
+ selector: '[scFileUploadList]',
14
+ host: {
15
+ 'data-slot': 'file-upload-list',
16
+ '[class]': 'class()',
17
+ },
18
+ }]
19
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
20
+ //# sourceMappingURL=file-upload-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload-list.js","sourceRoot":"","sources":["../../../../../../../libs/ui/src/lib/components/file-upload/file-upload-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;;AASjC,MAAM,OAAO,gBAAgB;IAClB,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IAEzC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,iDACxC,CAAC;uGALS,gBAAgB;2FAAhB,gBAAgB;;2FAAhB,gBAAgB;kBAP5B,SAAS;mBAAC;oBACT,QAAQ,EAAE,oBAAoB;oBAC9B,IAAI,EAAE;wBACJ,WAAW,EAAE,kBAAkB;wBAC/B,SAAS,EAAE,SAAS;qBACrB;iBACF","sourcesContent":["import { computed, Directive, input } from '@angular/core';\nimport { cn } from '../../utils';\n\n@Directive({\n selector: '[scFileUploadList]',\n host: {\n 'data-slot': 'file-upload-list',\n '[class]': 'class()',\n },\n})\nexport class ScFileUploadList {\n readonly classInput = input<string>('', { alias: 'class' });\n\n protected readonly class = computed(() =>\n cn('mt-4 space-y-2', this.classInput()),\n );\n}\n"]}
@@ -0,0 +1,66 @@
1
+ import { ChangeDetectionStrategy, Component, computed, ElementRef, inject, input, ViewEncapsulation, } from '@angular/core';
2
+ import { buttonVariants } from '../button';
3
+ import { cn } from '../../utils';
4
+ import { SC_FILE_UPLOAD } from './file-upload';
5
+ import * as i0 from "@angular/core";
6
+ export class ScFileUploadTrigger {
7
+ fileUpload = inject(SC_FILE_UPLOAD);
8
+ elementRef = inject(ElementRef);
9
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
10
+ class = computed(() => cn(buttonVariants({ variant: 'default', size: 'lg' }), this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
11
+ openFilePicker() {
12
+ if (this.fileUpload.disabled())
13
+ return;
14
+ const input = this.elementRef.nativeElement.querySelector('input[type="file"]');
15
+ input?.click();
16
+ }
17
+ onFileSelect(event) {
18
+ const input = event.target;
19
+ if (input.files && input.files.length > 0) {
20
+ this.fileUpload.addFiles(input.files);
21
+ input.value = '';
22
+ }
23
+ }
24
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadTrigger, deps: [], target: i0.ɵɵFactoryTarget.Component });
25
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.5", type: ScFileUploadTrigger, isStandalone: true, selector: "button[scFileUploadTrigger]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "file-upload-trigger", "type": "button" }, listeners: { "click": "openFilePicker()" }, properties: { "class": "class()", "disabled": "fileUpload.disabled()", "attr.aria-disabled": "fileUpload.disabled() || null" } }, ngImport: i0, template: `
26
+ <input
27
+ #fileInput
28
+ type="file"
29
+ class="sr-only"
30
+ [multiple]="fileUpload.multiple()"
31
+ [accept]="fileUpload.accept()"
32
+ [disabled]="fileUpload.disabled()"
33
+ (change)="onFileSelect($event)"
34
+ />
35
+ <ng-content />
36
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
37
+ }
38
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUploadTrigger, decorators: [{
39
+ type: Component,
40
+ args: [{
41
+ selector: 'button[scFileUploadTrigger]',
42
+ template: `
43
+ <input
44
+ #fileInput
45
+ type="file"
46
+ class="sr-only"
47
+ [multiple]="fileUpload.multiple()"
48
+ [accept]="fileUpload.accept()"
49
+ [disabled]="fileUpload.disabled()"
50
+ (change)="onFileSelect($event)"
51
+ />
52
+ <ng-content />
53
+ `,
54
+ host: {
55
+ 'data-slot': 'file-upload-trigger',
56
+ type: 'button',
57
+ '[class]': 'class()',
58
+ '[disabled]': 'fileUpload.disabled()',
59
+ '[attr.aria-disabled]': 'fileUpload.disabled() || null',
60
+ '(click)': 'openFilePicker()',
61
+ },
62
+ encapsulation: ViewEncapsulation.None,
63
+ changeDetection: ChangeDetectionStrategy.OnPush,
64
+ }]
65
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
66
+ //# sourceMappingURL=file-upload-trigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload-trigger.js","sourceRoot":"","sources":["../../../../../../../libs/ui/src/lib/components/file-upload/file-upload-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,MAAM,EACN,KAAK,EACL,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,EAAE,EA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AS;wBACpB,YAAY,EAAE,uBAAuB;wBACrC,sBAAsB,EAAE,+BAA+B;wBACvD,SAAS,EAAE,kBAAkB;qBAC9B;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { buttonVariants } from '../button';\nimport { cn } from '../../utils';\nimport { SC_FILE_UPLOAD } from './file-upload';\n\n@Component({\n selector: 'button[scFileUploadTrigger]',\n template: `\n <input\n #fileInput\n type=\"file\"\n class=\"sr-only\"\n [multiple]=\"fileUpload.multiple()\"\n [accept]=\"fileUpload.accept()\"\n [disabled]=\"fileUpload.disabled()\"\n (change)=\"onFileSelect($event)\"\n />\n <ng-content />\n `,\n host: {\n 'data-slot': 'file-upload-trigger',\n type: 'button',\n '[class]': 'class()',\n '[disabled]': 'fileUpload.disabled()',\n '[attr.aria-disabled]': 'fileUpload.disabled() || null',\n '(click)': 'openFilePicker()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScFileUploadTrigger {\n readonly fileUpload = inject(SC_FILE_UPLOAD);\n private readonly elementRef = inject(ElementRef);\n\n readonly classInput = input<string>('', { alias: 'class' });\n\n protected readonly class = computed(() =>\n cn(buttonVariants({ variant: 'default', size: 'lg' }), this.classInput()),\n );\n\n openFilePicker(): void {\n if (this.fileUpload.disabled()) return;\n const input = this.elementRef.nativeElement.querySelector(\n 'input[type=\"file\"]',\n ) as HTMLInputElement;\n input?.click();\n }\n\n onFileSelect(event: Event): void {\n const input = event.target as HTMLInputElement;\n if (input.files && input.files.length > 0) {\n this.fileUpload.addFiles(input.files);\n input.value = '';\n }\n }\n}\n"]}
@@ -0,0 +1,118 @@
1
+ import { computed, Directive, InjectionToken, input, model, output, } from '@angular/core';
2
+ import { cn } from '../../utils';
3
+ import * as i0 from "@angular/core";
4
+ // Token for file upload context
5
+ export const SC_FILE_UPLOAD = new InjectionToken('SC_FILE_UPLOAD');
6
+ export class ScFileUpload {
7
+ classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
8
+ multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
9
+ accept = input('', ...(ngDevMode ? [{ debugName: "accept" }] : []));
10
+ maxSize = input(0, ...(ngDevMode ? [{ debugName: "maxSize" }] : [])); // in bytes, 0 = no limit
11
+ maxFiles = input(0, ...(ngDevMode ? [{ debugName: "maxFiles" }] : [])); // 0 = no limit
12
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
13
+ files = model([], ...(ngDevMode ? [{ debugName: "files" }] : []));
14
+ filesSelected = output();
15
+ fileRemoved = output();
16
+ error = output();
17
+ class = computed(() => cn('block', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
18
+ generateId() {
19
+ return Math.random().toString(36).substring(2, 11);
20
+ }
21
+ addFiles(fileList) {
22
+ if (this.disabled())
23
+ return;
24
+ const newFiles = Array.from(fileList);
25
+ const currentFiles = this.files();
26
+ const maxFiles = this.maxFiles();
27
+ const maxSize = this.maxSize();
28
+ const accept = this.accept();
29
+ const validFiles = [];
30
+ for (const file of newFiles) {
31
+ // Check max files limit
32
+ if (maxFiles > 0 && currentFiles.length + validFiles.length >= maxFiles) {
33
+ this.error.emit(`Maximum ${maxFiles} files allowed`);
34
+ break;
35
+ }
36
+ // Check file size
37
+ if (maxSize > 0 && file.size > maxSize) {
38
+ this.error.emit(`File "${file.name}" exceeds maximum size`);
39
+ continue;
40
+ }
41
+ // Check file type
42
+ if (accept && !this.isAcceptedType(file, accept)) {
43
+ this.error.emit(`File "${file.name}" is not an accepted type`);
44
+ continue;
45
+ }
46
+ validFiles.push(file);
47
+ }
48
+ if (validFiles.length > 0) {
49
+ const uploadFiles = validFiles.map((file) => ({
50
+ file,
51
+ id: this.generateId(),
52
+ status: 'pending',
53
+ }));
54
+ if (this.multiple()) {
55
+ this.files.update((files) => [...files, ...uploadFiles]);
56
+ }
57
+ else {
58
+ this.files.set(uploadFiles.slice(0, 1));
59
+ }
60
+ this.filesSelected.emit(validFiles);
61
+ }
62
+ }
63
+ removeFile(fileId) {
64
+ const file = this.files().find((f) => f.id === fileId);
65
+ if (file) {
66
+ this.files.update((files) => files.filter((f) => f.id !== fileId));
67
+ this.fileRemoved.emit(file);
68
+ }
69
+ }
70
+ updateFileProgress(fileId, progress) {
71
+ this.files.update((files) => files.map((f) => f.id === fileId ? { ...f, progress, status: 'uploading' } : f));
72
+ }
73
+ updateFileStatus(fileId, status, error) {
74
+ this.files.update((files) => files.map((f) => (f.id === fileId ? { ...f, status, error } : f)));
75
+ }
76
+ clearFiles() {
77
+ this.files.set([]);
78
+ }
79
+ isAcceptedType(file, accept) {
80
+ const acceptTypes = accept.split(',').map((t) => t.trim().toLowerCase());
81
+ for (const acceptType of acceptTypes) {
82
+ if (acceptType.startsWith('.')) {
83
+ // Extension check
84
+ if (file.name.toLowerCase().endsWith(acceptType)) {
85
+ return true;
86
+ }
87
+ }
88
+ else if (acceptType.endsWith('/*')) {
89
+ // MIME type wildcard (e.g., image/*)
90
+ const mimePrefix = acceptType.slice(0, -2);
91
+ if (file.type.toLowerCase().startsWith(mimePrefix)) {
92
+ return true;
93
+ }
94
+ }
95
+ else {
96
+ // Exact MIME type match
97
+ if (file.type.toLowerCase() === acceptType) {
98
+ return true;
99
+ }
100
+ }
101
+ }
102
+ return false;
103
+ }
104
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUpload, deps: [], target: i0.ɵɵFactoryTarget.Directive });
105
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.5", type: ScFileUpload, isStandalone: true, selector: "[scFileUpload]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, maxSize: { classPropertyName: "maxSize", publicName: "maxSize", isSignal: true, isRequired: false, transformFunction: null }, maxFiles: { classPropertyName: "maxFiles", publicName: "maxFiles", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, files: { classPropertyName: "files", publicName: "files", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { files: "filesChange", filesSelected: "filesSelected", fileRemoved: "fileRemoved", error: "error" }, host: { attributes: { "data-slot": "file-upload" }, properties: { "class": "class()" } }, providers: [{ provide: SC_FILE_UPLOAD, useExisting: ScFileUpload }], ngImport: i0 });
106
+ }
107
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ScFileUpload, decorators: [{
108
+ type: Directive,
109
+ args: [{
110
+ selector: '[scFileUpload]',
111
+ providers: [{ provide: SC_FILE_UPLOAD, useExisting: ScFileUpload }],
112
+ host: {
113
+ 'data-slot': 'file-upload',
114
+ '[class]': 'class()',
115
+ },
116
+ }]
117
+ }], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], maxSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSize", required: false }] }], maxFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFiles", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], files: [{ type: i0.Input, args: [{ isSignal: true, alias: "files", required: false }] }, { type: i0.Output, args: ["filesChange"] }], filesSelected: [{ type: i0.Output, args: ["filesSelected"] }], fileRemoved: [{ type: i0.Output, args: ["fileRemoved"] }], error: [{ type: i0.Output, args: ["error"] }] } });
118
+ //# sourceMappingURL=file-upload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload.js","sourceRoot":"","sources":["../../../../../../../libs/ui/src/lib/components/file-upload/file-upload.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,SAAS,EACT,cAAc,EACd,KAAK,EACL,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;;AAEjC,gCAAgC;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,CAC9C,gBAAgB,CACjB,CAAC;AAkBF,MAAM,OAAO,YAAY;IACd,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IACnD,QAAQ,GAAG,KAAK,CAAU,KAAK,oDAAC,CAAC;IACjC,MAAM,GAAG,KAAK,CAAS,EAAE,kDAAC,CAAC;IAC3B,OAAO,GAAG,KAAK,CAAS,CAAC,mDAAC,CAAC,CAAC,yBAAyB;IACrD,QAAQ,GAAG,KAAK,CAAS,CAAC,oDAAC,CAAC,CAAC,eAAe;IAC5C,QAAQ,GAAG,KAAK,CAAU,KAAK,oDAAC,CAAC;IAEjC,KAAK,GAAG,KAAK,CAAqB,EAAE,iDAAC,CAAC;IACtC,aAAa,GAAG,MAAM,EAAU,CAAC;IACjC,WAAW,GAAG,MAAM,EAAoB,CAAC;IACzC,KAAK,GAAG,MAAM,EAAU,CAAC;IAEf,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,iDAAC,CAAC;IAElE,UAAU;QAChB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,QAAQ,CAAC,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AE,CAAC;oBACnD,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,wBAAwB;gBACxB,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,UAAU,EAAE,CAAC;oBAC3C,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;uGA3HU,YAAY;2FAAZ,YAAY,woCANZ,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;;2FAMxD,YAAY;kBARxB,SAAS;mBAAC;oBACT,QAAQ,EAAE,gBAAgB;oBAC1B,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,cAAc,EAAE,CAAC;oBACnE,IAAI,EAAE;wBACJ,WAAW,EAAE,aAAa;wBAC1B,SAAS,EAAE,SAAS;qBACrB;iBACF","sourcesContent":["import {\n computed,\n Directive,\n InjectionToken,\n input,\n model,\n output,\n} from '@angular/core';\nimport { cn } from '../../utils';\n\n// Token for file upload context\nexport const SC_FILE_UPLOAD = new InjectionToken<ScFileUpload>(\n 'SC_FILE_UPLOAD',\n);\n\nexport interface ScFileUploadFile {\n file: File;\n id: string;\n progress?: number;\n status: 'pending' | 'uploading' | 'complete' | 'error';\n error?: string;\n}\n\n@Directive({\n selector: '[scFileUpload]',\n providers: [{ provide: SC_FILE_UPLOAD, useExisting: ScFileUpload }],\n host: {\n 'data-slot': 'file-upload',\n '[class]': 'class()',\n },\n})\nexport class ScFileUpload {\n readonly classInput = input<string>('', { alias: 'class' });\n readonly multiple = input<boolean>(false);\n readonly accept = input<string>('');\n readonly maxSize = input<number>(0); // in bytes, 0 = no limit\n readonly maxFiles = input<number>(0); // 0 = no limit\n readonly disabled = input<boolean>(false);\n\n readonly files = model<ScFileUploadFile[]>([]);\n readonly filesSelected = output<File[]>();\n readonly fileRemoved = output<ScFileUploadFile>();\n readonly error = output<string>();\n\n protected readonly class = computed(() => cn('block', this.classInput()));\n\n private generateId(): string {\n return Math.random().toString(36).substring(2, 11);\n }\n\n addFiles(fileList: FileList | File[]): void {\n if (this.disabled()) return;\n\n const newFiles = Array.from(fileList);\n const currentFiles = this.files();\n const maxFiles = this.maxFiles();\n const maxSize = this.maxSize();\n const accept = this.accept();\n\n const validFiles: File[] = [];\n\n for (const file of newFiles) {\n // Check max files limit\n if (maxFiles > 0 && currentFiles.length + validFiles.length >= maxFiles) {\n this.error.emit(`Maximum ${maxFiles} files allowed`);\n break;\n }\n\n // Check file size\n if (maxSize > 0 && file.size > maxSize) {\n this.error.emit(`File \"${file.name}\" exceeds maximum size`);\n continue;\n }\n\n // Check file type\n if (accept && !this.isAcceptedType(file, accept)) {\n this.error.emit(`File \"${file.name}\" is not an accepted type`);\n continue;\n }\n\n validFiles.push(file);\n }\n\n if (validFiles.length > 0) {\n const uploadFiles: ScFileUploadFile[] = validFiles.map((file) => ({\n file,\n id: this.generateId(),\n status: 'pending' as const,\n }));\n\n if (this.multiple()) {\n this.files.update((files) => [...files, ...uploadFiles]);\n } else {\n this.files.set(uploadFiles.slice(0, 1));\n }\n\n this.filesSelected.emit(validFiles);\n }\n }\n\n removeFile(fileId: string): void {\n const file = this.files().find((f) => f.id === fileId);\n if (file) {\n this.files.update((files) => files.filter((f) => f.id !== fileId));\n this.fileRemoved.emit(file);\n }\n }\n\n updateFileProgress(fileId: string, progress: number): void {\n this.files.update((files) =>\n files.map((f) =>\n f.id === fileId ? { ...f, progress, status: 'uploading' as const } : f,\n ),\n );\n }\n\n updateFileStatus(\n fileId: string,\n status: ScFileUploadFile['status'],\n error?: string,\n ): void {\n this.files.update((files) =>\n files.map((f) => (f.id === fileId ? { ...f, status, error } : f)),\n );\n }\n\n clearFiles(): void {\n this.files.set([]);\n }\n\n private isAcceptedType(file: File, accept: string): boolean {\n const acceptTypes = accept.split(',').map((t) => t.trim().toLowerCase());\n\n for (const acceptType of acceptTypes) {\n if (acceptType.startsWith('.')) {\n // Extension check\n if (file.name.toLowerCase().endsWith(acceptType)) {\n return true;\n }\n } else if (acceptType.endsWith('/*')) {\n // MIME type wildcard (e.g., image/*)\n const mimePrefix = acceptType.slice(0, -2);\n if (file.type.toLowerCase().startsWith(mimePrefix)) {\n return true;\n }\n } else {\n // Exact MIME type match\n if (file.type.toLowerCase() === acceptType) {\n return true;\n }\n }\n }\n\n return false;\n }\n}\n"]}