@italia/carousel 1.0.0-alpha.9 → 1.0.0-beta.1
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 +6 -72
- package/custom-elements.json +9 -9
- package/dist/src/index.js +1 -1
- package/dist/src/it-carousel-slide.js +1 -1
- package/dist/src/it-carousel.d.ts +1 -0
- package/dist/src/it-carousel.d.ts.map +1 -1
- package/dist/src/it-carousel.js +41 -6
- package/dist/src/it-carousel.js.map +1 -1
- package/package.json +26 -26
package/README.md
CHANGED
|
@@ -1,77 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# <it-carousel>
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package is part of [dev-kit-italia](https://italia.github.io/dev-kit-italia), a Web Components kit for the **.italia** design-system.
|
|
4
4
|
|
|
5
|
-
## Installation
|
|
5
|
+
## Installation and usage
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm i @italia/carousel
|
|
9
|
-
npm i @italia/card
|
|
10
|
-
```
|
|
7
|
+
Most users want to install the full kit by installing [`@italia/dev-kit-italia`](https://npmjs.com/package/@italia/dev-kit-italia), but you have the option of installing this single Web Component separately if needed. Please find detailed installation and usage instructions in the [official documentation](https://italia.github.io/dev-kit-italia/?path=/docs/introduzione--documentazione).
|
|
11
8
|
|
|
12
|
-
##
|
|
9
|
+
## Documentation
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
<script type="module">
|
|
16
|
-
import '@italia/carousel';
|
|
17
|
-
import '@italia/card';
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<it-carousel>...</it-carousel>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Linting and formatting
|
|
24
|
-
|
|
25
|
-
To scan the project for linting and formatting errors, run
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm run lint
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
To automatically fix linting and formatting errors, run
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npm run format
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Testing with Web Test Runner
|
|
38
|
-
|
|
39
|
-
To execute a single test run:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
npm run test
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
To run the tests in interactive watch mode run:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
npm run test:watch
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Demoing with Storybook
|
|
52
|
-
|
|
53
|
-
To run a local instance of Storybook for your component, run
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npm run storybook
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
To build a production version of Storybook, run
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
npm run storybook:build
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Tooling configs
|
|
66
|
-
|
|
67
|
-
For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
|
|
68
|
-
|
|
69
|
-
If you customize the configuration a lot, you can consider moving them to individual files.
|
|
70
|
-
|
|
71
|
-
## Local Demo with `web-dev-server`
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
npm start
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
To run a local development server that serves the basic demo located in `demo/index.html`
|
|
11
|
+
Find the usage instructions for this specific component in its [dedicated documentation page](https://italia.github.io/dev-kit-italia/?path=/docs/componenti-carousel--documentazione).
|
package/custom-elements.json
CHANGED
|
@@ -442,7 +442,7 @@
|
|
|
442
442
|
"type": {
|
|
443
443
|
"text": "Meta<any>"
|
|
444
444
|
},
|
|
445
|
-
"default": "{ title: 'Componenti/Carousel', tags: ['
|
|
445
|
+
"default": "{ title: 'Componenti/Carousel', tags: ['web-component', 'a11y-ok'], component: 'it-carousel', args: { arrows: false, autoplay: false, fullscreen: false, separator: false, type: undefined, variant: 'single', config: undefined, title: 'Titolo carousel', }, argTypes: { fullscreen: { control: 'boolean', description: 'Se true, il carousel occupa tutta la larghezza disponibile.', table: { defaultValue: { summary: 'false' } }, }, arrows: { control: 'boolean', description: 'Se true, mostra le frecce di navigazione del carousel.', table: { defaultValue: { summary: 'false' } }, }, separator: { control: 'boolean', description: 'Se true, mostra un separatore verticale tra le slide.', table: { defaultValue: { summary: 'false' } }, }, variant: { control: 'select', description: 'Variante di layout del carousel.', options: VARIANTS, type: 'string', table: { defaultValue: { summary: 'single' } }, }, type: { control: 'select', description: 'Tipo di scorrimento del carousel. Se non specificato, viene usato il default della variante.', options: ['slide', 'loop', 'fade'], type: 'string', table: { defaultValue: { summary: '-' } }, }, autoplay: { control: 'boolean', description: \"Se true, abilita l'autoplay del carousel con modalità \\\"pause\\\" (il carousel avanza automaticamente ma parte in pausa, l'utente deve premere play per avviarlo). Viene renderizzato automaticamente un pulsante di toggle play/pause. Per personalizzare l'intervallo o altre opzioni dell'autoplay, usa config.autoplay.\", table: { defaultValue: { summary: 'false' } }, }, config: { control: false, description: 'Oggetto di configurazione avanzata da passare a Splide. Consulta la documentazione del componente Carousel e quella di Splide v4.x per conoscere le opzioni disponibili.', table: { defaultValue: { summary: '-' } }, }, cardOptions: { table: { disable: true }, }, title: { table: { disable: true }, }, }, parameters: { docs: { source: { excludeDecorators: true, }, }, layout: 'padded', a11y: { config: { rules: [ { id: 'aria-valid-attr-value', // La regola che sta urlando enabled: false, }, ], }, }, }, decorators: [(story) => html`<div style=\"padding:2rem\">${story()}</div>`], }"
|
|
446
446
|
},
|
|
447
447
|
{
|
|
448
448
|
"kind": "variable",
|
|
@@ -458,7 +458,7 @@
|
|
|
458
458
|
"type": {
|
|
459
459
|
"text": "Story"
|
|
460
460
|
},
|
|
461
|
-
"default": "{ name: 'Variante singola', args: { cardOptions: { type: 'inline', }, }, parameters: { docs: { description: { story: 'La variante `single` mostra una sola card alla volta.', }, }, }, render: (args) => renderComponent(args), }"
|
|
461
|
+
"default": "{ name: 'Variante singola', args: { title: 'Variante singola', cardOptions: { type: 'inline', }, }, parameters: { docs: { description: { story: 'La variante `single` mostra una sola card alla volta.', }, }, }, render: (args) => renderComponent(args), }"
|
|
462
462
|
},
|
|
463
463
|
{
|
|
464
464
|
"kind": "variable",
|
|
@@ -466,7 +466,7 @@
|
|
|
466
466
|
"type": {
|
|
467
467
|
"text": "Story"
|
|
468
468
|
},
|
|
469
|
-
"default": "{ name: 'Variante 3 colonne', args: { variant: 'columns', arrows: false, cardOptions: { type: 'simpleCard', }, }, render: (args) => renderComponent(args), }"
|
|
469
|
+
"default": "{ name: 'Variante 3 colonne', args: { variant: 'columns', arrows: false, title: 'Variante 3 colonne', cardOptions: { type: 'simpleCard', }, }, render: (args) => renderComponent(args), }"
|
|
470
470
|
},
|
|
471
471
|
{
|
|
472
472
|
"kind": "variable",
|
|
@@ -474,7 +474,7 @@
|
|
|
474
474
|
"type": {
|
|
475
475
|
"text": "Story"
|
|
476
476
|
},
|
|
477
|
-
"default": "{ name: 'Variante gallery small', args: { variant: 'gallery-sm', arrows: false, cardOptions: { type: 'image', }, title: 'Variante gallery small', }, render: (args) => renderComponent(args), }"
|
|
477
|
+
"default": "{ name: 'Variante gallery small', args: { variant: 'gallery-sm', arrows: false, cardOptions: { type: 'image', }, title: 'Variante gallery small', }, parameters: { layout: 'fullscreen', }, decorators: [ (story) => { if (!document.head.querySelector('#gallery-sm-fix')) { const s = document.createElement('style'); s.id = 'gallery-sm-fix'; s.textContent = '#storybook-root{width:100%!important}'; document.head.appendChild(s); } return html`<div style=\"max-width:1400px;margin:0 auto;\">${story()}</div>`; }, ], render: (args) => renderComponent(args), }"
|
|
478
478
|
},
|
|
479
479
|
{
|
|
480
480
|
"kind": "variable",
|
|
@@ -482,7 +482,7 @@
|
|
|
482
482
|
"type": {
|
|
483
483
|
"text": "Story"
|
|
484
484
|
},
|
|
485
|
-
"default": "{ name: 'Variante gallery large', args: { variant: 'gallery-lg', arrows: false, cardOptions: { type: 'image', }, title: 'Variante gallery large', }, parameters: { layout: 'fullscreen', docs: { story: { inline: false, iframeHeight: 550, }, }, }, decorators: [ (story) => { if (!document.head.querySelector('#gallery-lg-fix')) { const s = document.createElement('style'); s.id = 'gallery-lg-fix'; s.textContent = '#storybook-root{width:100%!important}'; document.head.appendChild(s); } return html`<div style=\"overflow:hidden
|
|
485
|
+
"default": "{ name: 'Variante gallery large', args: { variant: 'gallery-lg', arrows: false, cardOptions: { type: 'image', }, title: 'Variante gallery large', }, parameters: { layout: 'fullscreen', docs: { story: { inline: false, iframeHeight: 550, }, }, }, decorators: [ (story) => { if (!document.head.querySelector('#gallery-lg-fix')) { const s = document.createElement('style'); s.id = 'gallery-lg-fix'; s.textContent = '#storybook-root{width:100%!important}'; document.head.appendChild(s); } return html`<div style=\"max-width:1400px;margin:0 auto;overflow:hidden;\">${story()}</div>`; }, ], render: (args) => renderComponent(args), }"
|
|
486
486
|
},
|
|
487
487
|
{
|
|
488
488
|
"kind": "variable",
|
|
@@ -490,7 +490,7 @@
|
|
|
490
490
|
"type": {
|
|
491
491
|
"text": "Story"
|
|
492
492
|
},
|
|
493
|
-
"default": "{ name: 'Con frecce di navigazione', args: { variant: 'columns', arrows: true, cardOptions: { type: 'cardWithImage', }, }, render: (args) => html` <div style=\"display: flex; flex-direction: column; gap: 4rem;\"> ${renderComponent(args)} ${renderComponent({ ...args, variant: 'single' })} </div> `, }"
|
|
493
|
+
"default": "{ name: 'Con frecce di navigazione', args: { variant: 'columns', arrows: true, cardOptions: { type: 'cardWithImage', }, }, render: (args) => html` <div style=\"display: flex; flex-direction: column; gap: 4rem;\"> ${renderComponent({ ...args, title: 'Carousel 3 colonne con frecce' })} ${renderComponent({ ...args, variant: 'single', title: 'Carousel singolo con frecce' })} </div> `, }"
|
|
494
494
|
},
|
|
495
495
|
{
|
|
496
496
|
"kind": "variable",
|
|
@@ -498,7 +498,7 @@
|
|
|
498
498
|
"type": {
|
|
499
499
|
"text": "Story"
|
|
500
500
|
},
|
|
501
|
-
"default": "{ args: { variant: 'single', arrows: true, fullscreen: true, cardOptions: { type: 'inline', }, }, render: (args) => renderComponent(args), }"
|
|
501
|
+
"default": "{ args: { variant: 'single', arrows: true, fullscreen: true, title: 'Carousel fullscreen', cardOptions: { type: 'inline', }, }, render: (args) => renderComponent(args), }"
|
|
502
502
|
},
|
|
503
503
|
{
|
|
504
504
|
"kind": "variable",
|
|
@@ -506,7 +506,7 @@
|
|
|
506
506
|
"type": {
|
|
507
507
|
"text": "Story"
|
|
508
508
|
},
|
|
509
|
-
"default": "{ name: 'Con separatore tra le slide', args: { variant: 'columns', separator: true, cardOptions: { type: 'inline', }, }, render: (args) => renderComponent(args), }"
|
|
509
|
+
"default": "{ name: 'Con separatore tra le slide', args: { variant: 'columns', separator: true, title: 'Carousel con separatore', cardOptions: { type: 'inline', }, }, render: (args) => renderComponent(args), }"
|
|
510
510
|
},
|
|
511
511
|
{
|
|
512
512
|
"kind": "variable",
|
|
@@ -530,7 +530,7 @@
|
|
|
530
530
|
"type": {
|
|
531
531
|
"text": "Story"
|
|
532
532
|
},
|
|
533
|
-
"default": "{ name: 'Configurazione avanzata di Splide', args: { variant: 'columns', cardOptions: { type: 'cardWithImage', }, config: { type: 'loop', autoplay: 'pause', interval: 3000, pauseOnHover: true, resetProgress: false, perPage: 2, arrows: true, gap: 16, padding: { left: 8, right: 8 }, breakpoints: { 560: { perPage: 1, gap: 0, padding: { left: 24, right: 24 }, arrows: false, }, 768: { perPage: 2, gap: 0, padding: { left: 0, right: 0 }, arrows: false, }, 992: { perPage:
|
|
533
|
+
"default": "{ name: 'Configurazione avanzata di Splide', args: { variant: 'columns', title: 'Configurazione avanzata Splide', cardOptions: { type: 'cardWithImage', }, config: { type: 'loop', autoplay: 'pause', interval: 3000, pauseOnHover: true, resetProgress: false, perPage: 2, arrows: true, gap: 16, padding: { left: 8, right: 8 }, breakpoints: { 560: { perPage: 1, gap: 0, padding: { left: 24, right: 24 }, arrows: false, }, 768: { perPage: 2, gap: 0, padding: { left: 0, right: 0 }, arrows: false, }, 992: { perPage: 2, gap: 0, padding: { left: 0, right: 0 }, arrows: false, }, }, }, }, render: (args) => renderComponent(args), }"
|
|
534
534
|
},
|
|
535
535
|
{
|
|
536
536
|
"kind": "variable",
|
package/dist/src/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as styles, _ as __decorate, B as BaseComponent } from '../carousel-
|
|
1
|
+
import { s as styles, _ as __decorate, B as BaseComponent } from '../carousel-Dw2eJSN2.js';
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { customElement } from 'lit/decorators.js';
|
|
4
4
|
import 'lit/directive.js';
|
|
@@ -62,6 +62,7 @@ export declare class ItCarousel extends BaseLocalizedComponent {
|
|
|
62
62
|
* - `pagination-dot` – each individual dot `<button>`
|
|
63
63
|
*/
|
|
64
64
|
private _applyParts;
|
|
65
|
+
connectedCallback(): void;
|
|
65
66
|
disconnectedCallback(): void;
|
|
66
67
|
private handleTitleSlotChange;
|
|
67
68
|
private _sectionClass;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-carousel.d.ts","sourceRoot":"","sources":["../../src/it-carousel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAKzD,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAQtE;;;;;;;;;GASG;AACH,qBACa,UAAW,SAAQ,sBAAsB;IACpD,MAAM,CAAC,MAAM,+BAAU;IAGvB,MAAM,CAAC,EAAE,OAAO,CAAM;IAGtB,OAAO,EAAE,gBAAgB,CAAY;IAGrC,UAAU,CAAC,EAAE,OAAO,CAAS;IAG7B,MAAM,EAAE,OAAO,CAAS;IAGxB,SAAS,EAAE,OAAO,CAAS;IAE3B;;;;;OAKG;IAEH,IAAI,CAAC,EAAE,YAAY,CAAC;IAEpB;;;;;OAKG;IAEH,QAAQ,EAAE,OAAO,CAAS;IAG1B,aAAa,EAAG,WAAW,EAAE,CAAC;IAG9B,QAAQ,EAAG,eAAe,CAAC;IAG3B,OAAO,EAAG,WAAW,CAAC;IAGtB,IAAI,EAAG,WAAW,CAAC;IAGnB,OAAO,CAAC,cAAc,CAAS;IAE/B,OAAO,CAAC,OAAO,CAAC,CAAS;IAElB,aAAa;IAIb,YAAY;IAOnB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"it-carousel.d.ts","sourceRoot":"","sources":["../../src/it-carousel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAKzD,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAQtE;;;;;;;;;GASG;AACH,qBACa,UAAW,SAAQ,sBAAsB;IACpD,MAAM,CAAC,MAAM,+BAAU;IAGvB,MAAM,CAAC,EAAE,OAAO,CAAM;IAGtB,OAAO,EAAE,gBAAgB,CAAY;IAGrC,UAAU,CAAC,EAAE,OAAO,CAAS;IAG7B,MAAM,EAAE,OAAO,CAAS;IAGxB,SAAS,EAAE,OAAO,CAAS;IAE3B;;;;;OAKG;IAEH,IAAI,CAAC,EAAE,YAAY,CAAC;IAEpB;;;;;OAKG;IAEH,QAAQ,EAAE,OAAO,CAAS;IAG1B,aAAa,EAAG,WAAW,EAAE,CAAC;IAG9B,QAAQ,EAAG,eAAe,CAAC;IAG3B,OAAO,EAAG,WAAW,CAAC;IAGtB,IAAI,EAAG,WAAW,CAAC;IAGnB,OAAO,CAAC,cAAc,CAAS;IAE/B,OAAO,CAAC,OAAO,CAAC,CAAS;IAElB,aAAa;IAIb,YAAY;IAOnB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,WAAW;IA8GnB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAapB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,WAAW;IAgCV,iBAAiB;IAUjB,oBAAoB;IAK7B,OAAO,CAAC,qBAAqB;IAmB7B,OAAO,CAAC,aAAa;IAeZ,MAAM;CA+ChB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
package/dist/src/it-carousel.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerTranslation, s as styles, _ as __decorate, a as __metadata, b as BaseLocalizedComponent } from '../carousel-
|
|
1
|
+
import { r as registerTranslation, s as styles, _ as __decorate, a as __metadata, b as BaseLocalizedComponent } from '../carousel-Dw2eJSN2.js';
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { property, queryAssignedElements, query as query$1, state, customElement } from 'lit/decorators.js';
|
|
4
4
|
import { when } from 'lit/directives/when.js';
|
|
@@ -3721,7 +3721,16 @@ let ItCarousel = class ItCarousel extends BaseLocalizedComponent {
|
|
|
3721
3721
|
if (!this.wrapper)
|
|
3722
3722
|
return;
|
|
3723
3723
|
const { configKey } = VARIANT_MAP[this.variant];
|
|
3724
|
-
const
|
|
3724
|
+
const effectiveConfigKey = this.arrows && this.variant === 'columns'
|
|
3725
|
+
? 'it-carousel-landscape-abstract-three-cols-arrow-visible'
|
|
3726
|
+
: configKey;
|
|
3727
|
+
const baseConfig = CONFIGS[effectiveConfigKey];
|
|
3728
|
+
// When arrows are explicitly enabled by the consumer, ensure no breakpoint
|
|
3729
|
+
// can silently override them back to false — breakpoint configs only
|
|
3730
|
+
// carry arrows:false as an opinionated default, not a hard constraint.
|
|
3731
|
+
const breakpoints = this.arrows && baseConfig.breakpoints
|
|
3732
|
+
? Object.fromEntries(Object.entries(baseConfig.breakpoints).map(([bp, opts]) => [bp, { ...opts, arrows: true }]))
|
|
3733
|
+
: baseConfig.breakpoints;
|
|
3725
3734
|
const splideI18n = {
|
|
3726
3735
|
prev: this.$t('carousel_prev'),
|
|
3727
3736
|
next: this.$t('carousel_next'),
|
|
@@ -3738,6 +3747,7 @@ let ItCarousel = class ItCarousel extends BaseLocalizedComponent {
|
|
|
3738
3747
|
};
|
|
3739
3748
|
this._splide = new Splide(this.wrapper, {
|
|
3740
3749
|
...baseConfig,
|
|
3750
|
+
...(breakpoints ? { breakpoints } : {}),
|
|
3741
3751
|
...(this.type ? { type: this.type } : {}),
|
|
3742
3752
|
arrows: this.arrows,
|
|
3743
3753
|
...(this.autoplay
|
|
@@ -3842,6 +3852,29 @@ let ItCarousel = class ItCarousel extends BaseLocalizedComponent {
|
|
|
3842
3852
|
root.querySelectorAll('.splide__pagination__page').forEach((btn) => {
|
|
3843
3853
|
btn.setAttribute('part', 'pagination-dot');
|
|
3844
3854
|
});
|
|
3855
|
+
// Splide adds role="region" to its root div on mount. The host element already
|
|
3856
|
+
// carries role="region" with a proper accessible name (see connectedCallback and
|
|
3857
|
+
// handleTitleSlotChange), so the inner div's landmark role is redundant and would
|
|
3858
|
+
// cause a landmark-unique Axe violation. Demote it to a generic container.
|
|
3859
|
+
this.wrapper?.setAttribute('role', 'presentation');
|
|
3860
|
+
// Splide also sets aria-roledescription on the same div, but per the ARIA spec
|
|
3861
|
+
// aria-roledescription has no effect (and shouldn't be used) on an element with
|
|
3862
|
+
// role="presentation": the element is removed from the accessibility tree, so
|
|
3863
|
+
// the roledescription would never be announced. Move it to the host, where the
|
|
3864
|
+
// "region" landmark actually lives, for consistency with Bootstrap Italia.
|
|
3865
|
+
this.wrapper?.removeAttribute('aria-roledescription');
|
|
3866
|
+
if (!this.hasAttribute('aria-roledescription')) {
|
|
3867
|
+
this.setAttribute('aria-roledescription', this.$t('carousel_carousel'));
|
|
3868
|
+
}
|
|
3869
|
+
}
|
|
3870
|
+
connectedCallback() {
|
|
3871
|
+
super.connectedCallback?.();
|
|
3872
|
+
// The host element is the landmark: it lives in the light DOM together with
|
|
3873
|
+
// the slotted heading, so aria-labelledby can be resolved without
|
|
3874
|
+
// crossing shadow boundaries (which some AT and static tools don't handle).
|
|
3875
|
+
if (!this.hasAttribute('role')) {
|
|
3876
|
+
this.setAttribute('role', 'region');
|
|
3877
|
+
}
|
|
3845
3878
|
}
|
|
3846
3879
|
disconnectedCallback() {
|
|
3847
3880
|
super.disconnectedCallback?.();
|
|
@@ -3858,7 +3891,10 @@ let ItCarousel = class ItCarousel extends BaseLocalizedComponent {
|
|
|
3858
3891
|
return;
|
|
3859
3892
|
const id = this.generateId('it-carousel-title');
|
|
3860
3893
|
_el.setAttribute('id', id);
|
|
3861
|
-
|
|
3894
|
+
// Set aria-labelledby on the host (light DOM) rather than on the inner
|
|
3895
|
+
// shadow div, so the ID reference is resolved within the same tree and
|
|
3896
|
+
// is visible to screen readers and static analysis tools alike.
|
|
3897
|
+
this.setAttribute('aria-labelledby', id);
|
|
3862
3898
|
});
|
|
3863
3899
|
}
|
|
3864
3900
|
_sectionClass() {
|
|
@@ -3878,8 +3914,7 @@ let ItCarousel = class ItCarousel extends BaseLocalizedComponent {
|
|
|
3878
3914
|
return classes.join(' ');
|
|
3879
3915
|
}
|
|
3880
3916
|
render() {
|
|
3881
|
-
|
|
3882
|
-
return html `<div class=${this._sectionClass()} role="region">
|
|
3917
|
+
return html `<div class=${this._sectionClass()}>
|
|
3883
3918
|
<div class="it-header-block">
|
|
3884
3919
|
<div class="it-header-block-title">
|
|
3885
3920
|
<slot name="title" @slotchange=${this.handleTitleSlotChange}></slot>
|
|
@@ -3960,7 +3995,7 @@ __decorate([
|
|
|
3960
3995
|
__metadata("design:type", HTMLSlotElement)
|
|
3961
3996
|
], ItCarousel.prototype, "mainSlot", void 0);
|
|
3962
3997
|
__decorate([
|
|
3963
|
-
query$1('
|
|
3998
|
+
query$1('.it-carousel-wrapper'),
|
|
3964
3999
|
__metadata("design:type", HTMLElement)
|
|
3965
4000
|
], ItCarousel.prototype, "wrapper", void 0);
|
|
3966
4001
|
__decorate([
|