@styloviz/file-upload 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 StyloViz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # @styloviz/file-upload
2
+
3
+ > Drag-and-drop file uploader with previews, type/size validation and progress.
4
+
5
+ Part of the **StyloViz UI Kit** — a premium Angular 21 + Tailwind CSS 4 dashboard component library. Standalone, `OnPush`, strongly typed, dark-mode ready.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @styloviz/core @styloviz/file-upload
11
+ ```
12
+
13
+ Requires `@angular/core` and `@angular/common` >= 21. `@styloviz/core` is a peer dependency shared by every component. Prefer everything at once? `@styloviz/all` installs the whole free tier in one command.
14
+
15
+ ## Usage
16
+
17
+ ```ts
18
+ import { SvFileUploadComponent } from '@styloviz/file-upload';
19
+
20
+ @Component({
21
+ standalone: true,
22
+ imports: [SvFileUploadComponent],
23
+ template: `
24
+ <sv-file-upload />
25
+ `,
26
+ })
27
+ export class DemoComponent {}
28
+ ```
29
+
30
+ ## Inputs
31
+
32
+ | Input | Type | Default | Description |
33
+ | --- | --- | --- | --- |
34
+ | `variant` | `FileUploadVariant` | `'button'` | Trigger style: button or drag-and-drop dropzone. |
35
+ | `size` | `FileUploadSize` | `'md'` | Control size: sm, md or lg. |
36
+ | `accept` | `string` | `''` | Accepted file types (e.g. "image/*,.pdf"). |
37
+ | `multiple` | `boolean` | `true` | Allow selecting multiple files. |
38
+ | `maxFiles` | `number` | `10` | Maximum number of files. |
39
+ | `maxSizeMb` | `number` | `10` | Per-file size limit in MB. |
40
+ | `disabled` | `boolean` | `false` | Disable the uploader. |
41
+ | `autoSimulate` | `boolean` | `false` | Simulate upload progress after a file is added (demo only). |
42
+ | `label` | `string` | `'Upload files'` | Trigger/label text. |
43
+ | `hint` | `string` | `''` | Helper text shown under the trigger. |
44
+ | `customClass` | `string` | `''` | Extra CSS classes for the root. |
45
+
46
+ ## Outputs
47
+
48
+ | Output | Type | Description |
49
+ | --- | --- | --- |
50
+ | `filesChange` | `UploadFile[]` | Emitted with the full file list whenever it changes. |
51
+ | `fileAdded` | `UploadFile` | Emitted when a single file is added. |
52
+ | `fileRemoved` | `string` | Emitted with the id of a removed file. |
53
+ | `uploadComplete` | `UploadFile[]` | Emitted when all uploads finish successfully. |
54
+ | `uploadError` | `UploadFile` | Emitted when a file fails validation or upload. |
55
+
56
+ ## Documentation
57
+
58
+ Full API reference and live demos: https://styloviz.dev/docs
59
+
60
+ ## License
61
+
62
+ MIT
@@ -0,0 +1,335 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, PLATFORM_ID, input, output, signal, viewChild, computed, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { isPlatformBrowser, NgClass } from '@angular/common';
4
+
5
+ const FILE_ICONS = {
6
+ pdf: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM14 2v6h6M11 13H9M15 17H9M15 13h-1',
7
+ doc: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM14 2v6h6M16 17H8M16 13H8M10 9H8',
8
+ xls: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM14 2v6h6M8 13l8 8M16 13l-8 8',
9
+ zip: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM14 2v6h6M12 18v-7M9 15l3 3 3-3',
10
+ img: 'M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z',
11
+ vid: 'M22.54 6.42a2.78 2.78 0 0 0-1.95-1.96C18.88 4 12 4 12 4s-6.88 0-8.59.46A2.78 2.78 0 0 0 1.46 6.42 29 29 0 0 0 1 12a29 29 0 0 0 .46 5.58a2.78 2.78 0 0 0 1.95 1.96C5.12 20 12 20 12 20s6.88 0 8.59-.46a2.78 2.78 0 0 0 1.95-1.96A29 29 0 0 0 23 12a29 29 0 0 0-.46-5.58zM9.75 15.02l5.5-3.02-5.5-3.02v6.04z',
12
+ audio: 'M9 18V5l12-2v13M9 18a3 3 0 1 1-6 0 3 3 0 0 1 6 0zm12-2a3 3 0 1 1-6 0 3 3 0 0 1 6 0z',
13
+ file: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM14 2v6h6',
14
+ };
15
+ const EXT_MAP = {
16
+ pdf: 'pdf', doc: 'doc', docx: 'doc', xls: 'xls', xlsx: 'xls',
17
+ zip: 'zip', rar: 'zip', gz: 'zip',
18
+ mp4: 'vid', mov: 'vid', avi: 'vid', webm: 'vid',
19
+ mp3: 'audio', wav: 'audio', ogg: 'audio',
20
+ png: 'img', jpg: 'img', jpeg: 'img', gif: 'img', webp: 'img', svg: 'img',
21
+ };
22
+ const BADGE_COLOR = {
23
+ pdf: 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300',
24
+ doc: 'bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300',
25
+ xls: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300',
26
+ zip: 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/40 dark:text-yellow-300',
27
+ img: 'bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300',
28
+ vid: 'bg-pink-100 text-pink-700 dark:bg-pink-900/40 dark:text-pink-300',
29
+ audio: 'bg-indigo-100 text-indigo-700 dark:bg-indigo-900/40 dark:text-indigo-300',
30
+ file: 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300',
31
+ };
32
+ class SvFileUploadComponent {
33
+ static idCounter = 0;
34
+ platformId = inject(PLATFORM_ID);
35
+ uid() {
36
+ return `uf-${++SvFileUploadComponent.idCounter}-${Math.random().toString(36).slice(2, 7)}`;
37
+ }
38
+ // ── Inputs ─────────────────────────────────────────────────────────────────
39
+ /** Trigger style: button or drag-and-drop dropzone. @default 'button' */
40
+ variant = input('button', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
41
+ /** Control size: sm, md or lg. @default 'md' */
42
+ size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
43
+ /** Accepted file types (e.g. "image/*,.pdf"). */
44
+ accept = input('', ...(ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ [])); // e.g. "image/*,.pdf"
45
+ /** Allow selecting multiple files. @default true */
46
+ multiple = input(true, ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
47
+ /** Maximum number of files. @default 10 */
48
+ maxFiles = input(10, ...(ngDevMode ? [{ debugName: "maxFiles" }] : /* istanbul ignore next */ []));
49
+ /** Per-file size limit in MB. @default 10 */
50
+ maxSizeMb = input(10, ...(ngDevMode ? [{ debugName: "maxSizeMb" }] : /* istanbul ignore next */ [])); // per-file max in MB
51
+ /** Disable the uploader. @default false */
52
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
53
+ /** Simulate upload progress after a file is added (demo only). @default false */
54
+ autoSimulate = input(false, ...(ngDevMode ? [{ debugName: "autoSimulate" }] : /* istanbul ignore next */ [])); // simulate progress after add — opt-in only
55
+ /** Trigger/label text. @default 'Upload files' */
56
+ label = input('Upload files', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
57
+ /** Helper text shown under the trigger. */
58
+ hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
59
+ /** Extra CSS classes for the root. */
60
+ customClass = input('', ...(ngDevMode ? [{ debugName: "customClass" }] : /* istanbul ignore next */ []));
61
+ // ── Outputs ────────────────────────────────────────────────────────────────
62
+ /** Emitted with the full file list whenever it changes. */
63
+ filesChange = output();
64
+ /** Emitted when a single file is added. */
65
+ fileAdded = output();
66
+ /** Emitted with the id of a removed file. */
67
+ fileRemoved = output();
68
+ /** Emitted when all uploads finish successfully. */
69
+ uploadComplete = output();
70
+ /** Emitted when a file fails validation or upload. */
71
+ uploadError = output();
72
+ // ── Internal state ─────────────────────────────────────────────────────────
73
+ files = signal([], ...(ngDevMode ? [{ debugName: "files" }] : /* istanbul ignore next */ []));
74
+ isDragOver = signal(false, ...(ngDevMode ? [{ debugName: "isDragOver" }] : /* istanbul ignore next */ []));
75
+ fileInput = viewChild('fileInput', ...(ngDevMode ? [{ debugName: "fileInput" }] : /* istanbul ignore next */ []));
76
+ timers = [];
77
+ // ── Computed helpers ───────────────────────────────────────────────────────
78
+ hasFiles = computed(() => this.files().length > 0, ...(ngDevMode ? [{ debugName: "hasFiles" }] : /* istanbul ignore next */ []));
79
+ canAddMore = computed(() => this.files().length < this.maxFiles(), ...(ngDevMode ? [{ debugName: "canAddMore" }] : /* istanbul ignore next */ []));
80
+ successCount = computed(() => this.files().filter(f => f.status === 'success').length, ...(ngDevMode ? [{ debugName: "successCount" }] : /* istanbul ignore next */ []));
81
+ errorCount = computed(() => this.files().filter(f => f.status === 'error').length, ...(ngDevMode ? [{ debugName: "errorCount" }] : /* istanbul ignore next */ []));
82
+ uploadingCount = computed(() => this.files().filter(f => f.status === 'uploading').length, ...(ngDevMode ? [{ debugName: "uploadingCount" }] : /* istanbul ignore next */ []));
83
+ overallProgress = computed(() => {
84
+ const all = this.files();
85
+ if (!all.length)
86
+ return 0;
87
+ return Math.round(all.reduce((s, f) => s + f.progress, 0) / all.length);
88
+ }, ...(ngDevMode ? [{ debugName: "overallProgress" }] : /* istanbul ignore next */ []));
89
+ /** Screen-reader status summary (announced politely via an aria-live region). */
90
+ statusMessage = computed(() => {
91
+ const all = this.files();
92
+ if (!all.length)
93
+ return '';
94
+ const up = this.uploadingCount();
95
+ if (up > 0)
96
+ return `Uploading ${up} file${up === 1 ? '' : 's'}, ${this.overallProgress()} percent`;
97
+ const parts = [`${all.length} file${all.length === 1 ? '' : 's'} selected`];
98
+ if (this.successCount())
99
+ parts.push(`${this.successCount()} uploaded`);
100
+ if (this.errorCount())
101
+ parts.push(`${this.errorCount()} failed`);
102
+ return parts.join(', ');
103
+ }, ...(ngDevMode ? [{ debugName: "statusMessage" }] : /* istanbul ignore next */ []));
104
+ // ── Zone classes ───────────────────────────────────────────────────────────
105
+ zoneClasses = computed(() => {
106
+ const drag = this.isDragOver();
107
+ const dis = this.disabled();
108
+ const base = [
109
+ 'relative flex flex-col items-center justify-center rounded-xl border-2 border-dashed',
110
+ 'transition-all duration-200 cursor-pointer outline-none',
111
+ 'focus-visible:ring-2 focus-visible:ring-primary-400 focus-visible:ring-offset-2',
112
+ ];
113
+ const sizes = {
114
+ sm: 'gap-2 px-6 py-8',
115
+ md: 'gap-3 px-8 py-12',
116
+ lg: 'gap-4 px-10 py-16',
117
+ };
118
+ base.push(sizes[this.size()]);
119
+ if (dis) {
120
+ base.push('border-gray-200 bg-gray-50 opacity-60 cursor-not-allowed dark:border-gray-700 dark:bg-gray-800/40');
121
+ }
122
+ else if (drag) {
123
+ base.push('border-primary-400 bg-primary-50/60 dark:border-primary-500 dark:bg-primary-900/20 scale-[1.01]');
124
+ }
125
+ else {
126
+ base.push('border-gray-300 bg-gray-50/50 hover:border-primary-400 hover:bg-primary-50/30 dark:border-gray-700 dark:bg-gray-800/30 dark:hover:border-primary-500 dark:hover:bg-primary-900/10');
127
+ }
128
+ return base.join(' ');
129
+ }, ...(ngDevMode ? [{ debugName: "zoneClasses" }] : /* istanbul ignore next */ []));
130
+ iconSize = computed(() => ({ sm: 'h-8 w-8', md: 'h-10 w-10', lg: 'h-12 w-12' })[this.size()], ...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
131
+ labelClass = computed(() => ({ sm: 'text-sm', md: 'text-base', lg: 'text-lg' })[this.size()], ...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
132
+ hintClass = computed(() => ({ sm: 'text-xs', md: 'text-sm', lg: 'text-base' })[this.size()], ...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
133
+ // ── Public helpers used in template ───────────────────────────────────────
134
+ getIcon(file) {
135
+ const ext = file.name.split('.').pop()?.toLowerCase() ?? '';
136
+ const kind = EXT_MAP[ext] ?? (file.type.startsWith('image/') ? 'img' : 'file');
137
+ return FILE_ICONS[kind] ?? FILE_ICONS['file'];
138
+ }
139
+ getBadgeColor(file) {
140
+ const ext = file.name.split('.').pop()?.toLowerCase() ?? '';
141
+ const kind = EXT_MAP[ext] ?? (file.type.startsWith('image/') ? 'img' : 'file');
142
+ return BADGE_COLOR[kind] ?? BADGE_COLOR['file'];
143
+ }
144
+ getExtLabel(file) {
145
+ return (file.name.split('.').pop()?.toUpperCase() ?? 'FILE').slice(0, 5);
146
+ }
147
+ formatSize(bytes) {
148
+ if (bytes < 1024)
149
+ return `${bytes} B`;
150
+ if (bytes < 1024 ** 2)
151
+ return `${(bytes / 1024).toFixed(1)} KB`;
152
+ return `${(bytes / 1024 ** 2).toFixed(1)} MB`;
153
+ }
154
+ isImage(file) {
155
+ return file.type.startsWith('image/') && !!file.preview;
156
+ }
157
+ // ── File input / drag ─────────────────────────────────────────────────────
158
+ openFilePicker() {
159
+ if (this.disabled() || !this.canAddMore())
160
+ return;
161
+ this.fileInput()?.nativeElement.click();
162
+ }
163
+ onFileInputChange(e) {
164
+ const input = e.target;
165
+ if (input.files)
166
+ this.addFiles(Array.from(input.files));
167
+ input.value = '';
168
+ }
169
+ onDragOver(e) {
170
+ e.preventDefault();
171
+ if (!this.disabled())
172
+ this.isDragOver.set(true);
173
+ }
174
+ onDragLeave(e) {
175
+ if (!e.currentTarget.contains(e.relatedTarget)) {
176
+ this.isDragOver.set(false);
177
+ }
178
+ }
179
+ onDrop(e) {
180
+ e.preventDefault();
181
+ this.isDragOver.set(false);
182
+ if (this.disabled())
183
+ return;
184
+ const dropped = Array.from(e.dataTransfer?.files ?? []);
185
+ this.addFiles(dropped);
186
+ }
187
+ onZoneKeydown(e) {
188
+ if (e.key === 'Enter' || e.key === ' ') {
189
+ e.preventDefault();
190
+ this.openFilePicker();
191
+ }
192
+ }
193
+ /** Whether a file matches the `accept` filter (mime, mime/*, or .ext). */
194
+ isAccepted(file) {
195
+ const accept = this.accept().trim();
196
+ if (!accept)
197
+ return true;
198
+ const tokens = accept.split(',').map(t => t.trim().toLowerCase()).filter(Boolean);
199
+ if (!tokens.length)
200
+ return true;
201
+ const name = file.name.toLowerCase();
202
+ const type = file.type.toLowerCase();
203
+ return tokens.some(tok => {
204
+ if (tok.startsWith('.'))
205
+ return name.endsWith(tok);
206
+ if (tok.endsWith('/*'))
207
+ return type.startsWith(tok.slice(0, -1));
208
+ return type === tok;
209
+ });
210
+ }
211
+ // ── Core file logic ────────────────────────────────────────────────────────
212
+ addFiles(rawFiles) {
213
+ const remaining = this.maxFiles() - this.files().length;
214
+ const toAdd = this.multiple() ? rawFiles.slice(0, remaining) : rawFiles.slice(0, 1);
215
+ const newEntries = [];
216
+ for (const file of toAdd) {
217
+ const sizeMb = file.size / 1024 / 1024;
218
+ const entry = {
219
+ id: this.uid(),
220
+ file,
221
+ name: file.name,
222
+ size: file.size,
223
+ type: file.type,
224
+ status: 'pending',
225
+ progress: 0,
226
+ };
227
+ if (sizeMb > this.maxSizeMb()) {
228
+ entry.status = 'error';
229
+ entry.errorMsg = `File exceeds ${this.maxSizeMb()} MB limit`;
230
+ entry.progress = 0;
231
+ this.uploadError.emit(entry);
232
+ }
233
+ else if (!this.isAccepted(file)) {
234
+ entry.status = 'error';
235
+ entry.errorMsg = 'File type not allowed';
236
+ entry.progress = 0;
237
+ this.uploadError.emit(entry);
238
+ }
239
+ // Generate preview for images
240
+ if (file.type.startsWith('image/') && entry.status !== 'error') {
241
+ const reader = new FileReader();
242
+ reader.onload = (ev) => {
243
+ this.files.update(list => list.map(f => f.id === entry.id ? { ...f, preview: ev.target?.result } : f));
244
+ };
245
+ reader.readAsDataURL(file);
246
+ }
247
+ newEntries.push(entry);
248
+ }
249
+ this.files.update(list => [...list, ...newEntries]);
250
+ for (const entry of newEntries) {
251
+ this.fileAdded.emit(entry);
252
+ if (entry.status !== 'error' && this.autoSimulate()) {
253
+ this.simulateUpload(entry.id);
254
+ }
255
+ }
256
+ this.filesChange.emit(this.files());
257
+ }
258
+ simulateUpload(id) {
259
+ // Skip simulation in SSR environments where setTimeout is unreliable.
260
+ if (!isPlatformBrowser(this.platformId))
261
+ return;
262
+ this.files.update(list => list.map(f => f.id === id ? { ...f, status: 'uploading' } : f));
263
+ const duration = 1200 + Math.random() * 1800;
264
+ const interval = 80;
265
+ const steps = Math.round(duration / interval);
266
+ let step = 0;
267
+ const tick = () => {
268
+ step++;
269
+ const progress = Math.min(100, Math.round((step / steps) * 100));
270
+ const isDone = step >= steps;
271
+ const hasErr = Math.random() < 0.08 && progress > 40 && !isDone; // 8% random error
272
+ this.files.update(list => list.map(f => {
273
+ if (f.id !== id)
274
+ return f;
275
+ if (hasErr)
276
+ return { ...f, status: 'error', progress, errorMsg: 'Upload failed — server error' };
277
+ if (isDone)
278
+ return { ...f, status: 'success', progress: 100 };
279
+ return { ...f, progress };
280
+ }));
281
+ if (hasErr) {
282
+ const errFile = this.files().find(f => f.id === id);
283
+ if (errFile)
284
+ this.uploadError.emit(errFile);
285
+ return;
286
+ }
287
+ if (isDone) {
288
+ const allDone = this.files().every(f => f.status === 'success' || f.status === 'error');
289
+ if (allDone)
290
+ this.uploadComplete.emit(this.files());
291
+ return;
292
+ }
293
+ const t = setTimeout(tick, interval);
294
+ this.timers.push(t);
295
+ };
296
+ const t0 = setTimeout(tick, interval);
297
+ this.timers.push(t0);
298
+ }
299
+ retryFile(id) {
300
+ if (this.disabled())
301
+ return;
302
+ this.files.update(list => list.map(f => f.id === id ? { ...f, status: 'pending', progress: 0, errorMsg: undefined } : f));
303
+ if (this.autoSimulate())
304
+ this.simulateUpload(id);
305
+ }
306
+ removeFile(id) {
307
+ if (this.disabled())
308
+ return;
309
+ this.files.update(list => list.filter(f => f.id !== id));
310
+ this.fileRemoved.emit(id);
311
+ this.filesChange.emit(this.files());
312
+ }
313
+ clearAll() {
314
+ if (this.disabled())
315
+ return;
316
+ this.files.set([]);
317
+ this.filesChange.emit([]);
318
+ }
319
+ ngOnDestroy() {
320
+ this.timers.forEach(t => clearTimeout(t));
321
+ }
322
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: SvFileUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
323
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: SvFileUploadComponent, isStandalone: true, selector: "sv-file-upload", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, maxFiles: { classPropertyName: "maxFiles", publicName: "maxFiles", isSignal: true, isRequired: false, transformFunction: null }, maxSizeMb: { classPropertyName: "maxSizeMb", publicName: "maxSizeMb", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, autoSimulate: { classPropertyName: "autoSimulate", publicName: "autoSimulate", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, customClass: { classPropertyName: "customClass", publicName: "customClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filesChange: "filesChange", fileAdded: "fileAdded", fileRemoved: "fileRemoved", uploadComplete: "uploadComplete", uploadError: "uploadError" }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- Root -->\n<div [ngClass]=\"['flex flex-col gap-4 w-full', customClass()]\">\n\n <!-- \u2500\u2500 BUTTON trigger (free tier supports the button variant only) \u2500\u2500 -->\n\n <div class=\"flex items-center gap-3\">\n <button\n type=\"button\"\n [disabled]=\"disabled() || !canAddMore()\"\n class=\"inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm font-medium\n text-gray-700 shadow-sm transition-colors hover:bg-gray-50 focus:outline-none\n focus-visible:ring-2 focus-visible:ring-primary-400\n disabled:cursor-not-allowed disabled:opacity-50\n dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700\"\n (click)=\"openFilePicker()\"\n >\n <svg class=\"h-4 w-4\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12\"/>\n </svg>\n {{ label() }}\n </button>\n @if (hint()) {\n <span class=\"text-sm text-gray-500 dark:text-gray-400\">{{ hint() }}</span>\n }\n </div>\n\n <!-- Hidden file input -->\n <input\n #fileInput\n type=\"file\"\n class=\"sr-only\"\n [attr.accept]=\"accept() || null\"\n [attr.multiple]=\"multiple() || null\"\n [disabled]=\"disabled()\"\n (change)=\"onFileInputChange($event)\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n />\n\n <!-- Screen-reader status announcements -->\n <p class=\"sr-only\" role=\"status\" aria-live=\"polite\">{{ statusMessage() }}</p>\n\n <!-- \u2500\u2500 Overall progress bar (while uploading) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @if (uploadingCount() > 0) {\n <div class=\"space-y-1\">\n <div class=\"flex items-center justify-between text-xs text-gray-500 dark:text-gray-400\">\n <span>Uploading {{ uploadingCount() }} file{{ uploadingCount() === 1 ? '' : 's' }}\u2026</span>\n <span class=\"tabular-nums font-medium\">{{ overallProgress() }}%</span>\n </div>\n <div\n class=\"h-1.5 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"overallProgress()\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n aria-label=\"Overall upload progress\"\n >\n <div\n class=\"h-full rounded-full bg-primary-500 transition-all duration-150 dark:bg-primary-400\"\n [style.width.%]=\"overallProgress()\"\n ></div>\n </div>\n </div>\n }\n\n <!-- \u2500\u2500 File list \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @if (hasFiles()) {\n <ul class=\"space-y-2\" role=\"list\" aria-label=\"Uploaded files\">\n\n @for (file of files(); track file.id) {\n <li\n [ngClass]=\"[\n 'group flex items-center gap-3 rounded-xl border p-3 transition-colors',\n file.status === 'error'\n ? 'border-red-200 bg-red-50 dark:border-red-800/50 dark:bg-red-900/10'\n : file.status === 'success'\n ? 'border-emerald-200 bg-emerald-50 dark:border-emerald-800/50 dark:bg-emerald-900/10'\n : 'border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800/50'\n ]\"\n >\n\n <!-- Thumbnail or type badge -->\n <div class=\"relative flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg\"\n [ngClass]=\"isImage(file)\n ? 'border border-gray-200 dark:border-gray-700'\n : 'bg-gray-100 dark:bg-gray-800'\">\n @if (isImage(file)) {\n <img [src]=\"file.preview\" [alt]=\"file.name\"\n class=\"h-full w-full object-cover\" aria-hidden=\"true\"/>\n } @else {\n <svg class=\"h-5 w-5 text-gray-500 dark:text-gray-400\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"1.5\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path [attr.d]=\"getIcon(file)\"/>\n </svg>\n }\n </div>\n\n <!-- File info -->\n <div class=\"min-w-0 flex-1\">\n <div class=\"flex items-center gap-2\">\n <p class=\"truncate text-sm font-medium text-gray-800 dark:text-gray-100\"\n [title]=\"file.name\">{{ file.name }}</p>\n <span [ngClass]=\"['shrink-0 rounded px-1.5 py-0.5 text-xs font-semibold', getBadgeColor(file)]\">\n {{ getExtLabel(file) }}\n </span>\n </div>\n <div class=\"mt-0.5 flex items-center gap-2\">\n <span class=\"text-xs text-gray-500 dark:text-gray-400\">{{ formatSize(file.size) }}</span>\n\n @if (file.status === 'uploading') {\n <span class=\"text-xs text-gray-500 dark:text-gray-400 tabular-nums\">{{ file.progress }}%</span>\n } @else if (file.status === 'success') {\n <span class=\"flex items-center gap-1 text-xs font-medium text-emerald-600 dark:text-emerald-400\">\n <svg class=\"h-3 w-3\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"m20 6-11 11-5-5\"/>\n </svg>\n Uploaded\n </span>\n } @else if (file.status === 'error') {\n <span class=\"flex items-center gap-1 text-xs font-medium text-red-600 dark:text-red-400\">\n <svg class=\"h-3 w-3\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"/>\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"/>\n <line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"/>\n </svg>\n {{ file.errorMsg ?? 'Upload failed' }}\n </span>\n } @else {\n <span class=\"text-xs text-gray-500 dark:text-gray-400\">Pending</span>\n }\n </div>\n\n <!-- Progress bar -->\n @if (file.status === 'uploading' || (file.status === 'pending' && autoSimulate())) {\n <div\n class=\"mt-1.5 h-1 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"file.progress\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-label]=\"'Uploading ' + file.name\"\n >\n <div\n class=\"h-full rounded-full bg-primary-500 transition-all duration-150 dark:bg-primary-400\"\n [style.width.%]=\"file.progress\"\n ></div>\n </div>\n }\n </div>\n\n <!-- Actions -->\n <div class=\"flex shrink-0 items-center gap-1\">\n\n <!-- Retry button (error) -->\n @if (file.status === 'error') {\n <button\n type=\"button\"\n class=\"flex h-7 w-7 items-center justify-center rounded-lg text-gray-400\n transition-colors hover:bg-gray-100 hover:text-primary-600\n dark:hover:bg-gray-700 dark:hover:text-primary-400 focus:outline-none\n focus-visible:ring-1 focus-visible:ring-primary-400 disabled:opacity-40 disabled:cursor-not-allowed\"\n [attr.aria-label]=\"'Retry ' + file.name\"\n [disabled]=\"disabled()\"\n (click)=\"retryFile(file.id)\"\n >\n <svg class=\"h-3.5 w-3.5\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2.5\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <polyline points=\"1 4 1 10 7 10\"/>\n <path d=\"M3.51 15a9 9 0 1 0 .49-4.3\"/>\n </svg>\n </button>\n }\n\n <!-- Spinning indicator for uploading -->\n @if (file.status === 'uploading') {\n <span class=\"flex h-7 w-7 items-center justify-center text-primary-500 dark:text-primary-400\" aria-hidden=\"true\">\n <svg class=\"h-4 w-4 animate-spin\" fill=\"none\" viewBox=\"0 0 24 24\">\n <circle class=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" stroke-width=\"4\"/>\n <path class=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z\"/>\n </svg>\n </span>\n }\n\n <!-- Remove button -->\n <button\n type=\"button\"\n class=\"flex h-7 w-7 items-center justify-center rounded-lg text-gray-400\n transition-colors hover:bg-gray-100 hover:text-red-500\n dark:hover:bg-gray-700 dark:hover:text-red-400 focus:outline-none\n focus-visible:ring-1 focus-visible:ring-red-400 disabled:opacity-40 disabled:cursor-not-allowed\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n [disabled]=\"disabled()\"\n (click)=\"removeFile(file.id)\"\n >\n <svg class=\"h-3.5 w-3.5\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2.5\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M18 6 6 18M6 6l12 12\"/>\n </svg>\n </button>\n\n </div>\n </li>\n }\n\n </ul>\n\n <!-- File list footer -->\n <div class=\"flex items-center justify-between\">\n <p class=\"text-xs text-gray-500 dark:text-gray-400\">\n {{ files().length }} file{{ files().length === 1 ? '' : 's' }}\n @if (successCount() > 0) {\n &nbsp;&middot;&nbsp;\n <span class=\"text-emerald-600 dark:text-emerald-400 font-medium\">{{ successCount() }} uploaded</span>\n }\n @if (errorCount() > 0) {\n &nbsp;&middot;&nbsp;\n <span class=\"text-red-600 dark:text-red-400 font-medium\">{{ errorCount() }} failed</span>\n }\n </p>\n <button\n type=\"button\"\n class=\"text-xs text-gray-400 transition-colors hover:text-red-500 dark:text-gray-500 dark:hover:text-red-400\n focus:outline-none focus-visible:ring-1 focus-visible:ring-red-400 rounded disabled:opacity-40 disabled:cursor-not-allowed\"\n [disabled]=\"disabled()\"\n (click)=\"clearAll()\"\n aria-label=\"Remove all files\"\n >\n Clear all\n </button>\n </div>\n }\n\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
324
+ }
325
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: SvFileUploadComponent, decorators: [{
326
+ type: Component,
327
+ args: [{ selector: 'sv-file-upload', standalone: true, imports: [NgClass], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- Root -->\n<div [ngClass]=\"['flex flex-col gap-4 w-full', customClass()]\">\n\n <!-- \u2500\u2500 BUTTON trigger (free tier supports the button variant only) \u2500\u2500 -->\n\n <div class=\"flex items-center gap-3\">\n <button\n type=\"button\"\n [disabled]=\"disabled() || !canAddMore()\"\n class=\"inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm font-medium\n text-gray-700 shadow-sm transition-colors hover:bg-gray-50 focus:outline-none\n focus-visible:ring-2 focus-visible:ring-primary-400\n disabled:cursor-not-allowed disabled:opacity-50\n dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700\"\n (click)=\"openFilePicker()\"\n >\n <svg class=\"h-4 w-4\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12\"/>\n </svg>\n {{ label() }}\n </button>\n @if (hint()) {\n <span class=\"text-sm text-gray-500 dark:text-gray-400\">{{ hint() }}</span>\n }\n </div>\n\n <!-- Hidden file input -->\n <input\n #fileInput\n type=\"file\"\n class=\"sr-only\"\n [attr.accept]=\"accept() || null\"\n [attr.multiple]=\"multiple() || null\"\n [disabled]=\"disabled()\"\n (change)=\"onFileInputChange($event)\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n />\n\n <!-- Screen-reader status announcements -->\n <p class=\"sr-only\" role=\"status\" aria-live=\"polite\">{{ statusMessage() }}</p>\n\n <!-- \u2500\u2500 Overall progress bar (while uploading) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @if (uploadingCount() > 0) {\n <div class=\"space-y-1\">\n <div class=\"flex items-center justify-between text-xs text-gray-500 dark:text-gray-400\">\n <span>Uploading {{ uploadingCount() }} file{{ uploadingCount() === 1 ? '' : 's' }}\u2026</span>\n <span class=\"tabular-nums font-medium\">{{ overallProgress() }}%</span>\n </div>\n <div\n class=\"h-1.5 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"overallProgress()\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n aria-label=\"Overall upload progress\"\n >\n <div\n class=\"h-full rounded-full bg-primary-500 transition-all duration-150 dark:bg-primary-400\"\n [style.width.%]=\"overallProgress()\"\n ></div>\n </div>\n </div>\n }\n\n <!-- \u2500\u2500 File list \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @if (hasFiles()) {\n <ul class=\"space-y-2\" role=\"list\" aria-label=\"Uploaded files\">\n\n @for (file of files(); track file.id) {\n <li\n [ngClass]=\"[\n 'group flex items-center gap-3 rounded-xl border p-3 transition-colors',\n file.status === 'error'\n ? 'border-red-200 bg-red-50 dark:border-red-800/50 dark:bg-red-900/10'\n : file.status === 'success'\n ? 'border-emerald-200 bg-emerald-50 dark:border-emerald-800/50 dark:bg-emerald-900/10'\n : 'border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800/50'\n ]\"\n >\n\n <!-- Thumbnail or type badge -->\n <div class=\"relative flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg\"\n [ngClass]=\"isImage(file)\n ? 'border border-gray-200 dark:border-gray-700'\n : 'bg-gray-100 dark:bg-gray-800'\">\n @if (isImage(file)) {\n <img [src]=\"file.preview\" [alt]=\"file.name\"\n class=\"h-full w-full object-cover\" aria-hidden=\"true\"/>\n } @else {\n <svg class=\"h-5 w-5 text-gray-500 dark:text-gray-400\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"1.5\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path [attr.d]=\"getIcon(file)\"/>\n </svg>\n }\n </div>\n\n <!-- File info -->\n <div class=\"min-w-0 flex-1\">\n <div class=\"flex items-center gap-2\">\n <p class=\"truncate text-sm font-medium text-gray-800 dark:text-gray-100\"\n [title]=\"file.name\">{{ file.name }}</p>\n <span [ngClass]=\"['shrink-0 rounded px-1.5 py-0.5 text-xs font-semibold', getBadgeColor(file)]\">\n {{ getExtLabel(file) }}\n </span>\n </div>\n <div class=\"mt-0.5 flex items-center gap-2\">\n <span class=\"text-xs text-gray-500 dark:text-gray-400\">{{ formatSize(file.size) }}</span>\n\n @if (file.status === 'uploading') {\n <span class=\"text-xs text-gray-500 dark:text-gray-400 tabular-nums\">{{ file.progress }}%</span>\n } @else if (file.status === 'success') {\n <span class=\"flex items-center gap-1 text-xs font-medium text-emerald-600 dark:text-emerald-400\">\n <svg class=\"h-3 w-3\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"m20 6-11 11-5-5\"/>\n </svg>\n Uploaded\n </span>\n } @else if (file.status === 'error') {\n <span class=\"flex items-center gap-1 text-xs font-medium text-red-600 dark:text-red-400\">\n <svg class=\"h-3 w-3\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"/>\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"/>\n <line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"/>\n </svg>\n {{ file.errorMsg ?? 'Upload failed' }}\n </span>\n } @else {\n <span class=\"text-xs text-gray-500 dark:text-gray-400\">Pending</span>\n }\n </div>\n\n <!-- Progress bar -->\n @if (file.status === 'uploading' || (file.status === 'pending' && autoSimulate())) {\n <div\n class=\"mt-1.5 h-1 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"file.progress\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-label]=\"'Uploading ' + file.name\"\n >\n <div\n class=\"h-full rounded-full bg-primary-500 transition-all duration-150 dark:bg-primary-400\"\n [style.width.%]=\"file.progress\"\n ></div>\n </div>\n }\n </div>\n\n <!-- Actions -->\n <div class=\"flex shrink-0 items-center gap-1\">\n\n <!-- Retry button (error) -->\n @if (file.status === 'error') {\n <button\n type=\"button\"\n class=\"flex h-7 w-7 items-center justify-center rounded-lg text-gray-400\n transition-colors hover:bg-gray-100 hover:text-primary-600\n dark:hover:bg-gray-700 dark:hover:text-primary-400 focus:outline-none\n focus-visible:ring-1 focus-visible:ring-primary-400 disabled:opacity-40 disabled:cursor-not-allowed\"\n [attr.aria-label]=\"'Retry ' + file.name\"\n [disabled]=\"disabled()\"\n (click)=\"retryFile(file.id)\"\n >\n <svg class=\"h-3.5 w-3.5\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2.5\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <polyline points=\"1 4 1 10 7 10\"/>\n <path d=\"M3.51 15a9 9 0 1 0 .49-4.3\"/>\n </svg>\n </button>\n }\n\n <!-- Spinning indicator for uploading -->\n @if (file.status === 'uploading') {\n <span class=\"flex h-7 w-7 items-center justify-center text-primary-500 dark:text-primary-400\" aria-hidden=\"true\">\n <svg class=\"h-4 w-4 animate-spin\" fill=\"none\" viewBox=\"0 0 24 24\">\n <circle class=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" stroke-width=\"4\"/>\n <path class=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z\"/>\n </svg>\n </span>\n }\n\n <!-- Remove button -->\n <button\n type=\"button\"\n class=\"flex h-7 w-7 items-center justify-center rounded-lg text-gray-400\n transition-colors hover:bg-gray-100 hover:text-red-500\n dark:hover:bg-gray-700 dark:hover:text-red-400 focus:outline-none\n focus-visible:ring-1 focus-visible:ring-red-400 disabled:opacity-40 disabled:cursor-not-allowed\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n [disabled]=\"disabled()\"\n (click)=\"removeFile(file.id)\"\n >\n <svg class=\"h-3.5 w-3.5\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2.5\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M18 6 6 18M6 6l12 12\"/>\n </svg>\n </button>\n\n </div>\n </li>\n }\n\n </ul>\n\n <!-- File list footer -->\n <div class=\"flex items-center justify-between\">\n <p class=\"text-xs text-gray-500 dark:text-gray-400\">\n {{ files().length }} file{{ files().length === 1 ? '' : 's' }}\n @if (successCount() > 0) {\n &nbsp;&middot;&nbsp;\n <span class=\"text-emerald-600 dark:text-emerald-400 font-medium\">{{ successCount() }} uploaded</span>\n }\n @if (errorCount() > 0) {\n &nbsp;&middot;&nbsp;\n <span class=\"text-red-600 dark:text-red-400 font-medium\">{{ errorCount() }} failed</span>\n }\n </p>\n <button\n type=\"button\"\n class=\"text-xs text-gray-400 transition-colors hover:text-red-500 dark:text-gray-500 dark:hover:text-red-400\n focus:outline-none focus-visible:ring-1 focus-visible:ring-red-400 rounded disabled:opacity-40 disabled:cursor-not-allowed\"\n [disabled]=\"disabled()\"\n (click)=\"clearAll()\"\n aria-label=\"Remove all files\"\n >\n Clear all\n </button>\n </div>\n }\n\n</div>\n" }]
328
+ }], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], maxFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFiles", required: false }] }], maxSizeMb: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSizeMb", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], autoSimulate: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoSimulate", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], customClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "customClass", required: false }] }], filesChange: [{ type: i0.Output, args: ["filesChange"] }], fileAdded: [{ type: i0.Output, args: ["fileAdded"] }], fileRemoved: [{ type: i0.Output, args: ["fileRemoved"] }], uploadComplete: [{ type: i0.Output, args: ["uploadComplete"] }], uploadError: [{ type: i0.Output, args: ["uploadError"] }], fileInput: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }] } });
329
+
330
+ /**
331
+ * Generated bundle index. Do not edit.
332
+ */
333
+
334
+ export { SvFileUploadComponent };
335
+ //# sourceMappingURL=styloviz-file-upload.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styloviz-file-upload.mjs","sources":["../../../../projects/file-upload-free/src/lib/file-upload.component.ts","../../../../projects/file-upload-free/src/lib/file-upload.component.html","../../../../projects/file-upload-free/src/styloviz-file-upload.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n input,\n OnDestroy,\n output,\n PLATFORM_ID,\n signal,\n viewChild,\n} from '@angular/core';\nimport { isPlatformBrowser, NgClass } from '@angular/common';\n\nexport type FileUploadVariant = 'button';\nexport type FileUploadSize = 'sm' | 'md' | 'lg';\nexport type UploadFileStatus = 'pending' | 'uploading' | 'success' | 'error';\n\nexport interface UploadFile {\n id: string;\n file: File;\n name: string;\n size: number;\n type: string;\n status: UploadFileStatus;\n progress: number;\n preview?: string; // data-url for images\n errorMsg?: string;\n}\n\nconst FILE_ICONS: Record<string, string> = {\n pdf: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM14 2v6h6M11 13H9M15 17H9M15 13h-1',\n doc: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM14 2v6h6M16 17H8M16 13H8M10 9H8',\n xls: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM14 2v6h6M8 13l8 8M16 13l-8 8',\n zip: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM14 2v6h6M12 18v-7M9 15l3 3 3-3',\n img: 'M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z',\n vid: 'M22.54 6.42a2.78 2.78 0 0 0-1.95-1.96C18.88 4 12 4 12 4s-6.88 0-8.59.46A2.78 2.78 0 0 0 1.46 6.42 29 29 0 0 0 1 12a29 29 0 0 0 .46 5.58a2.78 2.78 0 0 0 1.95 1.96C5.12 20 12 20 12 20s6.88 0 8.59-.46a2.78 2.78 0 0 0 1.95-1.96A29 29 0 0 0 23 12a29 29 0 0 0-.46-5.58zM9.75 15.02l5.5-3.02-5.5-3.02v6.04z',\n audio:'M9 18V5l12-2v13M9 18a3 3 0 1 1-6 0 3 3 0 0 1 6 0zm12-2a3 3 0 1 1-6 0 3 3 0 0 1 6 0z',\n file: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM14 2v6h6',\n};\n\nconst EXT_MAP: Record<string, string> = {\n pdf: 'pdf', doc: 'doc', docx: 'doc', xls: 'xls', xlsx: 'xls',\n zip: 'zip', rar: 'zip', gz: 'zip',\n mp4: 'vid', mov: 'vid', avi: 'vid', webm: 'vid',\n mp3: 'audio', wav: 'audio', ogg: 'audio',\n png: 'img', jpg: 'img', jpeg: 'img', gif: 'img', webp: 'img', svg: 'img',\n};\n\nconst BADGE_COLOR: Record<string, string> = {\n pdf: 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300',\n doc: 'bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300',\n xls: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300',\n zip: 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/40 dark:text-yellow-300',\n img: 'bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300',\n vid: 'bg-pink-100 text-pink-700 dark:bg-pink-900/40 dark:text-pink-300',\n audio: 'bg-indigo-100 text-indigo-700 dark:bg-indigo-900/40 dark:text-indigo-300',\n file: 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300',\n};\n\n@Component({\n selector: 'sv-file-upload',\n standalone: true,\n imports: [NgClass],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './file-upload.component.html',\n})\nexport class SvFileUploadComponent implements OnDestroy {\n private static idCounter = 0;\n private readonly platformId = inject(PLATFORM_ID);\n\n private uid(): string {\n return `uf-${++SvFileUploadComponent.idCounter}-${Math.random().toString(36).slice(2, 7)}`;\n }\n\n // ── Inputs ─────────────────────────────────────────────────────────────────\n /** Trigger style: button or drag-and-drop dropzone. @default 'button' */\n variant = input<FileUploadVariant>('button');\n /** Control size: sm, md or lg. @default 'md' */\n size = input<FileUploadSize>('md');\n /** Accepted file types (e.g. \"image/*,.pdf\"). */\n accept = input<string>(''); // e.g. \"image/*,.pdf\"\n /** Allow selecting multiple files. @default true */\n multiple = input(true);\n /** Maximum number of files. @default 10 */\n maxFiles = input(10);\n /** Per-file size limit in MB. @default 10 */\n maxSizeMb = input(10); // per-file max in MB\n /** Disable the uploader. @default false */\n disabled = input(false);\n /** Simulate upload progress after a file is added (demo only). @default false */\n autoSimulate = input(false); // simulate progress after add — opt-in only\n /** Trigger/label text. @default 'Upload files' */\n label = input('Upload files');\n /** Helper text shown under the trigger. */\n hint = input('');\n /** Extra CSS classes for the root. */\n customClass = input('');\n\n // ── Outputs ────────────────────────────────────────────────────────────────\n /** Emitted with the full file list whenever it changes. */\n filesChange = output<UploadFile[]>();\n /** Emitted when a single file is added. */\n fileAdded = output<UploadFile>();\n /** Emitted with the id of a removed file. */\n fileRemoved = output<string>();\n /** Emitted when all uploads finish successfully. */\n uploadComplete = output<UploadFile[]>();\n /** Emitted when a file fails validation or upload. */\n uploadError = output<UploadFile>();\n\n // ── Internal state ─────────────────────────────────────────────────────────\n files = signal<UploadFile[]>([]);\n isDragOver = signal(false);\n\n private fileInput = viewChild<ElementRef<HTMLInputElement>>('fileInput');\n private timers: number[] = [];\n\n // ── Computed helpers ───────────────────────────────────────────────────────\n hasFiles = computed(() => this.files().length > 0);\n canAddMore = computed(() => this.files().length < this.maxFiles());\n successCount = computed(() => this.files().filter(f => f.status === 'success').length);\n errorCount = computed(() => this.files().filter(f => f.status === 'error').length);\n uploadingCount = computed(() => this.files().filter(f => f.status === 'uploading').length);\n\n overallProgress = computed(() => {\n const all = this.files();\n if (!all.length) return 0;\n return Math.round(all.reduce((s, f) => s + f.progress, 0) / all.length);\n });\n\n /** Screen-reader status summary (announced politely via an aria-live region). */\n statusMessage = computed<string>(() => {\n const all = this.files();\n if (!all.length) return '';\n const up = this.uploadingCount();\n if (up > 0) return `Uploading ${up} file${up === 1 ? '' : 's'}, ${this.overallProgress()} percent`;\n const parts = [`${all.length} file${all.length === 1 ? '' : 's'} selected`];\n if (this.successCount()) parts.push(`${this.successCount()} uploaded`);\n if (this.errorCount()) parts.push(`${this.errorCount()} failed`);\n return parts.join(', ');\n });\n\n // ── Zone classes ───────────────────────────────────────────────────────────\n zoneClasses = computed(() => {\n const drag = this.isDragOver();\n const dis = this.disabled();\n const base = [\n 'relative flex flex-col items-center justify-center rounded-xl border-2 border-dashed',\n 'transition-all duration-200 cursor-pointer outline-none',\n 'focus-visible:ring-2 focus-visible:ring-primary-400 focus-visible:ring-offset-2',\n ];\n const sizes: Record<FileUploadSize, string> = {\n sm: 'gap-2 px-6 py-8',\n md: 'gap-3 px-8 py-12',\n lg: 'gap-4 px-10 py-16',\n };\n base.push(sizes[this.size()]);\n if (dis) {\n base.push('border-gray-200 bg-gray-50 opacity-60 cursor-not-allowed dark:border-gray-700 dark:bg-gray-800/40');\n } else if (drag) {\n base.push('border-primary-400 bg-primary-50/60 dark:border-primary-500 dark:bg-primary-900/20 scale-[1.01]');\n } else {\n base.push('border-gray-300 bg-gray-50/50 hover:border-primary-400 hover:bg-primary-50/30 dark:border-gray-700 dark:bg-gray-800/30 dark:hover:border-primary-500 dark:hover:bg-primary-900/10');\n }\n return base.join(' ');\n });\n\n iconSize = computed(() => ({ sm: 'h-8 w-8', md: 'h-10 w-10', lg: 'h-12 w-12' })[this.size()]);\n labelClass = computed(() => ({ sm: 'text-sm', md: 'text-base', lg: 'text-lg' })[this.size()]);\n hintClass = computed(() => ({ sm: 'text-xs', md: 'text-sm', lg: 'text-base' })[this.size()]);\n\n // ── Public helpers used in template ───────────────────────────────────────\n getIcon(file: UploadFile): string {\n const ext = file.name.split('.').pop()?.toLowerCase() ?? '';\n const kind = EXT_MAP[ext] ?? (file.type.startsWith('image/') ? 'img' : 'file');\n return FILE_ICONS[kind] ?? FILE_ICONS['file'];\n }\n\n getBadgeColor(file: UploadFile): string {\n const ext = file.name.split('.').pop()?.toLowerCase() ?? '';\n const kind = EXT_MAP[ext] ?? (file.type.startsWith('image/') ? 'img' : 'file');\n return BADGE_COLOR[kind] ?? BADGE_COLOR['file'];\n }\n\n getExtLabel(file: UploadFile): string {\n return (file.name.split('.').pop()?.toUpperCase() ?? 'FILE').slice(0, 5);\n }\n\n formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 ** 2) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / 1024 ** 2).toFixed(1)} MB`;\n }\n\n isImage(file: UploadFile): boolean {\n return file.type.startsWith('image/') && !!file.preview;\n }\n\n // ── File input / drag ─────────────────────────────────────────────────────\n openFilePicker(): void {\n if (this.disabled() || !this.canAddMore()) return;\n this.fileInput()?.nativeElement.click();\n }\n\n onFileInputChange(e: Event): void {\n const input = e.target as HTMLInputElement;\n if (input.files) this.addFiles(Array.from(input.files));\n input.value = '';\n }\n\n onDragOver(e: DragEvent): void {\n e.preventDefault();\n if (!this.disabled()) this.isDragOver.set(true);\n }\n\n onDragLeave(e: DragEvent): void {\n if (!(e.currentTarget as HTMLElement).contains(e.relatedTarget as Node)) {\n this.isDragOver.set(false);\n }\n }\n\n onDrop(e: DragEvent): void {\n e.preventDefault();\n this.isDragOver.set(false);\n if (this.disabled()) return;\n const dropped = Array.from(e.dataTransfer?.files ?? []);\n this.addFiles(dropped);\n }\n\n onZoneKeydown(e: KeyboardEvent): void {\n if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); this.openFilePicker(); }\n }\n\n /** Whether a file matches the `accept` filter (mime, mime/*, or .ext). */\n private isAccepted(file: File): boolean {\n const accept = this.accept().trim();\n if (!accept) return true;\n const tokens = accept.split(',').map(t => t.trim().toLowerCase()).filter(Boolean);\n if (!tokens.length) return true;\n const name = file.name.toLowerCase();\n const type = file.type.toLowerCase();\n return tokens.some(tok => {\n if (tok.startsWith('.')) return name.endsWith(tok);\n if (tok.endsWith('/*')) return type.startsWith(tok.slice(0, -1));\n return type === tok;\n });\n }\n\n // ── Core file logic ────────────────────────────────────────────────────────\n private addFiles(rawFiles: File[]): void {\n const remaining = this.maxFiles() - this.files().length;\n const toAdd = this.multiple() ? rawFiles.slice(0, remaining) : rawFiles.slice(0, 1);\n\n const newEntries: UploadFile[] = [];\n\n for (const file of toAdd) {\n const sizeMb = file.size / 1024 / 1024;\n const entry: UploadFile = {\n id: this.uid(),\n file,\n name: file.name,\n size: file.size,\n type: file.type,\n status: 'pending',\n progress: 0,\n };\n\n if (sizeMb > this.maxSizeMb()) {\n entry.status = 'error';\n entry.errorMsg = `File exceeds ${this.maxSizeMb()} MB limit`;\n entry.progress = 0;\n this.uploadError.emit(entry);\n } else if (!this.isAccepted(file)) {\n entry.status = 'error';\n entry.errorMsg = 'File type not allowed';\n entry.progress = 0;\n this.uploadError.emit(entry);\n }\n\n // Generate preview for images\n if (file.type.startsWith('image/') && entry.status !== 'error') {\n const reader = new FileReader();\n reader.onload = (ev) => {\n this.files.update(list =>\n list.map(f => f.id === entry.id ? { ...f, preview: ev.target?.result as string } : f)\n );\n };\n reader.readAsDataURL(file);\n }\n\n newEntries.push(entry);\n }\n\n this.files.update(list => [...list, ...newEntries]);\n\n for (const entry of newEntries) {\n this.fileAdded.emit(entry);\n if (entry.status !== 'error' && this.autoSimulate()) {\n this.simulateUpload(entry.id);\n }\n }\n\n this.filesChange.emit(this.files());\n }\n\n private simulateUpload(id: string): void {\n // Skip simulation in SSR environments where setTimeout is unreliable.\n if (!isPlatformBrowser(this.platformId)) return;\n\n this.files.update(list =>\n list.map(f => f.id === id ? { ...f, status: 'uploading' as const } : f)\n );\n\n const duration = 1200 + Math.random() * 1800;\n const interval = 80;\n const steps = Math.round(duration / interval);\n let step = 0;\n\n const tick = () => {\n step++;\n const progress = Math.min(100, Math.round((step / steps) * 100));\n const isDone = step >= steps;\n const hasErr = Math.random() < 0.08 && progress > 40 && !isDone; // 8% random error\n\n this.files.update(list =>\n list.map(f => {\n if (f.id !== id) return f;\n if (hasErr) return { ...f, status: 'error' as const, progress, errorMsg: 'Upload failed — server error' };\n if (isDone) return { ...f, status: 'success' as const, progress: 100 };\n return { ...f, progress };\n })\n );\n\n if (hasErr) {\n const errFile = this.files().find(f => f.id === id);\n if (errFile) this.uploadError.emit(errFile);\n return;\n }\n\n if (isDone) {\n const allDone = this.files().every(f => f.status === 'success' || f.status === 'error');\n if (allDone) this.uploadComplete.emit(this.files());\n return;\n }\n\n const t = setTimeout(tick, interval);\n this.timers.push(t);\n };\n\n const t0 = setTimeout(tick, interval);\n this.timers.push(t0);\n }\n\n retryFile(id: string): void {\n if (this.disabled()) return;\n this.files.update(list =>\n list.map(f => f.id === id ? { ...f, status: 'pending' as const, progress: 0, errorMsg: undefined } : f)\n );\n if (this.autoSimulate()) this.simulateUpload(id);\n }\n\n removeFile(id: string): void {\n if (this.disabled()) return;\n this.files.update(list => list.filter(f => f.id !== id));\n this.fileRemoved.emit(id);\n this.filesChange.emit(this.files());\n }\n\n clearAll(): void {\n if (this.disabled()) return;\n this.files.set([]);\n this.filesChange.emit([]);\n }\n\n ngOnDestroy(): void {\n this.timers.forEach(t => clearTimeout(t));\n }\n}\n","<!-- Root -->\n<div [ngClass]=\"['flex flex-col gap-4 w-full', customClass()]\">\n\n <!-- ── BUTTON trigger (free tier supports the button variant only) ── -->\n\n <div class=\"flex items-center gap-3\">\n <button\n type=\"button\"\n [disabled]=\"disabled() || !canAddMore()\"\n class=\"inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm font-medium\n text-gray-700 shadow-sm transition-colors hover:bg-gray-50 focus:outline-none\n focus-visible:ring-2 focus-visible:ring-primary-400\n disabled:cursor-not-allowed disabled:opacity-50\n dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700\"\n (click)=\"openFilePicker()\"\n >\n <svg class=\"h-4 w-4\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12\"/>\n </svg>\n {{ label() }}\n </button>\n @if (hint()) {\n <span class=\"text-sm text-gray-500 dark:text-gray-400\">{{ hint() }}</span>\n }\n </div>\n\n <!-- Hidden file input -->\n <input\n #fileInput\n type=\"file\"\n class=\"sr-only\"\n [attr.accept]=\"accept() || null\"\n [attr.multiple]=\"multiple() || null\"\n [disabled]=\"disabled()\"\n (change)=\"onFileInputChange($event)\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n />\n\n <!-- Screen-reader status announcements -->\n <p class=\"sr-only\" role=\"status\" aria-live=\"polite\">{{ statusMessage() }}</p>\n\n <!-- ── Overall progress bar (while uploading) ─────────────────────────── -->\n @if (uploadingCount() > 0) {\n <div class=\"space-y-1\">\n <div class=\"flex items-center justify-between text-xs text-gray-500 dark:text-gray-400\">\n <span>Uploading {{ uploadingCount() }} file{{ uploadingCount() === 1 ? '' : 's' }}…</span>\n <span class=\"tabular-nums font-medium\">{{ overallProgress() }}%</span>\n </div>\n <div\n class=\"h-1.5 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"overallProgress()\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n aria-label=\"Overall upload progress\"\n >\n <div\n class=\"h-full rounded-full bg-primary-500 transition-all duration-150 dark:bg-primary-400\"\n [style.width.%]=\"overallProgress()\"\n ></div>\n </div>\n </div>\n }\n\n <!-- ── File list ────────────────────────────────────────────────────────── -->\n @if (hasFiles()) {\n <ul class=\"space-y-2\" role=\"list\" aria-label=\"Uploaded files\">\n\n @for (file of files(); track file.id) {\n <li\n [ngClass]=\"[\n 'group flex items-center gap-3 rounded-xl border p-3 transition-colors',\n file.status === 'error'\n ? 'border-red-200 bg-red-50 dark:border-red-800/50 dark:bg-red-900/10'\n : file.status === 'success'\n ? 'border-emerald-200 bg-emerald-50 dark:border-emerald-800/50 dark:bg-emerald-900/10'\n : 'border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800/50'\n ]\"\n >\n\n <!-- Thumbnail or type badge -->\n <div class=\"relative flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg\"\n [ngClass]=\"isImage(file)\n ? 'border border-gray-200 dark:border-gray-700'\n : 'bg-gray-100 dark:bg-gray-800'\">\n @if (isImage(file)) {\n <img [src]=\"file.preview\" [alt]=\"file.name\"\n class=\"h-full w-full object-cover\" aria-hidden=\"true\"/>\n } @else {\n <svg class=\"h-5 w-5 text-gray-500 dark:text-gray-400\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"1.5\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path [attr.d]=\"getIcon(file)\"/>\n </svg>\n }\n </div>\n\n <!-- File info -->\n <div class=\"min-w-0 flex-1\">\n <div class=\"flex items-center gap-2\">\n <p class=\"truncate text-sm font-medium text-gray-800 dark:text-gray-100\"\n [title]=\"file.name\">{{ file.name }}</p>\n <span [ngClass]=\"['shrink-0 rounded px-1.5 py-0.5 text-xs font-semibold', getBadgeColor(file)]\">\n {{ getExtLabel(file) }}\n </span>\n </div>\n <div class=\"mt-0.5 flex items-center gap-2\">\n <span class=\"text-xs text-gray-500 dark:text-gray-400\">{{ formatSize(file.size) }}</span>\n\n @if (file.status === 'uploading') {\n <span class=\"text-xs text-gray-500 dark:text-gray-400 tabular-nums\">{{ file.progress }}%</span>\n } @else if (file.status === 'success') {\n <span class=\"flex items-center gap-1 text-xs font-medium text-emerald-600 dark:text-emerald-400\">\n <svg class=\"h-3 w-3\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"m20 6-11 11-5-5\"/>\n </svg>\n Uploaded\n </span>\n } @else if (file.status === 'error') {\n <span class=\"flex items-center gap-1 text-xs font-medium text-red-600 dark:text-red-400\">\n <svg class=\"h-3 w-3\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"/>\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"/>\n <line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"/>\n </svg>\n {{ file.errorMsg ?? 'Upload failed' }}\n </span>\n } @else {\n <span class=\"text-xs text-gray-500 dark:text-gray-400\">Pending</span>\n }\n </div>\n\n <!-- Progress bar -->\n @if (file.status === 'uploading' || (file.status === 'pending' && autoSimulate())) {\n <div\n class=\"mt-1.5 h-1 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"file.progress\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-label]=\"'Uploading ' + file.name\"\n >\n <div\n class=\"h-full rounded-full bg-primary-500 transition-all duration-150 dark:bg-primary-400\"\n [style.width.%]=\"file.progress\"\n ></div>\n </div>\n }\n </div>\n\n <!-- Actions -->\n <div class=\"flex shrink-0 items-center gap-1\">\n\n <!-- Retry button (error) -->\n @if (file.status === 'error') {\n <button\n type=\"button\"\n class=\"flex h-7 w-7 items-center justify-center rounded-lg text-gray-400\n transition-colors hover:bg-gray-100 hover:text-primary-600\n dark:hover:bg-gray-700 dark:hover:text-primary-400 focus:outline-none\n focus-visible:ring-1 focus-visible:ring-primary-400 disabled:opacity-40 disabled:cursor-not-allowed\"\n [attr.aria-label]=\"'Retry ' + file.name\"\n [disabled]=\"disabled()\"\n (click)=\"retryFile(file.id)\"\n >\n <svg class=\"h-3.5 w-3.5\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2.5\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <polyline points=\"1 4 1 10 7 10\"/>\n <path d=\"M3.51 15a9 9 0 1 0 .49-4.3\"/>\n </svg>\n </button>\n }\n\n <!-- Spinning indicator for uploading -->\n @if (file.status === 'uploading') {\n <span class=\"flex h-7 w-7 items-center justify-center text-primary-500 dark:text-primary-400\" aria-hidden=\"true\">\n <svg class=\"h-4 w-4 animate-spin\" fill=\"none\" viewBox=\"0 0 24 24\">\n <circle class=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" stroke-width=\"4\"/>\n <path class=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z\"/>\n </svg>\n </span>\n }\n\n <!-- Remove button -->\n <button\n type=\"button\"\n class=\"flex h-7 w-7 items-center justify-center rounded-lg text-gray-400\n transition-colors hover:bg-gray-100 hover:text-red-500\n dark:hover:bg-gray-700 dark:hover:text-red-400 focus:outline-none\n focus-visible:ring-1 focus-visible:ring-red-400 disabled:opacity-40 disabled:cursor-not-allowed\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n [disabled]=\"disabled()\"\n (click)=\"removeFile(file.id)\"\n >\n <svg class=\"h-3.5 w-3.5\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2.5\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M18 6 6 18M6 6l12 12\"/>\n </svg>\n </button>\n\n </div>\n </li>\n }\n\n </ul>\n\n <!-- File list footer -->\n <div class=\"flex items-center justify-between\">\n <p class=\"text-xs text-gray-500 dark:text-gray-400\">\n {{ files().length }} file{{ files().length === 1 ? '' : 's' }}\n @if (successCount() > 0) {\n &nbsp;&middot;&nbsp;\n <span class=\"text-emerald-600 dark:text-emerald-400 font-medium\">{{ successCount() }} uploaded</span>\n }\n @if (errorCount() > 0) {\n &nbsp;&middot;&nbsp;\n <span class=\"text-red-600 dark:text-red-400 font-medium\">{{ errorCount() }} failed</span>\n }\n </p>\n <button\n type=\"button\"\n class=\"text-xs text-gray-400 transition-colors hover:text-red-500 dark:text-gray-500 dark:hover:text-red-400\n focus:outline-none focus-visible:ring-1 focus-visible:ring-red-400 rounded disabled:opacity-40 disabled:cursor-not-allowed\"\n [disabled]=\"disabled()\"\n (click)=\"clearAll()\"\n aria-label=\"Remove all files\"\n >\n Clear all\n </button>\n </div>\n }\n\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AA+BA,MAAM,UAAU,GAA2B;AACzC,IAAA,GAAG,EAAG,mGAAmG;AACzG,IAAA,GAAG,EAAG,iGAAiG;AACvG,IAAA,GAAG,EAAG,8FAA8F;AACpG,IAAA,GAAG,EAAG,gGAAgG;AACtG,IAAA,GAAG,EAAG,+DAA+D;AACrE,IAAA,GAAG,EAAG,4SAA4S;AAClT,IAAA,KAAK,EAAC,qFAAqF;AAC3F,IAAA,IAAI,EAAE,0EAA0E;CACjF;AAED,MAAM,OAAO,GAA2B;AACtC,IAAA,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK;IAC5D,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK;AACjC,IAAA,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK;IAC/C,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO;IACxC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK;CACzE;AAED,MAAM,WAAW,GAA2B;AAC1C,IAAA,GAAG,EAAI,8DAA8D;AACrE,IAAA,GAAG,EAAI,kEAAkE;AACzE,IAAA,GAAG,EAAI,8EAA8E;AACrF,IAAA,GAAG,EAAI,0EAA0E;AACjF,IAAA,GAAG,EAAI,0EAA0E;AACjF,IAAA,GAAG,EAAI,kEAAkE;AACzE,IAAA,KAAK,EAAE,0EAA0E;AACjF,IAAA,IAAI,EAAG,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"version": "0.1.1",
4
+ "description": "Drag-and-drop file uploader with previews, type/size validation and progress.",
5
+ "license": "MIT",
6
+ "author": "sazzad-bs23",
7
+ "homepage": "https://styloviz.dev",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/rhossain/angular-tailwind-dashboard-components.git",
11
+ "directory": "projects/file-upload-free"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/rhossain/angular-tailwind-dashboard-components/issues"
15
+ },
16
+ "peerDependencies": {
17
+ "@angular/common": ">=21.0.0",
18
+ "@angular/core": ">=21.0.0",
19
+ "@angular/forms": ">=21.0.0"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "engines": {
25
+ "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
26
+ },
27
+ "sideEffects": false,
28
+ "module": "fesm2022/styloviz-file-upload.mjs",
29
+ "typings": "types/styloviz-file-upload.d.ts",
30
+ "exports": {
31
+ "./package.json": {
32
+ "default": "./package.json"
33
+ },
34
+ ".": {
35
+ "types": "./types/styloviz-file-upload.d.ts",
36
+ "default": "./fesm2022/styloviz-file-upload.mjs"
37
+ }
38
+ },
39
+ "type": "module",
40
+ "dependencies": {
41
+ "tslib": "^2.3.0"
42
+ }
43
+ }
@@ -0,0 +1,94 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { OnDestroy } from '@angular/core';
3
+
4
+ type FileUploadVariant = 'button';
5
+ type FileUploadSize = 'sm' | 'md' | 'lg';
6
+ type UploadFileStatus = 'pending' | 'uploading' | 'success' | 'error';
7
+ interface UploadFile {
8
+ id: string;
9
+ file: File;
10
+ name: string;
11
+ size: number;
12
+ type: string;
13
+ status: UploadFileStatus;
14
+ progress: number;
15
+ preview?: string;
16
+ errorMsg?: string;
17
+ }
18
+ declare class SvFileUploadComponent implements OnDestroy {
19
+ private static idCounter;
20
+ private readonly platformId;
21
+ private uid;
22
+ /** Trigger style: button or drag-and-drop dropzone. @default 'button' */
23
+ variant: _angular_core.InputSignal<"button">;
24
+ /** Control size: sm, md or lg. @default 'md' */
25
+ size: _angular_core.InputSignal<FileUploadSize>;
26
+ /** Accepted file types (e.g. "image/*,.pdf"). */
27
+ accept: _angular_core.InputSignal<string>;
28
+ /** Allow selecting multiple files. @default true */
29
+ multiple: _angular_core.InputSignal<boolean>;
30
+ /** Maximum number of files. @default 10 */
31
+ maxFiles: _angular_core.InputSignal<number>;
32
+ /** Per-file size limit in MB. @default 10 */
33
+ maxSizeMb: _angular_core.InputSignal<number>;
34
+ /** Disable the uploader. @default false */
35
+ disabled: _angular_core.InputSignal<boolean>;
36
+ /** Simulate upload progress after a file is added (demo only). @default false */
37
+ autoSimulate: _angular_core.InputSignal<boolean>;
38
+ /** Trigger/label text. @default 'Upload files' */
39
+ label: _angular_core.InputSignal<string>;
40
+ /** Helper text shown under the trigger. */
41
+ hint: _angular_core.InputSignal<string>;
42
+ /** Extra CSS classes for the root. */
43
+ customClass: _angular_core.InputSignal<string>;
44
+ /** Emitted with the full file list whenever it changes. */
45
+ filesChange: _angular_core.OutputEmitterRef<UploadFile[]>;
46
+ /** Emitted when a single file is added. */
47
+ fileAdded: _angular_core.OutputEmitterRef<UploadFile>;
48
+ /** Emitted with the id of a removed file. */
49
+ fileRemoved: _angular_core.OutputEmitterRef<string>;
50
+ /** Emitted when all uploads finish successfully. */
51
+ uploadComplete: _angular_core.OutputEmitterRef<UploadFile[]>;
52
+ /** Emitted when a file fails validation or upload. */
53
+ uploadError: _angular_core.OutputEmitterRef<UploadFile>;
54
+ files: _angular_core.WritableSignal<UploadFile[]>;
55
+ isDragOver: _angular_core.WritableSignal<boolean>;
56
+ private fileInput;
57
+ private timers;
58
+ hasFiles: _angular_core.Signal<boolean>;
59
+ canAddMore: _angular_core.Signal<boolean>;
60
+ successCount: _angular_core.Signal<number>;
61
+ errorCount: _angular_core.Signal<number>;
62
+ uploadingCount: _angular_core.Signal<number>;
63
+ overallProgress: _angular_core.Signal<number>;
64
+ /** Screen-reader status summary (announced politely via an aria-live region). */
65
+ statusMessage: _angular_core.Signal<string>;
66
+ zoneClasses: _angular_core.Signal<string>;
67
+ iconSize: _angular_core.Signal<string>;
68
+ labelClass: _angular_core.Signal<string>;
69
+ hintClass: _angular_core.Signal<string>;
70
+ getIcon(file: UploadFile): string;
71
+ getBadgeColor(file: UploadFile): string;
72
+ getExtLabel(file: UploadFile): string;
73
+ formatSize(bytes: number): string;
74
+ isImage(file: UploadFile): boolean;
75
+ openFilePicker(): void;
76
+ onFileInputChange(e: Event): void;
77
+ onDragOver(e: DragEvent): void;
78
+ onDragLeave(e: DragEvent): void;
79
+ onDrop(e: DragEvent): void;
80
+ onZoneKeydown(e: KeyboardEvent): void;
81
+ /** Whether a file matches the `accept` filter (mime, mime/*, or .ext). */
82
+ private isAccepted;
83
+ private addFiles;
84
+ private simulateUpload;
85
+ retryFile(id: string): void;
86
+ removeFile(id: string): void;
87
+ clearAll(): void;
88
+ ngOnDestroy(): void;
89
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SvFileUploadComponent, never>;
90
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SvFileUploadComponent, "sv-file-upload", never, { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "maxFiles": { "alias": "maxFiles"; "required": false; "isSignal": true; }; "maxSizeMb": { "alias": "maxSizeMb"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "autoSimulate": { "alias": "autoSimulate"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "customClass": { "alias": "customClass"; "required": false; "isSignal": true; }; }, { "filesChange": "filesChange"; "fileAdded": "fileAdded"; "fileRemoved": "fileRemoved"; "uploadComplete": "uploadComplete"; "uploadError": "uploadError"; }, never, never, true, never>;
91
+ }
92
+
93
+ export { SvFileUploadComponent };
94
+ export type { FileUploadSize, FileUploadVariant, UploadFile, UploadFileStatus };