@italia/upload 1.0.0-beta.0 → 1.0.0-beta.2

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.
@@ -1,4 +1,4 @@
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-DgpsXg7c.js';
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-YOOyA0lD.js';
2
2
  import { css, html, nothing } from 'lit';
3
3
  import { query, queryAssignedElements, property, state, customElement } from 'lit/decorators.js';
4
4
  import { ifDefined } from 'lit/directives/if-defined.js';
@@ -906,8 +906,8 @@ input::-webkit-datetime-edit {
906
906
  .form-check [type=checkbox],
907
907
  .form-check [type=radio] {
908
908
  position: absolute;
909
- top: 9px;
910
- left: 9px;
909
+ top: 0;
910
+ left: 0;
911
911
  width: auto;
912
912
  margin-top: 0;
913
913
  margin-left: 0;
@@ -988,6 +988,9 @@ input::-webkit-datetime-edit {
988
988
  height: 0;
989
989
  border-color: transparent;
990
990
  }
991
+ .form-check input[type=checkbox] + label:hover::after {
992
+ border-color: var(--bsi-color-border-secondary-hover);
993
+ }
991
994
  .form-check input[type=checkbox]:disabled + label {
992
995
  opacity: 1;
993
996
  cursor: not-allowed;
@@ -1029,6 +1032,9 @@ input::-webkit-datetime-edit {
1029
1032
  .form-check input[type=radio]:checked + label::before {
1030
1033
  border-color: var(--bsi-form-checked-color);
1031
1034
  }
1035
+ .form-check input[type=radio] + label:hover::before {
1036
+ border-color: var(--bsi-color-border-secondary-hover);
1037
+ }
1032
1038
  .form-check input[type=radio]:disabled + label {
1033
1039
  cursor: not-allowed;
1034
1040
  }
@@ -1133,7 +1139,7 @@ input::-webkit-datetime-edit {
1133
1139
  .form-control {
1134
1140
  background-repeat: no-repeat;
1135
1141
  background-position: center right;
1136
- background-size: 45px 30%;
1142
+ background-size: 45px 20px;
1137
1143
  }
1138
1144
  .form-control:disabled {
1139
1145
  cursor: not-allowed;
@@ -1141,20 +1147,6 @@ input::-webkit-datetime-edit {
1141
1147
  border: 0;
1142
1148
  color: var(--bsi-color-text-disabled);
1143
1149
  }
1144
- .was-validated .form-control:valid, .form-control.is-valid {
1145
- 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");
1146
- }
1147
- .was-validated .form-control:invalid, .form-control.is-invalid {
1148
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23cc334d' viewBox='0 0 384 512'%3E%3Cpath d='M231.6 256l130.1-130.1c4.7-4.7 4.7-12.3 0-17l-22.6-22.6c-4.7-4.7-12.3-4.7-17 0L192 216.4 61.9 86.3c-4.7-4.7-12.3-4.7-17 0l-22.6 22.6c-4.7 4.7-4.7 12.3 0 17L152.4 256 22.3 386.1c-4.7 4.7-4.7 12.3 0 17l22.6 22.6c4.7 4.7 12.3 4.7 17 0L192 295.6l130.1 130.1c4.7 4.7 12.3 4.7 17 0l22.6-22.6c4.7-4.7 4.7-12.3 0-17L231.6 256z'/%3E%3C/svg%3E");
1149
- border-color: var(--bsi-color-border-danger);
1150
- }
1151
- .form-control.warning {
1152
- background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M2%2012C2%206.47715%206.47715%202%2012%202C14.6522%202%2017.1957%203.05357%2019.0711%204.92893C20.9464%206.8043%2022%209.34784%2022%2012C22%2017.5228%2017.5228%2022%2012%2022C6.47715%2022%202%2017.5228%202%2012ZM3%2012C3%2016.9706%207.02944%2021%2012%2021C16.9706%2021%2021%2016.9706%2021%2012C21%207.02944%2016.9706%203%2012%203C7.02944%203%203%207.02944%203%2012ZM11.5%2014.2V5.7H12.7V14.2H11.5ZM12.6%2018.3V16.5H11.4V18.3H12.6Z%22/%3E%0A%3C/svg%3E") no-repeat;
1153
- border-color: var(--bsi-color-border-warning);
1154
- }
1155
- .form-control.is-valid ~ .warning-feedback {
1156
- display: block;
1157
- }
1158
1150
 
1159
1151
  .form-control-sm {
1160
1152
  --bsi-form-control-spacing: var(--bsi-spacing-xxs) var(--bsi-spacing-3xs);
@@ -1402,6 +1394,10 @@ textarea.form-control-lg {
1402
1394
  overflow: hidden;
1403
1395
  }
1404
1396
 
1397
+ .avatar-upload-wrapper {
1398
+ position: relative;
1399
+ display: inline-block;
1400
+ }
1405
1401
  .avatar-upload-wrapper .avatar-upload-icon {
1406
1402
  position: absolute;
1407
1403
  right: 4px;
@@ -1409,30 +1405,23 @@ textarea.form-control-lg {
1409
1405
  display: flex;
1410
1406
  align-items: center;
1411
1407
  justify-content: center;
1412
- width: 26px;
1413
- height: 26px;
1408
+ width: 32px;
1409
+ height: 32px;
1414
1410
  border: 2px solid var(--bsi-color-border-inverse);
1415
1411
  border-radius: 50%;
1416
1412
  background: hsl(210, 6.2290689886%, 92.535%);
1417
1413
  pointer-events: none;
1418
- }
1419
- .avatar-upload-wrapper .avatar-upload-icon > svg {
1420
- width: 16px;
1421
- height: 16px;
1414
+ z-index: 1;
1422
1415
  }
1423
1416
  .avatar-upload-wrapper.size-sm .avatar {
1424
1417
  width: 80px;
1425
1418
  height: 80px;
1426
1419
  }
1427
1420
  .avatar-upload-wrapper.size-sm .avatar-upload-icon {
1428
- right: 4px;
1429
- bottom: 6px;
1430
- width: 18px;
1431
- height: 18px;
1432
- }
1433
- .avatar-upload-wrapper.size-sm .avatar-upload-icon > svg {
1434
- width: 12px;
1435
- height: 12px;
1421
+ right: 6px;
1422
+ bottom: 8px;
1423
+ width: 24px;
1424
+ height: 24px;
1436
1425
  }
1437
1426
 
1438
1427
  .upload-dragdrop {
@@ -1653,9 +1642,6 @@ textarea.form-control-lg {
1653
1642
  margin-top: 0.25rem;
1654
1643
  font-size: 0.75rem;
1655
1644
  }
1656
- .form-feedback.just-validate-error-label {
1657
- color: var(--bsi-color-text-danger);
1658
- }
1659
1645
 
1660
1646
  .input-group-text:has(~ [data-focus-mouse=true]:not(.btn)),
1661
1647
  [data-focus-mouse=true]:not(.btn) ~ .input-group-text,
@@ -1677,20 +1663,44 @@ button:has(~ .is-invalid),
1677
1663
  display: none;
1678
1664
  }
1679
1665
 
1680
- .just-validate-success-field {
1681
- border-color: var(--bsi-color-border-success) !important;
1666
+ .is-valid,
1667
+ .is-invalid {
1682
1668
  padding-right: calc(1.5em + 0.75rem) !important;
1683
- 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");
1669
+ }
1670
+ .is-valid[type=number],
1671
+ .is-invalid[type=number] {
1672
+ padding-right: calc(1.5em + 0.75rem + var(--bsi-form-control-spacing) + 1rem) !important;
1673
+ }
1674
+
1675
+ .was-validated &:valid,
1676
+ .is-valid {
1677
+ border-color: var(--bsi-color-border-success) !important;
1678
+ background-image: url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="%23008055" xmlns="http://www.w3.org/2000/svg"><path d="M9.6,16.9L4,11.4l0.8-0.7l4.8,4.8l8.5-8.4l0.7,0.7L9.6,16.9z" /></svg>');
1679
+ }
1680
+ .was-validated &:valid ~ .warning-feedback,
1681
+ .is-valid ~ .warning-feedback {
1682
+ display: block;
1683
+ }
1684
+
1685
+ .was-validated &:invalid,
1686
+ .is-invalid {
1687
+ border-color: var(--bsi-color-border-danger) !important;
1688
+ background-image: url('data:image/svg+xml,<svg width="24" fill="%23cc334d" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.7,12l6.7,6.6l-0.8,0.8L12,12.7l-6.6,6.7l-0.8-0.8l6.7-6.6L4.6,5.4l0.8-0.8l6.6,6.7l6.6-6.7l0.8,0.8L12.7,12z" /></svg>');
1689
+ }
1690
+
1691
+ .form-control.warning {
1692
+ border-color: var(--bsi-color-border-warning) !important;
1693
+ background-image: url('data:image/svg+xml,<svg width="24" height="24" fill="%23995c00" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.5,17h-1V2h1V17z M12.5,20h-1v2h1V20z" /></svg>');
1684
1694
  }
1685
1695
 
1686
- .input-group-text:has(~ .just-validate-success-field),
1687
- .just-validate-success-field ~ .input-group-text,
1688
- button:has(~ .just-validate-success-field),
1689
- .just-validate-success-field + button {
1696
+ .input-group-text:has(~ .is-valid),
1697
+ .is-valid ~ .input-group-text,
1698
+ button:has(~ .is-valid),
1699
+ .is-valid + button {
1690
1700
  border-color: var(--bsi-color-border-success);
1691
1701
  }
1692
1702
 
1693
- .just-validate-success-field + .input-group-text.align-buttons,
1703
+ .is-valid + .input-group-text.align-buttons,
1694
1704
  .is-invalid + .input-group-text.align-buttons {
1695
1705
  right: 30px;
1696
1706
  }
@@ -1699,33 +1709,12 @@ button:has(~ .just-validate-success-field),
1699
1709
  bottom: 22px;
1700
1710
  }
1701
1711
 
1702
- .autocomplete__wrapper .form-feedback.just-validate-error-label {
1712
+ .autocomplete__wrapper .form-feedback {
1703
1713
  position: absolute;
1704
1714
  }
1705
1715
 
1706
1716
  textarea.form-control {
1707
- background-position: top 0.3em right 0.3em !important;
1708
- background-size: 37px 30% !important;
1709
- }
1710
- textarea.is-invalid {
1711
- border-bottom-style: solid;
1712
- border-bottom-width: 1px;
1713
- }
1714
- textarea.just-validate-success-field {
1715
- border-bottom-style: solid;
1716
- border-bottom-width: 1px;
1717
- }
1718
-
1719
- input[type=checkbox].is-invalid,
1720
- input[type=radio].is-invalid {
1721
- --bsi-form-checkbox-border-color: var(--bsi-color-border-danger);
1722
- }
1723
-
1724
- select.is-invalid {
1725
- border: 1px solid var(--bsi-color-border-danger);
1726
- }
1727
- select.just-validate-success-field {
1728
- border: 1px solid var(--bsi-color-border-success);
1717
+ background-position: top 0.5em right !important;
1729
1718
  }
1730
1719
 
1731
1720
  body {
@@ -2041,6 +2030,126 @@ blockquote.blockquote-card.dark .blockquote-footer,
2041
2030
  margin: 0 !important;
2042
2031
  }
2043
2032
 
2033
+ .text-primary {
2034
+ --bsi-text-opacity: 1;
2035
+ color: rgba(var(--bsi-primary-rgb), var(--bsi-text-opacity)) !important;
2036
+ }
2037
+
2038
+ .text-secondary {
2039
+ --bsi-text-opacity: 1;
2040
+ color: hsl(210, 33%, 28%) !important;
2041
+ }
2042
+
2043
+ .text-success {
2044
+ --bsi-text-opacity: 1;
2045
+ color: rgba(var(--bsi-success-rgb), var(--bsi-text-opacity)) !important;
2046
+ }
2047
+
2048
+ .text-info {
2049
+ --bsi-text-opacity: 1;
2050
+ color: rgba(var(--bsi-info-rgb), var(--bsi-text-opacity)) !important;
2051
+ }
2052
+
2053
+ .text-warning {
2054
+ --bsi-text-opacity: 1;
2055
+ color: rgba(var(--bsi-warning-rgb), var(--bsi-text-opacity)) !important;
2056
+ }
2057
+
2058
+ .text-danger {
2059
+ --bsi-text-opacity: 1;
2060
+ color: rgba(var(--bsi-danger-rgb), var(--bsi-text-opacity)) !important;
2061
+ }
2062
+
2063
+ .text-light {
2064
+ --bsi-text-opacity: 1;
2065
+ color: rgba(var(--bsi-light-rgb), var(--bsi-text-opacity)) !important;
2066
+ }
2067
+
2068
+ .text-dark {
2069
+ --bsi-text-opacity: 1;
2070
+ color: rgba(var(--bsi-dark-rgb), var(--bsi-text-opacity)) !important;
2071
+ }
2072
+
2073
+ .text-black {
2074
+ --bsi-text-opacity: 1;
2075
+ color: rgba(var(--bsi-black-rgb), var(--bsi-text-opacity)) !important;
2076
+ }
2077
+
2078
+ .text-white {
2079
+ --bsi-text-opacity: 1;
2080
+ color: rgba(var(--bsi-white-rgb), var(--bsi-text-opacity)) !important;
2081
+ }
2082
+
2083
+ .text-100 {
2084
+ --bsi-text-opacity: 1;
2085
+ color: rgba(var(--bsi-100-rgb), var(--bsi-text-opacity)) !important;
2086
+ }
2087
+
2088
+ .text-200 {
2089
+ --bsi-text-opacity: 1;
2090
+ color: rgba(var(--bsi-200-rgb), var(--bsi-text-opacity)) !important;
2091
+ }
2092
+
2093
+ .text-300 {
2094
+ --bsi-text-opacity: 1;
2095
+ color: rgba(var(--bsi-300-rgb), var(--bsi-text-opacity)) !important;
2096
+ }
2097
+
2098
+ .text-400 {
2099
+ --bsi-text-opacity: 1;
2100
+ color: rgba(var(--bsi-400-rgb), var(--bsi-text-opacity)) !important;
2101
+ }
2102
+
2103
+ .text-500 {
2104
+ --bsi-text-opacity: 1;
2105
+ color: rgba(var(--bsi-500-rgb), var(--bsi-text-opacity)) !important;
2106
+ }
2107
+
2108
+ .text-600 {
2109
+ --bsi-text-opacity: 1;
2110
+ color: rgba(var(--bsi-600-rgb), var(--bsi-text-opacity)) !important;
2111
+ }
2112
+
2113
+ .text-700 {
2114
+ --bsi-text-opacity: 1;
2115
+ color: rgba(var(--bsi-700-rgb), var(--bsi-text-opacity)) !important;
2116
+ }
2117
+
2118
+ .text-800 {
2119
+ --bsi-text-opacity: 1;
2120
+ color: rgba(var(--bsi-800-rgb), var(--bsi-text-opacity)) !important;
2121
+ }
2122
+
2123
+ .text-900 {
2124
+ --bsi-text-opacity: 1;
2125
+ color: rgba(var(--bsi-900-rgb), var(--bsi-text-opacity)) !important;
2126
+ }
2127
+
2128
+ .text-body {
2129
+ --bsi-text-opacity: 1;
2130
+ color: rgba(var(--bsi-body-color-rgb), var(--bsi-text-opacity)) !important;
2131
+ }
2132
+
2133
+ .text-muted {
2134
+ --bsi-text-opacity: 1;
2135
+ color: hsl(210, 17%, 44%) !important;
2136
+ }
2137
+
2138
+ .text-black-50 {
2139
+ --bsi-text-opacity: 1;
2140
+ color: rgba(0, 0, 0, 0.5) !important;
2141
+ }
2142
+
2143
+ .text-white-50 {
2144
+ --bsi-text-opacity: 1;
2145
+ color: rgba(255, 255, 255, 0.5) !important;
2146
+ }
2147
+
2148
+ .text-reset {
2149
+ --bsi-text-opacity: 1;
2150
+ color: inherit !important;
2151
+ }
2152
+
2044
2153
  @media (min-width: 576px) {
2045
2154
  .d-sm-none {
2046
2155
  display: none !important;
@@ -2311,13 +2420,15 @@ let ItUpload = class ItUpload extends FormControl {
2311
2420
  this._validateFiles();
2312
2421
  }
2313
2422
  _validateFiles() {
2314
- if (this.required && this._files.length === 0) {
2315
- this.inputElement?.setCustomValidity(this.$t('validityRequired'));
2316
- this.validationMessage = this.$t('validityRequired');
2317
- }
2318
- else {
2319
- this.inputElement?.setCustomValidity('');
2320
- this.validationMessage = '';
2423
+ if (!this.customValidation) {
2424
+ if (this.required && this._files.length === 0) {
2425
+ this.inputElement?.setCustomValidity(this.$t('validityRequired'));
2426
+ this.validationMessage = this.$t('validityRequired');
2427
+ }
2428
+ else {
2429
+ this.inputElement?.setCustomValidity('');
2430
+ this.validationMessage = '';
2431
+ }
2321
2432
  }
2322
2433
  this.formControlController.updateValidity();
2323
2434
  }
@@ -2521,7 +2632,7 @@ let ItUpload = class ItUpload extends FormControl {
2521
2632
  _renderUploadInput() {
2522
2633
  const inputId = this._id;
2523
2634
  const labelText = this.variant === 'gallery' ? this.$t('upload_gallery_label') : this.$t('upload_label');
2524
- const showValidation = this.formControlController.submittedOnce;
2635
+ const showValidation = this.formControlController.submittedOnce || this.customValidation;
2525
2636
  const isInvalid = showValidation && this.validationMessage.length > 0;
2526
2637
  return html `
2527
2638
  <div class="form-group">
@@ -2551,6 +2662,7 @@ let ItUpload = class ItUpload extends FormControl {
2551
2662
  accept="${ifDefined(this.accept)}"
2552
2663
  ?disabled="${this.disabled}"
2553
2664
  ?required="${this.required && this._files.length === 0}"
2665
+ ?formNoValidate="${this.customValidation}"
2554
2666
  aria-invalid="${isInvalid ? 'true' : nothing}"
2555
2667
  aria-describedby="${ifDefined(isInvalid ? `invalid-feedback-${inputId}` : undefined)}"
2556
2668
  @change="${this._handleFileChange}"
@@ -2559,12 +2671,7 @@ let ItUpload = class ItUpload extends FormControl {
2559
2671
 
2560
2672
  ${when(this.supportText, () => html `<small class="form-text">${this.supportText}</small>`)}
2561
2673
 
2562
- <div
2563
- role="alert"
2564
- id="invalid-feedback-${inputId}"
2565
- class="invalid-feedback form-feedback form-text just-validate-error-label"
2566
- ?hidden=${!isInvalid}
2567
- >
2674
+ <div role="alert" id="invalid-feedback-${inputId}" class="form-feedback text-danger" ?hidden=${!isInvalid}>
2568
2675
  ${isInvalid ? html `<span class="visually-hidden">${this.label}: </span>${this.validationMessage}` : nothing}
2569
2676
  </div>
2570
2677
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"it-upload.js","sources":["../../../src/it-upload.ts"],"sourcesContent":["/* eslint-disable lit-a11y/no-redundant-role */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { FormControl, FormControlController } from '@italia/globals';\nimport { registerTranslation } from '@italia/i18n';\nimport { html, nothing } from 'lit';\nimport { customElement, property, query, queryAssignedElements, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { when } from 'lit/directives/when.js';\n\nimport type { UploadFile, UploadFileStatus, UploadVariant, UploadInternalFile } from './types.js';\nimport it from './locales/it.js';\nimport en from './locales/en.js';\nimport styles from './upload.scss';\nimport { formatSize } from './utils.js';\n\nregisterTranslation(it);\nregisterTranslation(en);\n\n@customElement('it-upload')\nexport class ItUpload extends FormControl {\n static styles = styles;\n\n // Override the base FormControlController to submit File[] instead of strings.\n // The base class field is declared as `protected readonly` but re-declaring here\n // shadows it cleanly via class field initialization order.\n protected override readonly formControlController: FormControlController = new FormControlController(this, {\n value: (el) => (el as ItUpload)._files.map((f) => f._raw),\n assumeInteractionOn: ['it-change'],\n });\n\n @query('.it-form__control')\n override inputElement!: HTMLInputElement;\n\n @queryAssignedElements({ slot: 'label' })\n labelElements!: HTMLElement[];\n\n get label(): string {\n if (this.labelElements.length > 0) {\n return this.labelElements[0].innerText.trim();\n }\n return '';\n }\n\n /** Allow multiple file selection */\n @property({ type: Boolean, reflect: true })\n multiple = false;\n\n /** Accepted file types, e.g. \"image/*,.pdf\" */\n @property({ type: String })\n accept?: string;\n\n /** Show image thumbnails in the file list */\n @property({ type: Boolean, attribute: 'image-preview' })\n imagePreview = false;\n\n /** Layout variant: 'default' shows a vertical file list, 'gallery' shows a pictures-wall grid */\n @property({ type: String, reflect: true })\n variant: UploadVariant = 'default';\n\n /** Support text displayed below the upload button */\n @property({ type: String, attribute: 'support-text' })\n supportText = '';\n\n /**\n * If true, files transition to 'success' automatically as soon as they are added\n * (useful for purely client-side scenarios).\n * Leave false (default) when you need to call setFileStatus() after a real HTTP upload.\n */\n @property({ type: Boolean, attribute: 'auto-success' })\n autoSuccess = false;\n\n @state()\n private _files: UploadInternalFile[] = [];\n\n /** Returns a copy of the current file list */\n get files(): UploadFile[] {\n return this._files.map(({ _raw: _, ...rest }) => rest);\n }\n\n /**\n * Programmatically add a file to the list with an initial status of 'loading'.\n * Returns the generated id for use with setFileStatus / removeFile.\n */\n addFile(file: File): string {\n const id = `upload-file-${Math.random().toString(36).slice(2)}`;\n const entry: UploadInternalFile = {\n id,\n name: file.name,\n size: file.size,\n status: 'loading',\n _raw: file,\n };\n this._files = [...this._files, entry];\n return id;\n }\n\n /** Update the status (and optional progress 0–100) of a file by id. No-op for unknown ids. */\n setFileStatus(id: string, status: UploadFileStatus, progress?: number) {\n this._files = this._files.map((f) => (f.id === id ? { ...f, status, progress: progress ?? f.progress } : f));\n }\n\n /** Set a thumbnail data URL for a file entry by id. No-op for unknown ids. */\n setFileThumbnail(id: string, dataUrl: string) {\n this._files = this._files.map((f) => (f.id === id ? { ...f, thumbnail: dataUrl } : f));\n }\n\n /** Remove a file entry by id. No-op for unknown ids. */\n removeFile(id: string) {\n this._files = this._files.filter((f) => f.id !== id);\n this._validateFiles();\n }\n\n override connectedCallback() {\n super.connectedCallback?.();\n this._handleReady();\n }\n\n override updated(changedProperties: Map<string | number | symbol, unknown>) {\n super.updated?.(changedProperties);\n\n if (!this.label && this.label?.length === 0) {\n this.logger.warn(\n `Label is required for accessibility. Define a <span slot=\"label\"> inside <it-upload name=\"${this.name}\">.`,\n );\n }\n }\n\n // Override FormControl.checkValidity — the native hidden input manages required state\n override checkValidity(): boolean {\n return this.inputElement?.checkValidity() ?? true;\n }\n\n /** Override to prevent string-level validation messages from FormControl base */\n protected override handleValidationMessages() {\n this._validateFiles();\n }\n\n private _validateFiles() {\n if (this.required && this._files.length === 0) {\n this.inputElement?.setCustomValidity(this.$t('validityRequired'));\n this.validationMessage = this.$t('validityRequired');\n } else {\n this.inputElement?.setCustomValidity('');\n this.validationMessage = '';\n }\n this.formControlController.updateValidity();\n }\n\n override get validity(): ValidityState {\n return this.inputElement?.validity;\n }\n\n private _handleFileChange(e: Event) {\n const input = e.target as HTMLInputElement;\n const fileList = input.files;\n if (!fileList || fileList.length === 0) return;\n\n const newFiles = Array.from(fileList);\n newFiles.forEach((file) => {\n const id = this.addFile(file);\n if (file.type.startsWith('image/') && (this.imagePreview || this.variant === 'gallery')) {\n const reader = new FileReader();\n reader.onload = (ev) => {\n this.setFileThumbnail(id, ev.target?.result as string);\n if (this.autoSuccess) this.setFileStatus(id, 'success');\n };\n reader.readAsDataURL(file);\n } else if (this.autoSuccess) {\n this.setFileStatus(id, 'success');\n }\n });\n\n // Reset the native input so the same file can be re-selected\n input.value = '';\n\n this._validateFiles();\n\n this.dispatchEvent(\n new CustomEvent('it-upload-add', {\n detail: { files: newFiles, name: this.name, id: this.id },\n bubbles: true,\n composed: true,\n }),\n );\n this.dispatchEvent(\n new CustomEvent('it-change', {\n detail: { files: this._files.map((f) => f._raw), name: this.name, id: this.id },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private _handleRemove(id: string, name: string) {\n this.removeFile(id);\n this.dispatchEvent(\n new CustomEvent('it-upload-remove', {\n detail: { id, name, componentName: this.name, componentId: this.id },\n bubbles: true,\n composed: true,\n }),\n );\n this.dispatchEvent(\n new CustomEvent('it-change', {\n detail: { files: this._files.map((f) => f._raw), name: this.name, id: this.id },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private _getStatusLabel(status: UploadFileStatus): string {\n switch (status) {\n case 'loading':\n return this.$t('upload_status_loading');\n case 'success':\n return this.$t('upload_status_success');\n case 'error':\n default:\n return this.$t('upload_status_error');\n }\n }\n\n private _getRemoveLabel(f: UploadInternalFile): string {\n let key: string;\n switch (f.status) {\n case 'loading':\n key = 'upload_remove_loading';\n break;\n case 'error':\n key = 'upload_remove_error';\n break;\n case 'success':\n default:\n key = 'upload_remove_done';\n break;\n }\n const template = this.$t(key);\n return template.replace('{name}', f.name);\n }\n\n // eslint-disable-next-line class-methods-use-this\n private _iconForStatus(status: UploadFileStatus) {\n switch (status) {\n case 'loading':\n case 'success':\n return 'it-file';\n case 'error':\n default:\n return 'it-close-circle';\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n private _colorForStatus(status: UploadFileStatus): string {\n switch (status) {\n case 'success':\n return 'success';\n case 'error':\n return 'danger';\n default:\n return 'secondary';\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n private _actionIconForStatus(status: UploadFileStatus): string {\n return status === 'success' ? 'it-check' : 'it-close';\n }\n\n private _renderFileItem(f: UploadInternalFile) {\n const liClass = this.composeClass('upload-file', f.status === 'loading' ? 'uploading' : f.status);\n\n const statusLabel = this._getStatusLabel(f.status);\n const removeLabel = this._getRemoveLabel(f);\n\n return html`\n <li class=\"${liClass}\" role=\"listitem\">\n ${when(\n this.imagePreview && f.thumbnail,\n () => html`\n <div class=\"upload-image\">\n <img src=\"${f.thumbnail!}\" alt=\"${f.name}\" />\n </div>\n `,\n () =>\n html`<it-icon\n name=\"${this._iconForStatus(f.status)}\"\n size=\"sm\"\n color=\"${this._colorForStatus(f.status)}\"\n aria-hidden=\"true\"\n ></it-icon>`,\n )}\n <p>\n <span class=\"visually-hidden\">${statusLabel}</span>${f.name}${when(\n f.status === 'success',\n () => html`<span class=\"upload-file-weight\">${formatSize(f.size)}</span>`,\n )}\n </p>\n\n ${when(\n f.status === 'success',\n () => html`\n <div class=\"upload-file-actions\" part=\"file-status-indicator\">\n <it-icon\n name=\"it-check\"\n size=\"xs\"\n color=\"success\"\n aria-hidden=\"true\"\n class=\"upload-file-success\"\n ></it-icon>\n <button\n part=\"file-remove-button\"\n type=\"button\"\n @click=\"${() => this._handleRemove(f.id, f.name)}\"\n ?disabled=\"${this.disabled}\"\n >\n <span class=\"visually-hidden\">${removeLabel}</span>\n <it-icon name=\"it-close\" aria-hidden=\"true\" color=\"secondary\"></it-icon>\n </button>\n </div>\n `,\n () => html`\n <button\n part=\"file-remove-button\"\n type=\"button\"\n @click=\"${() => this._handleRemove(f.id, f.name)}\"\n ?disabled=\"${this.disabled}\"\n >\n <span class=\"visually-hidden\">${removeLabel}</span>\n <it-icon\n name=\"${this._actionIconForStatus(f.status)}\"\n color=\"${this._colorForStatus(f.status)}\"\n aria-hidden=\"true\"\n ></it-icon>\n </button>\n `,\n )}\n ${when(\n f.status === 'loading',\n () => html` <it-progress type=\"line\" .value=\"${f.progress ?? 0}\" it-aria-label=\"${f.name}\"></it-progress> `,\n )}\n </li>\n `;\n }\n\n private _renderGalleryItem(f: UploadInternalFile) {\n // NOTE: BSI reference HTML does not include a remove button for gallery items.\n // Added here as a critical accessibility addition: without it there is no way\n // to remove a photo once added (WCAG 2.1 SC 3.3.4 Error Prevention).\n const removeLabel = this._getRemoveLabel(f);\n return html`\n <li class=\"upload-image\" role=\"listitem\">\n ${when(f.thumbnail, () => html`<img src=\"${f.thumbnail!}\" alt=\"${f.name}\" />`)}\n <button\n part=\"gallery-remove-button\"\n type=\"button\"\n class=\"btn btn-primary btn-icon btn-xs upload-image-remove\"\n @click=\"${() => this._handleRemove(f.id, f.name)}\"\n ?disabled=\"${this.disabled}\"\n >\n <span class=\"visually-hidden\">${removeLabel}</span>\n <it-icon name=\"it-close\" size=\"xs\" color=\"inverse\" aria-hidden=\"true\"></it-icon>\n </button>\n </li>\n `;\n }\n\n private _renderFileList() {\n if (this._files.length === 0) return nothing;\n\n if (this.variant === 'gallery') {\n return html` ${this._files.map((f) => this._renderGalleryItem(f))} `;\n }\n\n const listClass = this.composeClass('upload-file-list', this.imagePreview ? 'upload-file-list-image' : '');\n return html`\n <ul class=\"${listClass}\" aria-label=\"${this.$t('upload_file_list_label')}\" role=\"list\">\n ${this._files.map((f) => this._renderFileItem(f))}\n </ul>\n `;\n }\n\n private _renderUploadInput() {\n const inputId = this._id!;\n const labelText = this.variant === 'gallery' ? this.$t('upload_gallery_label') : this.$t('upload_label');\n\n const showValidation = this.formControlController.submittedOnce;\n const isInvalid = showValidation && this.validationMessage.length > 0;\n\n return html`\n <div class=\"form-group\">\n <!-- Wrapping pattern per Scott O'Hara \"Styled File Uploads\":\n https://scottaohara.github.io/a11y_styled_form_controls/src/file-upload/\n Input inside label instead of BSI's sibling pattern (0.1px ghost input +\n styled adjacent label). BSI's pattern makes VoiceOver visit the ghost as a\n confusing \"small square group\" before the real button. With wrapping, both\n stops are logical: label text → file upload control. No JS needed — click\n propagation to the file picker is handled natively by the label. -->\n <label part=\"input-label\" for=\"${inputId}\">\n <slot name=\"icon\">\n <it-icon\n name=\"${this.variant === 'gallery' ? 'it-plus' : 'it-upload'}\"\n size=\"${this.variant === 'gallery' ? 'lg' : 'sm'}\"\n aria-hidden=\"true\"\n color=\"${this.variant === 'gallery' ? 'primary' : 'inverse'}\"\n ></it-icon>\n </slot>\n <slot name=\"label\">${labelText}</slot>\n <input\n type=\"file\"\n class=\"upload it-form__control\"\n id=\"${inputId}\"\n name=\"${this.name}\"\n ?multiple=\"${this.multiple}\"\n accept=\"${ifDefined(this.accept)}\"\n ?disabled=\"${this.disabled}\"\n ?required=\"${this.required && this._files.length === 0}\"\n aria-invalid=\"${isInvalid ? 'true' : nothing}\"\n aria-describedby=\"${ifDefined(isInvalid ? `invalid-feedback-${inputId}` : undefined)}\"\n @change=\"${this._handleFileChange}\"\n />\n </label>\n\n ${when(this.supportText, () => html`<small class=\"form-text\">${this.supportText}</small>`)}\n\n <div\n role=\"alert\"\n id=\"invalid-feedback-${inputId}\"\n class=\"invalid-feedback form-feedback form-text just-validate-error-label\"\n ?hidden=${!isInvalid}\n >\n ${isInvalid ? html`<span class=\"visually-hidden\">${this.label}: </span>${this.validationMessage}` : nothing}\n </div>\n </div>\n `;\n }\n\n override render() {\n if (this.variant === 'gallery') {\n return html`\n <ul class=\"upload-pictures-wall\" role=\"list\">\n ${this._renderFileList()}\n <li>${this._renderUploadInput()}</li>\n </ul>\n `;\n }\n\n return html` ${this._renderUploadInput()} ${this._renderFileList()} `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-upload': ItUpload;\n }\n}\n"],"names":["it","en"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;;AACnC,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;AAIrB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AACP,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAInC,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;;AACrC,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAQjB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;;AACnC,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAGZ,UAAA,CAAA;AADP,IAAA,KAAK,EAAE;;AACkC,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AArD/B,QAAQ,GAAA,UAAA,CAAA;IADpB,aAAa,CAAC,WAAW;AACb,CAAA,EAAA,QAAQ,CA+apB;;;;"}
1
+ {"version":3,"file":"it-upload.js","sources":["../../../src/it-upload.ts"],"sourcesContent":["/* eslint-disable lit-a11y/no-redundant-role */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { FormControl, FormControlController } from '@italia/globals';\nimport { registerTranslation } from '@italia/i18n';\nimport { html, nothing } from 'lit';\nimport { customElement, property, query, queryAssignedElements, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { when } from 'lit/directives/when.js';\n\nimport type { UploadFile, UploadFileStatus, UploadVariant, UploadInternalFile } from './types.js';\nimport it from './locales/it.js';\nimport en from './locales/en.js';\nimport styles from './upload.scss';\nimport { formatSize } from './utils.js';\n\nregisterTranslation(it);\nregisterTranslation(en);\n\n@customElement('it-upload')\nexport class ItUpload extends FormControl {\n static styles = styles;\n\n // Override the base FormControlController to submit File[] instead of strings.\n // The base class field is declared as `protected readonly` but re-declaring here\n // shadows it cleanly via class field initialization order.\n protected override readonly formControlController: FormControlController = new FormControlController(this, {\n value: (el) => (el as ItUpload)._files.map((f) => f._raw),\n assumeInteractionOn: ['it-change'],\n });\n\n @query('.it-form__control')\n override inputElement!: HTMLInputElement;\n\n @queryAssignedElements({ slot: 'label' })\n labelElements!: HTMLElement[];\n\n get label(): string {\n if (this.labelElements.length > 0) {\n return this.labelElements[0].innerText.trim();\n }\n return '';\n }\n\n /** Allow multiple file selection */\n @property({ type: Boolean, reflect: true })\n multiple = false;\n\n /** Accepted file types, e.g. \"image/*,.pdf\" */\n @property({ type: String })\n accept?: string;\n\n /** Show image thumbnails in the file list */\n @property({ type: Boolean, attribute: 'image-preview' })\n imagePreview = false;\n\n /** Layout variant: 'default' shows a vertical file list, 'gallery' shows a pictures-wall grid */\n @property({ type: String, reflect: true })\n variant: UploadVariant = 'default';\n\n /** Support text displayed below the upload button */\n @property({ type: String, attribute: 'support-text' })\n supportText = '';\n\n /**\n * If true, files transition to 'success' automatically as soon as they are added\n * (useful for purely client-side scenarios).\n * Leave false (default) when you need to call setFileStatus() after a real HTTP upload.\n */\n @property({ type: Boolean, attribute: 'auto-success' })\n autoSuccess = false;\n\n @state()\n private _files: UploadInternalFile[] = [];\n\n /** Returns a copy of the current file list */\n get files(): UploadFile[] {\n return this._files.map(({ _raw: _, ...rest }) => rest);\n }\n\n /**\n * Programmatically add a file to the list with an initial status of 'loading'.\n * Returns the generated id for use with setFileStatus / removeFile.\n */\n addFile(file: File): string {\n const id = `upload-file-${Math.random().toString(36).slice(2)}`;\n const entry: UploadInternalFile = {\n id,\n name: file.name,\n size: file.size,\n status: 'loading',\n _raw: file,\n };\n this._files = [...this._files, entry];\n return id;\n }\n\n /** Update the status (and optional progress 0–100) of a file by id. No-op for unknown ids. */\n setFileStatus(id: string, status: UploadFileStatus, progress?: number) {\n this._files = this._files.map((f) => (f.id === id ? { ...f, status, progress: progress ?? f.progress } : f));\n }\n\n /** Set a thumbnail data URL for a file entry by id. No-op for unknown ids. */\n setFileThumbnail(id: string, dataUrl: string) {\n this._files = this._files.map((f) => (f.id === id ? { ...f, thumbnail: dataUrl } : f));\n }\n\n /** Remove a file entry by id. No-op for unknown ids. */\n removeFile(id: string) {\n this._files = this._files.filter((f) => f.id !== id);\n this._validateFiles();\n }\n\n override connectedCallback() {\n super.connectedCallback?.();\n this._handleReady();\n }\n\n override updated(changedProperties: Map<string | number | symbol, unknown>) {\n super.updated?.(changedProperties);\n\n if (!this.label && this.label?.length === 0) {\n this.logger.warn(\n `Label is required for accessibility. Define a <span slot=\"label\"> inside <it-upload name=\"${this.name}\">.`,\n );\n }\n }\n\n // Override FormControl.checkValidity — the native hidden input manages required state\n override checkValidity(): boolean {\n return this.inputElement?.checkValidity() ?? true;\n }\n\n /** Override to prevent string-level validation messages from FormControl base */\n protected override handleValidationMessages() {\n this._validateFiles();\n }\n\n private _validateFiles() {\n if (!this.customValidation) {\n if (this.required && this._files.length === 0) {\n this.inputElement?.setCustomValidity(this.$t('validityRequired'));\n this.validationMessage = this.$t('validityRequired');\n } else {\n this.inputElement?.setCustomValidity('');\n this.validationMessage = '';\n }\n }\n this.formControlController.updateValidity();\n }\n\n override get validity(): ValidityState {\n return this.inputElement?.validity;\n }\n\n private _handleFileChange(e: Event) {\n const input = e.target as HTMLInputElement;\n const fileList = input.files;\n if (!fileList || fileList.length === 0) return;\n\n const newFiles = Array.from(fileList);\n newFiles.forEach((file) => {\n const id = this.addFile(file);\n if (file.type.startsWith('image/') && (this.imagePreview || this.variant === 'gallery')) {\n const reader = new FileReader();\n reader.onload = (ev) => {\n this.setFileThumbnail(id, ev.target?.result as string);\n if (this.autoSuccess) this.setFileStatus(id, 'success');\n };\n reader.readAsDataURL(file);\n } else if (this.autoSuccess) {\n this.setFileStatus(id, 'success');\n }\n });\n\n // Reset the native input so the same file can be re-selected\n input.value = '';\n\n this._validateFiles();\n\n this.dispatchEvent(\n new CustomEvent('it-upload-add', {\n detail: { files: newFiles, name: this.name, id: this.id },\n bubbles: true,\n composed: true,\n }),\n );\n this.dispatchEvent(\n new CustomEvent('it-change', {\n detail: { files: this._files.map((f) => f._raw), name: this.name, id: this.id },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private _handleRemove(id: string, name: string) {\n this.removeFile(id);\n this.dispatchEvent(\n new CustomEvent('it-upload-remove', {\n detail: { id, name, componentName: this.name, componentId: this.id },\n bubbles: true,\n composed: true,\n }),\n );\n this.dispatchEvent(\n new CustomEvent('it-change', {\n detail: { files: this._files.map((f) => f._raw), name: this.name, id: this.id },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private _getStatusLabel(status: UploadFileStatus): string {\n switch (status) {\n case 'loading':\n return this.$t('upload_status_loading');\n case 'success':\n return this.$t('upload_status_success');\n case 'error':\n default:\n return this.$t('upload_status_error');\n }\n }\n\n private _getRemoveLabel(f: UploadInternalFile): string {\n let key: string;\n switch (f.status) {\n case 'loading':\n key = 'upload_remove_loading';\n break;\n case 'error':\n key = 'upload_remove_error';\n break;\n case 'success':\n default:\n key = 'upload_remove_done';\n break;\n }\n const template = this.$t(key);\n return template.replace('{name}', f.name);\n }\n\n // eslint-disable-next-line class-methods-use-this\n private _iconForStatus(status: UploadFileStatus) {\n switch (status) {\n case 'loading':\n case 'success':\n return 'it-file';\n case 'error':\n default:\n return 'it-close-circle';\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n private _colorForStatus(status: UploadFileStatus): string {\n switch (status) {\n case 'success':\n return 'success';\n case 'error':\n return 'danger';\n default:\n return 'secondary';\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n private _actionIconForStatus(status: UploadFileStatus): string {\n return status === 'success' ? 'it-check' : 'it-close';\n }\n\n private _renderFileItem(f: UploadInternalFile) {\n const liClass = this.composeClass('upload-file', f.status === 'loading' ? 'uploading' : f.status);\n\n const statusLabel = this._getStatusLabel(f.status);\n const removeLabel = this._getRemoveLabel(f);\n\n return html`\n <li class=\"${liClass}\" role=\"listitem\">\n ${when(\n this.imagePreview && f.thumbnail,\n () => html`\n <div class=\"upload-image\">\n <img src=\"${f.thumbnail!}\" alt=\"${f.name}\" />\n </div>\n `,\n () =>\n html`<it-icon\n name=\"${this._iconForStatus(f.status)}\"\n size=\"sm\"\n color=\"${this._colorForStatus(f.status)}\"\n aria-hidden=\"true\"\n ></it-icon>`,\n )}\n <p>\n <span class=\"visually-hidden\">${statusLabel}</span>${f.name}${when(\n f.status === 'success',\n () => html`<span class=\"upload-file-weight\">${formatSize(f.size)}</span>`,\n )}\n </p>\n\n ${when(\n f.status === 'success',\n () => html`\n <div class=\"upload-file-actions\" part=\"file-status-indicator\">\n <it-icon\n name=\"it-check\"\n size=\"xs\"\n color=\"success\"\n aria-hidden=\"true\"\n class=\"upload-file-success\"\n ></it-icon>\n <button\n part=\"file-remove-button\"\n type=\"button\"\n @click=\"${() => this._handleRemove(f.id, f.name)}\"\n ?disabled=\"${this.disabled}\"\n >\n <span class=\"visually-hidden\">${removeLabel}</span>\n <it-icon name=\"it-close\" aria-hidden=\"true\" color=\"secondary\"></it-icon>\n </button>\n </div>\n `,\n () => html`\n <button\n part=\"file-remove-button\"\n type=\"button\"\n @click=\"${() => this._handleRemove(f.id, f.name)}\"\n ?disabled=\"${this.disabled}\"\n >\n <span class=\"visually-hidden\">${removeLabel}</span>\n <it-icon\n name=\"${this._actionIconForStatus(f.status)}\"\n color=\"${this._colorForStatus(f.status)}\"\n aria-hidden=\"true\"\n ></it-icon>\n </button>\n `,\n )}\n ${when(\n f.status === 'loading',\n () => html` <it-progress type=\"line\" .value=\"${f.progress ?? 0}\" it-aria-label=\"${f.name}\"></it-progress> `,\n )}\n </li>\n `;\n }\n\n private _renderGalleryItem(f: UploadInternalFile) {\n // NOTE: BSI reference HTML does not include a remove button for gallery items.\n // Added here as a critical accessibility addition: without it there is no way\n // to remove a photo once added (WCAG 2.1 SC 3.3.4 Error Prevention).\n const removeLabel = this._getRemoveLabel(f);\n return html`\n <li class=\"upload-image\" role=\"listitem\">\n ${when(f.thumbnail, () => html`<img src=\"${f.thumbnail!}\" alt=\"${f.name}\" />`)}\n <button\n part=\"gallery-remove-button\"\n type=\"button\"\n class=\"btn btn-primary btn-icon btn-xs upload-image-remove\"\n @click=\"${() => this._handleRemove(f.id, f.name)}\"\n ?disabled=\"${this.disabled}\"\n >\n <span class=\"visually-hidden\">${removeLabel}</span>\n <it-icon name=\"it-close\" size=\"xs\" color=\"inverse\" aria-hidden=\"true\"></it-icon>\n </button>\n </li>\n `;\n }\n\n private _renderFileList() {\n if (this._files.length === 0) return nothing;\n\n if (this.variant === 'gallery') {\n return html` ${this._files.map((f) => this._renderGalleryItem(f))} `;\n }\n\n const listClass = this.composeClass('upload-file-list', this.imagePreview ? 'upload-file-list-image' : '');\n return html`\n <ul class=\"${listClass}\" aria-label=\"${this.$t('upload_file_list_label')}\" role=\"list\">\n ${this._files.map((f) => this._renderFileItem(f))}\n </ul>\n `;\n }\n\n private _renderUploadInput() {\n const inputId = this._id!;\n const labelText = this.variant === 'gallery' ? this.$t('upload_gallery_label') : this.$t('upload_label');\n\n const showValidation = this.formControlController.submittedOnce || this.customValidation;\n const isInvalid = showValidation && this.validationMessage.length > 0;\n\n return html`\n <div class=\"form-group\">\n <!-- Wrapping pattern per Scott O'Hara \"Styled File Uploads\":\n https://scottaohara.github.io/a11y_styled_form_controls/src/file-upload/\n Input inside label instead of BSI's sibling pattern (0.1px ghost input +\n styled adjacent label). BSI's pattern makes VoiceOver visit the ghost as a\n confusing \"small square group\" before the real button. With wrapping, both\n stops are logical: label text → file upload control. No JS needed — click\n propagation to the file picker is handled natively by the label. -->\n <label part=\"input-label\" for=\"${inputId}\">\n <slot name=\"icon\">\n <it-icon\n name=\"${this.variant === 'gallery' ? 'it-plus' : 'it-upload'}\"\n size=\"${this.variant === 'gallery' ? 'lg' : 'sm'}\"\n aria-hidden=\"true\"\n color=\"${this.variant === 'gallery' ? 'primary' : 'inverse'}\"\n ></it-icon>\n </slot>\n <slot name=\"label\">${labelText}</slot>\n <input\n type=\"file\"\n class=\"upload it-form__control\"\n id=\"${inputId}\"\n name=\"${this.name}\"\n ?multiple=\"${this.multiple}\"\n accept=\"${ifDefined(this.accept)}\"\n ?disabled=\"${this.disabled}\"\n ?required=\"${this.required && this._files.length === 0}\"\n ?formNoValidate=\"${this.customValidation}\"\n aria-invalid=\"${isInvalid ? 'true' : nothing}\"\n aria-describedby=\"${ifDefined(isInvalid ? `invalid-feedback-${inputId}` : undefined)}\"\n @change=\"${this._handleFileChange}\"\n />\n </label>\n\n ${when(this.supportText, () => html`<small class=\"form-text\">${this.supportText}</small>`)}\n\n <div role=\"alert\" id=\"invalid-feedback-${inputId}\" class=\"form-feedback text-danger\" ?hidden=${!isInvalid}>\n ${isInvalid ? html`<span class=\"visually-hidden\">${this.label}: </span>${this.validationMessage}` : nothing}\n </div>\n </div>\n `;\n }\n\n override render() {\n if (this.variant === 'gallery') {\n return html`\n <ul class=\"upload-pictures-wall\" role=\"list\">\n ${this._renderFileList()}\n <li>${this._renderUploadInput()}</li>\n </ul>\n `;\n }\n\n return html` ${this._renderUploadInput()} ${this._renderFileList()} `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-upload': ItUpload;\n }\n}\n"],"names":["it","en"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAAE,CAAC;;AAC1B,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAIjB,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;AACX,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAIhB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;;AACnC,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;AAIrB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AACP,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAInC,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;;AACrC,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAQjB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;;AACnC,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAGZ,UAAA,CAAA;AADP,IAAA,KAAK,EAAE;;AACkC,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AArD/B,QAAQ,GAAA,UAAA,CAAA;IADpB,aAAa,CAAC,WAAW;AACb,CAAA,EAAA,QAAQ,CA6apB;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@italia/upload",
3
3
  "description": "Web components it-upload, it-upload-avatar, it-upload-drag-drop del Design system .italia",
4
- "version": "1.0.0-beta.0",
4
+ "version": "1.0.0-beta.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -36,15 +36,15 @@
36
36
  "custom-elements.json"
37
37
  ],
38
38
  "dependencies": {
39
- "bootstrap-italia": "3.0.0-beta.1",
39
+ "bootstrap-italia": "3.0.0-beta.5",
40
40
  "lit": "^3.3.0",
41
- "@italia/globals": "^1.0.0-beta.0",
42
- "@italia/i18n": "^1.0.0-beta.0"
41
+ "@italia/globals": "^1.0.0-beta.2",
42
+ "@italia/i18n": "^1.0.0-beta.2"
43
43
  },
44
44
  "peerDependencies": {
45
- "@italia/icon": "^1.0.0-beta.0",
46
- "@italia/avatar": "^1.0.0-beta.0",
47
- "@italia/progress": "^1.0.0-beta.0"
45
+ "@italia/icon": "^1.0.0-beta.2",
46
+ "@italia/avatar": "^1.0.0-beta.2",
47
+ "@italia/progress": "^1.0.0-beta.2"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@custom-elements-manifest/analyzer": "^0.10.3",
@@ -58,8 +58,8 @@
58
58
  "rollup": "^4.42.0",
59
59
  "rollup-plugin-scss-lit": "^2.1.0",
60
60
  "tslib": "^2.6.3",
61
- "@italia/test-config": "^1.0.0-beta.0",
62
- "@italia/typescript-config": "^1.0.0-beta.0"
61
+ "@italia/test-config": "^1.0.0-beta.2",
62
+ "@italia/typescript-config": "^1.0.0-beta.1"
63
63
  },
64
64
  "customElements": "custom-elements.json",
65
65
  "scripts": {