@italia/carousel 1.0.0-alpha.8 → 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.
@@ -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', }, render: (args) => renderComponent(args), }"
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: 3, gap: 0, padding: { left: 0, right: 0 }, arrows: false, }, }, }, }, render: (args) => renderComponent(args), }"
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,6 +1,6 @@
1
1
  export { ItCarousel } from './it-carousel.js';
2
2
  export { ItCarouselSlide } from './it-carousel-slide.js';
3
- import '../carousel-Cq0OWp14.js';
3
+ import '../carousel-ZbyU7Mc2.js';
4
4
  import 'lit/directive.js';
5
5
  import 'lit';
6
6
  import 'lit/decorators.js';
@@ -1,4 +1,4 @@
1
- import { s as styles, _ as __decorate, B as BaseComponent } from '../carousel-Cq0OWp14.js';
1
+ import { s as styles, _ as __decorate, B as BaseComponent } from '../carousel-ZbyU7Mc2.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,eA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G,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;IAuBV,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"}
@@ -1,4 +1,4 @@
1
- import { r as registerTranslation, s as styles, _ as __decorate, a as __metadata, b as BaseLocalizedComponent } from '../carousel-Cq0OWp14.js';
1
+ import { r as registerTranslation, s as styles, _ as __decorate, a as __metadata, b as BaseLocalizedComponent } from '../carousel-ZbyU7Mc2.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 baseConfig = CONFIGS[configKey];
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,20 @@ 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
+ }
3861
+ connectedCallback() {
3862
+ super.connectedCallback?.();
3863
+ // The host element is the landmark: it lives in the light DOM together with
3864
+ // the slotted heading, so aria-labelledby can be resolved without
3865
+ // crossing shadow boundaries (which some AT and static tools don't handle).
3866
+ if (!this.hasAttribute('role')) {
3867
+ this.setAttribute('role', 'region');
3868
+ }
3845
3869
  }
3846
3870
  disconnectedCallback() {
3847
3871
  super.disconnectedCallback?.();
@@ -3858,7 +3882,10 @@ let ItCarousel = class ItCarousel extends BaseLocalizedComponent {
3858
3882
  return;
3859
3883
  const id = this.generateId('it-carousel-title');
3860
3884
  _el.setAttribute('id', id);
3861
- this.wrapper.setAttribute('aria-labelledby', id);
3885
+ // Set aria-labelledby on the host (light DOM) rather than on the inner
3886
+ // shadow div, so the ID reference is resolved within the same tree and
3887
+ // is visible to screen readers and static analysis tools alike.
3888
+ this.setAttribute('aria-labelledby', id);
3862
3889
  });
3863
3890
  }
3864
3891
  _sectionClass() {
@@ -3878,8 +3905,7 @@ let ItCarousel = class ItCarousel extends BaseLocalizedComponent {
3878
3905
  return classes.join(' ');
3879
3906
  }
3880
3907
  render() {
3881
- // eslint-disable-next-line lit-a11y/no-redundant-role
3882
- return html `<div class=${this._sectionClass()} role="region">
3908
+ return html `<div class=${this._sectionClass()}>
3883
3909
  <div class="it-header-block">
3884
3910
  <div class="it-header-block-title">
3885
3911
  <slot name="title" @slotchange=${this.handleTitleSlotChange}></slot>
@@ -3960,7 +3986,7 @@ __decorate([
3960
3986
  __metadata("design:type", HTMLSlotElement)
3961
3987
  ], ItCarousel.prototype, "mainSlot", void 0);
3962
3988
  __decorate([
3963
- query$1('div[role="region"]'),
3989
+ query$1('.it-carousel-wrapper'),
3964
3990
  __metadata("design:type", HTMLElement)
3965
3991
  ], ItCarousel.prototype, "wrapper", void 0);
3966
3992
  __decorate([