@italia/tabs 0.0.0 → 1.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/custom-elements.json +1188 -27
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/it-tab-panel.d.ts +44 -0
- package/dist/src/it-tab-panel.d.ts.map +1 -0
- package/dist/src/it-tab-panel.js +149 -0
- package/dist/src/it-tab-panel.js.map +1 -0
- package/dist/src/it-tab.d.ts +94 -0
- package/dist/src/it-tab.d.ts.map +1 -0
- package/dist/src/it-tab.js +400 -0
- package/dist/src/it-tab.js.map +1 -0
- package/dist/src/it-tabs.d.ts +241 -5
- package/dist/src/it-tabs.d.ts.map +1 -1
- package/dist/src/it-tabs.js +1323 -51
- package/dist/src/it-tabs.js.map +1 -1
- package/dist/src/locales/en.d.ts +4 -0
- package/dist/src/locales/en.d.ts.map +1 -0
- package/dist/src/locales/it.d.ts +4 -0
- package/dist/src/locales/it.d.ts.map +1 -0
- package/dist/src/types.d.ts +30 -0
- package/dist/src/types.d.ts.map +1 -0
- package/package.json +18 -9
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export { ItTabs } from './it-tabs.js';
|
|
2
|
+
export { ItTab } from './it-tab.js';
|
|
3
|
+
export { ItTabPanel } from './it-tab-panel.js';
|
|
4
|
+
import '../index-ijsUlb00.js';
|
|
5
|
+
import 'lit/directive.js';
|
|
2
6
|
import 'lit';
|
|
3
7
|
import 'lit/decorators.js';
|
|
8
|
+
import 'lit/directives/class-map.js';
|
|
9
|
+
import 'lit/directives/if-defined.js';
|
|
4
10
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BaseComponent } from '@italia/globals';
|
|
2
|
+
/**
|
|
3
|
+
* `it-tab-panel` rappresenta il pannello di contenuto associato a un `it-tab`.
|
|
4
|
+
*
|
|
5
|
+
* Il contenuto dello slot diventa il corpo del pannello, visibile solo quando
|
|
6
|
+
* il tab corrispondente è selezionato.
|
|
7
|
+
*
|
|
8
|
+
* L'attributo `name` deve corrispondere all'attributo `panel` dell'`it-tab` collegato.
|
|
9
|
+
*
|
|
10
|
+
* @slot - Contenuto del pannello
|
|
11
|
+
*
|
|
12
|
+
* @csspart panel - Il `div` contenitore interno del pannello
|
|
13
|
+
*/
|
|
14
|
+
export declare class ItTabPanel extends BaseComponent {
|
|
15
|
+
static styles: import("lit").CSSResultGroup;
|
|
16
|
+
/**
|
|
17
|
+
* Identificatore del pannello. Deve corrispondere all'attributo `panel`
|
|
18
|
+
* dell'`it-tab` associato. Viene usato anche come `id` dell'elemento host
|
|
19
|
+
* per il collegamento ARIA tramite `aria-controls`.
|
|
20
|
+
*/
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* Stato attivo del pannello. Gestito dall'`it-tabs` padre.
|
|
24
|
+
* Quando `true`, il pannello è visibile.
|
|
25
|
+
*/
|
|
26
|
+
active: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Attiva l'animazione "a comparsa" (fade-in) sul pannello al momento
|
|
29
|
+
* dell'attivazione, usando la Web Animations API (opacity 0→1, 150 ms).
|
|
30
|
+
* Rispetta automaticamente `prefers-reduced-motion`: se l'utente ha
|
|
31
|
+
* richiesto animazioni ridotte l'effetto viene completamente saltato.
|
|
32
|
+
* Da usare su tutti i pannelli dello stesso `it-tabs` per coerenza visiva.
|
|
33
|
+
*/
|
|
34
|
+
fade: boolean;
|
|
35
|
+
connectedCallback(): void;
|
|
36
|
+
updated(changed: Map<string | number | symbol, unknown>): void;
|
|
37
|
+
render(): import("lit").TemplateResult<1>;
|
|
38
|
+
}
|
|
39
|
+
declare global {
|
|
40
|
+
interface HTMLElementTagNameMap {
|
|
41
|
+
'it-tab-panel': ItTabPanel;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=it-tab-panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"it-tab-panel.d.ts","sourceRoot":"","sources":["../../src/it-tab-panel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD;;;;;;;;;;;GAWG;AACH,qBACa,UAAW,SAAQ,aAAa;IAC3C,MAAM,CAAC,MAAM,+BAAU;IAEvB;;;;OAIG;IAEH,IAAI,SAAM;IAEV;;;OAGG;IAEH,MAAM,UAAS;IAEf;;;;;;OAMG;IAEH,IAAI,UAAS;IAEJ,iBAAiB,IAAI,IAAI;IAWzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IA8BvE,MAAM;CAeP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,UAAU,CAAC;KAC5B;CACF"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { _ as __decorate, a as __metadata, B as BaseComponent } from '../index-ijsUlb00.js';
|
|
2
|
+
import { css, html } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
4
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
+
import 'lit/directive.js';
|
|
6
|
+
|
|
7
|
+
var styles = css`/***************************** 1 ****************************************/
|
|
8
|
+
/***************************** 2 ****************************************/
|
|
9
|
+
/***************************** 1 ****************************************/
|
|
10
|
+
/***************************** 2 ****************************************/
|
|
11
|
+
/***************************** 1 ****************************************/
|
|
12
|
+
/***************************** 2 ****************************************/
|
|
13
|
+
/***************************** 3 ****************************************/
|
|
14
|
+
/***************************** 1 ****************************************/
|
|
15
|
+
/***************************** 2 ****************************************/
|
|
16
|
+
/***************************** 3 ****************************************/
|
|
17
|
+
/***************************** NEUTRAL 1 ****************************************/
|
|
18
|
+
/***************************** NEUTRAL 2 ****************************************/
|
|
19
|
+
/***************************** NEUTRAL 2 / 3 ****************************************/
|
|
20
|
+
:host {
|
|
21
|
+
display: none;
|
|
22
|
+
margin-block: calc(-1 * var(--bsi-spacing-sm));
|
|
23
|
+
outline: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host([active]) {
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.tab-pane {
|
|
31
|
+
display: flex;
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
padding: var(--bsi-spacing-m, 1rem);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host(:focus-visible) {
|
|
38
|
+
box-shadow: inset 0 0 0 2px var(--bsi-color-outline-focus), inset 0 0 0 5px var(--bsi-color-border-inverse);
|
|
39
|
+
outline: 3px solid transparent;
|
|
40
|
+
outline-offset: 3px;
|
|
41
|
+
}`;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* `it-tab-panel` rappresenta il pannello di contenuto associato a un `it-tab`.
|
|
45
|
+
*
|
|
46
|
+
* Il contenuto dello slot diventa il corpo del pannello, visibile solo quando
|
|
47
|
+
* il tab corrispondente è selezionato.
|
|
48
|
+
*
|
|
49
|
+
* L'attributo `name` deve corrispondere all'attributo `panel` dell'`it-tab` collegato.
|
|
50
|
+
*
|
|
51
|
+
* @slot - Contenuto del pannello
|
|
52
|
+
*
|
|
53
|
+
* @csspart panel - Il `div` contenitore interno del pannello
|
|
54
|
+
*/
|
|
55
|
+
let ItTabPanel = class ItTabPanel extends BaseComponent {
|
|
56
|
+
constructor() {
|
|
57
|
+
super(...arguments);
|
|
58
|
+
/**
|
|
59
|
+
* Identificatore del pannello. Deve corrispondere all'attributo `panel`
|
|
60
|
+
* dell'`it-tab` associato. Viene usato anche come `id` dell'elemento host
|
|
61
|
+
* per il collegamento ARIA tramite `aria-controls`.
|
|
62
|
+
*/
|
|
63
|
+
this.name = '';
|
|
64
|
+
/**
|
|
65
|
+
* Stato attivo del pannello. Gestito dall'`it-tabs` padre.
|
|
66
|
+
* Quando `true`, il pannello è visibile.
|
|
67
|
+
*/
|
|
68
|
+
this.active = false;
|
|
69
|
+
/**
|
|
70
|
+
* Attiva l'animazione "a comparsa" (fade-in) sul pannello al momento
|
|
71
|
+
* dell'attivazione, usando la Web Animations API (opacity 0→1, 150 ms).
|
|
72
|
+
* Rispetta automaticamente `prefers-reduced-motion`: se l'utente ha
|
|
73
|
+
* richiesto animazioni ridotte l'effetto viene completamente saltato.
|
|
74
|
+
* Da usare su tutti i pannelli dello stesso `it-tabs` per coerenza visiva.
|
|
75
|
+
*/
|
|
76
|
+
this.fade = false;
|
|
77
|
+
}
|
|
78
|
+
connectedCallback() {
|
|
79
|
+
super.connectedCallback?.();
|
|
80
|
+
// L'id sull'host fa da target per aria-controls del tab
|
|
81
|
+
if (this.name && !this.id) {
|
|
82
|
+
this.id = this.name;
|
|
83
|
+
}
|
|
84
|
+
// role e tabindex sull'host: aria-labelledby è valido solo su elementi con role
|
|
85
|
+
if (!this.hasAttribute('role'))
|
|
86
|
+
this.setAttribute('role', 'tabpanel');
|
|
87
|
+
if (!this.hasAttribute('tabindex'))
|
|
88
|
+
this.tabIndex = 0;
|
|
89
|
+
}
|
|
90
|
+
updated(changed) {
|
|
91
|
+
super.updated?.(changed);
|
|
92
|
+
// Aggiorna l'id se il name cambia dopo la connessione
|
|
93
|
+
if (changed.has('name') && this.name && !this.hasAttribute('id')) {
|
|
94
|
+
this.id = this.name;
|
|
95
|
+
}
|
|
96
|
+
// Fade-in con Web Animations API quando il pannello diventa attivo.
|
|
97
|
+
// Viene saltato se il pannello non ha l'attributo `fade` oppure se
|
|
98
|
+
// l'utente ha richiesto animazioni ridotte (prefers-reduced-motion).
|
|
99
|
+
// Strategia: forziamo display:flex sull'host via style inline prima di animare,
|
|
100
|
+
// così il browser non deve risolvere la cascade da :host([active]) e l'elemento
|
|
101
|
+
// è sicuramente nel flusso quando opacity parte da 0.
|
|
102
|
+
// Al termine rimuoviamo lo style inline e lasciamo la cascade CSS riprendere.
|
|
103
|
+
if (changed.has('active') && this.fade) {
|
|
104
|
+
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
105
|
+
if (this.active && !reduced) {
|
|
106
|
+
// Forza display prima che il browser risolva la cascade, poi anima
|
|
107
|
+
// l'host stesso (più semplice e affidabile dell'animare il figlio shadow).
|
|
108
|
+
this.style.display = 'flex';
|
|
109
|
+
// eslint-disable-next-line no-unused-expressions
|
|
110
|
+
this.offsetHeight; // forza reflow: l'elemento è ora nel flusso
|
|
111
|
+
this.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 300, easing: 'linear', fill: 'none' }).finished.then(() => this.style.removeProperty('display'));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
render() {
|
|
116
|
+
return html `
|
|
117
|
+
<div
|
|
118
|
+
part="panel"
|
|
119
|
+
class=${classMap({
|
|
120
|
+
'tab-pane': true,
|
|
121
|
+
fade: this.fade,
|
|
122
|
+
active: this.active,
|
|
123
|
+
show: this.active,
|
|
124
|
+
})}
|
|
125
|
+
>
|
|
126
|
+
<slot></slot>
|
|
127
|
+
</div>
|
|
128
|
+
`;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
ItTabPanel.styles = styles;
|
|
132
|
+
__decorate([
|
|
133
|
+
property({ type: String, reflect: true }),
|
|
134
|
+
__metadata("design:type", Object)
|
|
135
|
+
], ItTabPanel.prototype, "name", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ type: Boolean, reflect: true }),
|
|
138
|
+
__metadata("design:type", Object)
|
|
139
|
+
], ItTabPanel.prototype, "active", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
property({ type: Boolean, reflect: true }),
|
|
142
|
+
__metadata("design:type", Object)
|
|
143
|
+
], ItTabPanel.prototype, "fade", void 0);
|
|
144
|
+
ItTabPanel = __decorate([
|
|
145
|
+
customElement('it-tab-panel')
|
|
146
|
+
], ItTabPanel);
|
|
147
|
+
|
|
148
|
+
export { ItTabPanel };
|
|
149
|
+
//# sourceMappingURL=it-tab-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"it-tab-panel.js","sources":["../../../src/it-tab-panel.ts"],"sourcesContent":["import { html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { BaseComponent } from '@italia/globals';\n\nimport styles from './it-tab-panel.scss';\n\n/**\n * `it-tab-panel` rappresenta il pannello di contenuto associato a un `it-tab`.\n *\n * Il contenuto dello slot diventa il corpo del pannello, visibile solo quando\n * il tab corrispondente è selezionato.\n *\n * L'attributo `name` deve corrispondere all'attributo `panel` dell'`it-tab` collegato.\n *\n * @slot - Contenuto del pannello\n *\n * @csspart panel - Il `div` contenitore interno del pannello\n */\n@customElement('it-tab-panel')\nexport class ItTabPanel extends BaseComponent {\n static styles = styles;\n\n /**\n * Identificatore del pannello. Deve corrispondere all'attributo `panel`\n * dell'`it-tab` associato. Viene usato anche come `id` dell'elemento host\n * per il collegamento ARIA tramite `aria-controls`.\n */\n @property({ type: String, reflect: true })\n name = '';\n\n /**\n * Stato attivo del pannello. Gestito dall'`it-tabs` padre.\n * Quando `true`, il pannello è visibile.\n */\n @property({ type: Boolean, reflect: true })\n active = false;\n\n /**\n * Attiva l'animazione \"a comparsa\" (fade-in) sul pannello al momento\n * dell'attivazione, usando la Web Animations API (opacity 0→1, 150 ms).\n * Rispetta automaticamente `prefers-reduced-motion`: se l'utente ha\n * richiesto animazioni ridotte l'effetto viene completamente saltato.\n * Da usare su tutti i pannelli dello stesso `it-tabs` per coerenza visiva.\n */\n @property({ type: Boolean, reflect: true })\n fade = false;\n\n override connectedCallback(): void {\n super.connectedCallback?.();\n // L'id sull'host fa da target per aria-controls del tab\n if (this.name && !this.id) {\n this.id = this.name;\n }\n // role e tabindex sull'host: aria-labelledby è valido solo su elementi con role\n if (!this.hasAttribute('role')) this.setAttribute('role', 'tabpanel');\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n }\n\n override updated(changed: Map<string | number | symbol, unknown>): void {\n super.updated?.(changed);\n\n // Aggiorna l'id se il name cambia dopo la connessione\n if (changed.has('name') && this.name && !this.hasAttribute('id')) {\n this.id = this.name;\n }\n\n // Fade-in con Web Animations API quando il pannello diventa attivo.\n // Viene saltato se il pannello non ha l'attributo `fade` oppure se\n // l'utente ha richiesto animazioni ridotte (prefers-reduced-motion).\n // Strategia: forziamo display:flex sull'host via style inline prima di animare,\n // così il browser non deve risolvere la cascade da :host([active]) e l'elemento\n // è sicuramente nel flusso quando opacity parte da 0.\n // Al termine rimuoviamo lo style inline e lasciamo la cascade CSS riprendere.\n if (changed.has('active') && this.fade) {\n const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n if (this.active && !reduced) {\n // Forza display prima che il browser risolva la cascade, poi anima\n // l'host stesso (più semplice e affidabile dell'animare il figlio shadow).\n this.style.display = 'flex';\n // eslint-disable-next-line no-unused-expressions\n this.offsetHeight; // forza reflow: l'elemento è ora nel flusso\n this.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 300, easing: 'linear', fill: 'none' }).finished.then(\n () => this.style.removeProperty('display'),\n );\n }\n }\n }\n\n render() {\n return html`\n <div\n part=\"panel\"\n class=${classMap({\n 'tab-pane': true,\n fade: this.fade,\n active: this.active,\n show: this.active,\n })}\n >\n <slot></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-tab-panel': ItTabPanel;\n }\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { BaseLocalizedComponent } from '@italia/globals';
|
|
2
|
+
/**
|
|
3
|
+
* `it-tab` rappresenta il singolo tab (trigger) all'interno di un componente `it-tabs`.
|
|
4
|
+
*
|
|
5
|
+
* L'host stesso è l'elemento interattivo: porta `role="tab"`, `tabIndex` e tutti
|
|
6
|
+
* gli attributi ARIA direttamente nel light DOM. Lo shadow DOM contiene solo
|
|
7
|
+
* `<slot>` per il contenuto — nessun elemento interattivo annidato (no nested-interactive).
|
|
8
|
+
*
|
|
9
|
+
* ## Accessibilità dismissible
|
|
10
|
+
*
|
|
11
|
+
* Quando `dismissible` è attivo, il componente imposta automaticamente sull'host:
|
|
12
|
+
*
|
|
13
|
+
* - `aria-keyshortcuts="Delete Backspace"` — annuncia le scorciatoie da tastiera
|
|
14
|
+
* agli screen reader desktop (NVDA, JAWS, VoiceOver+Mac).
|
|
15
|
+
* - `aria-description="Attiva di nuovo per chiudere."` (testo localizzato) — presente
|
|
16
|
+
* **solo** quando il tab è anche `active`; informa l'utente di screen reader mobile
|
|
17
|
+
* (VoiceOver+iOS, TalkBack+Android) che può chiudere il tab ri-attivando l'elemento
|
|
18
|
+
* (doppio tap nel DOM virtuale), senza bisogno di shortcut tastiera.
|
|
19
|
+
*
|
|
20
|
+
* Il click sull'host quando `active && dismissible` emette `it-tab-close-request`
|
|
21
|
+
* **solo** se il gesto viene da touch o pen (doppio tap SR mobile).
|
|
22
|
+
* Un click mouse sull'host non chiude il tab: l'utente usa la × esplicita.
|
|
23
|
+
*
|
|
24
|
+
* @slot - Etichetta del tab: testo, icona o icona+testo
|
|
25
|
+
*
|
|
26
|
+
* @fires it-tab-select - Emesso al click (non disabilitato, non già attivo+dismissibile).
|
|
27
|
+
* `detail.panel` contiene il nome del pannello associato.
|
|
28
|
+
* @fires it-tab-close-request - Emesso al doppio-tap touch/pen quando `active && dismissible`
|
|
29
|
+
* (SR mobile), oppure dal pulsante × interno.
|
|
30
|
+
* `detail.panel` e `detail.type` (`'click'`) propagano verso `it-tabs`.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ItTab extends BaseLocalizedComponent {
|
|
33
|
+
static styles: import("lit").CSSResultGroup;
|
|
34
|
+
/**
|
|
35
|
+
* Nome del pannello `it-tab-panel` associato.
|
|
36
|
+
* Deve corrispondere all'attributo `name` dell'`it-tab-panel` collegato.
|
|
37
|
+
*/
|
|
38
|
+
panel: string;
|
|
39
|
+
/** Se `true`, il tab è disabilitato e non interagibile. */
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Stato attivo. Gestito dall'`it-tabs` padre.
|
|
43
|
+
* Quando `true` il tab è selezionato e `tabIndex` dell'host è `0`.
|
|
44
|
+
*/
|
|
45
|
+
active: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* In variante card: impostato automaticamente dall'`it-tabs` padre quando `cards` è attivo.
|
|
48
|
+
* Porta gli stili card direttamente su :host([cards]) in it-tab.scss.
|
|
49
|
+
*/
|
|
50
|
+
cards: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Mostra il pulsante × per chiudere il tab.
|
|
53
|
+
* Impostato automaticamente dall'`it-tabs` padre (da `dismissible` sul container);
|
|
54
|
+
* non richiede manipolazione del light DOM (il bottone vive nello shadow DOM di `it-tab`).
|
|
55
|
+
* Al click emette `it-tab-close-request` (bubbles + composed) verso `it-tabs`.
|
|
56
|
+
*/
|
|
57
|
+
dismissible: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Restituisce l'`id` dell'host, usato dall'`it-tabs` padre per
|
|
60
|
+
* impostare `aria-labelledby` sul pannello associato (tutto in light DOM,
|
|
61
|
+
* nessun cross-shadow ARIA necessario).
|
|
62
|
+
*/
|
|
63
|
+
get tabId(): string;
|
|
64
|
+
/** Tipo di pointer dell'ultimo pointerdown: 'mouse' | 'touch' | 'pen' | '' */
|
|
65
|
+
private _lastPointerType;
|
|
66
|
+
/** Porta il focus sull'host. Chiamato dal `RovingTabindexController`. */
|
|
67
|
+
focusTab(): void;
|
|
68
|
+
connectedCallback(): void;
|
|
69
|
+
disconnectedCallback(): void;
|
|
70
|
+
updated(changed: Map<string | number | symbol, unknown>): void;
|
|
71
|
+
/**
|
|
72
|
+
* Aggiorna gli attributi ARIA legati alla funzionalità dismissible:
|
|
73
|
+
*
|
|
74
|
+
* - `aria-keyshortcuts="Delete Backspace"` — presente sempre quando il tab è dismissibile;
|
|
75
|
+
* annuncia la scorciatoia da tastiera agli screen reader (NVDA, JAWS, VoiceOver+Mac).
|
|
76
|
+
*
|
|
77
|
+
* - `aria-description` — presente solo quando il tab è **sia attivo sia dismissibile**;
|
|
78
|
+
* contiene il testo localizzato (es. "Attiva di nuovo per chiudere.") che informa
|
|
79
|
+
* l'utente mobile (VoiceOver/TalkBack) che può chiudere ri-attivando l'elemento
|
|
80
|
+
* (doppio tap), oltre ai tasti Delete/Backspace già coperti da aria-keyshortcuts.
|
|
81
|
+
*/
|
|
82
|
+
private _updateDismissibleAria;
|
|
83
|
+
private _handlePointerDown;
|
|
84
|
+
private _handleClick;
|
|
85
|
+
private _handleKeydown;
|
|
86
|
+
private _handleCloseClick;
|
|
87
|
+
render(): import("lit").TemplateResult<1>;
|
|
88
|
+
}
|
|
89
|
+
declare global {
|
|
90
|
+
interface HTMLElementTagNameMap {
|
|
91
|
+
'it-tab': ItTab;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=it-tab.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"it-tab.d.ts","sourceRoot":"","sources":["../../src/it-tab.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AASzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBACa,KAAM,SAAQ,sBAAsB;IAC/C,MAAM,CAAC,MAAM,+BAAU;IAEvB;;;OAGG;IAEH,KAAK,SAAM;IAEX,2DAA2D;IAE3D,QAAQ,UAAS;IAEjB;;;OAGG;IAEH,MAAM,UAAS;IAEf;;;OAGG;IAEH,KAAK,UAAS;IAEd;;;;;OAKG;IAEH,WAAW,UAAS;IAEpB;;;;OAIG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,8EAA8E;IAC9E,OAAO,CAAC,gBAAgB,CAAM;IAE9B,yEAAyE;IACzE,QAAQ,IAAI,IAAI;IAIP,iBAAiB,IAAI,IAAI;IAgBzB,oBAAoB,IAAI,IAAI;IAO5B,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAWvE;;;;;;;;;;OAUG;IACH,OAAO,CAAC,sBAAsB;IAc9B,OAAO,CAAC,kBAAkB,CAExB;IAEF,OAAO,CAAC,YAAY,CAqBlB;IAEF,OAAO,CAAC,cAAc,CAepB;IAEF,OAAO,CAAC,iBAAiB,CASvB;IAEF,MAAM;CAUP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,QAAQ,EAAE,KAAK,CAAC;KACjB;CACF"}
|