@italia/avatar 0.1.0-alpha.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.
@@ -0,0 +1,1769 @@
1
+ import { directive, Directive } from 'lit/directive.js';
2
+ import { LitElement, css, nothing, html } from 'lit';
3
+ import { state, query, property, customElement } from 'lit/decorators.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
5
+ import { ifDefined } from 'lit/directives/if-defined.js';
6
+
7
+ /******************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
22
+
23
+
24
+ function __decorate(decorators, target, key, desc) {
25
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
26
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
27
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
28
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
29
+ }
30
+
31
+ function __metadata(metadataKey, metadataValue) {
32
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
33
+ }
34
+
35
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
36
+ var e = new Error(message);
37
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
38
+ };
39
+
40
+ class SetAttributesDirective extends Directive {
41
+ update(part, [attributes]) {
42
+ const el = part.element;
43
+ for (const [name, value] of Object.entries(attributes)) {
44
+ if (value != null)
45
+ el.setAttribute(name, value);
46
+ else
47
+ el.removeAttribute(name);
48
+ }
49
+ return null;
50
+ }
51
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
52
+ render(_attributes) {
53
+ return null;
54
+ }
55
+ }
56
+ /* How to use:
57
+
58
+ <textarea ${setAttributes(this._ariaAttributes)} ... />
59
+ */
60
+ directive(SetAttributesDirective);
61
+
62
+ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
63
+
64
+ const connectedElements = new Set();
65
+ if (window && !window.translations) {
66
+ window.translations = new Map();
67
+ }
68
+ const { translations } = window;
69
+ let fallback;
70
+ // TODO: We need some way for users to be able to set these on the server.
71
+ let documentDirection = 'ltr';
72
+ // Fallback for server.
73
+ let documentLanguage = 'en';
74
+ const isClient = typeof MutationObserver !== 'undefined' &&
75
+ typeof document !== 'undefined' &&
76
+ typeof document.documentElement !== 'undefined';
77
+ /** Updates all localized elements that are currently connected */
78
+ function update() {
79
+ if (isClient) {
80
+ documentDirection = document.documentElement.dir || 'ltr';
81
+ documentLanguage = document.documentElement.lang || navigator.language;
82
+ }
83
+ [...connectedElements.keys()].forEach((el) => {
84
+ const litEl = el;
85
+ if (typeof litEl.requestUpdate === 'function') {
86
+ litEl.requestUpdate();
87
+ }
88
+ });
89
+ }
90
+ if (isClient) {
91
+ const documentElementObserver = new MutationObserver(update);
92
+ documentDirection = document.documentElement.dir || 'ltr';
93
+ documentLanguage = document.documentElement.lang || navigator.language;
94
+ // Watch for changes on <html lang>
95
+ documentElementObserver.observe(document.documentElement, {
96
+ attributes: true,
97
+ attributeFilter: ['dir', 'lang'],
98
+ });
99
+ }
100
+ /** Registers one or more translations */
101
+ function registerTranslation(...translation) {
102
+ translation.forEach((t) => {
103
+ const code = t.$code.toLowerCase();
104
+ if (translations.has(code)) {
105
+ // Merge translations that share the same language code
106
+ translations.set(code, { ...translations.get(code), ...t });
107
+ }
108
+ else {
109
+ translations.set(code, t);
110
+ }
111
+ // The first translation that's registered is the fallback
112
+ if (!fallback) {
113
+ fallback = t;
114
+ }
115
+ });
116
+ update();
117
+ }
118
+ window.registerTranslation = registerTranslation;
119
+ /**
120
+ * Localize Reactive Controller for components built with Lit
121
+ *
122
+ * To use this controller, import the class and instantiate it in a custom element constructor:
123
+ *
124
+ * private localize = new LocalizeController(this);
125
+ *
126
+ * This will add the element to the set and make it respond to changes to <html dir|lang> automatically. To make it
127
+ * respond to changes to its own dir|lang properties, make it a property:
128
+ *
129
+ * @property() dir: string;
130
+ * @property() lang: string;
131
+ *
132
+ * To use a translation method, call it like this:
133
+ *
134
+ * ${this.localize.term('term_key_here')}
135
+ * ${this.localize.date('2021-12-03')}
136
+ * ${this.localize.number(1000000)}
137
+ */
138
+ class LocalizeController {
139
+ constructor(host) {
140
+ this.host = host;
141
+ this.host.addController(this);
142
+ }
143
+ hostConnected() {
144
+ connectedElements.add(this.host);
145
+ }
146
+ hostDisconnected() {
147
+ connectedElements.delete(this.host);
148
+ }
149
+ /**
150
+ * Gets the host element's directionality as determined by the `dir` attribute. The return value is transformed to
151
+ * lowercase.
152
+ */
153
+ dir() {
154
+ return `${this.host.dir || documentDirection}`.toLowerCase();
155
+ }
156
+ /**
157
+ * Gets the host element's language as determined by the `lang` attribute. The return value is transformed to
158
+ * lowercase.
159
+ */
160
+ lang() {
161
+ return `${this.host.lang || documentLanguage}`.toLowerCase();
162
+ }
163
+ // eslint-disable-next-line class-methods-use-this
164
+ getTranslationData(lang) {
165
+ // Convert "en_US" to "en-US". Note that both underscores and dashes are allowed per spec, but underscores result in
166
+ // a RangeError by the call to `new Intl.Locale()`. See: https://unicode.org/reports/tr35/#unicode-locale-identifier
167
+ const locale = new Intl.Locale(lang.replace(/_/g, '-'));
168
+ const language = locale?.language.toLowerCase();
169
+ const region = locale?.region?.toLowerCase() ?? '';
170
+ const primary = translations.get(`${language}-${region}`);
171
+ const secondary = translations.get(language);
172
+ return { locale, language, region, primary, secondary };
173
+ }
174
+ /** Determines if the specified term exists, optionally checking the fallback translation. */
175
+ exists(key, options) {
176
+ const { primary, secondary } = this.getTranslationData(options.lang ?? this.lang());
177
+ const mergedOptions = {
178
+ includeFallback: false,
179
+ ...options,
180
+ };
181
+ if ((primary && primary[key]) ||
182
+ (secondary && secondary[key]) ||
183
+ (mergedOptions.includeFallback && fallback && fallback[key])) {
184
+ return true;
185
+ }
186
+ return false;
187
+ }
188
+ /** Outputs a translated term. */
189
+ term(key, ...args) {
190
+ const { primary, secondary } = this.getTranslationData(this.lang());
191
+ let term;
192
+ // Look for a matching term using regionCode, code, then the fallback
193
+ if (primary && primary[key]) {
194
+ term = primary[key];
195
+ }
196
+ else if (secondary && secondary[key]) {
197
+ term = secondary[key];
198
+ }
199
+ else if (fallback && fallback[key]) {
200
+ term = fallback[key];
201
+ }
202
+ else {
203
+ // eslint-disable-next-line no-console
204
+ console.error(`No translation found for: ${String(key)}`);
205
+ return String(key);
206
+ }
207
+ if (typeof term === 'function') {
208
+ return term(...args);
209
+ }
210
+ return term;
211
+ }
212
+ /** Outputs a localized date in the specified format. */
213
+ date(dateToFormat, options) {
214
+ const date = new Date(dateToFormat);
215
+ return new Intl.DateTimeFormat(this.lang(), options).format(date);
216
+ }
217
+ /** Outputs a localized number in the specified format. */
218
+ number(numberToFormat, options) {
219
+ const num = Number(numberToFormat);
220
+ return Number.isNaN(num) ? '' : new Intl.NumberFormat(this.lang(), options).format(num);
221
+ }
222
+ /** Outputs a localized time in relative format. */
223
+ relativeTime(value, unit, options) {
224
+ return new Intl.RelativeTimeFormat(this.lang(), options).format(value, unit);
225
+ }
226
+ }
227
+
228
+ /**
229
+ * @param Base The base class.
230
+ * @returns A mix-in implementing `localizations` method.
231
+ *
232
+ *@example
233
+ * <!-- Terms -->
234
+ ${this.$localize.term('hello')}
235
+ or
236
+ ${this.$t('hello')}
237
+
238
+ <!-- Dates -->
239
+ ${this.$localize.date('2021-09-15 14:00:00 ET', { month: 'long', day: 'numeric', year: 'numeric' })}
240
+ or
241
+ ${this.$d('2021-09-15 14:00:00 ET', { month: 'long', day: 'numeric', year: 'numeric' })}
242
+
243
+ <!-- Numbers/currency -->
244
+ ${this.$localize.number(1000, { style: 'currency', currency: 'USD'})}
245
+ or
246
+ ${this.$n(1000,{ style: 'currency', currency: 'USD'})}
247
+
248
+ <!-- Determining language -->
249
+ ${this.$localize.lang()}
250
+
251
+ <!-- Determining directionality, e.g. 'ltr' or 'rtl' -->
252
+ ${this.$localize.dir()}
253
+
254
+
255
+ *** HOW TO DEFINE TRANSLATIONS: ***
256
+ // Simple terms
257
+ upload: 'Upload',
258
+
259
+ // Terms with placeholders
260
+ greetUser: (name: string) => `Hello, ${name}!`,
261
+
262
+ // Plurals
263
+ numFilesSelected: (count: number) => {
264
+ if (count === 0) return 'No files selected';
265
+ if (count === 1) return '1 file selected';
266
+ return `${count} files selected`;
267
+ }
268
+ */
269
+ const LocalizeMixin = (Base) => class extends Base {
270
+ constructor() {
271
+ super(...arguments);
272
+ this.localize = new LocalizeController(this);
273
+ }
274
+ // Provide default values to avoid definite assignment errors and avoid decorators
275
+ // commentati perchè danno problemi su React.js. Sono attributi nativi, e assegnare un valore di default a react da fastidio
276
+ // dir: string = '';
277
+ // lang: string = '';
278
+ /**
279
+ * Restituisce tutta l'utility di traduzione
280
+ *
281
+
282
+ *
283
+ * @returns tutta l'utility di traduzione
284
+ *
285
+ * @example
286
+ * this.$localize.lang() -> ritorna la lingua corrente
287
+ * this.$localize.dir() -> ritorna la direzione della lingua corrente
288
+ */
289
+ get $localize() {
290
+ return this.localize;
291
+ }
292
+ /**
293
+ * Restituisce una stringa localizzata a partire da una chiave di termine.
294
+ *
295
+ * Utilizza il `LocalizeController` per accedere al dizionario corrente e
296
+ * tradurre la chiave fornita secondo la lingua attiva.
297
+ *
298
+ * @param t - La chiave del termine da localizzare (es. 'hello', 'submit', ecc.).
299
+ * @returns La stringa tradotta in base alla lingua attiva. Se la chiave non è trovata, restituisce la chiave stessa.
300
+ *
301
+ * @example
302
+ * this.$t('hello'); // → "Ciao" (in locale it-IT)
303
+ */
304
+ $t(t) {
305
+ // format term
306
+ return this.localize.term(t);
307
+ }
308
+ /**
309
+ * Formatta una data in base alla localizzazione attiva.
310
+ *
311
+ * Utilizza il `LocalizeController` per restituire una stringa localizzata
312
+ * secondo le opzioni fornite (es. mese esteso, anno, ecc.).
313
+ *
314
+ * @param n - La data da formattare come stringa compatibile (es. ISO o con timezone, es. '2021-09-15 14:00:00 ET').
315
+ * @param p - Le opzioni di formattazione per `Intl.DateTimeFormat` (es. { year: 'numeric', month: 'long', day: 'numeric' }).
316
+ * @returns Una stringa rappresentante la data formattata secondo la localizzazione attiva.
317
+ *
318
+ * @example
319
+ * this.$d('2021-09-15 14:00:00 ET', { year: 'numeric', month: 'long', day: 'numeric' });
320
+ * // → "15 settembre 2021" (in locale it-IT)
321
+ */
322
+ $d(d, p) {
323
+ // format date
324
+ return this.localize.date(d, p);
325
+ }
326
+ /**
327
+ * Formatta un numero secondo le impostazioni locali dell'utente corrente.
328
+ *
329
+ * Utilizza il `LocalizeController` per applicare formattazione numerica,
330
+ * incluse opzioni come separatori, decimali, valute, ecc.
331
+ *
332
+ * @param d - Il numero da formattare.
333
+ * @param p - Le opzioni di formattazione (es. { style: 'currency', currency: 'EUR' }).
334
+ * @returns Una stringa rappresentante il numero formattato secondo la localizzazione attiva.
335
+ *
336
+ * @example
337
+ * this.$n(1234.56, { style: 'currency', currency: 'USD' }); // → "$1,234.56" (in locale en-US)
338
+ */
339
+ $n(d, p) {
340
+ return this.localize.number(d, p);
341
+ }
342
+ };
343
+
344
+ /* eslint-disable no-console */
345
+ class Logger {
346
+ constructor(tag) {
347
+ this.tag = tag;
348
+ }
349
+ format(level, msg) {
350
+ return [`[${this.tag}] ${msg}`];
351
+ }
352
+ warn(msg) {
353
+ console.warn(...this.format('warn', msg));
354
+ }
355
+ error(msg) {
356
+ console.error(...this.format('error', msg));
357
+ }
358
+ info(msg) {
359
+ console.info(...this.format('info', msg));
360
+ }
361
+ }
362
+
363
+ /**
364
+ * Factory function per creare una base class estendibile
365
+ * con stili personalizzati.
366
+ */
367
+ class BaseComponent extends LitElement {
368
+ constructor() {
369
+ super();
370
+ this.composeClass = clsx;
371
+ this.logger = new Logger(this.tagName.toLowerCase());
372
+ }
373
+ get _ariaAttributes() {
374
+ const attributes = {};
375
+ for (const attr of this.getAttributeNames()) {
376
+ if (attr === 'it-role') {
377
+ attributes.role = this.getAttribute(attr);
378
+ }
379
+ else if (attr.startsWith('it-aria-')) {
380
+ attributes[attr.replace(/^it-/, '')] = this.getAttribute(attr);
381
+ }
382
+ }
383
+ return attributes;
384
+ }
385
+ // eslint-disable-next-line class-methods-use-this
386
+ generateId(prefix) {
387
+ return `${prefix}-${Math.random().toString(36).slice(2)}`;
388
+ }
389
+ // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
390
+ addFocus(element) {
391
+ // new TrackFocus(element); // per il momento è stato disattivato perchè ci sono le pseudo classi ::focus-visible per fare quello che fa TrackFocus. Si possono aggiungere regole css in bsi-italia 3 dato che stiamo facendo una breaking release di bsi.
392
+ }
393
+ // eslint-disable-next-line class-methods-use-this
394
+ getActiveElement() {
395
+ let active = document.activeElement;
396
+ while (active && active.shadowRoot && active.shadowRoot.activeElement) {
397
+ active = active.shadowRoot.activeElement;
398
+ }
399
+ return active;
400
+ }
401
+ get focusElement() {
402
+ return this;
403
+ }
404
+ // eslint-disable-next-line class-methods-use-this
405
+ get prefersReducedMotion() {
406
+ return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
407
+ }
408
+ connectedCallback() {
409
+ super.connectedCallback();
410
+ // generate internal _id
411
+ const prefix = this.id?.length > 0 ? this.id : this.tagName.toLowerCase();
412
+ this._id = this.generateId(prefix);
413
+ }
414
+ }
415
+ const BaseLocalizedComponent = LocalizeMixin(BaseComponent);
416
+
417
+ //
418
+ // We store a WeakMap of forms + controls so we can keep references to all FormControl within a given form. As
419
+ // elements connect and disconnect to/from the DOM, their containing form is used as the key and the form control is
420
+ // added and removed from the form's set, respectively.
421
+ //
422
+ const formCollections = new WeakMap();
423
+ //
424
+ // We store a WeakMap of reportValidity() overloads so we can override it when form controls connect to the DOM and
425
+ // restore the original behavior when they disconnect.
426
+ //
427
+ const reportValidityOverloads = new WeakMap();
428
+ const checkValidityOverloads = new WeakMap();
429
+ //
430
+ // We store a Set of controls that users have interacted with. This allows us to determine the interaction state
431
+ // without littering the DOM with additional data attributes.
432
+ //
433
+ const userInteractedControls = new WeakSet();
434
+ //
435
+ // We store a WeakMap of interactions for each form control so we can track when all conditions are met for validation.
436
+ //
437
+ const interactions = new WeakMap();
438
+ /** A reactive controller to allow form controls to participate in form submission, validation, etc. */
439
+ class FormControlController {
440
+ constructor(host, options) {
441
+ this.handleFormData = (event) => {
442
+ // console.log('handleFormData');
443
+ const disabled = this.options.disabled(this.host);
444
+ const name = this.options.name(this.host);
445
+ const value = this.options.value(this.host);
446
+ const tagName = this.host.tagName.toLowerCase();
447
+ // For buttons, we only submit the value if they were the submitter. This is currently done in doAction() by
448
+ // injecting the name/value on a temporary button, so we can just skip them here.
449
+ const isButton = tagName === 'it-button';
450
+ if (this.host.isConnected &&
451
+ !disabled &&
452
+ !isButton &&
453
+ typeof name === 'string' &&
454
+ name.length > 0 &&
455
+ typeof value !== 'undefined') {
456
+ switch (tagName) {
457
+ case 'it-radio':
458
+ if (this.host.checked) {
459
+ event.formData.append(name, value);
460
+ }
461
+ break;
462
+ default:
463
+ if (Array.isArray(value)) {
464
+ value.forEach((val) => {
465
+ event.formData.append(name, val.toString());
466
+ });
467
+ }
468
+ else {
469
+ event.formData.append(name, value.toString());
470
+ }
471
+ }
472
+ }
473
+ };
474
+ this.handleFormSubmit = (event) => {
475
+ const disabled = this.options.disabled(this.host);
476
+ const reportValidity = this.options.reportValidity;
477
+ // Update the interacted state for all controls when the form is submitted
478
+ if (this.form && !this.form.noValidate) {
479
+ formCollections.get(this.form)?.forEach((control) => {
480
+ this.setUserInteracted(control, true);
481
+ });
482
+ }
483
+ if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {
484
+ event.preventDefault();
485
+ // event.stopImmediatePropagation(); // se lo attiviamo, valida un campo alla volta
486
+ }
487
+ };
488
+ this.handleFormReset = () => {
489
+ this.options.setValue(this.host, '');
490
+ this.setUserInteracted(this.host, false);
491
+ interactions.set(this.host, []);
492
+ };
493
+ this.handleInteraction = (event) => {
494
+ const emittedEvents = interactions.get(this.host);
495
+ if (!emittedEvents.includes(event.type)) {
496
+ emittedEvents.push(event.type);
497
+ }
498
+ // Mark it as user-interacted as soon as all associated events have been emitted
499
+ if (emittedEvents.length === this.options.assumeInteractionOn.length) {
500
+ this.setUserInteracted(this.host, true);
501
+ }
502
+ };
503
+ this.checkFormValidity = () => {
504
+ // console.log('checkFormValidity');
505
+ //
506
+ // This is very similar to the `reportFormValidity` function, but it does not trigger native constraint validation
507
+ // Allow the user to simply check if the form is valid and handling validity in their own way.
508
+ //
509
+ // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger
510
+ // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't
511
+ // be necessary once we can use ElementInternals.
512
+ //
513
+ // Note that we're also honoring the form's novalidate attribute.
514
+ //
515
+ if (this.form && !this.form.noValidate) {
516
+ // This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom
517
+ // elements that support the constraint validation API.
518
+ const elements = this.form.querySelectorAll('*');
519
+ for (const element of elements) {
520
+ if (typeof element.checkValidity === 'function') {
521
+ if (!element.checkValidity()) {
522
+ return false;
523
+ }
524
+ }
525
+ }
526
+ }
527
+ return true;
528
+ };
529
+ this.reportFormValidity = () => {
530
+ // console.log('reportFormValidity');
531
+ //
532
+ // FormControl work hard to act like regular form controls. They support the Constraint Validation API
533
+ // and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also
534
+ // has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using
535
+ // ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.
536
+ //
537
+ // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger
538
+ // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't
539
+ // be necessary once we can use ElementInternals.
540
+ //
541
+ // Note that we're also honoring the form's novalidate attribute.
542
+ //
543
+ if (this.form && !this.form.noValidate) {
544
+ // This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom
545
+ // elements that support the constraint validation API.
546
+ const elements = this.form.querySelectorAll('*');
547
+ for (const element of elements) {
548
+ if (typeof element.reportValidity === 'function') {
549
+ if (!element.reportValidity()) {
550
+ return false;
551
+ }
552
+ }
553
+ }
554
+ }
555
+ return true;
556
+ };
557
+ (this.host = host).addController(this);
558
+ this.options = {
559
+ form: (input) => {
560
+ // If there's a form attribute, use it to find the target form by id
561
+ // Controls may not always reflect the 'form' property. For example, `<it-button>` doesn't reflect.
562
+ const formId = input.form;
563
+ if (formId) {
564
+ const root = input.getRootNode();
565
+ const form = root.querySelector(`#${formId}`);
566
+ if (form) {
567
+ return form;
568
+ }
569
+ }
570
+ return input.closest('form');
571
+ },
572
+ name: (input) => input.name,
573
+ value: (input) => input.value,
574
+ disabled: (input) => input.disabled ?? false,
575
+ reportValidity: (input) => typeof input.reportValidity === 'function' ? input.reportValidity() : true,
576
+ checkValidity: (input) => (typeof input.checkValidity === 'function' ? input.checkValidity() : true),
577
+ setValue: (input, value) => {
578
+ // eslint-disable-next-line no-param-reassign
579
+ input.value = value;
580
+ },
581
+ assumeInteractionOn: ['it-input'],
582
+ ...options,
583
+ };
584
+ }
585
+ hostConnected() {
586
+ const form = this.options.form(this.host);
587
+ if (form) {
588
+ this.attachForm(form);
589
+ }
590
+ // Listen for interactions
591
+ interactions.set(this.host, []);
592
+ this.options.assumeInteractionOn.forEach((event) => {
593
+ this.host.addEventListener(event, this.handleInteraction);
594
+ });
595
+ }
596
+ hostDisconnected() {
597
+ this.detachForm();
598
+ // Clean up interactions
599
+ interactions.delete(this.host);
600
+ this.options.assumeInteractionOn.forEach((event) => {
601
+ this.host.removeEventListener(event, this.handleInteraction);
602
+ });
603
+ }
604
+ hostUpdated() {
605
+ const form = this.options.form(this.host);
606
+ // Detach if the form no longer exists
607
+ if (!form) {
608
+ this.detachForm();
609
+ }
610
+ // If the form has changed, reattach it
611
+ if (form && this.form !== form) {
612
+ this.detachForm();
613
+ this.attachForm(form);
614
+ }
615
+ if (this.host.hasUpdated) {
616
+ this.setValidity(this.host.validity.valid);
617
+ }
618
+ }
619
+ attachForm(form) {
620
+ if (form) {
621
+ this.form = form;
622
+ // Add this element to the form's collection
623
+ if (formCollections.has(this.form)) {
624
+ formCollections.get(this.form).add(this.host);
625
+ }
626
+ else {
627
+ formCollections.set(this.form, new Set([this.host]));
628
+ }
629
+ this.form.addEventListener('formdata', this.handleFormData);
630
+ this.form.addEventListener('submit', this.handleFormSubmit);
631
+ this.form.addEventListener('reset', this.handleFormReset);
632
+ // Overload the form's reportValidity() method so it looks at FormControl
633
+ if (!reportValidityOverloads.has(this.form)) {
634
+ reportValidityOverloads.set(this.form, this.form.reportValidity);
635
+ this.form.reportValidity = () => this.reportFormValidity();
636
+ }
637
+ // Overload the form's checkValidity() method so it looks at FormControl
638
+ if (!checkValidityOverloads.has(this.form)) {
639
+ checkValidityOverloads.set(this.form, this.form.checkValidity);
640
+ this.form.checkValidity = () => this.checkFormValidity();
641
+ }
642
+ }
643
+ else {
644
+ this.form = undefined;
645
+ }
646
+ }
647
+ detachForm() {
648
+ if (!this.form)
649
+ return;
650
+ const formCollection = formCollections.get(this.form);
651
+ if (!formCollection) {
652
+ return;
653
+ }
654
+ // Remove this host from the form's collection
655
+ formCollection.delete(this.host);
656
+ // Check to make sure there's no other form controls in the collection. If we do this
657
+ // without checking if any other controls are still in the collection, then we will wipe out the
658
+ // validity checks for all other elements.
659
+ // see: https://github.com/shoelace-style/shoelace/issues/1703
660
+ if (formCollection.size <= 0) {
661
+ this.form.removeEventListener('formdata', this.handleFormData);
662
+ this.form.removeEventListener('submit', this.handleFormSubmit);
663
+ this.form.removeEventListener('reset', this.handleFormReset);
664
+ // Remove the overload and restore the original method
665
+ if (reportValidityOverloads.has(this.form)) {
666
+ this.form.reportValidity = reportValidityOverloads.get(this.form);
667
+ reportValidityOverloads.delete(this.form);
668
+ }
669
+ if (checkValidityOverloads.has(this.form)) {
670
+ this.form.checkValidity = checkValidityOverloads.get(this.form);
671
+ checkValidityOverloads.delete(this.form);
672
+ }
673
+ // So it looks weird here to not always set the form to undefined. But I _think_ if we unattach this.form here,
674
+ // we end up in this fun spot where future validity checks don't have a reference to the form validity handler.
675
+ // First form element in sets the validity handler. So we can't clean up `this.form` until there are no other form elements in the form.
676
+ this.form = undefined;
677
+ }
678
+ }
679
+ // eslint-disable-next-line class-methods-use-this
680
+ setUserInteracted(el, hasInteracted) {
681
+ if (hasInteracted) {
682
+ userInteractedControls.add(el);
683
+ }
684
+ else {
685
+ userInteractedControls.delete(el);
686
+ }
687
+ el.requestUpdate();
688
+ }
689
+ doAction(type, submitter) {
690
+ // console.log('doaction', type);
691
+ if (this.form) {
692
+ const button = document.createElement('button');
693
+ button.type = type;
694
+ button.style.position = 'absolute';
695
+ button.style.width = '0';
696
+ button.style.height = '0';
697
+ button.style.clipPath = 'inset(50%)';
698
+ button.style.overflow = 'hidden';
699
+ button.style.whiteSpace = 'nowrap';
700
+ // Pass name, value, and form attributes through to the temporary button
701
+ if (submitter) {
702
+ button.name = submitter.name;
703
+ button.value = submitter.value;
704
+ ['formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget'].forEach((attr) => {
705
+ if (submitter.hasAttribute(attr)) {
706
+ button.setAttribute(attr, submitter.getAttribute(attr));
707
+ }
708
+ });
709
+ }
710
+ this.form.append(button);
711
+ button.click();
712
+ button.remove();
713
+ }
714
+ }
715
+ /** Returns the associated `<form>` element, if one exists. */
716
+ getForm() {
717
+ return this.form ?? null;
718
+ }
719
+ /** Resets the form, restoring all the control to their default value */
720
+ reset(submitter) {
721
+ this.doAction('reset', submitter);
722
+ }
723
+ /** Submits the form, triggering validation and form data injection. */
724
+ submit(submitter) {
725
+ // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a
726
+ // native submit button into the form, "click" it, then remove it to simulate a standard form submission.
727
+ this.doAction('submit', submitter);
728
+ }
729
+ /**
730
+ * Synchronously sets the form control's validity. Call this when you know the future validity but need to update
731
+ * the host element immediately, i.e. before Lit updates the component in the next update.
732
+ */
733
+ setValidity(isValid) {
734
+ const host = this.host;
735
+ const hasInteracted = Boolean(userInteractedControls.has(host));
736
+ const required = Boolean(host.required);
737
+ //
738
+ // We're mapping the following "states" to data attributes. In the future, we can use ElementInternals.states to
739
+ // create a similar mapping, but instead of [data-invalid] it will look like :--invalid.
740
+ //
741
+ // See this RFC for more details: https://github.com/shoelace-style/shoelace/issues/1011
742
+ //
743
+ host.toggleAttribute('data-required', required);
744
+ host.toggleAttribute('data-optional', !required);
745
+ host.toggleAttribute('data-invalid', !isValid);
746
+ host.toggleAttribute('data-valid', isValid);
747
+ host.toggleAttribute('data-user-invalid', !isValid && hasInteracted);
748
+ host.toggleAttribute('data-user-valid', isValid && hasInteracted);
749
+ }
750
+ /**
751
+ * Updates the form control's validity based on the current value of `host.validity.valid`. Call this when anything
752
+ * that affects constraint validation changes so the component receives the correct validity states.
753
+ */
754
+ updateValidity() {
755
+ const host = this.host;
756
+ this.setValidity(host.validity.valid);
757
+ }
758
+ /**
759
+ * Dispatches a non-bubbling, cancelable custom event of type `it-invalid`.
760
+ * If the `it-invalid` event will be cancelled then the original `invalid`
761
+ * event (which may have been passed as argument) will also be cancelled.
762
+ * If no original `invalid` event has been passed then the `it-invalid`
763
+ * event will be cancelled before being dispatched.
764
+ */
765
+ emitInvalidEvent(originalInvalidEvent) {
766
+ const itInvalidEvent = new CustomEvent('it-invalid', {
767
+ bubbles: false,
768
+ composed: false,
769
+ cancelable: true,
770
+ detail: {},
771
+ });
772
+ if (!originalInvalidEvent) {
773
+ itInvalidEvent.preventDefault();
774
+ }
775
+ if (!this.host.dispatchEvent(itInvalidEvent)) {
776
+ originalInvalidEvent?.preventDefault();
777
+ }
778
+ }
779
+ }
780
+
781
+ const translation$2 = {
782
+ $code: 'it',
783
+ $name: 'Italiano',
784
+ $dir: 'ltr',
785
+ validityRequired: 'Questo campo è obbligatorio.',
786
+ validityPattern: 'Il valore non corrisponde al formato richiesto.',
787
+ validityMinlength: 'Il valore deve essere lungo almeno {minlength} caratteri.',
788
+ validityMaxlength: 'Il valore deve essere lungo al massimo {maxlength} caratteri.',
789
+ };
790
+
791
+ registerTranslation(translation$2);
792
+ class FormControl extends BaseLocalizedComponent {
793
+ constructor() {
794
+ super(...arguments);
795
+ this.formControlController = new FormControlController(this, {
796
+ assumeInteractionOn: ['it-input', 'it-blur', 'it-change'],
797
+ });
798
+ // TODO: verificare se serve davvero con il fatto che usiamo form-controller
799
+ // static formAssociated = true;
800
+ // @property()
801
+ // internals = this.attachInternals();
802
+ this._touched = false;
803
+ /** The name of the input, submitted as a name/value pair with form data. */
804
+ this.name = '';
805
+ /** The current value of the input, submitted as a name/value pair with form data. */
806
+ this.value = '';
807
+ /** If the input is disabled. */
808
+ this.disabled = false;
809
+ /**
810
+ * By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you
811
+ * to place the form control outside of a form and associate it with the form that has this `id`. The form must be in
812
+ * the same document or shadow root for this to work.
813
+ */
814
+ this.form = '';
815
+ /** If you implement your custom validation and you won't to trigger default validation */
816
+ this.customValidation = false;
817
+ /** If your input is invalid from your custom validition, set this attribute with message validation */
818
+ this.validationText = '';
819
+ /**
820
+ * Specifies the granularity that the value must adhere to, or the special value `any` which means no stepping is
821
+ * implied, allowing any numeric value. Only applies to date and number input types.
822
+ */
823
+ this.step = 'any';
824
+ /** The input's minimum length. */
825
+ this.minlength = -1;
826
+ /** The input's maximum length. */
827
+ this.maxlength = -1;
828
+ /** If the input is required. */
829
+ this.required = false;
830
+ this.validationMessage = '';
831
+ }
832
+ /** Gets the validity state object */
833
+ get validity() {
834
+ return this.inputElement?.validity;
835
+ }
836
+ // Form validation methods
837
+ checkValidity() {
838
+ const inputValid = this.inputElement?.checkValidity() ?? true; // this.inputElement.checkValidity() è la validazione del browser
839
+ return inputValid;
840
+ }
841
+ /** Gets the associated form, if one exists. */
842
+ getForm() {
843
+ return this.formControlController.getForm();
844
+ }
845
+ /** Checks for validity and shows the browser's validation message if the control is invalid. */
846
+ reportValidity() {
847
+ const ret = this.inputElement.checkValidity();
848
+ this.handleValidationMessages();
849
+ return ret; // this.inputElement.reportValidity();
850
+ }
851
+ /** Sets a custom validation message. Pass an empty string to restore validity. */
852
+ setCustomValidity(message) {
853
+ this.inputElement.setCustomValidity(message);
854
+ this.validationMessage = this.inputElement.validationMessage;
855
+ this.formControlController.updateValidity();
856
+ }
857
+ // Handlers
858
+ _handleReady() {
859
+ requestAnimationFrame(() => {
860
+ this.dispatchEvent(new CustomEvent('it-input-ready', { bubbles: true, detail: { el: this.inputElement } }));
861
+ });
862
+ }
863
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
864
+ _handleInput(e) {
865
+ this.handleValidationMessages();
866
+ this.dispatchEvent(new CustomEvent('it-input', {
867
+ detail: { value: this.inputElement.value, el: this.inputElement },
868
+ bubbles: true,
869
+ composed: true,
870
+ }));
871
+ }
872
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
873
+ _handleBlur(e) {
874
+ this._touched = true;
875
+ this.handleValidationMessages();
876
+ this.dispatchEvent(new FocusEvent('it-blur', { bubbles: true, composed: true }));
877
+ }
878
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
879
+ _handleFocus(e) {
880
+ this.dispatchEvent(new FocusEvent('it-focus', { bubbles: true, composed: true }));
881
+ }
882
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
883
+ _handleClick(e) {
884
+ this.dispatchEvent(new MouseEvent('it-click', { bubbles: true, composed: true }));
885
+ }
886
+ /*
887
+ Override default browser validation messages
888
+ */
889
+ handleValidationMessages() {
890
+ if (!this.customValidation) {
891
+ const _v = this.inputElement.validity;
892
+ if (_v.valueMissing) {
893
+ this.setCustomValidity(this.$t('validityRequired'));
894
+ }
895
+ else if (_v.patternMismatch) {
896
+ this.setCustomValidity(this.$t('validityPattern'));
897
+ }
898
+ else if (_v.tooShort) {
899
+ this.setCustomValidity(this.$t('validityMinlength').replace('{minlength}', this.minlength.toString()));
900
+ }
901
+ else if (_v.tooLong) {
902
+ this.setCustomValidity(this.$t('validityMaxlength').replace('{maxlength}', this.maxlength.toString()));
903
+ }
904
+ else {
905
+ /* nothing. Usa il messaggio di errore della validazione
906
+ di default del browser per altri errori di validità come:
907
+ - typeMismatch
908
+ - rangeUnderflow
909
+ - rangeOverflow
910
+ - stepMismatch
911
+ - badInput */
912
+ const otherConstraintErrors = _v.typeMismatch || _v.rangeUnderflow || _v.rangeOverflow || _v.stepMismatch || _v.badInput;
913
+ if (!otherConstraintErrors) {
914
+ this.setCustomValidity('');
915
+ }
916
+ }
917
+ }
918
+ this.validationMessage = this.inputElement.validationMessage;
919
+ }
920
+ _handleInvalid(event) {
921
+ this.formControlController.setValidity(false);
922
+ this.formControlController.emitInvalidEvent(event);
923
+ }
924
+ _handleChange(e) {
925
+ const target = e.target;
926
+ let value;
927
+ if (target instanceof HTMLInputElement) {
928
+ switch (target.type) {
929
+ case 'checkbox':
930
+ case 'radio':
931
+ value = target.checked;
932
+ break;
933
+ case 'file':
934
+ value = target.files; // FileList
935
+ break;
936
+ default:
937
+ value = target.value;
938
+ }
939
+ }
940
+ else if (target instanceof HTMLSelectElement) {
941
+ if (target.multiple) {
942
+ value = Array.from(target.selectedOptions).map((o) => o.value);
943
+ }
944
+ else {
945
+ value = target.value;
946
+ }
947
+ }
948
+ else {
949
+ // textarea o altri input con value
950
+ value = target.value;
951
+ }
952
+ this.dispatchEvent(new CustomEvent('it-change', {
953
+ detail: { value, el: target },
954
+ bubbles: true,
955
+ composed: true,
956
+ }));
957
+ }
958
+ updated(changedProperties) {
959
+ super.updated?.(changedProperties);
960
+ if (this.customValidation) {
961
+ this.setCustomValidity(this.validationText ?? '');
962
+ }
963
+ else {
964
+ this.formControlController.updateValidity();
965
+ }
966
+ }
967
+ }
968
+ __decorate([
969
+ state(),
970
+ __metadata("design:type", Object)
971
+ ], FormControl.prototype, "_touched", void 0);
972
+ __decorate([
973
+ query('.it-form__control'),
974
+ __metadata("design:type", HTMLInputElement)
975
+ ], FormControl.prototype, "inputElement", void 0);
976
+ __decorate([
977
+ property({ type: String, reflect: true }) // from FormControl
978
+ ,
979
+ __metadata("design:type", Object)
980
+ ], FormControl.prototype, "name", void 0);
981
+ __decorate([
982
+ property({ reflect: true }),
983
+ __metadata("design:type", Object)
984
+ ], FormControl.prototype, "value", void 0);
985
+ __decorate([
986
+ property({ type: Boolean, reflect: true }) // from FormControl
987
+ ,
988
+ __metadata("design:type", Object)
989
+ ], FormControl.prototype, "disabled", void 0);
990
+ __decorate([
991
+ property({ reflect: true, type: String }),
992
+ __metadata("design:type", Object)
993
+ ], FormControl.prototype, "form", void 0);
994
+ __decorate([
995
+ property({ type: Boolean, reflect: true, attribute: 'custom-validation' }),
996
+ __metadata("design:type", Object)
997
+ ], FormControl.prototype, "customValidation", void 0);
998
+ __decorate([
999
+ property({ attribute: 'validity-message', reflect: true }),
1000
+ __metadata("design:type", String)
1001
+ ], FormControl.prototype, "validationText", void 0);
1002
+ __decorate([
1003
+ property(),
1004
+ __metadata("design:type", String)
1005
+ ], FormControl.prototype, "pattern", void 0);
1006
+ __decorate([
1007
+ property(),
1008
+ __metadata("design:type", Object)
1009
+ ], FormControl.prototype, "min", void 0);
1010
+ __decorate([
1011
+ property(),
1012
+ __metadata("design:type", Object)
1013
+ ], FormControl.prototype, "max", void 0);
1014
+ __decorate([
1015
+ property(),
1016
+ __metadata("design:type", Object)
1017
+ ], FormControl.prototype, "step", void 0);
1018
+ __decorate([
1019
+ property({ type: Number }),
1020
+ __metadata("design:type", Object)
1021
+ ], FormControl.prototype, "minlength", void 0);
1022
+ __decorate([
1023
+ property({ type: Number }),
1024
+ __metadata("design:type", Object)
1025
+ ], FormControl.prototype, "maxlength", void 0);
1026
+ __decorate([
1027
+ property({ type: Boolean, reflect: true }) // from FormControl
1028
+ ,
1029
+ __metadata("design:type", Object)
1030
+ ], FormControl.prototype, "required", void 0);
1031
+ __decorate([
1032
+ state(),
1033
+ __metadata("design:type", Object)
1034
+ ], FormControl.prototype, "validationMessage", void 0);
1035
+
1036
+ var styles = css`/***************************** 1 ****************************************/
1037
+ /***************************** 2 ****************************************/
1038
+ /***************************** 1 ****************************************/
1039
+ /***************************** 2 ****************************************/
1040
+ /***************************** 1 ****************************************/
1041
+ /***************************** 2 ****************************************/
1042
+ /***************************** 3 ****************************************/
1043
+ /***************************** 1 ****************************************/
1044
+ /***************************** 2 ****************************************/
1045
+ /***************************** 3 ****************************************/
1046
+ /***************************** NEUTRAL 1 ****************************************/
1047
+ /***************************** NEUTRAL 2 ****************************************/
1048
+ /***************************** NEUTRAL 2 / 3 ****************************************/
1049
+ .visually-hidden,
1050
+ .visually-hidden-focusable:not(:focus):not(:focus-within) {
1051
+ position: absolute !important;
1052
+ width: 1px !important;
1053
+ height: 1px !important;
1054
+ padding: 0 !important;
1055
+ margin: -1px !important;
1056
+ overflow: hidden !important;
1057
+ clip: rect(0, 0, 0, 0) !important;
1058
+ white-space: nowrap !important;
1059
+ border: 0 !important;
1060
+ }
1061
+
1062
+ .avatar {
1063
+ --bs-avatar-background: var(--bs-color-background-secondary-lighter);
1064
+ --bs-avatar-text-color: var(--bs-color-text-secondary);
1065
+ --bs-avatar-font-size: var(--bs-font-size-3);
1066
+ --bs-avatar-font-weight: var(--bs-font-weight-solid);
1067
+ --bs-avatar-icon-size: var(--bs-icon-size-s);
1068
+ --bs-avatar-radius: var(--bs-radius-circle);
1069
+ --bs-avatar-size: 2.5rem;
1070
+ --bs-avatar-dot-size: 12px;
1071
+ --bs-avatar-dot-border-size: 2px;
1072
+ --bs-avatar-dot-border-color: var(--bs-color-border-inverse);
1073
+ --bs-avatar-dot-offset-right: 0;
1074
+ --bs-avatar-dot-offset-top: 4px;
1075
+ --bs-avatar-dot-offset-bottom: 0;
1076
+ --bs-avatar-overlay-background: var(--bs-color-background-emphasis);
1077
+ }
1078
+
1079
+ .avatar {
1080
+ position: relative;
1081
+ z-index: 1;
1082
+ display: inline-flex;
1083
+ align-items: center;
1084
+ justify-content: center;
1085
+ width: var(--bs-avatar-size);
1086
+ height: var(--bs-avatar-size);
1087
+ border-radius: var(--bs-avatar-radius);
1088
+ background: var(--bs-avatar-background);
1089
+ color: var(--bs-avatar-text-color);
1090
+ transition: background-color var(--bs-transition-instant);
1091
+ }
1092
+ .avatar.avatar-primary {
1093
+ --bs-avatar-background: var(--bs-theme-primary);
1094
+ --bs-avatar-text-color: var(--bs-color-text-inverse);
1095
+ }
1096
+ .avatar.avatar-secondary {
1097
+ --bs-avatar-background: var(--bs-color-background-secondary);
1098
+ --bs-avatar-text-color: var(--bs-color-text-inverse);
1099
+ }
1100
+ .avatar.size-xs {
1101
+ --bs-avatar-dot-border-size: 1px;
1102
+ --bs-avatar-font-size: 0.625rem;
1103
+ --bs-avatar-size: 1rem;
1104
+ --bs-avatar-icon-size: 0.625rem;
1105
+ }
1106
+ .avatar.size-sm {
1107
+ --bs-avatar-dot-border-size: 1px;
1108
+ --bs-avatar-font-size: var(--bs-font-size-1);
1109
+ --bs-avatar-size: 1.5rem;
1110
+ --bs-avatar-icon-size: var(--bs-icon-size-xs);
1111
+ }
1112
+ .avatar.size-md {
1113
+ --bs-avatar-font-size: var(--bs-font-size-4);
1114
+ --bs-avatar-size: 2.5rem;
1115
+ --bs-avatar-icon-size: var(--bs-icon-size-s);
1116
+ --bs-avatar-dot-offset-right: -2px;
1117
+ }
1118
+ .avatar.size-lg {
1119
+ --bs-avatar-font-size: var(--bs-font-size-6);
1120
+ --bs-avatar-size: 3.5rem;
1121
+ --bs-avatar-icon-size: var(--bs-icon-size-m);
1122
+ --bs-avatar-dot-offset-right: -2px;
1123
+ --bs-avatar-dot-size: 14px;
1124
+ }
1125
+ .avatar.size-xl {
1126
+ --bs-avatar-font-size: var(--bs-font-size-9);
1127
+ --bs-avatar-size: 5rem;
1128
+ --bs-avatar-icon-size: var(--bs-icon-size-l);
1129
+ --bs-avatar-dot-size: 16px;
1130
+ }
1131
+ .avatar.size-xxl {
1132
+ --bs-avatar-font-size: var(--bs-font-size-11);
1133
+ --bs-avatar-size: 7rem;
1134
+ --bs-avatar-icon-size: var(--bs-icon-size-xl);
1135
+ --bs-avatar-dot-size: 20px;
1136
+ --bs-avatar-dot-offset-right: 4px;
1137
+ }
1138
+ .avatar-wrapper {
1139
+ position: relative;
1140
+ z-index: 1;
1141
+ }
1142
+ .avatar-presence, .avatar-status {
1143
+ position: absolute;
1144
+ right: var(--bs-avatar-dot-offset-right);
1145
+ z-index: 10;
1146
+ display: flex;
1147
+ align-items: center;
1148
+ justify-content: center;
1149
+ width: var(--bs-avatar-dot-size);
1150
+ height: var(--bs-avatar-dot-size);
1151
+ border: var(--bs-avatar-dot-border-size) solid var(--bs-avatar-dot-border-color);
1152
+ border-radius: var(--bs-avatar-radius);
1153
+ background: hsl(210, 3%, 85%);
1154
+ color: var(--bs-color-text-inverse);
1155
+ }
1156
+ .avatar-presence .icon, .avatar-status .icon {
1157
+ stroke-width: 2px;
1158
+ stroke: var(--bs-icon-inverse);
1159
+ }
1160
+ .avatar-presence.active, .avatar-status.approved {
1161
+ background: var(--bs-color-background-success);
1162
+ }
1163
+ .avatar-presence.busy, .avatar-status.declined {
1164
+ background: hsl(350, 60%, 50%);
1165
+ }
1166
+ .avatar-presence {
1167
+ bottom: 8px;
1168
+ }
1169
+ .avatar-presence.hidden:after {
1170
+ position: absolute;
1171
+ top: 50%;
1172
+ left: 50%;
1173
+ content: "";
1174
+ width: calc(100% - 4px);
1175
+ height: calc(100% - 4px);
1176
+ border-radius: 50%;
1177
+ background: var(--bs-color-background-inverse);
1178
+ transform: translateX(-50%) translateY(-50%);
1179
+ }
1180
+ .avatar-status {
1181
+ top: var(--bs-avatar-dot-offset-top);
1182
+ }
1183
+ .avatar-status.notify {
1184
+ background: var(--bs-theme-primary);
1185
+ }
1186
+ .avatar img {
1187
+ width: 100%;
1188
+ height: 100%;
1189
+ border-radius: var(--bs-avatar-radius);
1190
+ object-fit: cover;
1191
+ object-position: center;
1192
+ }
1193
+ .avatar p {
1194
+ margin: 0;
1195
+ color: var(--bs-avatar-text-color);
1196
+ font-size: var(--bs-avatar-font-size);
1197
+ font-weight: var(--bs-avatar-font-weight);
1198
+ line-height: 1;
1199
+ }
1200
+ .avatar .icon {
1201
+ width: var(--bs-avatar-icon-size);
1202
+ height: var(--bs-avatar-icon-size);
1203
+ }
1204
+ .avatar ~ span {
1205
+ margin-left: var(--bs-spacing-xxs);
1206
+ }
1207
+
1208
+ a.avatar::after,
1209
+ a .avatar::after {
1210
+ position: absolute;
1211
+ top: 0;
1212
+ right: 0;
1213
+ z-index: 10;
1214
+ content: "";
1215
+ display: block;
1216
+ width: 100%;
1217
+ height: 100%;
1218
+ border-radius: var(--bs-avatar-radius);
1219
+ opacity: 0;
1220
+ background: var(--bs-color-background-emphasis);
1221
+ transition: opacity 0.2s;
1222
+ }
1223
+ a.avatar:hover::after,
1224
+ a .avatar:hover::after {
1225
+ opacity: 0.25;
1226
+ }
1227
+
1228
+ a.avatar,
1229
+ a.avatar:hover,
1230
+ a.avatar:hover p,
1231
+ a .avatar:hover,
1232
+ a .avatar:hover p {
1233
+ text-decoration: none;
1234
+ }
1235
+
1236
+ .avatar-dropdown {
1237
+ position: relative;
1238
+ overflow: visible;
1239
+ }
1240
+ .avatar-dropdown .dropdown {
1241
+ position: absolute;
1242
+ top: 0;
1243
+ right: 0;
1244
+ left: 0;
1245
+ display: flex;
1246
+ align-items: center;
1247
+ justify-content: center;
1248
+ height: 100%;
1249
+ border: 0;
1250
+ }
1251
+ .avatar-dropdown .dropdown-menu {
1252
+ margin-left: -27px;
1253
+ }
1254
+ .avatar-dropdown .btn-dropdown {
1255
+ padding: 0;
1256
+ color: inherit;
1257
+ font-size: var(--bs-label-font-size-xs);
1258
+ line-height: 0;
1259
+ }
1260
+ .avatar-dropdown .btn-dropdown:focus {
1261
+ box-shadow: none;
1262
+ }
1263
+ .avatar-dropdown .list-item {
1264
+ display: flex;
1265
+ align-items: center;
1266
+ }
1267
+ .avatar-dropdown .link-list {
1268
+ white-space: nowrap;
1269
+ }
1270
+
1271
+ .avatar-extra-text {
1272
+ display: inline-flex;
1273
+ align-items: center;
1274
+ justify-content: flex-start;
1275
+ margin-bottom: 16px;
1276
+ }
1277
+ .avatar-extra-text .avatar {
1278
+ flex-shrink: 0;
1279
+ }
1280
+ .avatar-extra-text .extra-text, .avatar-extra-text slot[name=extra-text]::slotted(*) {
1281
+ margin-left: var(--bs-spacing-s);
1282
+ }
1283
+ .avatar-extra-text .extra-text h3, .avatar-extra-text slot[name=extra-text]::slotted(*) h3,
1284
+ .avatar-extra-text .extra-text h4,
1285
+ .avatar-extra-text slot[name=extra-text]::slotted(*) h4 {
1286
+ margin: 0;
1287
+ font-size: var(--bs-heading-6-font-size);
1288
+ }
1289
+ .avatar-extra-text .extra-text h3 a, .avatar-extra-text slot[name=extra-text]::slotted(*) h3 a,
1290
+ .avatar-extra-text .extra-text h4 a,
1291
+ .avatar-extra-text slot[name=extra-text]::slotted(*) h4 a {
1292
+ display: inline-block;
1293
+ }
1294
+ .avatar-extra-text .extra-text p, .avatar-extra-text slot[name=extra-text]::slotted(*) p,
1295
+ .avatar-extra-text .extra-text time,
1296
+ .avatar-extra-text slot[name=extra-text]::slotted(*) time {
1297
+ margin: 0;
1298
+ color: var(--bs-color-text-secondary);
1299
+ font-size: var(--bs-caption-font-size);
1300
+ text-transform: uppercase;
1301
+ }
1302
+
1303
+ .avatar-group > li {
1304
+ margin-bottom: var(--bs-spacing-s);
1305
+ line-height: auto;
1306
+ }
1307
+ .avatar-group > li:last-child {
1308
+ margin-bottom: 0;
1309
+ }
1310
+ .avatar-group > li .list-item {
1311
+ display: inline-flex;
1312
+ align-items: center;
1313
+ padding: 0;
1314
+ }
1315
+
1316
+ .avatar-group-stacked {
1317
+ display: flex;
1318
+ flex-direction: row;
1319
+ align-items: flex-start;
1320
+ justify-content: flex-start;
1321
+ margin: 0;
1322
+ padding: 0;
1323
+ }
1324
+ .avatar-group-stacked li {
1325
+ list-style-type: none;
1326
+ line-height: 0;
1327
+ }
1328
+ .avatar-group-stacked li > .avatar {
1329
+ margin-left: -6px;
1330
+ border: 2px solid var(--bs-color-border-inverse);
1331
+ }
1332
+
1333
+ :host {
1334
+ display: inline-flex;
1335
+ --bs-avatar-background: var(--bs-color-background-secondary-lighter);
1336
+ --bs-avatar-text-color: var(--bs-color-text-secondary);
1337
+ --bs-avatar-font-size: var(--bs-font-size-3);
1338
+ --bs-avatar-font-weight: var(--bs-font-weight-solid);
1339
+ --bs-avatar-icon-size: var(--bs-icon-size-s);
1340
+ --bs-avatar-radius: var(--bs-radius-circle);
1341
+ --bs-avatar-size: 2.5rem;
1342
+ --bs-avatar-dot-size: 12px;
1343
+ --bs-avatar-dot-border-size: 2px;
1344
+ --bs-avatar-dot-border-color: var(--bs-color-border-inverse);
1345
+ --bs-avatar-dot-offset-right: 0;
1346
+ --bs-avatar-dot-offset-top: 4px;
1347
+ --bs-avatar-dot-offset-bottom: 0;
1348
+ }
1349
+ :host a.avatar,
1350
+ :host a .avatar {
1351
+ text-decoration: none;
1352
+ }
1353
+ :host a.avatar:hover,
1354
+ :host a .avatar:hover {
1355
+ text-decoration: none;
1356
+ }
1357
+
1358
+ it-icon::part(icon) {
1359
+ width: var(--bs-avatar-icon-size);
1360
+ height: var(--bs-avatar-icon-size);
1361
+ }
1362
+
1363
+ it-icon {
1364
+ display: inline-flex;
1365
+ }
1366
+
1367
+ it-icon.presence-icon::part(icon),
1368
+ it-icon.status-icon::part(icon) {
1369
+ width: 12px;
1370
+ height: 12px;
1371
+ stroke: var(--bs-icon-inverse);
1372
+ stroke-width: 2px;
1373
+ }
1374
+
1375
+ .extra-text, slot[name=extra-text]::slotted(*) {
1376
+ margin-left: var(--bs-spacing-s);
1377
+ }
1378
+ .extra-text h3, slot[name=extra-text]::slotted(*) h3,
1379
+ .extra-text h4,
1380
+ slot[name=extra-text]::slotted(*) h4 {
1381
+ margin: 0;
1382
+ font-size: var(--bs-heading-6-font-size) !important;
1383
+ }
1384
+ .extra-text h3 a, slot[name=extra-text]::slotted(*) h3 a,
1385
+ .extra-text h4 a,
1386
+ slot[name=extra-text]::slotted(*) h4 a {
1387
+ display: inline-block;
1388
+ }
1389
+ .extra-text p, slot[name=extra-text]::slotted(*) p,
1390
+ .extra-text time,
1391
+ slot[name=extra-text]::slotted(*) time {
1392
+ margin: 0;
1393
+ color: var(--bs-color-text-secondary);
1394
+ font-size: var(--bs-caption-font-size);
1395
+ text-transform: uppercase;
1396
+ }
1397
+
1398
+ .avatar-wrapper {
1399
+ display: inline-flex;
1400
+ }`;
1401
+
1402
+ const translation$1 = {
1403
+ $code: 'it',
1404
+ $name: 'Italiano',
1405
+ $dir: 'ltr',
1406
+ // Presence translations
1407
+ avatar_presence_active: 'attivo',
1408
+ avatar_presence_busy: 'non disponibile',
1409
+ avatar_presence_hidden: 'invisibile',
1410
+ avatar_presence_label: 'Presenza',
1411
+ // Status translations
1412
+ avatar_status_approved: 'approvato',
1413
+ avatar_status_declined: 'respinto',
1414
+ avatar_status_notify: 'notifica',
1415
+ avatar_status_label: 'Stato',
1416
+ };
1417
+
1418
+ const translation = {
1419
+ $code: 'en',
1420
+ $name: 'English',
1421
+ $dir: 'ltr',
1422
+ // Presence translations
1423
+ avatar_presence_active: 'active',
1424
+ avatar_presence_busy: 'busy',
1425
+ avatar_presence_hidden: 'hidden',
1426
+ avatar_presence_label: 'Presence',
1427
+ // Status translations
1428
+ avatar_status_approved: 'approved',
1429
+ avatar_status_declined: 'declined',
1430
+ avatar_status_notify: 'notify',
1431
+ avatar_status_label: 'Status',
1432
+ };
1433
+
1434
+ registerTranslation(translation$1);
1435
+ registerTranslation(translation);
1436
+ let ItAvatar = class ItAvatar extends BaseLocalizedComponent {
1437
+ constructor() {
1438
+ super(...arguments);
1439
+ this.size = 'md';
1440
+ this.variant = '';
1441
+ this.presence = '';
1442
+ this.status = '';
1443
+ this.type = '';
1444
+ this.src = '';
1445
+ this.alt = '';
1446
+ this.text = '';
1447
+ this.icon = '';
1448
+ this._imageLoadError = false;
1449
+ this.href = '';
1450
+ this.avatarTitle = '';
1451
+ this._onImageError = () => {
1452
+ this._imageLoadError = true;
1453
+ this.requestUpdate();
1454
+ };
1455
+ this.onExtraTextSlotChange = () => {
1456
+ const extraTextSlot = this.shadowRoot?.querySelector('slot[name="extra-text"]');
1457
+ if (extraTextSlot?.assignedElements().length > 0) {
1458
+ extraTextSlot?.assignedElements().forEach((el) => {
1459
+ el.classList.add('extra-text');
1460
+ });
1461
+ }
1462
+ };
1463
+ }
1464
+ get __hasExplicitSize() {
1465
+ return this.hasAttribute('size');
1466
+ }
1467
+ get focusElement() {
1468
+ // Se c'è un link, usa quello
1469
+ const link = this.shadowRoot?.querySelector('a.avatar');
1470
+ if (link)
1471
+ return link;
1472
+ return null;
1473
+ }
1474
+ getAutoType() {
1475
+ // Se type è specificato esplicitamente, usalo
1476
+ if (this.type !== '') {
1477
+ return this.type;
1478
+ }
1479
+ // Determinazione automatica:
1480
+ // 1. Se c'è src → image
1481
+ // 2. Se c'è icon → icon
1482
+ // 3. Altrimenti → text
1483
+ if (this.src) {
1484
+ return 'image';
1485
+ }
1486
+ if (this.icon) {
1487
+ return 'icon';
1488
+ }
1489
+ return 'text';
1490
+ }
1491
+ getInitials() {
1492
+ if (this.text) {
1493
+ const words = this.text.trim().split(/\s+/);
1494
+ if (this.size === 'xs' || this.size === 'sm') {
1495
+ return words[0]?.charAt(0)?.toUpperCase() || '';
1496
+ }
1497
+ return (words
1498
+ .slice(0, 2)
1499
+ .map((word) => word.charAt(0)?.toUpperCase())
1500
+ .join('') || '');
1501
+ }
1502
+ return '';
1503
+ }
1504
+ getInitialsFromName(name) {
1505
+ const words = name.trim().split(/\s+/);
1506
+ if (this.size === 'xs' || this.size === 'sm') {
1507
+ return words[0]?.charAt(0)?.toUpperCase() || '';
1508
+ }
1509
+ return (words
1510
+ .slice(0, 2)
1511
+ .map((word) => word.charAt(0)?.toUpperCase())
1512
+ .join('') || '');
1513
+ }
1514
+ getAvatarWrapperClasses() {
1515
+ return classMap({
1516
+ avatar: true,
1517
+ [`size-${this.size}`]: !!this.size,
1518
+ [`avatar-${this.variant}`]: !!this.variant,
1519
+ 'avatar-extra-text': this.hasExtraTextContent,
1520
+ 'avatar-dropdown': this.type === 'dropdown',
1521
+ });
1522
+ }
1523
+ getAvatarClasses() {
1524
+ return classMap({
1525
+ avatar: true,
1526
+ [`size-${this.size}`]: !!this.size,
1527
+ [`avatar-${this.variant}`]: !!this.variant,
1528
+ 'avatar-dropdown': this.type === 'dropdown',
1529
+ });
1530
+ }
1531
+ getPresenceClasses() {
1532
+ return classMap({
1533
+ 'avatar-presence': true,
1534
+ [this.presence]: !!this.presence,
1535
+ });
1536
+ }
1537
+ getStatusClasses() {
1538
+ return classMap({
1539
+ 'avatar-status': true,
1540
+ [this.status]: !!this.status,
1541
+ });
1542
+ }
1543
+ renderPresence() {
1544
+ if (!this.presence)
1545
+ return nothing;
1546
+ const presenceText = this.$t(`avatar_presence_${this.presence}`);
1547
+ const presenceLabel = this.$t('avatar_presence_label');
1548
+ // Icone di default per i diversi stati di presenza
1549
+ let presenceIcon = '';
1550
+ switch (this.presence) {
1551
+ case 'active':
1552
+ presenceIcon = 'it-check';
1553
+ break;
1554
+ case 'busy':
1555
+ presenceIcon = 'it-minus';
1556
+ break;
1557
+ case 'hidden':
1558
+ presenceIcon = '';
1559
+ break;
1560
+ default:
1561
+ presenceIcon = '';
1562
+ }
1563
+ return html `
1564
+ <div class="${this.getPresenceClasses()}">
1565
+ ${presenceIcon
1566
+ ? html `<it-icon name="${presenceIcon}" size="xs" variant="white" class="presence-icon"></it-icon>`
1567
+ : nothing}
1568
+ <span class="visually-hidden">${presenceLabel}: ${presenceText}</span>
1569
+ </div>
1570
+ `;
1571
+ }
1572
+ renderStatus() {
1573
+ if (!this.status)
1574
+ return nothing;
1575
+ const statusText = this.$t(`avatar_status_${this.status}`);
1576
+ const statusLabel = this.$t('avatar_status_label');
1577
+ // Icone di default per i diversi stati dello status
1578
+ let statusIcon = '';
1579
+ switch (this.status) {
1580
+ case 'approved':
1581
+ statusIcon = 'it-check';
1582
+ break;
1583
+ case 'declined':
1584
+ statusIcon = 'it-close';
1585
+ break;
1586
+ case 'notify':
1587
+ statusIcon = '';
1588
+ break;
1589
+ default:
1590
+ statusIcon = '';
1591
+ }
1592
+ return html `
1593
+ <div class="${this.getStatusClasses()}">
1594
+ ${statusIcon
1595
+ ? html `<it-icon name="${statusIcon}" size="xs" variant="white" class="status-icon"></it-icon>`
1596
+ : nothing}
1597
+ <span class="visually-hidden">${statusLabel}: ${statusText}</span>
1598
+ </div>
1599
+ `;
1600
+ }
1601
+ renderImage() {
1602
+ if (!this.src || this._imageLoadError) {
1603
+ // Fallback su iniziali quando immagine non disponibile
1604
+ const fallbackText = this.alt || this.text || '';
1605
+ if (fallbackText) {
1606
+ const initials = this.getInitialsFromName(fallbackText);
1607
+ return html `
1608
+ <p aria-hidden="true">${initials}</p>
1609
+ <span class="visually-hidden">${fallbackText}</span>
1610
+ `;
1611
+ }
1612
+ return nothing;
1613
+ }
1614
+ return html `
1615
+ <img
1616
+ src="${this.src}"
1617
+ alt="${this.alt || this.text || ''}"
1618
+ @error="${this._onImageError}"
1619
+ ${this.text ? 'aria-hidden="true"' : ''}
1620
+ />
1621
+ ${this.text ? html `<span class="visually-hidden">${this.text}</span>` : nothing}
1622
+ `;
1623
+ }
1624
+ willUpdate(changedProperties) {
1625
+ super.willUpdate(changedProperties);
1626
+ // Reset image error when src changes
1627
+ if (changedProperties.has('src')) {
1628
+ this._imageLoadError = false;
1629
+ }
1630
+ }
1631
+ renderText() {
1632
+ const initials = this.getInitials();
1633
+ if (!initials)
1634
+ return nothing;
1635
+ return html `
1636
+ <p aria-hidden="true">${initials}</p>
1637
+ ${this.text ? html `<span class="visually-hidden">${this.text}</span>` : nothing}
1638
+ `;
1639
+ }
1640
+ renderIcon() {
1641
+ if (!this.icon)
1642
+ return nothing;
1643
+ const accessibleText = this.avatarTitle || this.text || this.alt || 'Icona';
1644
+ return html `
1645
+ <it-icon name="${this.icon}" aria-hidden="true"></it-icon>
1646
+ <span class="visually-hidden">${accessibleText}</span>
1647
+ `;
1648
+ }
1649
+ renderAvatarContent() {
1650
+ const autoType = this.getAutoType();
1651
+ const content = html `
1652
+ ${autoType === 'image' ? this.renderImage() : nothing} ${autoType === 'text' ? this.renderText() : nothing}
1653
+ ${autoType === 'icon' ? this.renderIcon() : nothing}
1654
+ ${autoType === 'dropdown' ? html `<slot name="avatar-dropdown-content"></slot>` : nothing}
1655
+ `;
1656
+ return content;
1657
+ }
1658
+ updated() {
1659
+ const autoType = this.getAutoType();
1660
+ // Warning accessibilità automatici
1661
+ if (autoType === 'image' && this.src && !this.alt && !this.text) {
1662
+ this.logger.warn('Avatar: immagine fornita senza testo alternativo (alt) o contenuto testuale (text). ' +
1663
+ 'Questo impatta negativamente l\'accessibilità. Aggiungi alt="..." o text="..."');
1664
+ }
1665
+ if (autoType === 'icon' && this.icon && !this.avatarTitle && !this.text && !this.alt) {
1666
+ this.logger.warn('Avatar: icona fornita senza testo alternativo. ' +
1667
+ 'Aggiungi avatar-title="..." o text="..." o alt="..." per l\'accessibilità.');
1668
+ }
1669
+ if (autoType === 'text' && !this.text) {
1670
+ this.logger.warn('Avatar: tipo text rilevato ma nessun contenuto testuale fornito. Aggiungi text="..."');
1671
+ }
1672
+ if (this.href && !this.avatarTitle && !this.text) {
1673
+ this.logger.warn('Avatar: link fornito senza titolo o contenuto testuale. ' +
1674
+ 'Aggiungi avatar-title="..." o text="..." per l\'accessibilità.');
1675
+ }
1676
+ if (this.src && this.icon) {
1677
+ this.logger.warn('Avatar: sia src che icon sono specificati. Il tipo verrà determinato automaticamente come "image".');
1678
+ }
1679
+ }
1680
+ get hasExtraTextContent() {
1681
+ const extraTextSlot = this.shadowRoot?.querySelector('slot[name="extra-text"]');
1682
+ return extraTextSlot?.assignedElements().length > 0 || false;
1683
+ }
1684
+ getWrapperClasses() {
1685
+ return classMap({
1686
+ 'avatar-wrapper': true,
1687
+ 'avatar-extra-text': this.hasExtraTextContent,
1688
+ });
1689
+ }
1690
+ render() {
1691
+ const avatarContent = this.renderAvatarContent();
1692
+ const avatar = this.href && this.type !== 'dropdown'
1693
+ ? html `
1694
+ <a
1695
+ href="${this.href}"
1696
+ class="${this.getAvatarWrapperClasses()}"
1697
+ title="${ifDefined(this.avatarTitle || this.text || undefined)}"
1698
+ part="avatar focusable"
1699
+ >
1700
+ ${avatarContent}
1701
+ </a>
1702
+ `
1703
+ : html `<div class="${this.getAvatarClasses()}" part="avatar">${avatarContent}</div>`;
1704
+ return html `
1705
+ <div class="${this.getWrapperClasses()}">
1706
+ ${avatar}
1707
+ <slot name="extra-text" @slotchange="${this.onExtraTextSlotChange}" part="extra-text"></slot>
1708
+ <slot name="avatar-dropdown-content" part="avatar-dropdown-content"></slot>
1709
+ <slot name="presence" part="presence">${this.renderPresence()}</slot>
1710
+ <slot name="status" part="status">${this.renderStatus()}</slot>
1711
+ </div>
1712
+ `;
1713
+ }
1714
+ };
1715
+ ItAvatar.styles = styles;
1716
+ ItAvatar.shadowRootOptions = {
1717
+ ...BaseLocalizedComponent.shadowRootOptions,
1718
+ delegatesFocus: true,
1719
+ };
1720
+ __decorate([
1721
+ property({ type: String, reflect: true }),
1722
+ __metadata("design:type", String)
1723
+ ], ItAvatar.prototype, "size", void 0);
1724
+ __decorate([
1725
+ property({ type: String, reflect: true }),
1726
+ __metadata("design:type", String)
1727
+ ], ItAvatar.prototype, "variant", void 0);
1728
+ __decorate([
1729
+ property({ type: String, reflect: true }),
1730
+ __metadata("design:type", String)
1731
+ ], ItAvatar.prototype, "presence", void 0);
1732
+ __decorate([
1733
+ property({ type: String, reflect: true }),
1734
+ __metadata("design:type", String)
1735
+ ], ItAvatar.prototype, "status", void 0);
1736
+ __decorate([
1737
+ property({ type: String, reflect: true }),
1738
+ __metadata("design:type", String)
1739
+ ], ItAvatar.prototype, "type", void 0);
1740
+ __decorate([
1741
+ property({ type: String, reflect: true }),
1742
+ __metadata("design:type", Object)
1743
+ ], ItAvatar.prototype, "src", void 0);
1744
+ __decorate([
1745
+ property({ type: String, reflect: true }),
1746
+ __metadata("design:type", Object)
1747
+ ], ItAvatar.prototype, "alt", void 0);
1748
+ __decorate([
1749
+ property({ type: String, reflect: true }),
1750
+ __metadata("design:type", Object)
1751
+ ], ItAvatar.prototype, "text", void 0);
1752
+ __decorate([
1753
+ property({ type: String, reflect: true }),
1754
+ __metadata("design:type", Object)
1755
+ ], ItAvatar.prototype, "icon", void 0);
1756
+ __decorate([
1757
+ property({ type: String, reflect: true }),
1758
+ __metadata("design:type", Object)
1759
+ ], ItAvatar.prototype, "href", void 0);
1760
+ __decorate([
1761
+ property({ type: String, reflect: true, attribute: 'avatar-title' }),
1762
+ __metadata("design:type", Object)
1763
+ ], ItAvatar.prototype, "avatarTitle", void 0);
1764
+ ItAvatar = __decorate([
1765
+ customElement('it-avatar')
1766
+ ], ItAvatar);
1767
+
1768
+ export { ItAvatar };
1769
+ //# sourceMappingURL=it-avatar.js.map