@muxima-ui/core 1.0.0 → 1.2.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 (55) hide show
  1. package/README.md +12 -4
  2. package/fesm2022/muxima-ui-core-carousel.mjs +377 -0
  3. package/fesm2022/muxima-ui-core-carousel.mjs.map +1 -0
  4. package/fesm2022/muxima-ui-core-chips.mjs +349 -0
  5. package/fesm2022/muxima-ui-core-chips.mjs.map +1 -0
  6. package/fesm2022/muxima-ui-core-clipboard.mjs +110 -0
  7. package/fesm2022/muxima-ui-core-clipboard.mjs.map +1 -0
  8. package/fesm2022/muxima-ui-core-color-picker.mjs +755 -0
  9. package/fesm2022/muxima-ui-core-color-picker.mjs.map +1 -0
  10. package/fesm2022/muxima-ui-core-date-picker.mjs +494 -12
  11. package/fesm2022/muxima-ui-core-date-picker.mjs.map +1 -1
  12. package/fesm2022/muxima-ui-core-file-upload.mjs +392 -0
  13. package/fesm2022/muxima-ui-core-file-upload.mjs.map +1 -0
  14. package/fesm2022/muxima-ui-core-notification-center.mjs +487 -0
  15. package/fesm2022/muxima-ui-core-notification-center.mjs.map +1 -0
  16. package/fesm2022/muxima-ui-core-rating.mjs +212 -0
  17. package/fesm2022/muxima-ui-core-rating.mjs.map +1 -0
  18. package/fesm2022/muxima-ui-core-sidebar.mjs +333 -0
  19. package/fesm2022/muxima-ui-core-sidebar.mjs.map +1 -0
  20. package/fesm2022/muxima-ui-core-slider.mjs +211 -3
  21. package/fesm2022/muxima-ui-core-slider.mjs.map +1 -1
  22. package/fesm2022/muxima-ui-core-time-picker.mjs +389 -0
  23. package/fesm2022/muxima-ui-core-time-picker.mjs.map +1 -0
  24. package/fesm2022/muxima-ui-core-timeline.mjs +117 -0
  25. package/fesm2022/muxima-ui-core-timeline.mjs.map +1 -0
  26. package/fesm2022/muxima-ui-core.mjs +1 -1
  27. package/fesm2022/muxima-ui-core.mjs.map +1 -1
  28. package/package.json +41 -1
  29. package/styles/base.css +21 -1
  30. package/styles/components/carousel.css +113 -0
  31. package/styles/components/chips.css +170 -0
  32. package/styles/components/clipboard.css +52 -0
  33. package/styles/components/color-picker.css +207 -0
  34. package/styles/components/date-picker.css +135 -0
  35. package/styles/components/file-upload.css +164 -0
  36. package/styles/components/notification-center.css +220 -0
  37. package/styles/components/rating.css +89 -0
  38. package/styles/components/sidebar.css +211 -0
  39. package/styles/components/slider.css +111 -0
  40. package/styles/components/time-picker.css +39 -0
  41. package/styles/components/timeline.css +180 -0
  42. package/styles/muxima.css +10 -0
  43. package/types/muxima-ui-core-carousel.d.ts +72 -0
  44. package/types/muxima-ui-core-chips.d.ts +120 -0
  45. package/types/muxima-ui-core-clipboard.d.ts +42 -0
  46. package/types/muxima-ui-core-color-picker.d.ts +153 -0
  47. package/types/muxima-ui-core-date-picker.d.ts +130 -2
  48. package/types/muxima-ui-core-file-upload.d.ts +96 -0
  49. package/types/muxima-ui-core-notification-center.d.ts +91 -0
  50. package/types/muxima-ui-core-rating.d.ts +64 -0
  51. package/types/muxima-ui-core-sidebar.d.ts +115 -0
  52. package/types/muxima-ui-core-slider.d.ts +68 -6
  53. package/types/muxima-ui-core-time-picker.d.ts +83 -0
  54. package/types/muxima-ui-core-timeline.d.ts +59 -0
  55. package/types/muxima-ui-core.d.ts +1 -1
@@ -0,0 +1,392 @@
1
+ import * as i0 from '@angular/core';
2
+ import { model, input, booleanAttribute, numberAttribute, output, inject, ElementRef, viewChild, Injector, computed, signal, afterNextRender, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { LiveAnnouncer } from '@angular/cdk/a11y';
4
+ import { NgControl, Validators } from '@angular/forms';
5
+ import { MxFormField, mxUniqueId, MX_FORM_FIELD_CONTROL } from '@muxima-ui/core/form-field';
6
+
7
+ /** "1,2 MB", "340 kB". */
8
+ function mxFormatBytes(bytes, locale = 'pt-AO') {
9
+ const units = ['B', 'kB', 'MB', 'GB'];
10
+ let v = bytes;
11
+ let u = 0;
12
+ while (v >= 1000 && u < units.length - 1) {
13
+ v /= 1000;
14
+ u++;
15
+ }
16
+ return `${new Intl.NumberFormat(locale, { maximumFractionDigits: u ? 1 : 0 }).format(v)} ${units[u]}`;
17
+ }
18
+ /** true se o ficheiro corresponde a `accept` (".pdf,image/*"). */
19
+ function mxFileMatches(file, accept) {
20
+ if (!accept.trim())
21
+ return true;
22
+ const name = file.name.toLowerCase();
23
+ const type = file.type.toLowerCase();
24
+ return accept
25
+ .split(',')
26
+ .map((a) => a.trim().toLowerCase())
27
+ .filter(Boolean)
28
+ .some((a) => (a.startsWith('.') ? name.endsWith(a) : a.endsWith('/*') ? type.startsWith(a.slice(0, -1)) : type === a));
29
+ }
30
+ /**
31
+ * Envio de ficheiros: arrastar para a área ou carregar no botão (que abre o seletor nativo).
32
+ * Valida tipo, tamanho e número, mostra a lista com tamanho, progresso e botão de remover.
33
+ *
34
+ * ```html
35
+ * <mx-form-field>
36
+ * <label mxLabel>Comprovativos</label>
37
+ * <mx-file-upload formControlName="ficheiros" accept=".pdf,image/*" [maxSize]="5_000_000" multiple />
38
+ * <mx-hint>PDF ou imagem, até 5 MB cada.</mx-hint>
39
+ * </mx-form-field>
40
+ * ```
41
+ *
42
+ * O valor é `File[]`. O envio para o servidor fica do teu lado: passa a percentagem de cada
43
+ * ficheiro em `[progress]` (pelo nome) e os erros em `[errors]`.
44
+ */
45
+ class MxFileUpload {
46
+ value = model([], ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
47
+ /** Tipos aceites, como no input nativo: ".pdf,image/*". */
48
+ accept = input('', ...(ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []));
49
+ multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
50
+ /** Tamanho máximo de cada ficheiro, em bytes. */
51
+ maxSize = input(Infinity, { ...(ngDevMode ? { debugName: "maxSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
52
+ maxFiles = input(Infinity, { ...(ngDevMode ? { debugName: "maxFiles" } : /* istanbul ignore next */ {}), transform: numberAttribute });
53
+ /** Percentagem de envio por nome de ficheiro. */
54
+ progress = input({}, ...(ngDevMode ? [{ debugName: "progress" }] : /* istanbul ignore next */ []));
55
+ /** Erro de envio por nome de ficheiro. */
56
+ errors = input({}, ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
57
+ dropText = input('Arrasta os ficheiros para aqui ou', ...(ngDevMode ? [{ debugName: "dropText" }] : /* istanbul ignore next */ []));
58
+ buttonText = input('escolhe no computador', ...(ngDevMode ? [{ debugName: "buttonText" }] : /* istanbul ignore next */ []));
59
+ /** Linha de ajuda dentro da área (ex.: "PDF até 5 MB"). */
60
+ description = input('', ...(ngDevMode ? [{ debugName: "description" }] : /* istanbul ignore next */ []));
61
+ listLabel = input('Ficheiros escolhidos', ...(ngDevMode ? [{ debugName: "listLabel" }] : /* istanbul ignore next */ []));
62
+ removeText = input('Remover', ...(ngDevMode ? [{ debugName: "removeText" }] : /* istanbul ignore next */ []));
63
+ doneText = input('Enviado', ...(ngDevMode ? [{ debugName: "doneText" }] : /* istanbul ignore next */ []));
64
+ locale = input('pt-AO', ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
65
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
66
+ required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
67
+ invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
68
+ id = input(undefined, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
69
+ rejected = output();
70
+ field = inject(MxFormField, { optional: true });
71
+ ngControl = inject(NgControl, { self: true, optional: true });
72
+ announcer = inject(LiveAnnouncer);
73
+ host = inject(ElementRef).nativeElement;
74
+ input = viewChild.required('input');
75
+ injector = inject(Injector);
76
+ generatedId = mxUniqueId('mx-file-upload');
77
+ controlId = computed(() => this.id() ?? this.generatedId, ...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
78
+ descId = mxUniqueId('mx-file-upload-desc');
79
+ files = computed(() => this.value() ?? [], ...(ngDevMode ? [{ debugName: "files" }] : /* istanbul ignore next */ []));
80
+ dragging = signal(false, ...(ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []));
81
+ rejections = signal([], ...(ngDevMode ? [{ debugName: "rejections" }] : /* istanbul ignore next */ []));
82
+ formDisabled = signal(false, ...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
83
+ isDisabled = computed(() => this.disabled() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
84
+ describedBy = computed(() => [this.description() ? this.descId : null, this.field?.describedBy()].filter(Boolean).join(' ') || null, ...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
85
+ dragDepth = 0;
86
+ onChange = () => { };
87
+ onTouched = () => { };
88
+ constructor() {
89
+ if (this.ngControl)
90
+ this.ngControl.valueAccessor = this;
91
+ }
92
+ size(bytes) {
93
+ return mxFormatBytes(bytes, this.locale());
94
+ }
95
+ /** Abre o seletor de ficheiros do sistema. */
96
+ browse() {
97
+ if (!this.isDisabled())
98
+ this.input().nativeElement.click();
99
+ }
100
+ /** Acrescenta ficheiros, com as mesmas validações do arrastar e do seletor. */
101
+ addFiles(list) {
102
+ const incoming = Array.from(list);
103
+ const accepted = [];
104
+ const rejected = [];
105
+ const current = this.multiple() ? this.files() : [];
106
+ for (const file of incoming) {
107
+ if (!mxFileMatches(file, this.accept())) {
108
+ rejected.push({ file, reason: 'type', message: `${file.name}: tipo de ficheiro não aceite.` });
109
+ }
110
+ else if (file.size > this.maxSize()) {
111
+ rejected.push({ file, reason: 'size', message: `${file.name}: tem ${this.size(file.size)}, o máximo é ${this.size(this.maxSize())}.` });
112
+ }
113
+ else if (current.length + accepted.length >= (this.multiple() ? this.maxFiles() : 1)) {
114
+ rejected.push({ file, reason: 'count', message: `${file.name}: só podes juntar ${this.multiple() ? this.maxFiles() : 1} ficheiro${this.maxFiles() === 1 || !this.multiple() ? '' : 's'}.` });
115
+ }
116
+ else {
117
+ accepted.push(file);
118
+ }
119
+ }
120
+ this.rejections.set(rejected);
121
+ if (rejected.length)
122
+ this.rejected.emit(rejected);
123
+ if (accepted.length)
124
+ this.update([...current, ...accepted]);
125
+ const parts = [];
126
+ if (accepted.length)
127
+ parts.push(accepted.length === 1 ? `${accepted[0].name} juntado.` : `${accepted.length} ficheiros juntados.`);
128
+ parts.push(...rejected.map((r) => r.message));
129
+ if (parts.length)
130
+ this.announcer.announce(parts.join(' '), rejected.length ? 'assertive' : 'polite');
131
+ this.onTouched();
132
+ }
133
+ remove(index) {
134
+ const file = this.files()[index];
135
+ this.update(this.files().filter((_, i) => i !== index));
136
+ this.announcer.announce(`${file.name} removido.`);
137
+ afterNextRender(() => {
138
+ const removes = this.host.querySelectorAll('.mx-file-upload-remove');
139
+ (removes[Math.min(index, removes.length - 1)] ?? this.host.querySelector('.mx-file-upload-button'))?.focus();
140
+ }, { injector: this.injector });
141
+ }
142
+ update(files) {
143
+ this.value.set(files);
144
+ this.onChange(files);
145
+ }
146
+ onPick(event) {
147
+ const el = event.target;
148
+ if (el.files?.length)
149
+ this.addFiles(el.files);
150
+ // permite escolher o mesmo ficheiro outra vez
151
+ el.value = '';
152
+ }
153
+ onDragEnter(event) {
154
+ if (this.isDisabled())
155
+ return;
156
+ event.preventDefault();
157
+ this.dragDepth++;
158
+ this.dragging.set(true);
159
+ }
160
+ onDragOver(event) {
161
+ if (this.isDisabled())
162
+ return;
163
+ event.preventDefault();
164
+ if (event.dataTransfer)
165
+ event.dataTransfer.dropEffect = 'copy';
166
+ }
167
+ onDragLeave(event) {
168
+ event.preventDefault();
169
+ if (--this.dragDepth <= 0) {
170
+ this.dragDepth = 0;
171
+ this.dragging.set(false);
172
+ }
173
+ }
174
+ onDrop(event) {
175
+ event.preventDefault();
176
+ this.dragDepth = 0;
177
+ this.dragging.set(false);
178
+ if (this.isDisabled() || !event.dataTransfer?.files.length)
179
+ return;
180
+ this.addFiles(event.dataTransfer.files);
181
+ }
182
+ // ---- MxFormFieldControl ----
183
+ errorState() {
184
+ if (this.invalid())
185
+ return true;
186
+ const c = this.ngControl;
187
+ return !!c && !!c.invalid && !!(c.touched || c.dirty);
188
+ }
189
+ isRequired() {
190
+ return this.required() || !!this.ngControl?.control?.hasValidator?.(Validators.required);
191
+ }
192
+ // ---- ControlValueAccessor ----
193
+ writeValue(value) {
194
+ this.value.set(value ?? []);
195
+ this.rejections.set([]);
196
+ }
197
+ registerOnChange(fn) {
198
+ this.onChange = fn;
199
+ }
200
+ registerOnTouched(fn) {
201
+ this.onTouched = fn;
202
+ }
203
+ setDisabledState(isDisabled) {
204
+ this.formDisabled.set(isDisabled);
205
+ }
206
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxFileUpload, deps: [], target: i0.ɵɵFactoryTarget.Component });
207
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: MxFileUpload, isStandalone: true, selector: "mx-file-upload", inputs: { value: { classPropertyName: "value", publicName: "value", 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 }, maxSize: { classPropertyName: "maxSize", publicName: "maxSize", isSignal: true, isRequired: false, transformFunction: null }, maxFiles: { classPropertyName: "maxFiles", publicName: "maxFiles", isSignal: true, isRequired: false, transformFunction: null }, progress: { classPropertyName: "progress", publicName: "progress", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, dropText: { classPropertyName: "dropText", publicName: "dropText", isSignal: true, isRequired: false, transformFunction: null }, buttonText: { classPropertyName: "buttonText", publicName: "buttonText", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, listLabel: { classPropertyName: "listLabel", publicName: "listLabel", isSignal: true, isRequired: false, transformFunction: null }, removeText: { classPropertyName: "removeText", publicName: "removeText", isSignal: true, isRequired: false, transformFunction: null }, doneText: { classPropertyName: "doneText", publicName: "doneText", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", rejected: "rejected" }, host: { properties: { "attr.data-disabled": "isDisabled() ? \"\" : null", "attr.data-invalid": "errorState() ? \"\" : null", "attr.aria-label": "null" }, classAttribute: "mx-file-upload" }, providers: [{ provide: MX_FORM_FIELD_CONTROL, useExisting: MxFileUpload }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, isSignal: true }], exportAs: ["mxFileUpload"], ngImport: i0, template: `
208
+ <div
209
+ class="mx-file-upload-zone"
210
+ [attr.data-dragging]="dragging() ? '' : null"
211
+ (dragenter)="onDragEnter($event)"
212
+ (dragover)="onDragOver($event)"
213
+ (dragleave)="onDragLeave($event)"
214
+ (drop)="onDrop($event)"
215
+ >
216
+ <svg class="mx-file-upload-icon" viewBox="0 0 24 24" fill="none" aria-hidden="true">
217
+ <path d="M12 15V4M7.5 8.5L12 4l4.5 4.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" />
218
+ <path d="M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
219
+ </svg>
220
+ <p class="mx-file-upload-text">
221
+ <span aria-hidden="true">{{ dropText() }}</span>
222
+ <button
223
+ type="button"
224
+ class="mx-file-upload-button"
225
+ [id]="controlId()"
226
+ [disabled]="isDisabled()"
227
+ [attr.aria-describedby]="describedBy()"
228
+ [attr.aria-labelledby]="field?.labelId() ? field!.labelId() + ' ' + controlId() : null"
229
+ (click)="browse()"
230
+ >
231
+ {{ buttonText() }}
232
+ </button>
233
+ </p>
234
+ @if (description()) {
235
+ <p class="mx-file-upload-desc" [id]="descId">{{ description() }}</p>
236
+ }
237
+ <input
238
+ #input
239
+ type="file"
240
+ class="mx-visually-hidden"
241
+ tabindex="-1"
242
+ aria-hidden="true"
243
+ [accept]="accept()"
244
+ [multiple]="multiple()"
245
+ [disabled]="isDisabled()"
246
+ (change)="onPick($event)"
247
+ />
248
+ </div>
249
+
250
+ @if (rejections().length) {
251
+ <ul class="mx-file-upload-rejections">
252
+ @for (r of rejections(); track $index) {
253
+ <li>{{ r.message }}</li>
254
+ }
255
+ </ul>
256
+ }
257
+
258
+ @if (files().length) {
259
+ <ul class="mx-file-upload-list" [attr.aria-label]="listLabel()">
260
+ @for (f of files(); track f; let i = $index) {
261
+ <li class="mx-file-upload-item" [attr.data-error]="errors()[f.name] ? '' : null">
262
+ <svg class="mx-file-upload-file-icon" viewBox="0 0 16 16" fill="none" aria-hidden="true">
263
+ <path d="M4 1.75h5l3 3v9.5H4z" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" />
264
+ <path d="M9 1.75v3h3" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" />
265
+ </svg>
266
+ <div class="mx-file-upload-info">
267
+ <span class="mx-file-upload-name">{{ f.name }}</span>
268
+ <span class="mx-file-upload-meta">
269
+ {{ size(f.size) }}
270
+ @if (errors()[f.name]; as e) {
271
+ · <span class="mx-file-upload-error">{{ e }}</span>
272
+ } @else if (progress()[f.name] !== undefined) {
273
+ · {{ progress()[f.name] >= 100 ? doneText() : progress()[f.name] + '%' }}
274
+ }
275
+ </span>
276
+ @if (progress()[f.name] !== undefined && progress()[f.name] < 100 && !errors()[f.name]) {
277
+ <progress class="mx-file-upload-progress" max="100" [value]="progress()[f.name]" [attr.aria-label]="'A enviar ' + f.name"></progress>
278
+ }
279
+ </div>
280
+ <button type="button" class="mx-file-upload-remove" [disabled]="isDisabled()" [attr.aria-label]="removeText() + ' ' + f.name" (click)="remove(i)">
281
+ <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 4.5l7 7M11.5 4.5l-7 7" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" /></svg>
282
+ </button>
283
+ </li>
284
+ }
285
+ </ul>
286
+ }
287
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
288
+ }
289
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxFileUpload, decorators: [{
290
+ type: Component,
291
+ args: [{
292
+ selector: 'mx-file-upload',
293
+ exportAs: 'mxFileUpload',
294
+ providers: [{ provide: MX_FORM_FIELD_CONTROL, useExisting: MxFileUpload }],
295
+ changeDetection: ChangeDetectionStrategy.OnPush,
296
+ encapsulation: ViewEncapsulation.None,
297
+ host: {
298
+ class: 'mx-file-upload',
299
+ '[attr.data-disabled]': 'isDisabled() ? "" : null',
300
+ '[attr.data-invalid]': 'errorState() ? "" : null',
301
+ '[attr.aria-label]': 'null',
302
+ },
303
+ template: `
304
+ <div
305
+ class="mx-file-upload-zone"
306
+ [attr.data-dragging]="dragging() ? '' : null"
307
+ (dragenter)="onDragEnter($event)"
308
+ (dragover)="onDragOver($event)"
309
+ (dragleave)="onDragLeave($event)"
310
+ (drop)="onDrop($event)"
311
+ >
312
+ <svg class="mx-file-upload-icon" viewBox="0 0 24 24" fill="none" aria-hidden="true">
313
+ <path d="M12 15V4M7.5 8.5L12 4l4.5 4.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" />
314
+ <path d="M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
315
+ </svg>
316
+ <p class="mx-file-upload-text">
317
+ <span aria-hidden="true">{{ dropText() }}</span>
318
+ <button
319
+ type="button"
320
+ class="mx-file-upload-button"
321
+ [id]="controlId()"
322
+ [disabled]="isDisabled()"
323
+ [attr.aria-describedby]="describedBy()"
324
+ [attr.aria-labelledby]="field?.labelId() ? field!.labelId() + ' ' + controlId() : null"
325
+ (click)="browse()"
326
+ >
327
+ {{ buttonText() }}
328
+ </button>
329
+ </p>
330
+ @if (description()) {
331
+ <p class="mx-file-upload-desc" [id]="descId">{{ description() }}</p>
332
+ }
333
+ <input
334
+ #input
335
+ type="file"
336
+ class="mx-visually-hidden"
337
+ tabindex="-1"
338
+ aria-hidden="true"
339
+ [accept]="accept()"
340
+ [multiple]="multiple()"
341
+ [disabled]="isDisabled()"
342
+ (change)="onPick($event)"
343
+ />
344
+ </div>
345
+
346
+ @if (rejections().length) {
347
+ <ul class="mx-file-upload-rejections">
348
+ @for (r of rejections(); track $index) {
349
+ <li>{{ r.message }}</li>
350
+ }
351
+ </ul>
352
+ }
353
+
354
+ @if (files().length) {
355
+ <ul class="mx-file-upload-list" [attr.aria-label]="listLabel()">
356
+ @for (f of files(); track f; let i = $index) {
357
+ <li class="mx-file-upload-item" [attr.data-error]="errors()[f.name] ? '' : null">
358
+ <svg class="mx-file-upload-file-icon" viewBox="0 0 16 16" fill="none" aria-hidden="true">
359
+ <path d="M4 1.75h5l3 3v9.5H4z" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" />
360
+ <path d="M9 1.75v3h3" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" />
361
+ </svg>
362
+ <div class="mx-file-upload-info">
363
+ <span class="mx-file-upload-name">{{ f.name }}</span>
364
+ <span class="mx-file-upload-meta">
365
+ {{ size(f.size) }}
366
+ @if (errors()[f.name]; as e) {
367
+ · <span class="mx-file-upload-error">{{ e }}</span>
368
+ } @else if (progress()[f.name] !== undefined) {
369
+ · {{ progress()[f.name] >= 100 ? doneText() : progress()[f.name] + '%' }}
370
+ }
371
+ </span>
372
+ @if (progress()[f.name] !== undefined && progress()[f.name] < 100 && !errors()[f.name]) {
373
+ <progress class="mx-file-upload-progress" max="100" [value]="progress()[f.name]" [attr.aria-label]="'A enviar ' + f.name"></progress>
374
+ }
375
+ </div>
376
+ <button type="button" class="mx-file-upload-remove" [disabled]="isDisabled()" [attr.aria-label]="removeText() + ' ' + f.name" (click)="remove(i)">
377
+ <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 4.5l7 7M11.5 4.5l-7 7" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" /></svg>
378
+ </button>
379
+ </li>
380
+ }
381
+ </ul>
382
+ }
383
+ `,
384
+ }]
385
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], maxSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSize", required: false }] }], maxFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFiles", required: false }] }], progress: [{ type: i0.Input, args: [{ isSignal: true, alias: "progress", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], dropText: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropText", required: false }] }], buttonText: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonText", required: false }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], listLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "listLabel", required: false }] }], removeText: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeText", required: false }] }], doneText: [{ type: i0.Input, args: [{ isSignal: true, alias: "doneText", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], rejected: [{ type: i0.Output, args: ["rejected"] }], input: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }] } });
386
+
387
+ /**
388
+ * Generated bundle index. Do not edit.
389
+ */
390
+
391
+ export { MxFileUpload, mxFileMatches, mxFormatBytes };
392
+ //# sourceMappingURL=muxima-ui-core-file-upload.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"muxima-ui-core-file-upload.mjs","sources":["../../../projects/core/file-upload/file-upload.ts","../../../projects/core/file-upload/muxima-ui-core-file-upload.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Injector,\n afterNextRender,\n Component,\n ElementRef,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n inject,\n input,\n model,\n numberAttribute,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { LiveAnnouncer } from '@angular/cdk/a11y';\nimport { ControlValueAccessor, NgControl, Validators } from '@angular/forms';\nimport { MX_FORM_FIELD_CONTROL, MxFormField, MxFormFieldControl, mxUniqueId } from '@muxima-ui/core/form-field';\n\nexport interface MxFileRejection {\n file: File;\n reason: 'type' | 'size' | 'count';\n message: string;\n}\n\n/** \"1,2 MB\", \"340 kB\". */\nexport function mxFormatBytes(bytes: number, locale = 'pt-AO'): string {\n const units = ['B', 'kB', 'MB', 'GB'];\n let v = bytes;\n let u = 0;\n while (v >= 1000 && u < units.length - 1) {\n v /= 1000;\n u++;\n }\n return `${new Intl.NumberFormat(locale, { maximumFractionDigits: u ? 1 : 0 }).format(v)} ${units[u]}`;\n}\n\n/** true se o ficheiro corresponde a `accept` (\".pdf,image/*\"). */\nexport function mxFileMatches(file: File, accept: string): boolean {\n if (!accept.trim()) return true;\n const name = file.name.toLowerCase();\n const type = file.type.toLowerCase();\n return accept\n .split(',')\n .map((a) => a.trim().toLowerCase())\n .filter(Boolean)\n .some((a) => (a.startsWith('.') ? name.endsWith(a) : a.endsWith('/*') ? type.startsWith(a.slice(0, -1)) : type === a));\n}\n\n/**\n * Envio de ficheiros: arrastar para a área ou carregar no botão (que abre o seletor nativo).\n * Valida tipo, tamanho e número, mostra a lista com tamanho, progresso e botão de remover.\n *\n * ```html\n * <mx-form-field>\n * <label mxLabel>Comprovativos</label>\n * <mx-file-upload formControlName=\"ficheiros\" accept=\".pdf,image/*\" [maxSize]=\"5_000_000\" multiple />\n * <mx-hint>PDF ou imagem, até 5 MB cada.</mx-hint>\n * </mx-form-field>\n * ```\n *\n * O valor é `File[]`. O envio para o servidor fica do teu lado: passa a percentagem de cada\n * ficheiro em `[progress]` (pelo nome) e os erros em `[errors]`.\n */\n@Component({\n selector: 'mx-file-upload',\n exportAs: 'mxFileUpload',\n providers: [{ provide: MX_FORM_FIELD_CONTROL, useExisting: MxFileUpload }],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'mx-file-upload',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : null',\n '[attr.data-invalid]': 'errorState() ? \"\" : null',\n '[attr.aria-label]': 'null',\n },\n template: `\n <div\n class=\"mx-file-upload-zone\"\n [attr.data-dragging]=\"dragging() ? '' : null\"\n (dragenter)=\"onDragEnter($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\"\n >\n <svg class=\"mx-file-upload-icon\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M12 15V4M7.5 8.5L12 4l4.5 4.5\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n <path d=\"M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n <p class=\"mx-file-upload-text\">\n <span aria-hidden=\"true\">{{ dropText() }}</span>\n <button\n type=\"button\"\n class=\"mx-file-upload-button\"\n [id]=\"controlId()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-labelledby]=\"field?.labelId() ? field!.labelId() + ' ' + controlId() : null\"\n (click)=\"browse()\"\n >\n {{ buttonText() }}\n </button>\n </p>\n @if (description()) {\n <p class=\"mx-file-upload-desc\" [id]=\"descId\">{{ description() }}</p>\n }\n <input\n #input\n type=\"file\"\n class=\"mx-visually-hidden\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"isDisabled()\"\n (change)=\"onPick($event)\"\n />\n </div>\n\n @if (rejections().length) {\n <ul class=\"mx-file-upload-rejections\">\n @for (r of rejections(); track $index) {\n <li>{{ r.message }}</li>\n }\n </ul>\n }\n\n @if (files().length) {\n <ul class=\"mx-file-upload-list\" [attr.aria-label]=\"listLabel()\">\n @for (f of files(); track f; let i = $index) {\n <li class=\"mx-file-upload-item\" [attr.data-error]=\"errors()[f.name] ? '' : null\">\n <svg class=\"mx-file-upload-file-icon\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M4 1.75h5l3 3v9.5H4z\" stroke=\"currentColor\" stroke-width=\"1.2\" stroke-linejoin=\"round\" />\n <path d=\"M9 1.75v3h3\" stroke=\"currentColor\" stroke-width=\"1.2\" stroke-linejoin=\"round\" />\n </svg>\n <div class=\"mx-file-upload-info\">\n <span class=\"mx-file-upload-name\">{{ f.name }}</span>\n <span class=\"mx-file-upload-meta\">\n {{ size(f.size) }}\n @if (errors()[f.name]; as e) {\n · <span class=\"mx-file-upload-error\">{{ e }}</span>\n } @else if (progress()[f.name] !== undefined) {\n · {{ progress()[f.name] >= 100 ? doneText() : progress()[f.name] + '%' }}\n }\n </span>\n @if (progress()[f.name] !== undefined && progress()[f.name] < 100 && !errors()[f.name]) {\n <progress class=\"mx-file-upload-progress\" max=\"100\" [value]=\"progress()[f.name]\" [attr.aria-label]=\"'A enviar ' + f.name\"></progress>\n }\n </div>\n <button type=\"button\" class=\"mx-file-upload-remove\" [disabled]=\"isDisabled()\" [attr.aria-label]=\"removeText() + ' ' + f.name\" (click)=\"remove(i)\">\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M4.5 4.5l7 7M11.5 4.5l-7 7\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" /></svg>\n </button>\n </li>\n }\n </ul>\n }\n `,\n})\nexport class MxFileUpload implements ControlValueAccessor, MxFormFieldControl {\n readonly value = model<File[]>([]);\n /** Tipos aceites, como no input nativo: \".pdf,image/*\". */\n readonly accept = input('');\n readonly multiple = input(false, { transform: booleanAttribute });\n /** Tamanho máximo de cada ficheiro, em bytes. */\n readonly maxSize = input(Infinity, { transform: numberAttribute });\n readonly maxFiles = input(Infinity, { transform: numberAttribute });\n /** Percentagem de envio por nome de ficheiro. */\n readonly progress = input<Record<string, number>>({});\n /** Erro de envio por nome de ficheiro. */\n readonly errors = input<Record<string, string>>({});\n readonly dropText = input('Arrasta os ficheiros para aqui ou');\n readonly buttonText = input('escolhe no computador');\n /** Linha de ajuda dentro da área (ex.: \"PDF até 5 MB\"). */\n readonly description = input('');\n readonly listLabel = input('Ficheiros escolhidos');\n readonly removeText = input('Remover');\n readonly doneText = input('Enviado');\n readonly locale = input('pt-AO');\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly required = input(false, { transform: booleanAttribute });\n readonly invalid = input(false, { transform: booleanAttribute });\n readonly id = input<string | undefined>(undefined);\n readonly rejected = output<MxFileRejection[]>();\n\n protected readonly field = inject(MxFormField, { optional: true });\n private readonly ngControl = inject(NgControl, { self: true, optional: true });\n private readonly announcer = inject(LiveAnnouncer);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly input = viewChild.required<ElementRef<HTMLInputElement>>('input');\n private readonly injector = inject(Injector);\n\n private readonly generatedId = mxUniqueId('mx-file-upload');\n readonly controlId = computed(() => this.id() ?? this.generatedId);\n protected readonly descId = mxUniqueId('mx-file-upload-desc');\n protected readonly files = computed(() => this.value() ?? []);\n protected readonly dragging = signal(false);\n protected readonly rejections = signal<MxFileRejection[]>([]);\n private readonly formDisabled = signal(false);\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled());\n protected readonly describedBy = computed(\n () => [this.description() ? this.descId : null, this.field?.describedBy()].filter(Boolean).join(' ') || null,\n );\n private dragDepth = 0;\n\n private onChange: (value: File[]) => void = () => {};\n private onTouched: () => void = () => {};\n\n constructor() {\n if (this.ngControl) this.ngControl.valueAccessor = this;\n }\n\n protected size(bytes: number): string {\n return mxFormatBytes(bytes, this.locale());\n }\n\n /** Abre o seletor de ficheiros do sistema. */\n browse(): void {\n if (!this.isDisabled()) this.input().nativeElement.click();\n }\n\n /** Acrescenta ficheiros, com as mesmas validações do arrastar e do seletor. */\n addFiles(list: Iterable<File> | ArrayLike<File>): void {\n const incoming = Array.from(list);\n const accepted: File[] = [];\n const rejected: MxFileRejection[] = [];\n const current = this.multiple() ? this.files() : [];\n for (const file of incoming) {\n if (!mxFileMatches(file, this.accept())) {\n rejected.push({ file, reason: 'type', message: `${file.name}: tipo de ficheiro não aceite.` });\n } else if (file.size > this.maxSize()) {\n rejected.push({ file, reason: 'size', message: `${file.name}: tem ${this.size(file.size)}, o máximo é ${this.size(this.maxSize())}.` });\n } else if (current.length + accepted.length >= (this.multiple() ? this.maxFiles() : 1)) {\n rejected.push({ file, reason: 'count', message: `${file.name}: só podes juntar ${this.multiple() ? this.maxFiles() : 1} ficheiro${this.maxFiles() === 1 || !this.multiple() ? '' : 's'}.` });\n } else {\n accepted.push(file);\n }\n }\n this.rejections.set(rejected);\n if (rejected.length) this.rejected.emit(rejected);\n if (accepted.length) this.update([...current, ...accepted]);\n const parts = [];\n if (accepted.length) parts.push(accepted.length === 1 ? `${accepted[0].name} juntado.` : `${accepted.length} ficheiros juntados.`);\n parts.push(...rejected.map((r) => r.message));\n if (parts.length) this.announcer.announce(parts.join(' '), rejected.length ? 'assertive' : 'polite');\n this.onTouched();\n }\n\n remove(index: number): void {\n const file = this.files()[index];\n this.update(this.files().filter((_, i) => i !== index));\n this.announcer.announce(`${file.name} removido.`);\n afterNextRender(() => {\n const removes = this.host.querySelectorAll<HTMLElement>('.mx-file-upload-remove');\n (removes[Math.min(index, removes.length - 1)] ?? this.host.querySelector<HTMLElement>('.mx-file-upload-button'))?.focus();\n }, { injector: this.injector });\n }\n\n private update(files: File[]): void {\n this.value.set(files);\n this.onChange(files);\n }\n\n protected onPick(event: Event): void {\n const el = event.target as HTMLInputElement;\n if (el.files?.length) this.addFiles(el.files);\n // permite escolher o mesmo ficheiro outra vez\n el.value = '';\n }\n\n protected onDragEnter(event: DragEvent): void {\n if (this.isDisabled()) return;\n event.preventDefault();\n this.dragDepth++;\n this.dragging.set(true);\n }\n protected onDragOver(event: DragEvent): void {\n if (this.isDisabled()) return;\n event.preventDefault();\n if (event.dataTransfer) event.dataTransfer.dropEffect = 'copy';\n }\n protected onDragLeave(event: DragEvent): void {\n event.preventDefault();\n if (--this.dragDepth <= 0) {\n this.dragDepth = 0;\n this.dragging.set(false);\n }\n }\n protected onDrop(event: DragEvent): void {\n event.preventDefault();\n this.dragDepth = 0;\n this.dragging.set(false);\n if (this.isDisabled() || !event.dataTransfer?.files.length) return;\n this.addFiles(event.dataTransfer.files);\n }\n\n // ---- MxFormFieldControl ----\n errorState(): boolean {\n if (this.invalid()) return true;\n const c = this.ngControl;\n return !!c && !!c.invalid && !!(c.touched || c.dirty);\n }\n isRequired(): boolean {\n return this.required() || !!this.ngControl?.control?.hasValidator?.(Validators.required);\n }\n\n // ---- ControlValueAccessor ----\n writeValue(value: File[] | null): void {\n this.value.set(value ?? []);\n this.rejections.set([]);\n }\n registerOnChange(fn: (value: File[]) => void): void {\n this.onChange = fn;\n }\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n setDisabledState(isDisabled: boolean): void {\n this.formDisabled.set(isDisabled);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AA2BA;SACgB,aAAa,CAAC,KAAa,EAAE,MAAM,GAAG,OAAO,EAAA;IAC3D,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IACrC,IAAI,CAAC,GAAG,KAAK;IACb,IAAI,CAAC,GAAG,CAAC;AACT,IAAA,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACxC,CAAC,IAAI,IAAI;AACT,QAAA,CAAC,EAAE;IACL;AACA,IAAA,OAAO,CAAA,EAAG,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,qBAAqB,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;AACvG;AAEA;AACM,SAAU,aAAa,CAAC,IAAU,EAAE,MAAc,EAAA;AACtD,IAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;AAAE,QAAA,OAAO,IAAI;IAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;IACpC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;AACpC,IAAA,OAAO;SACJ,KAAK,CAAC,GAAG;AACT,SAAA,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAA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