@italia/thumbnav 1.0.0-alpha.9 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +51 -6
- package/dist/src/index.js +1 -1
- package/dist/src/it-thumbnav-item.d.ts +4 -2
- package/dist/src/it-thumbnav-item.d.ts.map +1 -1
- package/dist/src/it-thumbnav-item.js +17 -19
- package/dist/src/it-thumbnav-item.js.map +1 -1
- package/dist/src/it-thumbnav.d.ts +5 -0
- package/dist/src/it-thumbnav.d.ts.map +1 -1
- package/dist/src/it-thumbnav.js +23 -17
- package/dist/src/it-thumbnav.js.map +1 -1
- package/package.json +5 -5
- package/styles/globals.scss +2 -1
package/custom-elements.json
CHANGED
|
@@ -31,9 +31,32 @@
|
|
|
31
31
|
"declarations": [
|
|
32
32
|
{
|
|
33
33
|
"kind": "class",
|
|
34
|
-
"description": "Singolo elemento della Thumbnav.\nInserisce il contenuto (tipicamente un anchor con immagine) in un elemento `<li>`.\
|
|
34
|
+
"description": "Singolo elemento della Thumbnav.\nInserisce il contenuto (tipicamente un anchor con immagine) in un elemento `<li>`.\nUsa l'attributo `active` per indicare l'elemento corrente:\n`<it-thumbnav-item active><a href=\"#\" class=\"ratio ratio-3x2\"><img …></a></it-thumbnav-item>`",
|
|
35
35
|
"name": "ItThumbnavItem",
|
|
36
|
-
"members": [
|
|
36
|
+
"members": [
|
|
37
|
+
{
|
|
38
|
+
"kind": "field",
|
|
39
|
+
"name": "active",
|
|
40
|
+
"type": {
|
|
41
|
+
"text": "boolean"
|
|
42
|
+
},
|
|
43
|
+
"default": "false",
|
|
44
|
+
"description": "Indica l'elemento attivo/corrente nella navigazione.",
|
|
45
|
+
"attribute": "active",
|
|
46
|
+
"reflects": true
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"attributes": [
|
|
50
|
+
{
|
|
51
|
+
"name": "active",
|
|
52
|
+
"type": {
|
|
53
|
+
"text": "boolean"
|
|
54
|
+
},
|
|
55
|
+
"default": "false",
|
|
56
|
+
"description": "Indica l'elemento attivo/corrente nella navigazione.",
|
|
57
|
+
"fieldName": "active"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
37
60
|
"superclass": {
|
|
38
61
|
"name": "BaseComponent",
|
|
39
62
|
"package": "@italia/globals"
|
|
@@ -132,6 +155,28 @@
|
|
|
132
155
|
"description": "Posizione in overlay all'interno di un contenitore `.position-relative`.\nValori: `bottom`, `top`, `left`, `right`.",
|
|
133
156
|
"attribute": "position",
|
|
134
157
|
"reflects": true
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"kind": "field",
|
|
161
|
+
"name": "_slotEl",
|
|
162
|
+
"type": {
|
|
163
|
+
"text": "HTMLSlotElement"
|
|
164
|
+
},
|
|
165
|
+
"privacy": "private"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"kind": "field",
|
|
169
|
+
"name": "_items",
|
|
170
|
+
"type": {
|
|
171
|
+
"text": "ItThumbnavItem[]"
|
|
172
|
+
},
|
|
173
|
+
"privacy": "protected",
|
|
174
|
+
"readonly": true
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"kind": "field",
|
|
178
|
+
"name": "_setChildrenProperties",
|
|
179
|
+
"privacy": "protected"
|
|
135
180
|
}
|
|
136
181
|
],
|
|
137
182
|
"attributes": [
|
|
@@ -280,7 +325,7 @@
|
|
|
280
325
|
"type": {
|
|
281
326
|
"text": "Meta<ThumbnnavProps>"
|
|
282
327
|
},
|
|
283
|
-
"default": "{ title: 'Componenti/Thumbnav', tags: ['a11y-ok', 'web-component', 'alpha'], component: 'it-thumbnav', args: { small: false, vertical: false, fixed: false, hover: undefined, auto: undefined, position: undefined, }, argTypes: { small: { control: 'boolean', description: 'Usa thumbnail di dimensione ridotta (120px invece di 240px).', table: { defaultValue: { summary: 'false' } }, }, vertical: { control: 'boolean', description: 'Dispone le thumbnail in colonna verticale invece che orizzontale.', table: { defaultValue: { summary: 'false' } }, }, fixed: { control: 'boolean', description: 'Imposta larghezza fissa per ogni thumbnail: 240px per default, 120px se combinato con `small`.', table: { defaultValue: { summary: 'false' } }, }, hover: { control: 'select', options: THUMBNAV_HOVER_EFFECTS, description: \"Personalizza l'effetto al passaggio del mouse. Ometti l'attributo per lo zoom predefinito. Usa `nozoom` per disabilitarlo, `black` o `primary` per aggiungere un layer colorato sull'immagine.\", }, auto: { control: 'select', options: THUMBNAV_AUTO_COLUMNS, description: 'Attiva la griglia a larghezza automatica e imposta il numero di thumbnail per riga (2, 3, 4 o 5).', }, position: { control: 'select', options: THUMBNAV_POSITIONS, description: \"Posiziona la Thumbnav in overlay rispetto a un contenitore con classe `.position-relative`. Usa `bottom` o `top` per la versione orizzontale, `left` o `right` per la verticale (il comportamento verticale viene applicato automaticamente). Questo attributo non ha effetto nell'esempio interattivo: richiede la struttura HTML corretta con un contenitore esterno. Vedi le stories dedicate agli overlay.\", }, }, parameters: { layout: 'padded',
|
|
328
|
+
"default": "{ title: 'Componenti/Thumbnav', tags: ['a11y-ok', 'web-component', 'alpha'], component: 'it-thumbnav', args: { small: false, vertical: false, fixed: false, hover: undefined, auto: undefined, position: undefined, }, argTypes: { small: { control: 'boolean', description: 'Usa thumbnail di dimensione ridotta (120px invece di 240px).', table: { defaultValue: { summary: 'false' } }, }, vertical: { control: 'boolean', description: 'Dispone le thumbnail in colonna verticale invece che orizzontale.', table: { defaultValue: { summary: 'false' } }, }, fixed: { control: 'boolean', description: 'Imposta larghezza fissa per ogni thumbnail: 240px per default, 120px se combinato con `small`.', table: { defaultValue: { summary: 'false' } }, }, hover: { control: 'select', options: THUMBNAV_HOVER_EFFECTS, description: \"Personalizza l'effetto al passaggio del mouse. Ometti l'attributo per lo zoom predefinito. Usa `nozoom` per disabilitarlo, `black` o `primary` per aggiungere un layer colorato sull'immagine.\", }, auto: { control: 'select', options: THUMBNAV_AUTO_COLUMNS, description: 'Attiva la griglia a larghezza automatica e imposta il numero di thumbnail per riga (2, 3, 4 o 5).', }, position: { control: 'select', options: THUMBNAV_POSITIONS, description: \"Posiziona la Thumbnav in overlay rispetto a un contenitore con classe `.position-relative`. Usa `bottom` o `top` per la versione orizzontale, `left` o `right` per la verticale (il comportamento verticale viene applicato automaticamente). Questo attributo non ha effetto nell'esempio interattivo: richiede la struttura HTML corretta con un contenitore esterno. Vedi le stories dedicate agli overlay.\", }, }, parameters: { layout: 'padded', docs: { description: { component: ` Componente di navigazione con immagini thumbnail. Il componente Thumbnav è composto da due elementi: - \\`it-thumbnav\\`: contenitore che raggruppa le thumbnail e gestisce il layout; - \\`it-thumbnav-item\\`: singolo elemento, che accetta nello slot un anchor con immagine. Ogni \\`it-thumbnav-item\\` si aspetta un anchor con la classe Bootstrap \\`.ratio\\` per il corretto rapporto d'aspetto: \\`\\`\\`html <it-thumbnav> <it-thumbnav-item> <a href=\"#\" class=\"ratio ratio-3x2\"> <img src=\"…\" alt=\"Descrizione azione\"> </a> </it-thumbnav-item> </it-thumbnav> \\`\\`\\` `, }, }, }, }"
|
|
284
329
|
},
|
|
285
330
|
{
|
|
286
331
|
"kind": "variable",
|
|
@@ -368,7 +413,7 @@
|
|
|
368
413
|
"type": {
|
|
369
414
|
"text": "Story"
|
|
370
415
|
},
|
|
371
|
-
"default": "{ name: 'Griglia a larghezza fissa', render: () => html` <it-thumbnav fixed> ${renderItems(5)} </it-thumbnav> `, }"
|
|
416
|
+
"default": "{ name: 'Griglia a larghezza fissa', parameters: { pageLayout: 'w-100' }, render: () => html` <it-thumbnav fixed> ${renderItems(5)} </it-thumbnav> `, }"
|
|
372
417
|
},
|
|
373
418
|
{
|
|
374
419
|
"kind": "variable",
|
|
@@ -376,7 +421,7 @@
|
|
|
376
421
|
"type": {
|
|
377
422
|
"text": "Story"
|
|
378
423
|
},
|
|
379
|
-
"default": "{ name: 'Griglia automatica - 3 per riga', render: () => html` <it-thumbnav auto=\"3\"> ${renderItems(5)} </it-thumbnav> `, }"
|
|
424
|
+
"default": "{ name: 'Griglia automatica - 3 per riga', parameters: { pageLayout: 'w-100' }, render: () => html` <it-thumbnav auto=\"3\"> ${renderItems(5)} </it-thumbnav> `, }"
|
|
380
425
|
},
|
|
381
426
|
{
|
|
382
427
|
"kind": "variable",
|
|
@@ -384,7 +429,7 @@
|
|
|
384
429
|
"type": {
|
|
385
430
|
"text": "Story"
|
|
386
431
|
},
|
|
387
|
-
"default": "{ name: 'Griglia automatica - 5 per riga', render: () => html` <it-thumbnav auto=\"5\"> ${renderItems(5)} </it-thumbnav> `, }"
|
|
432
|
+
"default": "{ name: 'Griglia automatica - 5 per riga', parameters: { pageLayout: 'w-100' }, render: () => html` <it-thumbnav auto=\"5\"> ${renderItems(5)} </it-thumbnav> `, }"
|
|
388
433
|
}
|
|
389
434
|
],
|
|
390
435
|
"exports": [
|
package/dist/src/index.js
CHANGED
|
@@ -2,11 +2,13 @@ import { BaseComponent } from '@italia/globals';
|
|
|
2
2
|
/**
|
|
3
3
|
* Singolo elemento della Thumbnav.
|
|
4
4
|
* Inserisce il contenuto (tipicamente un anchor con immagine) in un elemento `<li>`.
|
|
5
|
-
*
|
|
6
|
-
* `<a href="#" class="ratio ratio-3x2
|
|
5
|
+
* Usa l'attributo `active` per indicare l'elemento corrente:
|
|
6
|
+
* `<it-thumbnav-item active><a href="#" class="ratio ratio-3x2"><img …></a></it-thumbnav-item>`
|
|
7
7
|
*/
|
|
8
8
|
export declare class ItThumbnavItem extends BaseComponent {
|
|
9
9
|
static styles: import("lit").CSSResultGroup;
|
|
10
|
+
/** Indica l'elemento attivo/corrente nella navigazione. */
|
|
11
|
+
active: boolean;
|
|
10
12
|
render(): import("lit").TemplateResult<1>;
|
|
11
13
|
}
|
|
12
14
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-thumbnav-item.d.ts","sourceRoot":"","sources":["../../src/it-thumbnav-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD;;;;;GAKG;AACH,qBACa,cAAe,SAAQ,aAAa;IAC/C,MAAM,CAAC,MAAM,+BAAU;
|
|
1
|
+
{"version":3,"file":"it-thumbnav-item.d.ts","sourceRoot":"","sources":["../../src/it-thumbnav-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD;;;;;GAKG;AACH,qBACa,cAAe,SAAQ,aAAa;IAC/C,MAAM,CAAC,MAAM,+BAAU;IAEvB,2DAA2D;IAE3D,MAAM,UAAS;IAEN,MAAM;CAGhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,cAAc,CAAC;KACpC;CACF"}
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
import { _ as __decorate, B as BaseComponent } from '../index-
|
|
1
|
+
import { _ as __decorate, a as __metadata, B as BaseComponent } from '../index-DEVGY9Gu.js';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
|
-
import { customElement } from 'lit/decorators.js';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
4
4
|
import 'lit/directive.js';
|
|
5
5
|
|
|
6
|
-
var styles = css
|
|
7
|
-
/***************************** 2 ****************************************/
|
|
8
|
-
/***************************** 1 ****************************************/
|
|
9
|
-
/***************************** 2 ****************************************/
|
|
10
|
-
/***************************** 1 ****************************************/
|
|
11
|
-
/***************************** 2 ****************************************/
|
|
12
|
-
/***************************** 3 ****************************************/
|
|
13
|
-
/***************************** 1 ****************************************/
|
|
14
|
-
/***************************** 2 ****************************************/
|
|
15
|
-
/***************************** 3 ****************************************/
|
|
16
|
-
/***************************** NEUTRAL 1 ****************************************/
|
|
17
|
-
/***************************** NEUTRAL 2 ****************************************/
|
|
18
|
-
/***************************** NEUTRAL 2 / 3 ****************************************/
|
|
19
|
-
.thumb-nav {
|
|
6
|
+
var styles = css`.thumb-nav {
|
|
20
7
|
--bsi-thumb-nav-gap: var(--bsi-spacing-xxs);
|
|
21
8
|
--bsi-thumb-nav-auto-basis-offset: var(--bsi-spacing-s);
|
|
22
9
|
--bsi-thumb-nav-overlay-offset: var(--bsi-spacing-s);
|
|
@@ -209,10 +196,12 @@ li {
|
|
|
209
196
|
transition-duration: 1s;
|
|
210
197
|
}
|
|
211
198
|
|
|
199
|
+
:host([active]) ::slotted(a),
|
|
212
200
|
::slotted(a.active) {
|
|
213
201
|
pointer-events: none;
|
|
214
202
|
}
|
|
215
203
|
|
|
204
|
+
:host([active]) ::slotted(a)::after,
|
|
216
205
|
::slotted(a.active)::after {
|
|
217
206
|
background: var(--bsi-color-background-primary);
|
|
218
207
|
opacity: 0.6;
|
|
@@ -221,15 +210,24 @@ li {
|
|
|
221
210
|
/**
|
|
222
211
|
* Singolo elemento della Thumbnav.
|
|
223
212
|
* Inserisce il contenuto (tipicamente un anchor con immagine) in un elemento `<li>`.
|
|
224
|
-
*
|
|
225
|
-
* `<a href="#" class="ratio ratio-3x2
|
|
213
|
+
* Usa l'attributo `active` per indicare l'elemento corrente:
|
|
214
|
+
* `<it-thumbnav-item active><a href="#" class="ratio ratio-3x2"><img …></a></it-thumbnav-item>`
|
|
226
215
|
*/
|
|
227
216
|
let ItThumbnavItem = class ItThumbnavItem extends BaseComponent {
|
|
217
|
+
constructor() {
|
|
218
|
+
super(...arguments);
|
|
219
|
+
/** Indica l'elemento attivo/corrente nella navigazione. */
|
|
220
|
+
this.active = false;
|
|
221
|
+
}
|
|
228
222
|
render() {
|
|
229
|
-
return html `<li><slot></slot></li>`;
|
|
223
|
+
return html `<li role="presentation"><slot></slot></li>`;
|
|
230
224
|
}
|
|
231
225
|
};
|
|
232
226
|
ItThumbnavItem.styles = styles;
|
|
227
|
+
__decorate([
|
|
228
|
+
property({ type: Boolean, reflect: true }),
|
|
229
|
+
__metadata("design:type", Object)
|
|
230
|
+
], ItThumbnavItem.prototype, "active", void 0);
|
|
233
231
|
ItThumbnavItem = __decorate([
|
|
234
232
|
customElement('it-thumbnav-item')
|
|
235
233
|
], ItThumbnavItem);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-thumbnav-item.js","sources":["../../../src/it-thumbnav-item.ts"],"sourcesContent":["import { BaseComponent } from '@italia/globals';\nimport { html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport styles from './thumbnav-item.scss';\n\n/**\n * Singolo elemento della Thumbnav.\n * Inserisce il contenuto (tipicamente un anchor con immagine) in un elemento `<li>`.\n *
|
|
1
|
+
{"version":3,"file":"it-thumbnav-item.js","sources":["../../../src/it-thumbnav-item.ts"],"sourcesContent":["import { BaseComponent } from '@italia/globals';\nimport { html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport styles from './thumbnav-item.scss';\n\n/**\n * Singolo elemento della Thumbnav.\n * Inserisce il contenuto (tipicamente un anchor con immagine) in un elemento `<li>`.\n * Usa l'attributo `active` per indicare l'elemento corrente:\n * `<it-thumbnav-item active><a href=\"#\" class=\"ratio ratio-3x2\"><img …></a></it-thumbnav-item>`\n */\n@customElement('it-thumbnav-item')\nexport class ItThumbnavItem extends BaseComponent {\n static styles = styles;\n\n /** Indica l'elemento attivo/corrente nella navigazione. */\n @property({ type: Boolean, reflect: true })\n active = false;\n\n override render() {\n return html`<li role=\"presentation\"><slot></slot></li>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-thumbnav-item': ItThumbnavItem;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;;;;;AAKG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,aAAa,CAAA;AAA1C,IAAA,WAAA,GAAA;;;QAKL,IAAA,CAAA,MAAM,GAAG,KAAK;IAKhB;IAHW,MAAM,GAAA;QACb,OAAO,IAAI,CAAA,CAAA,0CAAA,CAA4C;IACzD;;AARO,cAAA,CAAA,MAAM,GAAG,MAAH;AAIb,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAC5B,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AALJ,cAAc,GAAA,UAAA,CAAA;IAD1B,aAAa,CAAC,kBAAkB;AACpB,CAAA,EAAA,cAAc,CAU1B;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseComponent } from '@italia/globals';
|
|
2
2
|
import type { ThumbnnavHoverEffect, ThumbnnavPosition, ThumbnnavAutoColumns } from './types.js';
|
|
3
|
+
import type { ItThumbnavItem } from './it-thumbnav-item.js';
|
|
3
4
|
/**
|
|
4
5
|
* Contenitore Thumbnav: lista di link con immagini thumbnail.
|
|
5
6
|
* I singoli elementi vanno inseriti tramite `it-thumbnav-item`.
|
|
@@ -40,6 +41,10 @@ export declare class ItThumbnav extends BaseComponent {
|
|
|
40
41
|
* Valori: `bottom`, `top`, `left`, `right`.
|
|
41
42
|
*/
|
|
42
43
|
position?: ThumbnnavPosition;
|
|
44
|
+
private _slotEl;
|
|
45
|
+
protected get _items(): ItThumbnavItem[];
|
|
46
|
+
protected _setChildrenProperties: () => void;
|
|
47
|
+
protected updated(): void;
|
|
43
48
|
render(): import("lit").TemplateResult<1>;
|
|
44
49
|
}
|
|
45
50
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-thumbnav.d.ts","sourceRoot":"","sources":["../../src/it-thumbnav.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"it-thumbnav.d.ts","sourceRoot":"","sources":["../../src/it-thumbnav.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;;;;;;;;;;GAWG;AACH,qBACa,UAAW,SAAQ,aAAa;IAC3C,MAAM,CAAC,MAAM,+BAAU;IAEvB,mEAAmE;IAEnE,KAAK,UAAS;IAEd;;;OAGG;IAEH,QAAQ,UAAS;IAEjB,qEAAqE;IAErE,KAAK,UAAS;IAEd;;;;;OAKG;IAEH,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAE7B;;;OAGG;IAEH,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAE5B;;;OAGG;IAEH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAEd,OAAO,CAAC,OAAO,CAAmB;IAEjD,SAAS,KAAK,MAAM,IAAI,cAAc,EAAE,CAKvC;IAED,SAAS,CAAC,sBAAsB,aAI9B;cAEiB,OAAO;IAIjB,MAAM;CAsBhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
package/dist/src/it-thumbnav.js
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import { _ as __decorate, a as __metadata, B as BaseComponent } from '../index-
|
|
1
|
+
import { _ as __decorate, a as __metadata, B as BaseComponent } from '../index-DEVGY9Gu.js';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
|
-
import { property, customElement } from 'lit/decorators.js';
|
|
3
|
+
import { property, query, customElement } from 'lit/decorators.js';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
5
|
import 'lit/directive.js';
|
|
6
6
|
|
|
7
|
-
var styles = css
|
|
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
|
-
.thumb-nav {
|
|
7
|
+
var styles = css`.thumb-nav {
|
|
21
8
|
--bsi-thumb-nav-gap: var(--bsi-spacing-xxs);
|
|
22
9
|
--bsi-thumb-nav-auto-basis-offset: var(--bsi-spacing-s);
|
|
23
10
|
--bsi-thumb-nav-overlay-offset: var(--bsi-spacing-s);
|
|
@@ -261,6 +248,21 @@ let ItThumbnav = class ItThumbnav extends BaseComponent {
|
|
|
261
248
|
this.vertical = false;
|
|
262
249
|
/** Larghezza fissa per ogni thumbnail (240px o 120px se `small`). */
|
|
263
250
|
this.fixed = false;
|
|
251
|
+
this._setChildrenProperties = () => {
|
|
252
|
+
for (const item of this._items) {
|
|
253
|
+
item.role = 'listitem';
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
get _items() {
|
|
258
|
+
if (!this._slotEl)
|
|
259
|
+
return [];
|
|
260
|
+
return this._slotEl
|
|
261
|
+
.assignedElements({ flatten: true })
|
|
262
|
+
.filter((el) => el.tagName === 'IT-THUMBNAV-ITEM');
|
|
263
|
+
}
|
|
264
|
+
updated() {
|
|
265
|
+
this._setChildrenProperties();
|
|
264
266
|
}
|
|
265
267
|
render() {
|
|
266
268
|
const effectiveVertical = this.vertical || this.position === 'left' || this.position === 'right';
|
|
@@ -280,7 +282,7 @@ let ItThumbnav = class ItThumbnav extends BaseComponent {
|
|
|
280
282
|
'thumb-nav-right': this.position === 'right',
|
|
281
283
|
});
|
|
282
284
|
return html `<ul class="${classes}" part="thumbnav" role="list">
|
|
283
|
-
<slot></slot>
|
|
285
|
+
<slot @slotchange=${this._setChildrenProperties}></slot>
|
|
284
286
|
</ul>`;
|
|
285
287
|
}
|
|
286
288
|
};
|
|
@@ -309,6 +311,10 @@ __decorate([
|
|
|
309
311
|
property({ type: String, reflect: true }),
|
|
310
312
|
__metadata("design:type", String)
|
|
311
313
|
], ItThumbnav.prototype, "position", void 0);
|
|
314
|
+
__decorate([
|
|
315
|
+
query('slot'),
|
|
316
|
+
__metadata("design:type", HTMLSlotElement)
|
|
317
|
+
], ItThumbnav.prototype, "_slotEl", void 0);
|
|
312
318
|
ItThumbnav = __decorate([
|
|
313
319
|
customElement('it-thumbnav')
|
|
314
320
|
], ItThumbnav);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-thumbnav.js","sources":["../../../src/it-thumbnav.ts"],"sourcesContent":["/* eslint-disable lit-a11y/no-redundant-role */\n/* eslint-disable lit-a11y/list */\nimport { BaseComponent } from '@italia/globals';\nimport { html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport type { ThumbnnavHoverEffect, ThumbnnavPosition, ThumbnnavAutoColumns } from './types.js';\nimport styles from './thumbnav.scss';\n\n/**\n * Contenitore Thumbnav: lista di link con immagini thumbnail.\n * I singoli elementi vanno inseriti tramite `it-thumbnav-item`.\n *\n * ```html\n * <it-thumbnav>\n * <it-thumbnav-item>\n * <a href=\"#\" class=\"ratio ratio-3x2\"><img src=\"…\" alt=\"…\"></a>\n * </it-thumbnav-item>\n * </it-thumbnav>\n * ```\n */\n@customElement('it-thumbnav')\nexport class ItThumbnav extends BaseComponent {\n static styles = styles;\n\n /** Usa thumbnail di dimensione ridotta (120px invece di 240px). */\n @property({ type: Boolean, reflect: true })\n small = false;\n\n /**\n * Dispone le thumbnail in colonna verticale.\n * Viene applicato automaticamente quando `position` è `left` o `right`.\n */\n @property({ type: Boolean, reflect: true })\n vertical = false;\n\n /** Larghezza fissa per ogni thumbnail (240px o 120px se `small`). */\n @property({ type: Boolean, reflect: true })\n fixed = false;\n\n /**\n * Effetto hover sull'immagine.\n * - `nozoom`: disabilita lo zoom al passaggio del mouse.\n * - `black`: overlay nero semitrasparente.\n * - `primary`: overlay di colore primary semitrasparente.\n */\n @property({ type: String, reflect: true })\n hover?: ThumbnnavHoverEffect;\n\n /**\n * Griglia a larghezza automatica: numero di thumbnail per riga (2–5).\n * Equivale alle classi `.thumb-nav-auto.thumb-nav-auto-N`.\n */\n @property({ type: Number, reflect: true })\n auto?: ThumbnnavAutoColumns;\n\n /**\n * Posizione in overlay all'interno di un contenitore `.position-relative`.\n * Valori: `bottom`, `top`, `left`, `right`.\n */\n @property({ type: String, reflect: true })\n position?: ThumbnnavPosition;\n\n override render() {\n const effectiveVertical = this.vertical || this.position === 'left' || this.position === 'right';\n const classes = classMap({\n 'thumb-nav': true,\n 'thumb-nav-small': this.small,\n 'thumb-nav-vertical': effectiveVertical,\n 'thumb-nav-fixed': this.fixed,\n 'thumb-nav-nozoom': this.hover === 'nozoom',\n 'thumb-nav-black': this.hover === 'black',\n 'thumb-nav-primary': this.hover === 'primary',\n 'thumb-nav-auto': this.auto != null,\n [`thumb-nav-auto-${this.auto}`]: this.auto != null,\n 'thumb-nav-bottom': this.position === 'bottom',\n 'thumb-nav-top': this.position === 'top',\n 'thumb-nav-left': this.position === 'left',\n 'thumb-nav-right': this.position === 'right',\n });\n\n return html`<ul class=\"${classes}\" part=\"thumbnav\" role=\"list\">\n <slot></slot>\n </ul>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-thumbnav': ItThumbnav;\n }\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"it-thumbnav.js","sources":["../../../src/it-thumbnav.ts"],"sourcesContent":["/* eslint-disable lit-a11y/no-redundant-role */\n/* eslint-disable lit-a11y/list */\nimport { BaseComponent } from '@italia/globals';\nimport { html } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport type { ThumbnnavHoverEffect, ThumbnnavPosition, ThumbnnavAutoColumns } from './types.js';\nimport type { ItThumbnavItem } from './it-thumbnav-item.js';\nimport styles from './thumbnav.scss';\n\n/**\n * Contenitore Thumbnav: lista di link con immagini thumbnail.\n * I singoli elementi vanno inseriti tramite `it-thumbnav-item`.\n *\n * ```html\n * <it-thumbnav>\n * <it-thumbnav-item>\n * <a href=\"#\" class=\"ratio ratio-3x2\"><img src=\"…\" alt=\"…\"></a>\n * </it-thumbnav-item>\n * </it-thumbnav>\n * ```\n */\n@customElement('it-thumbnav')\nexport class ItThumbnav extends BaseComponent {\n static styles = styles;\n\n /** Usa thumbnail di dimensione ridotta (120px invece di 240px). */\n @property({ type: Boolean, reflect: true })\n small = false;\n\n /**\n * Dispone le thumbnail in colonna verticale.\n * Viene applicato automaticamente quando `position` è `left` o `right`.\n */\n @property({ type: Boolean, reflect: true })\n vertical = false;\n\n /** Larghezza fissa per ogni thumbnail (240px o 120px se `small`). */\n @property({ type: Boolean, reflect: true })\n fixed = false;\n\n /**\n * Effetto hover sull'immagine.\n * - `nozoom`: disabilita lo zoom al passaggio del mouse.\n * - `black`: overlay nero semitrasparente.\n * - `primary`: overlay di colore primary semitrasparente.\n */\n @property({ type: String, reflect: true })\n hover?: ThumbnnavHoverEffect;\n\n /**\n * Griglia a larghezza automatica: numero di thumbnail per riga (2–5).\n * Equivale alle classi `.thumb-nav-auto.thumb-nav-auto-N`.\n */\n @property({ type: Number, reflect: true })\n auto?: ThumbnnavAutoColumns;\n\n /**\n * Posizione in overlay all'interno di un contenitore `.position-relative`.\n * Valori: `bottom`, `top`, `left`, `right`.\n */\n @property({ type: String, reflect: true })\n position?: ThumbnnavPosition;\n\n @query('slot') private _slotEl!: HTMLSlotElement;\n\n protected get _items(): ItThumbnavItem[] {\n if (!this._slotEl) return [];\n return this._slotEl\n .assignedElements({ flatten: true })\n .filter((el) => el.tagName === 'IT-THUMBNAV-ITEM') as ItThumbnavItem[];\n }\n\n protected _setChildrenProperties = () => {\n for (const item of this._items) {\n item.role = 'listitem';\n }\n };\n\n protected override updated() {\n this._setChildrenProperties();\n }\n\n override render() {\n const effectiveVertical = this.vertical || this.position === 'left' || this.position === 'right';\n const classes = classMap({\n 'thumb-nav': true,\n 'thumb-nav-small': this.small,\n 'thumb-nav-vertical': effectiveVertical,\n 'thumb-nav-fixed': this.fixed,\n 'thumb-nav-nozoom': this.hover === 'nozoom',\n 'thumb-nav-black': this.hover === 'black',\n 'thumb-nav-primary': this.hover === 'primary',\n 'thumb-nav-auto': this.auto != null,\n [`thumb-nav-auto-${this.auto}`]: this.auto != null,\n 'thumb-nav-bottom': this.position === 'bottom',\n 'thumb-nav-top': this.position === 'top',\n 'thumb-nav-left': this.position === 'left',\n 'thumb-nav-right': this.position === 'right',\n });\n\n return html`<ul class=\"${classes}\" part=\"thumbnav\" role=\"list\">\n <slot @slotchange=${this._setChildrenProperties}></slot>\n </ul>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-thumbnav': ItThumbnav;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA;;;;;;;;;;;AAWG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,aAAa,CAAA;AAAtC,IAAA,WAA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AA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAO5B,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AACb,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAEN,UAAA,CAAA;IAAtB,KAAK,CAAC,MAAM,CAAC;8BAAmB,eAAe;AAAC,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAzCtC,UAAU,GAAA,UAAA,CAAA;IADtB,aAAa,CAAC,aAAa;AACf,CAAA,EAAA,UAAU,CAkFtB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@italia/thumbnav",
|
|
3
3
|
"description": "Web component it-thumbnav del Design system .italia",
|
|
4
|
-
"version": "1.0.0-
|
|
4
|
+
"version": "1.0.0-beta.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"custom-elements.json"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"bootstrap-italia": "3.0.0-
|
|
38
|
+
"bootstrap-italia": "3.0.0-beta.1",
|
|
39
39
|
"lit": "^3.3.0",
|
|
40
|
-
"@italia/globals": "^1.0.0-
|
|
40
|
+
"@italia/globals": "^1.0.0-beta.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@custom-elements-manifest/analyzer": "^0.10.3",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"stylelint": "^16.19.1",
|
|
54
54
|
"tslib": "^2.8.1",
|
|
55
55
|
"typescript": "^5.5.3",
|
|
56
|
-
"@italia/test-config": "^0.0.0",
|
|
57
|
-
"@italia/typescript-config": "^0.0.0"
|
|
56
|
+
"@italia/test-config": "^1.0.0-beta.0",
|
|
57
|
+
"@italia/typescript-config": "^1.0.0-beta.0"
|
|
58
58
|
},
|
|
59
59
|
"customElements": "custom-elements.json",
|
|
60
60
|
"scripts": {
|
package/styles/globals.scss
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
@
|
|
1
|
+
@use 'bootstrap-italia/src/scss/base/config' as *;
|
|
2
|
+
@use 'bootstrap-italia/src/scss/components/thumbnav' as *;
|
|
2
3
|
|
|
3
4
|
// Zoom immagine al passaggio del mouse:
|
|
4
5
|
// non è gestibile da shadow DOM perché richiede di stilizzare
|