@italia/upload 1.0.0-alpha.10

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.
@@ -0,0 +1,1486 @@
1
+ import { r as registerTranslation, t as translation, a as translation$1, _ as __decorate, b as __metadata, F as FormControl, c as FormControlController } from '../en-C97ZNr-2.js';
2
+ import { css, nothing, html } from 'lit';
3
+ import { query, property, state, customElement } from 'lit/decorators.js';
4
+ import { ifDefined } from 'lit/directives/if-defined.js';
5
+ import { f as formatSize } from '../utils-xlxkOHqp.js';
6
+ import 'lit/directive.js';
7
+
8
+ var styles = css`@charset "UTF-8";
9
+ /***************************** 1 ****************************************/
10
+ /***************************** 2 ****************************************/
11
+ /***************************** 1 ****************************************/
12
+ /***************************** 2 ****************************************/
13
+ /***************************** 1 ****************************************/
14
+ /***************************** 2 ****************************************/
15
+ /***************************** 3 ****************************************/
16
+ /***************************** 1 ****************************************/
17
+ /***************************** 2 ****************************************/
18
+ /***************************** 3 ****************************************/
19
+ /***************************** NEUTRAL 1 ****************************************/
20
+ /***************************** NEUTRAL 2 ****************************************/
21
+ /***************************** NEUTRAL 2 / 3 ****************************************/
22
+ *,
23
+ *::before,
24
+ *::after {
25
+ box-sizing: border-box;
26
+ }
27
+
28
+ @media (prefers-reduced-motion: no-preference) {
29
+ :root {
30
+ scroll-behavior: smooth;
31
+ }
32
+ }
33
+
34
+ body {
35
+ margin: 0;
36
+ -webkit-text-size-adjust: 100%;
37
+ -webkit-tap-highlight-color: hsla(0, 0%, 0%, 0);
38
+ }
39
+
40
+ hr {
41
+ margin: 1rem 0;
42
+ color: inherit;
43
+ border: 0;
44
+ border-top: 1px solid;
45
+ opacity: 0.25;
46
+ }
47
+
48
+ p {
49
+ margin-top: 0;
50
+ margin-bottom: var(--bsi-paragraph-spacing);
51
+ }
52
+
53
+ abbr[title] {
54
+ text-decoration: underline dotted;
55
+ cursor: help;
56
+ text-decoration-skip-ink: none;
57
+ }
58
+
59
+ address {
60
+ margin-bottom: var(--bsi-spacing-s);
61
+ font-style: normal;
62
+ line-height: inherit;
63
+ }
64
+
65
+ ol,
66
+ ul {
67
+ padding-left: var(--bsi-spacing-l);
68
+ }
69
+
70
+ ol,
71
+ ul,
72
+ dl {
73
+ margin-top: 0;
74
+ margin-bottom: var(--bsi-spacing-s);
75
+ }
76
+
77
+ ol ol,
78
+ ul ul,
79
+ ol ul,
80
+ ul ol {
81
+ margin-bottom: 0;
82
+ }
83
+
84
+ dt {
85
+ font-weight: var(--bsi-font-weight-strong);
86
+ }
87
+
88
+ dd {
89
+ margin-bottom: var(--bsi-spacing-xxs);
90
+ margin-left: 0;
91
+ }
92
+
93
+ blockquote {
94
+ margin: 0 0 var(--bsi-spacing-s);
95
+ }
96
+
97
+ sub,
98
+ sup {
99
+ position: relative;
100
+ font-size: var(--bsi-font-size-1);
101
+ line-height: 0;
102
+ vertical-align: baseline;
103
+ }
104
+
105
+ sub {
106
+ bottom: -0.25em;
107
+ }
108
+
109
+ sup {
110
+ top: -0.5em;
111
+ }
112
+
113
+ a {
114
+ color: var(--bsi-color-link);
115
+ text-decoration: underline;
116
+ text-decoration-skip-ink: auto;
117
+ text-underline-offset: 2px;
118
+ }
119
+ a:hover {
120
+ color: var(--bsi-color-link-hover);
121
+ cursor: pointer;
122
+ }
123
+
124
+ pre,
125
+ code,
126
+ kbd,
127
+ samp {
128
+ font-size: 1em;
129
+ }
130
+
131
+ pre {
132
+ display: block;
133
+ margin-top: 0;
134
+ margin-bottom: var(--bsi-paragraph-spacing);
135
+ overflow: auto;
136
+ }
137
+ pre code {
138
+ word-break: normal;
139
+ }
140
+
141
+ a > code {
142
+ color: inherit;
143
+ }
144
+
145
+ figure {
146
+ margin: 0 0 1rem;
147
+ }
148
+
149
+ img,
150
+ svg {
151
+ vertical-align: middle;
152
+ }
153
+
154
+ table {
155
+ caption-side: bottom;
156
+ border-collapse: collapse;
157
+ }
158
+
159
+ caption {
160
+ padding-top: 0.5rem;
161
+ padding-bottom: 0.5rem;
162
+ color: hsl(210, 17%, 44%);
163
+ text-align: left;
164
+ }
165
+
166
+ th {
167
+ text-align: inherit;
168
+ text-align: -webkit-match-parent;
169
+ }
170
+
171
+ thead,
172
+ tbody,
173
+ tfoot,
174
+ tr,
175
+ td,
176
+ th {
177
+ border-color: inherit;
178
+ border-style: solid;
179
+ border-width: 0;
180
+ }
181
+
182
+ label {
183
+ display: inline-block;
184
+ }
185
+
186
+ button {
187
+ border-radius: 0;
188
+ }
189
+
190
+ button:focus:not(:focus-visible) {
191
+ outline: 0;
192
+ }
193
+
194
+ input,
195
+ button,
196
+ select,
197
+ optgroup,
198
+ textarea {
199
+ margin: 0;
200
+ font-family: inherit;
201
+ font-size: inherit;
202
+ line-height: inherit;
203
+ }
204
+
205
+ button,
206
+ select {
207
+ text-transform: none;
208
+ }
209
+
210
+ [role=button] {
211
+ cursor: pointer;
212
+ }
213
+
214
+ select {
215
+ word-wrap: normal;
216
+ }
217
+ select:disabled {
218
+ opacity: 1;
219
+ }
220
+
221
+ [list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator {
222
+ display: none !important;
223
+ }
224
+
225
+ button,
226
+ [type=button],
227
+ [type=reset],
228
+ [type=submit] {
229
+ -webkit-appearance: button;
230
+ }
231
+ button:not(:disabled),
232
+ [type=button]:not(:disabled),
233
+ [type=reset]:not(:disabled),
234
+ [type=submit]:not(:disabled) {
235
+ cursor: pointer;
236
+ }
237
+
238
+ ::-moz-focus-inner {
239
+ padding: 0;
240
+ border-style: none;
241
+ }
242
+
243
+ textarea {
244
+ resize: vertical;
245
+ }
246
+
247
+ fieldset {
248
+ min-width: 0;
249
+ padding: 0;
250
+ margin: 0;
251
+ border: 0;
252
+ }
253
+
254
+ ::-webkit-datetime-edit-fields-wrapper,
255
+ ::-webkit-datetime-edit-text,
256
+ ::-webkit-datetime-edit-minute,
257
+ ::-webkit-datetime-edit-hour-field,
258
+ ::-webkit-datetime-edit-day-field,
259
+ ::-webkit-datetime-edit-month-field,
260
+ ::-webkit-datetime-edit-year-field {
261
+ padding: 0;
262
+ }
263
+
264
+ ::-webkit-inner-spin-button {
265
+ height: auto;
266
+ }
267
+
268
+ [type=search] {
269
+ outline-offset: -2px;
270
+ -webkit-appearance: textfield;
271
+ }
272
+
273
+ /* rtl:raw:
274
+ [type="tel"],
275
+ [type="url"],
276
+ [type="email"],
277
+ [type="number"] {
278
+ direction: ltr;
279
+ }
280
+ */
281
+ ::-webkit-search-decoration {
282
+ -webkit-appearance: none;
283
+ }
284
+
285
+ ::-webkit-color-swatch-wrapper {
286
+ padding: 0;
287
+ }
288
+
289
+ ::file-selector-button {
290
+ font: inherit;
291
+ -webkit-appearance: button;
292
+ }
293
+
294
+ output {
295
+ display: inline-block;
296
+ }
297
+
298
+ iframe {
299
+ border: 0;
300
+ }
301
+
302
+ summary {
303
+ display: list-item;
304
+ cursor: pointer;
305
+ }
306
+
307
+ progress {
308
+ vertical-align: baseline;
309
+ }
310
+
311
+ [hidden] {
312
+ display: none !important;
313
+ }
314
+
315
+ .visually-hidden,
316
+ .visually-hidden-focusable:not(:focus):not(:focus-within) {
317
+ position: absolute !important;
318
+ width: 1px !important;
319
+ height: 1px !important;
320
+ padding: 0 !important;
321
+ margin: -1px !important;
322
+ overflow: hidden !important;
323
+ clip: rect(0, 0, 0, 0) !important;
324
+ white-space: nowrap !important;
325
+ border: 0 !important;
326
+ }
327
+
328
+ .upload,
329
+ .upload-avatar {
330
+ position: absolute;
331
+ z-index: -1;
332
+ width: 0.1px;
333
+ height: 0.1px;
334
+ overflow: hidden;
335
+ opacity: 0;
336
+ }
337
+
338
+ .upload[type=file] + label {
339
+ display: inline-block;
340
+ margin-bottom: 0;
341
+ max-width: 80%;
342
+ padding: var(--bsi-spacing-xs) var(--bsi-spacing-m);
343
+ overflow: hidden;
344
+ border-radius: var(--bsi-form-control-border-radius);
345
+ background-color: var(--bsi-color-background-primary);
346
+ color: var(--bsi-color-text-inverse);
347
+ font-size: 1rem;
348
+ font-weight: 700;
349
+ transition: background-color var(--bsi-transition-instant);
350
+ cursor: pointer;
351
+ }
352
+ .upload[type=file] + label:hover {
353
+ background-color: var(--bsi-color-background-primary-hover);
354
+ }
355
+ .upload[type=file] + label svg {
356
+ margin-right: var(--bsi-spacing-xxs);
357
+ fill: var(--bsi-icon-inverse);
358
+ }
359
+
360
+ .upload-pictures-wall {
361
+ display: flex;
362
+ flex-wrap: wrap;
363
+ padding: 0;
364
+ }
365
+ .upload-pictures-wall > li {
366
+ margin-right: var(--bsi-spacing-xxs);
367
+ margin-bottom: var(--bsi-spacing-xxs);
368
+ list-style-type: none;
369
+ }
370
+ .upload-pictures-wall > li:last-child {
371
+ margin-right: 0;
372
+ }
373
+ .upload-pictures-wall .upload[type=file] + label {
374
+ display: table-cell;
375
+ width: 128px;
376
+ height: 128px;
377
+ padding: 0;
378
+ border: 2px dashed var(--bsi-color-border-primary);
379
+ border-radius: 0;
380
+ background-color: var(--bsi-color-border-primary-lighter);
381
+ color: var(--bsi-color-text-primary);
382
+ font-weight: 600;
383
+ text-align: center;
384
+ vertical-align: middle;
385
+ transition: border-color var(--bsi-transition-instant);
386
+ }
387
+ .upload-pictures-wall .upload[type=file] + label .icon {
388
+ display: block;
389
+ flex-shrink: 0;
390
+ width: 48px;
391
+ height: 48px;
392
+ margin: 0 auto;
393
+ fill: var(--bsi-icon-primary);
394
+ }
395
+ .upload-pictures-wall .upload[type=file] + label:hover {
396
+ border: 2px dashed var(--bsi-color-border-primary-hover);
397
+ }
398
+ .upload-pictures-wall .upload-image {
399
+ flex-shrink: 0;
400
+ width: 128px;
401
+ height: 128px;
402
+ }
403
+ .upload-pictures-wall .upload-image img {
404
+ width: 100%;
405
+ height: 100%;
406
+ object-fit: cover;
407
+ }
408
+
409
+ .upload-file-list {
410
+ margin-top: 5px;
411
+ padding: 0;
412
+ }
413
+ .upload-file-list.upload-file-list-image .progress {
414
+ left: 52px;
415
+ }
416
+ .upload-file-list .upload-file {
417
+ position: relative;
418
+ display: flex;
419
+ align-items: center;
420
+ max-width: 375px;
421
+ margin-bottom: var(--bsi-spacing-s);
422
+ list-style-type: none;
423
+ }
424
+ .upload-file-list .upload-file.uploading .icon {
425
+ fill: var(--bsi-icon-secondary);
426
+ }
427
+ .upload-file-list .upload-file.uploading p {
428
+ color: var(--bsi-color-text-secondary);
429
+ }
430
+ .upload-file-list .upload-file.success svg {
431
+ fill: var(--bsi-icon-success);
432
+ }
433
+ .upload-file-list .upload-file.success p {
434
+ color: var(--bsi-color-text-success);
435
+ }
436
+ .upload-file-list .upload-file.success p .upload-file-weight {
437
+ display: inline-block;
438
+ }
439
+ .upload-file-list .upload-file.error svg {
440
+ fill: var(--bsi-icon-danger);
441
+ }
442
+ .upload-file-list .upload-file.error p {
443
+ color: var(--bsi-color-text-danger);
444
+ }
445
+ .upload-file-list .upload-file svg {
446
+ flex-shrink: 0;
447
+ }
448
+ .upload-file-list .upload-file .upload-image {
449
+ flex-shrink: 0;
450
+ width: 40px;
451
+ height: 40px;
452
+ }
453
+ .upload-file-list .upload-file .upload-image img {
454
+ width: 100%;
455
+ height: 100%;
456
+ object-fit: cover;
457
+ }
458
+ .upload-file-list .upload-file p {
459
+ margin: 0;
460
+ margin-left: 12px;
461
+ overflow: hidden;
462
+ font-size: 0.875rem;
463
+ font-weight: 600;
464
+ text-overflow: ellipsis;
465
+ white-space: nowrap;
466
+ }
467
+ .upload-file-list .upload-file p .upload-file-weight {
468
+ display: none;
469
+ margin-left: 10px;
470
+ color: var(--bsi-color-text-secondary);
471
+ }
472
+ .upload-file-list .upload-file button {
473
+ margin-left: auto;
474
+ padding: 0;
475
+ border: 0;
476
+ background: transparent;
477
+ }
478
+ .upload-file-list .upload-file button:hover {
479
+ cursor: pointer;
480
+ }
481
+ .upload-file-list .upload-file button:hover svg {
482
+ fill: var(--bsi-icon-primary);
483
+ }
484
+ .upload-file-list .progress {
485
+ position: absolute;
486
+ bottom: -4px;
487
+ left: 36px;
488
+ width: calc(100% - 45px);
489
+ height: 4px;
490
+ background-color: hsl(210, 3%, 85%);
491
+ box-shadow: none;
492
+ }
493
+ .upload-file-list .progress.progress-image {
494
+ width: calc(100% - 60px);
495
+ }
496
+
497
+ .upload-avatar-container {
498
+ position: absolute;
499
+ top: 0;
500
+ left: 0;
501
+ width: 100%;
502
+ height: 100%;
503
+ }
504
+ .upload-avatar-container .upload-avatar[type=file] + label {
505
+ position: absolute;
506
+ top: 0;
507
+ left: 0;
508
+ width: 100%;
509
+ height: 100%;
510
+ }
511
+ .upload-avatar-container .upload-avatar[type=file] + label svg {
512
+ display: none;
513
+ }
514
+ .upload-avatar-container .upload-avatar[type=file] + label span {
515
+ display: none;
516
+ }
517
+
518
+ .avatar-upload {
519
+ overflow: hidden;
520
+ }
521
+
522
+ .avatar-upload-wrapper .avatar-upload-icon {
523
+ position: absolute;
524
+ right: 4px;
525
+ bottom: 16px;
526
+ display: flex;
527
+ align-items: center;
528
+ justify-content: center;
529
+ width: 26px;
530
+ height: 26px;
531
+ border: 2px solid var(--bsi-color-border-inverse);
532
+ border-radius: 50%;
533
+ background: hsl(210, 6.2290689886%, 92.535%);
534
+ pointer-events: none;
535
+ }
536
+ .avatar-upload-wrapper .avatar-upload-icon > svg {
537
+ width: 16px;
538
+ height: 16px;
539
+ }
540
+ .avatar-upload-wrapper.size-sm .avatar {
541
+ width: 80px;
542
+ height: 80px;
543
+ }
544
+ .avatar-upload-wrapper.size-sm .avatar-upload-icon {
545
+ right: 4px;
546
+ bottom: 6px;
547
+ width: 18px;
548
+ height: 18px;
549
+ }
550
+ .avatar-upload-wrapper.size-sm .avatar-upload-icon > svg {
551
+ width: 12px;
552
+ height: 12px;
553
+ }
554
+
555
+ .upload-dragdrop {
556
+ display: inline-flex;
557
+ align-items: center;
558
+ }
559
+ .upload-dragdrop.dragover .upload-dragdrop-image img, .upload-dragdrop.loading .upload-dragdrop-image img {
560
+ transform: translateX(-50%) translateY(-50%) scale(0.85);
561
+ }
562
+ .upload-dragdrop.loading p:not(.upload-dragdrop-weight) {
563
+ font-style: italic;
564
+ }
565
+ .upload-dragdrop.loading .upload-dragdrop-loading {
566
+ opacity: 1;
567
+ }
568
+ .upload-dragdrop.loading .upload-dragdrop-text .upload-dragdrop-weight, .upload-dragdrop.success .upload-dragdrop-text .upload-dragdrop-weight {
569
+ visibility: visible;
570
+ }
571
+ .upload-dragdrop.success .upload-dragdrop-success {
572
+ opacity: 1;
573
+ transform: scale(1);
574
+ }
575
+
576
+ .upload-dragdrop-text p {
577
+ margin: 0;
578
+ color: var(--bsi-color-text-secondary);
579
+ font-size: 0.875rem;
580
+ }
581
+ .upload-dragdrop-text p.upload-dragdrop-weight {
582
+ visibility: hidden;
583
+ color: var(--bsi-color-text-secondary);
584
+ font-size: 0.75rem;
585
+ }
586
+ .upload-dragdrop-text p.upload-dragdrop-weight svg {
587
+ fill: var(--bsi-icon-secondary);
588
+ }
589
+ .upload-dragdrop-text h5 {
590
+ margin: 0;
591
+ color: var(--bsi-color-text-base);
592
+ }
593
+
594
+ .upload-dragdrop-input {
595
+ position: absolute;
596
+ z-index: -1;
597
+ width: 0.1px;
598
+ height: 0.1px;
599
+ overflow: hidden;
600
+ opacity: 0;
601
+ }
602
+ .upload-dragdrop-input[type=file] + label {
603
+ color: var(--bsi-color-text-primary);
604
+ text-decoration: underline;
605
+ cursor: pointer;
606
+ }
607
+ .upload-dragdrop-input:focus[type=file] + label {
608
+ outline: auto 5px -webkit-focus-ring-color;
609
+ }
610
+
611
+ .upload-dragdrop-loading {
612
+ position: absolute;
613
+ top: 0;
614
+ right: 0;
615
+ bottom: 0;
616
+ left: 0;
617
+ width: 128px;
618
+ height: 128px;
619
+ overflow: hidden;
620
+ border-radius: 50%;
621
+ opacity: 0;
622
+ transition: opacity 0.2s;
623
+ }
624
+ .upload-dragdrop-loading .progress-donut {
625
+ position: relative;
626
+ }
627
+ .upload-dragdrop-loading .progress-donut .progressbar-text {
628
+ color: #000 !important;
629
+ font-weight: 700;
630
+ }
631
+ .upload-dragdrop-loading .progress-donut svg {
632
+ position: relative;
633
+ }
634
+ .upload-dragdrop-loading .progress-donut svg path:first-child {
635
+ display: none;
636
+ }
637
+ .upload-dragdrop-loading .progress-donut:before {
638
+ position: absolute;
639
+ top: 50%;
640
+ left: 50%;
641
+ z-index: 0;
642
+ content: "";
643
+ width: 67px;
644
+ height: 67px;
645
+ border-radius: 50%;
646
+ background: #fff;
647
+ transform: translateX(-50%) translateY(-50%);
648
+ }
649
+
650
+ .upload-dragdrop-image {
651
+ position: relative;
652
+ flex-shrink: 0;
653
+ width: 128px;
654
+ height: 128px;
655
+ margin-right: var(--bsi-spacing-s);
656
+ }
657
+ .upload-dragdrop-image img {
658
+ position: absolute;
659
+ top: 50%;
660
+ left: 50%;
661
+ display: block;
662
+ width: 100%;
663
+ height: 100%;
664
+ overflow: hidden;
665
+ border-radius: 50%;
666
+ transform: translateX(-50%) translateY(-50%);
667
+ transform-origin: center center;
668
+ transition: transform 0.4s cubic-bezier(0.33, 1.07, 0.54, 1);
669
+ }
670
+ .upload-dragdrop-image .upload-dragdrop-success {
671
+ position: absolute;
672
+ top: calc(50% - 18px);
673
+ left: 20px;
674
+ display: flex;
675
+ align-items: center;
676
+ justify-content: center;
677
+ width: 36px;
678
+ height: 36px;
679
+ border-radius: 50%;
680
+ opacity: 0;
681
+ background: var(--bsi-color-background-success);
682
+ transform: scale(0.6);
683
+ transition: opacity 0.2s, transform 0.5s cubic-bezier(0.75, -0.5, 0, 1.75);
684
+ }
685
+ .upload-dragdrop-image .upload-dragdrop-success svg {
686
+ width: 30px;
687
+ height: 30px;
688
+ fill: var(--bsi-icon-inverse);
689
+ }
690
+ .upload-dragdrop-image .upload-dragdrop-success .upload-dragdrop-text h5 + p {
691
+ color: var(--bsi-color-text-success);
692
+ font-weight: var(--bsi-font-weight-solid);
693
+ }
694
+
695
+ @media (min-width: 576px) {
696
+ .upload[type=file] + label {
697
+ font-size: var(--bsi-label-font-size-s);
698
+ }
699
+ }
700
+ @media (min-width: 768px) {
701
+ .upload-dragdrop-image {
702
+ width: 180px;
703
+ height: 180px;
704
+ margin-right: 32px;
705
+ }
706
+ .upload-dragdrop-image .upload-dragdrop-success {
707
+ left: 28px;
708
+ }
709
+ .upload-dragdrop-loading {
710
+ width: 180px;
711
+ height: 180px;
712
+ }
713
+ .upload-dragdrop-loading .progress-donut:before {
714
+ content: "";
715
+ width: 94px;
716
+ height: 94px;
717
+ }
718
+ }
719
+ @media (min-width: 1200px) {
720
+ .avatar-upload:hover .upload-avatar-container,
721
+ .avatar-upload:focus-within .upload-avatar-container {
722
+ opacity: 1;
723
+ }
724
+ .upload-avatar-container {
725
+ top: auto;
726
+ right: 0;
727
+ bottom: -10%;
728
+ left: 0;
729
+ width: 100%;
730
+ height: 60%;
731
+ opacity: 0;
732
+ background-color: var(--bsi-overlay-background-primary-muted);
733
+ transition: opacity var(--bsi-transition-instant);
734
+ }
735
+ .upload-avatar-container .upload-avatar[type=file] + label {
736
+ display: flex;
737
+ flex-direction: column;
738
+ align-items: center;
739
+ justify-content: flex-start;
740
+ width: 100%;
741
+ height: 100%;
742
+ margin: 0;
743
+ padding-top: var(--bsi-spacing-xxs);
744
+ color: var(--bsi-color-text-inverse);
745
+ font-size: 0.75rem;
746
+ text-align: center;
747
+ cursor: pointer;
748
+ }
749
+ .upload-avatar-container .upload-avatar[type=file] + label span {
750
+ display: block;
751
+ }
752
+ .upload-avatar-container .upload-avatar[type=file] + label svg {
753
+ display: block;
754
+ width: 20px;
755
+ height: 20px;
756
+ fill: var(--bsi-icon-inverse);
757
+ }
758
+ .upload-avatar-container .upload-avatar:focus:not([data-focus-mouse=true])[type=file] + label {
759
+ outline: auto 5px -webkit-focus-ring-color;
760
+ }
761
+ .avatar-upload-wrapper .avatar-upload-icon {
762
+ display: none;
763
+ }
764
+ .avatar-upload-wrapper.size-sm .upload-avatar[type=file] + label span {
765
+ display: none;
766
+ }
767
+ }
768
+ .form-feedback {
769
+ width: 100%;
770
+ margin-top: 0.25rem;
771
+ font-size: 0.75rem;
772
+ }
773
+ .form-feedback.just-validate-error-label {
774
+ color: var(--bsi-color-text-danger);
775
+ }
776
+
777
+ .input-group-text:has(~ [data-focus-mouse=true]:not(.btn)),
778
+ [data-focus-mouse=true]:not(.btn) ~ .input-group-text,
779
+ button:has(~ [data-focus-mouse=true]:not(.btn)),
780
+ [data-focus-mouse=true]:not(.btn) + button {
781
+ border-color: inherit !important;
782
+ box-shadow: none !important;
783
+ outline: none !important;
784
+ }
785
+
786
+ .input-group-text:has(~ .is-invalid),
787
+ .is-invalid ~ .input-group-text,
788
+ button:has(~ .is-invalid),
789
+ .is-invalid + button {
790
+ border-color: var(--bsi-color-border-danger) !important;
791
+ }
792
+
793
+ .sr-only-justvalidate-bi {
794
+ display: none;
795
+ }
796
+
797
+ .just-validate-success-field {
798
+ border-color: var(--bsi-color-border-success) !important;
799
+ padding-right: calc(1.5em + 0.75rem) !important;
800
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23008055' viewBox='0 0 192 512'%3E%3Cpath d='M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z'/%3E%3C/svg%3E");
801
+ }
802
+
803
+ .input-group-text:has(~ .just-validate-success-field),
804
+ .just-validate-success-field ~ .input-group-text,
805
+ button:has(~ .just-validate-success-field),
806
+ .just-validate-success-field + button {
807
+ border-color: var(--bsi-color-border-success);
808
+ }
809
+
810
+ .just-validate-success-field + .input-group-text.align-buttons,
811
+ .is-invalid + .input-group-text.align-buttons {
812
+ right: 30px;
813
+ }
814
+
815
+ .is-invalid + .input-group-text.align-buttons {
816
+ bottom: 22px;
817
+ }
818
+
819
+ .autocomplete__wrapper .form-feedback.just-validate-error-label {
820
+ position: absolute;
821
+ }
822
+
823
+ textarea.form-control {
824
+ background-position: top 0.3em right 0.3em !important;
825
+ background-size: 37px 30% !important;
826
+ }
827
+ textarea.is-invalid {
828
+ border-bottom-style: solid;
829
+ border-bottom-width: 1px;
830
+ }
831
+ textarea.just-validate-success-field {
832
+ border-bottom-style: solid;
833
+ border-bottom-width: 1px;
834
+ }
835
+
836
+ input[type=checkbox].is-invalid,
837
+ input[type=radio].is-invalid {
838
+ --bsi-form-checkbox-border-color: var(--bsi-color-border-danger);
839
+ }
840
+
841
+ select.is-invalid {
842
+ border: 1px solid var(--bsi-color-border-danger);
843
+ }
844
+ select.just-validate-success-field {
845
+ border: 1px solid var(--bsi-color-border-success);
846
+ }
847
+
848
+ body {
849
+ font-family: var(--bsi-font-sans);
850
+ }
851
+
852
+ p,
853
+ ul,
854
+ ol,
855
+ dl {
856
+ font-size: var(--bsi-body-font-size);
857
+ line-height: var(--bsi-body-leading);
858
+ }
859
+
860
+ caption,
861
+ figcaption {
862
+ font-size: var(--bsi-caption-font-size);
863
+ line-height: var(--bsi-caption-leading);
864
+ }
865
+
866
+ b,
867
+ strong {
868
+ font-weight: var(--bsi-font-weight-strong);
869
+ }
870
+
871
+ mark,
872
+ code {
873
+ padding: 0 var(--bsi-spacing-3xs);
874
+ }
875
+
876
+ mark {
877
+ background-color: var(--bsi-highlight-background);
878
+ }
879
+
880
+ pre,
881
+ code,
882
+ kbd,
883
+ samp {
884
+ border-radius: var(--bsi-radius-smooth);
885
+ font-family: var(--bsi-font-mono);
886
+ }
887
+
888
+ ins,
889
+ del {
890
+ position: relative;
891
+ display: flex;
892
+ align-items: center;
893
+ padding: var(--bsi-spacing-3xs) var(--bsi-spacing-m);
894
+ font: var(--bsi-body-font-size);
895
+ text-decoration: none;
896
+ }
897
+
898
+ ins {
899
+ background-color: var(--bsi-ins-background);
900
+ text-decoration: none;
901
+ }
902
+
903
+ del {
904
+ background-color: var(--bsi-del-background);
905
+ }
906
+
907
+ del::before,
908
+ ins::before {
909
+ position: absolute;
910
+ left: 0.5rem;
911
+ }
912
+
913
+ del::before {
914
+ content: "−";
915
+ }
916
+
917
+ ins::before {
918
+ content: "+";
919
+ }
920
+
921
+ kbd {
922
+ margin: 0 2px;
923
+ padding: 2px var(--bsi-spacing-3xs);
924
+ border: var(--bsi-border-base) solid var(--bsi-color-border-subtle);
925
+ background-color: var(--bsi-color-background-secondary-lighter);
926
+ box-shadow: var(--bsi-elevation-low), 0 2px 0 0 hsla(255, 0%, 100%, 0.7) inset;
927
+ color: var(--bsi-color-text-secondary);
928
+ font-size: var(--bsi-font-size-1);
929
+ font-weight: var(--bsi-font-weight-solid);
930
+ white-space: nowrap;
931
+ }
932
+ kbd kbd {
933
+ padding: 0;
934
+ font-size: var(--bsi-code-font-size);
935
+ }
936
+
937
+ small,
938
+ .small {
939
+ font-size: var(--bsi-caption-font-size);
940
+ }
941
+
942
+ .x-small {
943
+ font-size: var(--bsi-font-size-1);
944
+ }
945
+
946
+ h1,
947
+ .h1 {
948
+ font-size: var(--bsi-heading-1-font-size);
949
+ }
950
+
951
+ h2,
952
+ .h2 {
953
+ font-size: var(--bsi-heading-2-font-size);
954
+ }
955
+
956
+ h3,
957
+ .h3 {
958
+ font-size: var(--bsi-heading-3-font-size);
959
+ }
960
+
961
+ h4,
962
+ .h4 {
963
+ font-size: var(--bsi-heading-4-font-size);
964
+ }
965
+
966
+ h5,
967
+ .h5 {
968
+ font-size: var(--bsi-heading-5-font-size);
969
+ }
970
+
971
+ h6,
972
+ .h6 {
973
+ font-size: var(--bsi-heading-6-font-size);
974
+ }
975
+
976
+ h1,
977
+ .h1,
978
+ h2,
979
+ .h2,
980
+ h3,
981
+ .h3,
982
+ h4,
983
+ .h4,
984
+ h5,
985
+ .h5,
986
+ h6,
987
+ .h6 {
988
+ margin-top: 0;
989
+ margin-bottom: var(--bsi-heading-spacing);
990
+ line-height: var(--bsi-heading-leading);
991
+ }
992
+ :is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) + h1, p + h1,
993
+ :is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) + .h1,
994
+ p + .h1,
995
+ :is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) + h2,
996
+ p + h2,
997
+ :is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) + .h2,
998
+ p + .h2,
999
+ :is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) + h3,
1000
+ p + h3,
1001
+ :is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) + .h3,
1002
+ p + .h3,
1003
+ :is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) + h4,
1004
+ p + h4,
1005
+ :is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) + .h4,
1006
+ p + .h4,
1007
+ :is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) + h5,
1008
+ p + h5,
1009
+ :is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) + .h5,
1010
+ p + .h5,
1011
+ :is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) + h6,
1012
+ p + h6,
1013
+ :is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) + .h6,
1014
+ p + .h6 {
1015
+ padding-top: var(--bsi-spacing-s);
1016
+ }
1017
+
1018
+ h1,
1019
+ h2,
1020
+ h3,
1021
+ .h1,
1022
+ .h2,
1023
+ .h3 {
1024
+ font-weight: var(--bsi-heading-font-weight);
1025
+ }
1026
+
1027
+ h4,
1028
+ h5,
1029
+ h6,
1030
+ .h4,
1031
+ .h5,
1032
+ .h6 {
1033
+ font-weight: var(--bsi-heading-font-weight-weak);
1034
+ }
1035
+
1036
+ h1,
1037
+ .h1,
1038
+ .display-1 {
1039
+ letter-spacing: -1px;
1040
+ }
1041
+
1042
+ .font-serif {
1043
+ font-family: var(--bsi-font-serif) !important;
1044
+ }
1045
+
1046
+ .font-sans-serif {
1047
+ font-family: var(--bsi-font-sans) !important;
1048
+ }
1049
+
1050
+ .font-monospace {
1051
+ font-family: var(--bsi-font-mono) !important;
1052
+ }
1053
+
1054
+ .display-1 {
1055
+ font-size: var(--bsi-display-font-size);
1056
+ font-weight: var(--bsi-heading-font-weight);
1057
+ line-height: var(--bsi-heading-leading);
1058
+ }
1059
+
1060
+ .lead {
1061
+ font-size: var(--bsi-lead-font-size);
1062
+ font-weight: var(--bsi-lead-font-weight);
1063
+ line-height: var(--bsi-lead-leading);
1064
+ }
1065
+
1066
+ blockquote,
1067
+ .blockquote {
1068
+ margin: var(--bsi-spacing-m) 0;
1069
+ margin-left: var(--bsi-spacin-inline-xs);
1070
+ padding: var(--bsi-spacing-s);
1071
+ border-left: var(--bsi-border-thick) solid var(--bsi-border-color-secondary);
1072
+ font-size: var(--bsi-body-font-size);
1073
+ line-height: var(--bsi-body-leading);
1074
+ }
1075
+ blockquote > :last-child,
1076
+ .blockquote > :last-child {
1077
+ margin-bottom: 0;
1078
+ }
1079
+ blockquote.text-end,
1080
+ .blockquote.text-end {
1081
+ margin-right: var(--bsi-spacin-inline-xs);
1082
+ border-right: var(--bsi-border-thick) solid var(--bsi-border-color-secondary);
1083
+ }
1084
+ blockquote.text-center, blockquote.text-end, blockquote.blockquote-simple,
1085
+ .blockquote.text-center,
1086
+ .blockquote.text-end,
1087
+ .blockquote.blockquote-simple {
1088
+ margin-left: 0;
1089
+ border-right: none;
1090
+ border-left: none;
1091
+ }
1092
+ blockquote.text-center, blockquote.blockquote-simple,
1093
+ .blockquote.text-center,
1094
+ .blockquote.blockquote-simple {
1095
+ padding: 0;
1096
+ }
1097
+ blockquote.blockquote-simple,
1098
+ .blockquote.blockquote-simple {
1099
+ font-style: italic;
1100
+ }
1101
+ blockquote.blockquote-card,
1102
+ .blockquote.blockquote-card {
1103
+ margin-left: 0;
1104
+ padding: var(--bsi-spacing-m);
1105
+ background-color: var(--bsi-color-background-inverse);
1106
+ box-shadow: var(--bsi-elevation-low);
1107
+ }
1108
+ blockquote.blockquote-card .blockquote-footer,
1109
+ .blockquote.blockquote-card .blockquote-footer {
1110
+ font-size: inherit;
1111
+ }
1112
+ blockquote.blockquote-card .blockquote-footer:before,
1113
+ .blockquote.blockquote-card .blockquote-footer:before {
1114
+ content: none;
1115
+ }
1116
+ blockquote.blockquote-card.dark,
1117
+ .blockquote.blockquote-card.dark {
1118
+ border-left: none;
1119
+ background-color: var(--bsi-color-background-primary);
1120
+ color: var(--bsi-color-text-inverse);
1121
+ }
1122
+ blockquote.blockquote-card.dark .blockquote-footer,
1123
+ .blockquote.blockquote-card.dark .blockquote-footer {
1124
+ color: var(--bsi-color-text-inverse);
1125
+ }
1126
+
1127
+ .blockquote-footer {
1128
+ margin-top: 0;
1129
+ margin-bottom: var(--bsi-spacing-s);
1130
+ color: var(--bsi-color-text-secondary);
1131
+ font-size: var(--bsi-label-font-size);
1132
+ }
1133
+ .blockquote-footer::before {
1134
+ content: "— ";
1135
+ }
1136
+ .bg-dark .blockquote-footer {
1137
+ color: var(--bsi-color-text-muted);
1138
+ }
1139
+
1140
+ .initialism {
1141
+ font-size: var(--bsi-label-font-size-s);
1142
+ text-transform: uppercase;
1143
+ }
1144
+
1145
+ :host {
1146
+ display: inline-block;
1147
+ }
1148
+
1149
+ .it-form__control {
1150
+ display: none;
1151
+ }
1152
+
1153
+ .upload-dragdrop-loading it-progress {
1154
+ display: block;
1155
+ width: 100%;
1156
+ height: 100%;
1157
+ --it-progress-donut-track-color: transparent;
1158
+ }
1159
+
1160
+ :focus-visible,
1161
+ .upload:focus-visible + label,
1162
+ .upload-dragdrop-input:focus-visible[type=file] + label,
1163
+ .avatar-upload:focus-within:focus-visible {
1164
+ border-color: #000 !important;
1165
+ box-shadow: 0 0 0 2px hsl(0, 0%, 100%), 0 0 0 5px hsl(0, 0%, 0%) !important;
1166
+ outline: 3px solid rgba(0, 0, 0, 0) !important;
1167
+ outline-offset: 3px !important;
1168
+ }
1169
+
1170
+ .upload-dragdrop-weight {
1171
+ display: flex;
1172
+ align-items: center;
1173
+ gap: var(--bsi-spacing-xxs, 8px);
1174
+ }`;
1175
+
1176
+ registerTranslation(translation);
1177
+ registerTranslation(translation$1);
1178
+ // Base64‑encoded copy of bootstrap-italia/dist/assets/upload-drag-drop-icon.svg
1179
+ // bundled inline so the component works standalone without a public assets path.
1180
+ const DRAG_DROP_ICON_SRC = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTgwcHgiIGhlaWdodD0iMTgwcHgiIHZpZXdCb3g9IjAgMCAxODAgMTgwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPHRpdGxlPmljb248L3RpdGxlPgogICAgPGcgaWQ9IlVwbG9hZCIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9IkFydGJvYXJkIj4KICAgICAgICAgICAgPGcgaWQ9Imljb24iPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZSIgZmlsbD0iI0QxRTdGRiIgeD0iMCIgeT0iMCIgd2lkdGg9IjE4MCIgaGVpZ2h0PSIxODAiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSJHcm91cC02LUNvcHkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwNy44NTUxNzUsIDEwOS43MDIyNDgpIHJvdGF0ZSgtMTApIHRyYW5zbGF0ZSgtMTA3Ljg1NTE3NSwgLTEwOS43MDIyNDgpIHRyYW5zbGF0ZSg0OC4zNTUxNzUsIDM1LjIwMjI0OCkiPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik05LjA5NDg1NzY1LDAuODE4Mzc2OTk5IEw4OS4wOTA5MjA2LDAuODE4Mzc2OTk5IEwxMTguNTkwOTIxLDMwLjQxODM3NyBMMTE4LjU5MDkyMSwxNDAuMzE0NDQgQzExOC41OTA5MjEsMTQ1LjAxMTAzNSAxMTQuNzgzNTc4LDE0OC44MTgzNzcgMTEwLjA4Njk4NCwxNDguODE4Mzc3IEw2LjI2MDIxMTk4LDE0OC44MTgzNzcgQzMuMTI5MTQ4ODMsMTQ4LjgxODM3NyAwLjU5MDkyMDY0MywxNDYuMjgwMTQ5IDAuNTkwOTIwNjQzLDE0My4xNDkwODYgTDAuNTkwOTIwNjQzLDkuMzIyMzE0MDEgQzAuNTkwOTIwNjQzLDQuNjI1NzE5MjggNC4zOTgyNjI5MywwLjgxODM3Njk5OSA5LjA5NDg1NzY1LDAuODE4Mzc2OTk5IFoiIGZpbGw9IiM2NkE1RTMiIG9wYWNpdHk9IjAuNCI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwb2x5Z29uIGZpbGw9IiNGRkZGRkYiIGZpbGwtcnVsZT0ibm9uemVybyIgcG9pbnRzPSIyMS4wNTczOTU5IDczLjg1ODQ5NTkgMjEuMDU3Mzk1OSA2NS4zNTQ1NTg5IDcwLjg2MzA0MTIgNjUuMzU0NTU4OSA3MC44NjMwNDEyIDczLjg1ODQ5NTkiPjwvcG9seWdvbj4KICAgICAgICAgICAgICAgICAgICA8cG9seWdvbiBmaWxsPSIjRkZGRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iIHBvaW50cz0iMjAuMjE3MTkzNCA5MS4zMjIxNTkgMjAuMjE3MTkzNCA4Mi44MTgyMjIgOTkuNzIxMTMwNCA4Mi44MTgyMjIgOTkuNzIxMTMwNCA5MS4zMjIxNTkiPjwvcG9seWdvbj4KICAgICAgICAgICAgICAgICAgICA8cG9seWdvbiBmaWxsPSIjRkZGRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iIHBvaW50cz0iMjAuMzkzMjQ1OCAxMDcuNjAwMDI4IDIwLjM5MzI0NTggOTkuMDk2MDkwNiA5OS44OTcxODI4IDk5LjA5NjA5MDYgOTkuODk3MTgyOCAxMDcuNjAwMDI4Ij48L3BvbHlnb24+CiAgICAgICAgICAgICAgICAgICAgPHBvbHlnb24gZmlsbD0iIzAwNTlCMyIgb3BhY2l0eT0iMC4yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMDUuNDQ5MzYxLCA0MC42MTA1MzUpIHNjYWxlKC0xLCAxKSByb3RhdGUoOTApIHRyYW5zbGF0ZSgtMTA1LjQ0OTM2MSwgLTQwLjYxMDUzNSkiIHBvaW50cz0iOTIuMzA0MDQyMiAyNy40NzUwNDA5IDExOC41OTQ2ODEgNTMuNzQ2MDI5NiA5NS4yNDY0MDUyIDUzLjczNzc1ODkiPjwvcG9seWdvbj4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNODkuMDkyNzUyOCwwLjg0MjY2NjY0NyBMMTE4LjU2MDYyNSwzMC4zOTE1OTQ3IEwxMDAuMjQ3NzMzLDMwLjY3MTkxNDYgQzk0LjE4MDU4OTQsMzAuNzY0Nzg1OSA4OS4xODY5MTEsMjUuOTIxNjgxNSA4OS4wOTQwMzk3LDE5Ljg1NDUzODIgQzg5LjA5MzE4MTgsMTkuNzk4NDg5NSA4OS4wOTI3NTI4LDE5Ljc0MjQzNTEgODkuMDkyNzUyOCwxOS42ODYzNzk5IEw4OS4wOTI3NTI4LDAuODQyNjY2NjQ3IFoiIGZpbGw9IiNGRkZGRkYiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+';
1181
+ let ItUploadDragDrop = class ItUploadDragDrop extends FormControl {
1182
+ constructor() {
1183
+ super(...arguments);
1184
+ // Override the base FormControlController: value is the selected File.
1185
+ this.formControlController = new FormControlController(this, {
1186
+ value: (el) => el._currentFile,
1187
+ assumeInteractionOn: ['it-change'],
1188
+ });
1189
+ /** The currently selected File (null until file is chosen/dropped). */
1190
+ this._currentFile = null;
1191
+ this._state = 'idle';
1192
+ this._progress = 0;
1193
+ this._fileName = '';
1194
+ this._fileWeight = '';
1195
+ this._fileType = '';
1196
+ this._indeterminate = false;
1197
+ this._autoStarted = false;
1198
+ }
1199
+ get _formClass() {
1200
+ return this.composeClass('upload-dragdrop', this._state === 'dragover' ? 'dragover' : '', this._state === 'loading' ? 'loading' : '', this._state === 'success' ? 'success' : '');
1201
+ }
1202
+ /** Advance the donut progress. Value must be between 0 and 1. */
1203
+ progress(value) {
1204
+ this._indeterminate = false;
1205
+ const clamped = Math.min(1, Math.max(0, value));
1206
+ this._progress = Math.round(clamped * 100);
1207
+ }
1208
+ /** Transition to the loading state, starting the progress animation. */
1209
+ start() {
1210
+ this._state = 'loading';
1211
+ }
1212
+ /** Mark upload as successful. */
1213
+ success() {
1214
+ this._state = 'success';
1215
+ }
1216
+ /** Reset to idle state with progress at 0. */
1217
+ reset() {
1218
+ this._state = 'idle';
1219
+ this._progress = 0;
1220
+ this._indeterminate = false;
1221
+ this._autoStarted = false;
1222
+ this._fileName = '';
1223
+ this._fileWeight = '';
1224
+ this._fileType = '';
1225
+ this._currentFile = null;
1226
+ }
1227
+ _extractFileType(fileName) {
1228
+ const ext = fileName.split('.').pop();
1229
+ return ext ? ext.toUpperCase() : '';
1230
+ }
1231
+ _preventEvent(e) {
1232
+ e.preventDefault();
1233
+ e.stopPropagation();
1234
+ }
1235
+ _onDragEnter(e) {
1236
+ this._preventEvent(e);
1237
+ if (this.disabled || this._state === 'success' || this._state === 'loading')
1238
+ return;
1239
+ const cancelled = !this.dispatchEvent(new CustomEvent('it-dd-start', {
1240
+ cancelable: true,
1241
+ bubbles: true,
1242
+ composed: true,
1243
+ detail: {},
1244
+ }));
1245
+ if (!cancelled) {
1246
+ this.start();
1247
+ this._autoStarted = true;
1248
+ }
1249
+ else {
1250
+ this._state = 'dragover';
1251
+ }
1252
+ }
1253
+ _onDragOver(e) {
1254
+ e.preventDefault();
1255
+ if (this.disabled || this._state === 'success')
1256
+ return;
1257
+ if (this._state === 'idle')
1258
+ this._state = 'dragover';
1259
+ }
1260
+ _onDragLeave(e) {
1261
+ this._preventEvent(e);
1262
+ if (this.disabled)
1263
+ return;
1264
+ if (this._state === 'dragover') {
1265
+ this._state = 'idle';
1266
+ }
1267
+ else if (this._state === 'loading' && this._autoStarted && !this._currentFile) {
1268
+ this._state = 'idle';
1269
+ this._autoStarted = false;
1270
+ }
1271
+ }
1272
+ _onDragEnd(e) {
1273
+ this._preventEvent(e);
1274
+ if (this.disabled)
1275
+ return;
1276
+ if (this._state === 'dragover') {
1277
+ this._state = 'idle';
1278
+ }
1279
+ }
1280
+ _onDrop(e) {
1281
+ this._preventEvent(e);
1282
+ if (this.disabled || this._state === 'success')
1283
+ return;
1284
+ const file = e.dataTransfer?.files?.[0];
1285
+ if (!file)
1286
+ return;
1287
+ this._currentFile = file;
1288
+ this._fileName = file.name;
1289
+ this._fileWeight = formatSize(file.size);
1290
+ this._fileType = this._extractFileType(file.name);
1291
+ this._autoStarted = false;
1292
+ const dropCancelled = !this.dispatchEvent(new CustomEvent('it-dd-drop', {
1293
+ cancelable: true,
1294
+ bubbles: true,
1295
+ composed: true,
1296
+ detail: { file, name: this.name, id: this.id },
1297
+ }));
1298
+ if (!dropCancelled) {
1299
+ if (this._state !== 'loading')
1300
+ this.start();
1301
+ this._indeterminate = true;
1302
+ }
1303
+ this.dispatchEvent(new CustomEvent('it-change', {
1304
+ detail: { file, name: this.name, id: this.id },
1305
+ bubbles: true,
1306
+ composed: true,
1307
+ }));
1308
+ }
1309
+ _onFileInputChange(e) {
1310
+ const input = e.target;
1311
+ const file = input.files?.[0];
1312
+ if (!file)
1313
+ return;
1314
+ this._currentFile = file;
1315
+ this._fileName = file.name;
1316
+ this._fileWeight = formatSize(file.size);
1317
+ this._fileType = this._extractFileType(file.name);
1318
+ input.value = '';
1319
+ const dropCancelled = !this.dispatchEvent(new CustomEvent('it-dd-drop', {
1320
+ cancelable: true,
1321
+ bubbles: true,
1322
+ composed: true,
1323
+ detail: { file, name: this.name, id: this.id },
1324
+ }));
1325
+ if (!dropCancelled) {
1326
+ this.start();
1327
+ this._indeterminate = true;
1328
+ }
1329
+ this.dispatchEvent(new CustomEvent('it-change', {
1330
+ detail: { file, name: this.name, id: this.id },
1331
+ bubbles: true,
1332
+ composed: true,
1333
+ }));
1334
+ }
1335
+ _getStatusText() {
1336
+ switch (this._state) {
1337
+ case 'dragover':
1338
+ return this.$t('upload_dd_status_dragover');
1339
+ case 'loading':
1340
+ return this.$t('upload_dd_status_loading');
1341
+ case 'success':
1342
+ return this.$t('upload_dd_status_success');
1343
+ default:
1344
+ return '';
1345
+ }
1346
+ }
1347
+ _renderTextContent() {
1348
+ const hasFile = this._fileName.length > 0;
1349
+ // Title: slot or default per state
1350
+ const titleText = hasFile ? this._fileName : this.$t('upload_dd_title');
1351
+ return html `
1352
+ <div class="upload-dragdrop-text">
1353
+ ${hasFile && this._fileWeight
1354
+ ? html `
1355
+ <p class="upload-dragdrop-weight">
1356
+ <it-icon name="it-file" size="xs" aria-hidden="true" color="secondary"></it-icon>
1357
+ <span>${this._fileType ? `${this._fileType} ` : ''}(${this._fileWeight})</span>
1358
+ </p>
1359
+ `
1360
+ : nothing}
1361
+ <h5>
1362
+ <slot name="title">${titleText}</slot>
1363
+ </h5>
1364
+ ${this._state === 'idle' || this._state === 'dragover'
1365
+ ? html `
1366
+ <p>
1367
+ <slot name="description">${this.$t('upload_dd_description')}</slot>
1368
+ </p>
1369
+ <p>
1370
+ <input
1371
+ type="file"
1372
+ class="upload-dragdrop-input"
1373
+ id="${this._id}"
1374
+ accept="${ifDefined(this.accept)}"
1375
+ ?disabled="${this.disabled}"
1376
+ aria-label="${this.$t('upload_label')}"
1377
+ @change="${this._onFileInputChange}"
1378
+ />
1379
+ <label for="${this._id}">${this.$t('upload_dd_select')}</label>
1380
+ </p>
1381
+ `
1382
+ : nothing}
1383
+ ${this._state === 'loading' ? html `<p>${this.$t('upload_dd_status_loading')}</p>` : nothing}
1384
+ ${this._state === 'success' ? html `<p>${this.$t('upload_dd_status_success')}</p>` : nothing}
1385
+ </div>
1386
+ `;
1387
+ }
1388
+ render() {
1389
+ const statusText = this._getStatusText();
1390
+ const isInvalid = this.formControlController.submittedOnce && this.validationMessage.length > 0;
1391
+ return html `
1392
+ <div
1393
+ part="drop-zone"
1394
+ class="${this._formClass}"
1395
+ @drag="${this._preventEvent}"
1396
+ @dragstart="${this._preventEvent}"
1397
+ @dragend="${this._onDragEnd}"
1398
+ @dragover="${this._onDragOver}"
1399
+ @dragenter="${this._onDragEnter}"
1400
+ @dragleave="${this._onDragLeave}"
1401
+ @drop="${this._onDrop}"
1402
+ >
1403
+ <div class="upload-dragdrop-image">
1404
+ <img src="${this.illustration ?? DRAG_DROP_ICON_SRC}" alt="" aria-hidden="true" width="180" height="180" />
1405
+ <div class="upload-dragdrop-loading" aria-hidden="${this._state !== 'loading' ? 'true' : nothing}">
1406
+ <it-progress
1407
+ type="donut"
1408
+ .value="${this._indeterminate ? 0 : this._progress}"
1409
+ it-aria-label="${this.$t('upload_dd_progress_label')}"
1410
+ ?show-value="${!this._indeterminate}"
1411
+ ></it-progress>
1412
+ </div>
1413
+ <div class="upload-dragdrop-success" aria-hidden="${this._state !== 'success' ? 'true' : nothing}">
1414
+ <it-icon name="it-check" aria-hidden="true" color="inverse"></it-icon>
1415
+ </div>
1416
+ </div>
1417
+
1418
+ ${this._renderTextContent()}
1419
+
1420
+ <!-- Accessible live region for state announcements -->
1421
+ <div role="status" aria-live="polite" aria-atomic="true" class="visually-hidden">${statusText}</div>
1422
+ </div>
1423
+
1424
+ <!-- Hidden proxy input: drives native required/validity checking via FormControl base class -->
1425
+ <input
1426
+ type="text"
1427
+ class="it-form__control"
1428
+ .value="${this._currentFile?.name || ''}"
1429
+ ?required="${this.required}"
1430
+ tabindex="-1"
1431
+ aria-hidden="true"
1432
+ />
1433
+
1434
+ <div class="invalid-feedback form-feedback form-text just-validate-error-label" role="alert">
1435
+ ${isInvalid ? this.validationMessage : nothing}
1436
+ </div>
1437
+ `;
1438
+ }
1439
+ };
1440
+ ItUploadDragDrop.styles = styles;
1441
+ __decorate([
1442
+ query('.it-form__control'),
1443
+ __metadata("design:type", HTMLInputElement)
1444
+ ], ItUploadDragDrop.prototype, "inputElement", void 0);
1445
+ __decorate([
1446
+ property({ type: String }),
1447
+ __metadata("design:type", String)
1448
+ ], ItUploadDragDrop.prototype, "accept", void 0);
1449
+ __decorate([
1450
+ property({ type: String }),
1451
+ __metadata("design:type", String)
1452
+ ], ItUploadDragDrop.prototype, "illustration", void 0);
1453
+ __decorate([
1454
+ state(),
1455
+ __metadata("design:type", Object)
1456
+ ], ItUploadDragDrop.prototype, "_currentFile", void 0);
1457
+ __decorate([
1458
+ state(),
1459
+ __metadata("design:type", String)
1460
+ ], ItUploadDragDrop.prototype, "_state", void 0);
1461
+ __decorate([
1462
+ state(),
1463
+ __metadata("design:type", Object)
1464
+ ], ItUploadDragDrop.prototype, "_progress", void 0);
1465
+ __decorate([
1466
+ state(),
1467
+ __metadata("design:type", Object)
1468
+ ], ItUploadDragDrop.prototype, "_fileName", void 0);
1469
+ __decorate([
1470
+ state(),
1471
+ __metadata("design:type", Object)
1472
+ ], ItUploadDragDrop.prototype, "_fileWeight", void 0);
1473
+ __decorate([
1474
+ state(),
1475
+ __metadata("design:type", Object)
1476
+ ], ItUploadDragDrop.prototype, "_fileType", void 0);
1477
+ __decorate([
1478
+ state(),
1479
+ __metadata("design:type", Object)
1480
+ ], ItUploadDragDrop.prototype, "_indeterminate", void 0);
1481
+ ItUploadDragDrop = __decorate([
1482
+ customElement('it-upload-drag-drop')
1483
+ ], ItUploadDragDrop);
1484
+
1485
+ export { ItUploadDragDrop };
1486
+ //# sourceMappingURL=it-upload-drag-drop.js.map