@zanichelli/albe-web-components 20.0.2 → 21.0.0-RC2
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/dist/cjs/dialog-polyfill.esm-D8Polhcd.js +863 -0
- package/dist/cjs/dialog-polyfill.esm-D8Polhcd.js.map +1 -0
- package/dist/cjs/hammer-CJF2Ixtg.js +2665 -0
- package/dist/cjs/hammer-CJF2Ixtg.js.map +1 -0
- package/dist/cjs/index-CZz7uP-M.js +6 -6
- package/dist/cjs/z-app-header_12.cjs.entry.js +7 -1
- package/dist/cjs/z-app-header_12.cjs.entry.js.map +1 -1
- package/dist/cjs/z-dragdrop-area_2.cjs.entry.js +8 -862
- package/dist/cjs/z-dragdrop-area_2.cjs.entry.js.map +1 -1
- package/dist/cjs/z-toast-notification.cjs.entry.js +7 -2657
- package/dist/cjs/z-toast-notification.cjs.entry.js.map +1 -1
- package/dist/collection/components/z-input/index.js +7 -1
- package/dist/collection/components/z-input/index.js.map +1 -1
- package/dist/collection/components/z-modal/index.js +8 -6
- package/dist/collection/components/z-modal/index.js.map +1 -1
- package/dist/collection/components/z-toast-notification/index.js +7 -5
- package/dist/collection/components/z-toast-notification/index.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/{utils.js → p-8C_CrFxp.js} +3 -3
- package/dist/components/p-B3VFztJH.js +6 -0
- package/dist/components/p-B5U9pSXR.js +2 -0
- package/dist/components/{index14.js.map → p-B5U9pSXR.js.map} +1 -1
- package/dist/components/p-B6jtvVtV.js +2 -0
- package/dist/components/{utils2.js.map → p-B6jtvVtV.js.map} +1 -1
- package/dist/components/{_commonjsHelpers.js → p-B85MJLTf.js} +1 -1
- package/dist/components/p-BAguKZnb.js +2 -0
- package/dist/components/{index4.js.map → p-BAguKZnb.js.map} +1 -1
- package/dist/components/p-BRkq64wS.js +2 -0
- package/dist/components/p-BRkq64wS.js.map +1 -0
- package/dist/components/p-BeSVHdId.js +2 -0
- package/dist/components/{index9.js.map → p-BeSVHdId.js.map} +1 -1
- package/dist/components/p-Bj8MyegH.js +2 -0
- package/dist/components/{index18.js.map → p-Bj8MyegH.js.map} +1 -1
- package/dist/components/p-BoiZb7m1.js +2 -0
- package/dist/components/{index13.js.map → p-BoiZb7m1.js.map} +1 -1
- package/dist/components/p-BolVsvfr.js +2 -0
- package/dist/components/{index5.js.map → p-BolVsvfr.js.map} +1 -1
- package/dist/components/p-Bt1M0wUw.js +7 -0
- package/dist/components/p-Bt1M0wUw.js.map +1 -0
- package/dist/components/p-BvCsF6Eq.js +2 -0
- package/dist/components/p-BvCsF6Eq.js.map +1 -0
- package/dist/components/p-CGSP8diU.js +2 -0
- package/dist/components/{index15.js.map → p-CGSP8diU.js.map} +1 -1
- package/dist/components/p-CJjo0ntH.js +2 -0
- package/dist/components/{index12.js.map → p-CJjo0ntH.js.map} +1 -1
- package/dist/components/p-CaSvyuw6.js +2 -0
- package/dist/components/{index17.js.map → p-CaSvyuw6.js.map} +1 -1
- package/dist/components/p-CbXEdwLi.js +2 -0
- package/dist/components/{index3.js.map → p-CbXEdwLi.js.map} +1 -1
- package/dist/components/p-CdBqnUF6.js +2 -0
- package/dist/components/{index7.js.map → p-CdBqnUF6.js.map} +1 -1
- package/dist/components/p-Ch6o4_VN.js +2 -0
- package/dist/components/{index21.js.map → p-Ch6o4_VN.js.map} +1 -1
- package/dist/components/{iconset.js → p-D1c5gR45.js} +1 -1
- package/dist/components/p-D8wde41u.js +2 -0
- package/dist/components/{index16.js.map → p-D8wde41u.js.map} +1 -1
- package/dist/components/p-DL2QAfIP.js +2 -0
- package/dist/components/{index11.js.map → p-DL2QAfIP.js.map} +1 -1
- package/dist/components/{index2.js → p-DdetsoIY.js} +1 -1
- package/dist/components/p-LXvmZzZa.js +2 -0
- package/dist/components/p-LXvmZzZa.js.map +1 -0
- package/dist/components/{breakpoints.js → p-Q-tWjk7P.js} +1 -1
- package/dist/components/p-RmbDDbWd.js +2 -0
- package/dist/components/p-RmbDDbWd.js.map +1 -0
- package/dist/components/p-VP75-vje.js +2 -0
- package/dist/components/{index19.js.map → p-VP75-vje.js.map} +1 -1
- package/dist/components/p-cpTAMdcF.js +2 -0
- package/dist/components/{index8.js.map → p-cpTAMdcF.js.map} +1 -1
- package/dist/components/p-mphirYN3.js +2 -0
- package/dist/components/{index10.js.map → p-mphirYN3.js.map} +1 -1
- package/dist/components/z-accordion.js +1 -1
- package/dist/components/z-accordion.js.map +1 -1
- package/dist/components/z-anchor-navigation.js +1 -1
- package/dist/components/z-anchor-navigation.js.map +1 -1
- package/dist/components/z-app-header.js +1 -1
- package/dist/components/z-app-header.js.map +1 -1
- package/dist/components/z-aria-alert.js +1 -1
- package/dist/components/z-aria-alert.js.map +1 -1
- package/dist/components/z-avatar.js +1 -1
- package/dist/components/z-avatar.js.map +1 -1
- package/dist/components/z-book-card-app.js +1 -1
- package/dist/components/z-book-card-app.js.map +1 -1
- package/dist/components/z-book-card.js +1 -1
- package/dist/components/z-book-card.js.map +1 -1
- package/dist/components/z-book-cover.js +1 -1
- package/dist/components/z-breadcrumb.js +1 -1
- package/dist/components/z-breadcrumb.js.map +1 -1
- package/dist/components/z-button-sort.js +1 -1
- package/dist/components/z-button-sort.js.map +1 -1
- package/dist/components/z-button.js +1 -1
- package/dist/components/z-card.js +1 -1
- package/dist/components/z-card.js.map +1 -1
- package/dist/components/z-carousel.js +1 -1
- package/dist/components/z-carousel.js.map +1 -1
- package/dist/components/z-chip.js +1 -1
- package/dist/components/z-color-picker.js +1 -1
- package/dist/components/z-color-picker.js.map +1 -1
- package/dist/components/z-combobox.js +1 -1
- package/dist/components/z-combobox.js.map +1 -1
- package/dist/components/z-cover-hero.js +1 -1
- package/dist/components/z-cover-hero.js.map +1 -1
- package/dist/components/z-date-picker.js +2 -2
- package/dist/components/z-date-picker.js.map +1 -1
- package/dist/components/z-divider.js +1 -1
- package/dist/components/z-dragdrop-area.js +1 -1
- package/dist/components/z-file-upload.js +1 -1
- package/dist/components/z-file-upload.js.map +1 -1
- package/dist/components/z-file.js +1 -1
- package/dist/components/z-file.js.map +1 -1
- package/dist/components/z-ghost-loading.js +1 -1
- package/dist/components/z-icon.js +1 -1
- package/dist/components/z-info-box.js +1 -1
- package/dist/components/z-info-box.js.map +1 -1
- package/dist/components/z-info-reveal.js +1 -1
- package/dist/components/z-input-message.js +1 -1
- package/dist/components/z-input-range.js +1 -1
- package/dist/components/z-input-range.js.map +1 -1
- package/dist/components/z-input.js +1 -1
- package/dist/components/z-list-element.js +1 -1
- package/dist/components/z-list-group.js +1 -1
- package/dist/components/z-list.js +1 -1
- package/dist/components/z-logo.js +1 -1
- package/dist/components/z-logo.js.map +1 -1
- package/dist/components/z-menu-section.js +1 -1
- package/dist/components/z-menu-section.js.map +1 -1
- package/dist/components/z-menu.js +1 -1
- package/dist/components/z-menu.js.map +1 -1
- package/dist/components/z-modal.js +1 -1
- package/dist/components/z-navigation-tabs.js +1 -1
- package/dist/components/z-navigation-tabs.js.map +1 -1
- package/dist/components/z-notification.js +1 -1
- package/dist/components/z-notification.js.map +1 -1
- package/dist/components/z-offcanvas.js +1 -1
- package/dist/components/z-pagination.js +1 -1
- package/dist/components/z-pagination.js.map +1 -1
- package/dist/components/z-popover.js +1 -1
- package/dist/components/z-range-picker.js +1 -1
- package/dist/components/z-range-picker.js.map +1 -1
- package/dist/components/z-result-card.js +1 -1
- package/dist/components/z-result-card.js.map +1 -1
- package/dist/components/z-searchbar.js +1 -1
- package/dist/components/z-select.js +1 -1
- package/dist/components/z-select.js.map +1 -1
- package/dist/components/z-skip-to-content.js +1 -1
- package/dist/components/z-skip-to-content.js.map +1 -1
- package/dist/components/z-stepper-item.js +1 -1
- package/dist/components/z-stepper-item.js.map +1 -1
- package/dist/components/z-stepper.js +1 -1
- package/dist/components/z-stepper.js.map +1 -1
- package/dist/components/z-table.js +1 -1
- package/dist/components/z-table.js.map +1 -1
- package/dist/components/z-tag.js +1 -1
- package/dist/components/z-tbody.js +1 -1
- package/dist/components/z-tbody.js.map +1 -1
- package/dist/components/z-td.js +1 -1
- package/dist/components/z-td.js.map +1 -1
- package/dist/components/z-tfoot.js +1 -1
- package/dist/components/z-tfoot.js.map +1 -1
- package/dist/components/z-th.js +1 -1
- package/dist/components/z-th.js.map +1 -1
- package/dist/components/z-thead.js +1 -1
- package/dist/components/z-thead.js.map +1 -1
- package/dist/components/z-toast-notification-list.js +1 -1
- package/dist/components/z-toast-notification-list.js.map +1 -1
- package/dist/components/z-toast-notification.js +2 -7
- package/dist/components/z-toast-notification.js.map +1 -1
- package/dist/components/z-toggle-switch.js +1 -1
- package/dist/components/z-toggle-switch.js.map +1 -1
- package/dist/components/z-tool.js +1 -1
- package/dist/components/z-tool.js.map +1 -1
- package/dist/components/z-toolbar.js +1 -1
- package/dist/components/z-toolbar.js.map +1 -1
- package/dist/components/z-tooltip.js +1 -1
- package/dist/components/z-tr.js +1 -1
- package/dist/components/z-tr.js.map +1 -1
- package/dist/components/z-tree-list.js +1 -1
- package/dist/components/z-tree-list.js.map +1 -1
- package/dist/components/z-visually-hidden.js +1 -1
- package/dist/components/z-visually-hidden.js.map +1 -1
- package/dist/esm/dialog-polyfill.esm-BRkq64wS.js +861 -0
- package/dist/esm/dialog-polyfill.esm-BRkq64wS.js.map +1 -0
- package/dist/esm/hammer-C3JqVNyx.js +2663 -0
- package/dist/esm/hammer-C3JqVNyx.js.map +1 -0
- package/dist/esm/index-BcDWN4F1.js +6 -6
- package/dist/esm/z-app-header_12.entry.js +7 -1
- package/dist/esm/z-app-header_12.entry.js.map +1 -1
- package/dist/esm/z-dragdrop-area_2.entry.js +8 -862
- package/dist/esm/z-dragdrop-area_2.entry.js.map +1 -1
- package/dist/esm/z-toast-notification.entry.js +7 -2657
- package/dist/esm/z-toast-notification.entry.js.map +1 -1
- package/dist/types/components/z-input/index.d.ts +1 -0
- package/dist/types/components/z-modal/index.d.ts +1 -1
- package/dist/web-components-library/p-67051e01.entry.js +3 -0
- package/dist/web-components-library/p-67051e01.entry.js.map +1 -0
- package/dist/web-components-library/p-BRkq64wS.js +2 -0
- package/dist/web-components-library/p-BRkq64wS.js.map +1 -0
- package/dist/web-components-library/p-Bt1M0wUw.js +7 -0
- package/dist/web-components-library/p-Bt1M0wUw.js.map +1 -0
- package/dist/web-components-library/p-c3f69ac9.entry.js +2 -0
- package/dist/web-components-library/p-c3f69ac9.entry.js.map +1 -0
- package/dist/web-components-library/p-e2eea612.entry.js +2 -0
- package/dist/web-components-library/p-e2eea612.entry.js.map +1 -0
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/package.json +9 -4
- package/react/components.d.ts +68 -66
- package/react/components.js +134 -69
- package/react/z-accordion.d.ts +12 -0
- package/react/z-accordion.js +18 -0
- package/react/z-anchor-navigation.d.ts +9 -0
- package/react/z-anchor-navigation.js +18 -0
- package/react/z-app-header.d.ts +12 -0
- package/react/z-app-header.js +18 -0
- package/react/z-aria-alert.d.ts +9 -0
- package/react/z-aria-alert.js +18 -0
- package/react/z-avatar.d.ts +9 -0
- package/react/z-avatar.js +18 -0
- package/react/z-book-card-app.d.ts +12 -0
- package/react/z-book-card-app.js +18 -0
- package/react/z-book-card.d.ts +14 -0
- package/react/z-book-card.js +22 -0
- package/react/z-book-cover.d.ts +9 -0
- package/react/z-book-cover.js +18 -0
- package/react/z-breadcrumb.d.ts +12 -0
- package/react/z-breadcrumb.js +18 -0
- package/react/z-button-sort.d.ts +12 -0
- package/react/z-button-sort.js +18 -0
- package/react/z-button.d.ts +9 -0
- package/react/z-button.js +18 -0
- package/react/z-card.d.ts +9 -0
- package/react/z-card.js +18 -0
- package/react/z-carousel.d.ts +14 -0
- package/react/z-carousel.js +18 -0
- package/react/z-chip.d.ts +12 -0
- package/react/z-chip.js +18 -0
- package/react/z-color-picker.d.ts +12 -0
- package/react/z-color-picker.js +18 -0
- package/react/z-combobox.d.ts +12 -0
- package/react/z-combobox.js +18 -0
- package/react/z-cover-hero.d.ts +9 -0
- package/react/z-cover-hero.js +18 -0
- package/react/z-date-picker.d.ts +12 -0
- package/react/z-date-picker.js +18 -0
- package/react/z-divider.d.ts +9 -0
- package/react/z-divider.js +18 -0
- package/react/z-dragdrop-area.d.ts +12 -0
- package/react/z-dragdrop-area.js +18 -0
- package/react/z-file-upload.d.ts +16 -0
- package/react/z-file-upload.js +21 -0
- package/react/z-file.d.ts +12 -0
- package/react/z-file.js +18 -0
- package/react/z-ghost-loading.d.ts +9 -0
- package/react/z-ghost-loading.js +18 -0
- package/react/z-icon.d.ts +9 -0
- package/react/z-icon.js +18 -0
- package/react/z-info-box.d.ts +14 -0
- package/react/z-info-box.js +18 -0
- package/react/z-info-reveal.d.ts +9 -0
- package/react/z-info-reveal.js +18 -0
- package/react/z-input-message.d.ts +9 -0
- package/react/z-input-message.js +18 -0
- package/react/z-input-range.d.ts +13 -0
- package/react/z-input-range.js +21 -0
- package/react/z-input.d.ts +17 -0
- package/react/z-input.js +25 -0
- package/react/z-list-element.d.ts +14 -0
- package/react/z-list-element.js +22 -0
- package/react/z-list-group.d.ts +9 -0
- package/react/z-list-group.js +18 -0
- package/react/z-list.d.ts +9 -0
- package/react/z-list.js +18 -0
- package/react/z-logo.d.ts +9 -0
- package/react/z-logo.js +18 -0
- package/react/z-menu-section.d.ts +13 -0
- package/react/z-menu-section.js +21 -0
- package/react/z-menu.d.ts +13 -0
- package/react/z-menu.js +21 -0
- package/react/z-modal.d.ts +14 -0
- package/react/z-modal.js +22 -0
- package/react/z-navigation-tabs.d.ts +12 -0
- package/react/z-navigation-tabs.js +18 -0
- package/react/z-notification.d.ts +13 -0
- package/react/z-notification.js +21 -0
- package/react/z-offcanvas.d.ts +12 -0
- package/react/z-offcanvas.js +18 -0
- package/react/z-pagination.d.ts +12 -0
- package/react/z-pagination.js +18 -0
- package/react/z-popover.d.ts +17 -0
- package/react/z-popover.js +21 -0
- package/react/z-range-picker.d.ts +12 -0
- package/react/z-range-picker.js +18 -0
- package/react/z-result-card.d.ts +9 -0
- package/react/z-result-card.js +18 -0
- package/react/z-searchbar.d.ts +14 -0
- package/react/z-searchbar.js +22 -0
- package/react/z-select.d.ts +13 -0
- package/react/z-select.js +21 -0
- package/react/z-skip-to-content.d.ts +9 -0
- package/react/z-skip-to-content.js +18 -0
- package/react/z-stepper-item.d.ts +9 -0
- package/react/z-stepper-item.js +18 -0
- package/react/z-stepper.d.ts +9 -0
- package/react/z-stepper.js +18 -0
- package/react/z-table.d.ts +9 -0
- package/react/z-table.js +18 -0
- package/react/z-tag.d.ts +9 -0
- package/react/z-tag.js +18 -0
- package/react/z-tbody.d.ts +9 -0
- package/react/z-tbody.js +18 -0
- package/react/z-td.d.ts +12 -0
- package/react/z-td.js +18 -0
- package/react/z-tfoot.d.ts +9 -0
- package/react/z-tfoot.js +18 -0
- package/react/z-th.d.ts +12 -0
- package/react/z-th.js +18 -0
- package/react/z-thead.d.ts +9 -0
- package/react/z-thead.js +18 -0
- package/react/z-toast-notification-list.d.ts +9 -0
- package/react/z-toast-notification-list.js +18 -0
- package/react/z-toast-notification.d.ts +12 -0
- package/react/z-toast-notification.js +18 -0
- package/react/z-toggle-switch.d.ts +12 -0
- package/react/z-toggle-switch.js +18 -0
- package/react/z-tool.d.ts +13 -0
- package/react/z-tool.js +21 -0
- package/react/z-toolbar.d.ts +9 -0
- package/react/z-toolbar.js +18 -0
- package/react/z-tooltip.d.ts +14 -0
- package/react/z-tooltip.js +18 -0
- package/react/z-tr.d.ts +12 -0
- package/react/z-tr.js +18 -0
- package/react/z-tree-list.d.ts +16 -0
- package/react/z-tree-list.js +18 -0
- package/react/z-visually-hidden.d.ts +9 -0
- package/react/z-visually-hidden.js +18 -0
- package/readme.md +7 -4
- package/www/build/{p-9a93e186.js → p-3ddbf8a7.js} +1 -1
- package/www/build/p-67051e01.entry.js +3 -0
- package/www/build/p-67051e01.entry.js.map +1 -0
- package/www/build/p-BRkq64wS.js +2 -0
- package/www/build/p-BRkq64wS.js.map +1 -0
- package/www/build/p-Bt1M0wUw.js +7 -0
- package/www/build/p-Bt1M0wUw.js.map +1 -0
- package/www/build/p-c3f69ac9.entry.js +2 -0
- package/www/build/p-c3f69ac9.entry.js.map +1 -0
- package/www/build/p-e2eea612.entry.js +2 -0
- package/www/build/p-e2eea612.entry.js.map +1 -0
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +1 -1
- package/dist/components/index10.js +0 -2
- package/dist/components/index11.js +0 -2
- package/dist/components/index12.js +0 -2
- package/dist/components/index13.js +0 -2
- package/dist/components/index14.js +0 -2
- package/dist/components/index15.js +0 -2
- package/dist/components/index16.js +0 -2
- package/dist/components/index17.js +0 -2
- package/dist/components/index18.js +0 -2
- package/dist/components/index19.js +0 -2
- package/dist/components/index20.js +0 -2
- package/dist/components/index20.js.map +0 -1
- package/dist/components/index21.js +0 -2
- package/dist/components/index3.js +0 -2
- package/dist/components/index4.js +0 -2
- package/dist/components/index5.js +0 -2
- package/dist/components/index6.js +0 -2
- package/dist/components/index6.js.map +0 -1
- package/dist/components/index7.js +0 -2
- package/dist/components/index8.js +0 -2
- package/dist/components/index9.js +0 -2
- package/dist/components/reactive-controller.js +0 -6
- package/dist/components/utils2.js +0 -2
- package/dist/web-components-library/p-1fad41b2.entry.js +0 -2
- package/dist/web-components-library/p-1fad41b2.entry.js.map +0 -1
- package/dist/web-components-library/p-baa35a6e.entry.js +0 -2
- package/dist/web-components-library/p-baa35a6e.entry.js.map +0 -1
- package/dist/web-components-library/p-ea96790b.entry.js +0 -8
- package/dist/web-components-library/p-ea96790b.entry.js.map +0 -1
- package/react/react-component-lib/createComponent.d.ts +0 -10
- package/react/react-component-lib/createComponent.js +0 -101
- package/react/react-component-lib/createOverlayComponent.d.ts +0 -21
- package/react/react-component-lib/createOverlayComponent.js +0 -115
- package/react/react-component-lib/index.d.ts +0 -2
- package/react/react-component-lib/index.js +0 -7
- package/react/react-component-lib/interfaces.d.ts +0 -29
- package/react/react-component-lib/interfaces.js +0 -2
- package/react/react-component-lib/utils/attachProps.d.ts +0 -16
- package/react/react-component-lib/utils/attachProps.js +0 -115
- package/react/react-component-lib/utils/case.d.ts +0 -2
- package/react/react-component-lib/utils/case.js +0 -11
- package/react/react-component-lib/utils/dev.d.ts +0 -2
- package/react/react-component-lib/utils/dev.js +0 -17
- package/react/react-component-lib/utils/index.d.ts +0 -10
- package/react/react-component-lib/utils/index.js +0 -55
- package/www/build/p-1fad41b2.entry.js +0 -2
- package/www/build/p-1fad41b2.entry.js.map +0 -1
- package/www/build/p-baa35a6e.entry.js +0 -2
- package/www/build/p-baa35a6e.entry.js.map +0 -1
- package/www/build/p-ea96790b.entry.js +0 -8
- package/www/build/p-ea96790b.entry.js.map +0 -1
- /package/dist/components/{utils.js.map → p-8C_CrFxp.js.map} +0 -0
- /package/dist/components/{reactive-controller.js.map → p-B3VFztJH.js.map} +0 -0
- /package/dist/components/{_commonjsHelpers.js.map → p-B85MJLTf.js.map} +0 -0
- /package/dist/components/{iconset.js.map → p-D1c5gR45.js.map} +0 -0
- /package/dist/components/{index2.js.map → p-DdetsoIY.js.map} +0 -0
- /package/dist/components/{breakpoints.js.map → p-Q-tWjk7P.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,createEvent as i,h as n,Host as o,transformTag as s}from"@stencil/core/internal/client";import{U as a,V as r,B as l}from"./index2.js";import{d as h}from"./index4.js";import{d as f}from"./index17.js";import{d as g}from"./index3.js";const d=()=>`:host{--z-carousel-gutter:0;font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host([single]){display:flex;flex-direction:column;align-items:center;justify-content:center}:host([single]) .z-carousel-container{width:fit-content;max-width:100%}.z-carousel-container{display:flex;flex-direction:column}.z-carousel-title{margin-bottom:calc(var(--space-unit) * 2)}.z-carousel-wrapper{position:relative}.z-carousel-items-container{display:flex;max-width:100%;flex-direction:row;margin:0;box-shadow:var(--z-carousel-items-shadow, none);column-gap:var(--z-carousel-gutter);list-style:none;-ms-overflow-style:none;overflow-x:scroll;padding-inline-start:0;scroll-behavior:smooth;scroll-snap-type:x mandatory;scrollbar-width:none;}.z-carousel-items-container::-webkit-scrollbar{display:none}.z-carousel-items-container ::slotted(*){scroll-snap-align:center}.z-carousel-navigation-arrow[hidden]{display:none}.z-carousel-navigation-arrow[data-direction]{position:absolute;z-index:1;bottom:50%;transform:translateY(50%)}.z-carousel-navigation-arrow[data-direction="next"]{right:0}:host(:not([fixed-arrows])) .z-carousel-wrapper .z-carousel-navigation-arrow{display:none}.z-carousel-footer{display:flex;flex-direction:row;align-items:center;justify-content:center;column-gap:calc(var(--space-unit) * 3)}:host([arrows-position="bottom"]) .z-carousel-footer{margin-top:calc(var(--space-unit) * 0.75)}.z-carousel-footer .numbers-progress,.z-carousel-footer .dots-progress{display:flex;align-items:center;justify-content:center}.z-carousel-footer .dots-progress{column-gap:calc(var(--space-unit) * 3)}:host(:not([arrows-position="bottom"])) .z-carousel-footer .dots-progress{margin-top:calc(var(--space-unit) * 2)}.z-carousel-footer .dots-progress button{display:flex;width:calc(var(--space-unit) * 3);height:calc(var(--space-unit) * 3);align-items:center;padding:0;border:none;margin:0;background-color:var(--color-surface03);border-radius:calc(var(--space-unit) * 3)}.z-carousel-footer .dots-progress button.current{background-color:var(--color-primary01)}.z-carousel-footer .dots-progress button:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}.z-carousel-footer .dots-progress button:not(.current){cursor:pointer}.z-carousel-footer .numbers-progress{column-gap:calc(var(--space-unit) / 2)}:host(:not([arrows-position="bottom"])) .z-carousel-footer .numbers-progress{margin-top:var(--space-unit)}.z-carousel-footer .numbers-progress .current{font-weight:var(--font-sb)}@media (min-width: 768px){:host(:not([fixed-arrows])) .z-carousel-wrapper:hover .z-carousel-navigation-arrow:not([hidden]){display:flex}}`;const b=()=>`:root{--font-family-sans:"IBM Plex Sans", sans-serif;--font-family-serif:"IBM Plex Serif", serif;--font-lt:300;--font-rg:400;--font-sb:600;--font-bd:700;--font-size-1:0.75rem;--font-size-2:0.875rem;--font-size-3:1rem;--font-size-4:1.125rem;--font-size-5:1.25rem;--font-size-6:1.5rem;--font-size-7:1.75rem;--font-size-8:2rem;--font-size-9:2.25rem;--font-size-10:2.625rem;--font-size-11:3rem;--font-size-12:3.375rem;--font-size-13:3.75rem;--font-size-14:4.25rem;--font-size-15:4.75rem;--font-size-16:5.25rem;--font-size-17:5.75rem;--section-title-1:var(--font-sb) var(--font-size-11) / 1.083 var(--font-family-serif);--section-title-2:var(--font-sb) var(--font-size-10) / 1.142 var(--font-family-serif);--section-title-3:var(--font-sb) var(--font-size-9) / 1.222 var(--font-family-serif);--section-title-4:var(--font-sb) var(--font-size-8) / 1.25 var(--font-family-serif);--section-title-5:var(--font-sb) var(--font-size-7) / 1.2857 var(--font-family-serif);--section-title-6:var(--font-sb) var(--font-size-6) / 1.333 var(--font-family-serif)}.heading-1,.heading-1-sb,.heading-1-lt{font-size:var(--font-size-7);font-weight:var(--font-rg);line-height:1.28}.heading-2,.heading-2-sb,.heading-2-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.heading-3,.heading-3-sb,.heading-3-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.heading-4,.heading-4-sb,.heading-4-lt{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.body-1,.body-1-sb{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.body-2,.body-2-sb{font-size:var(--font-size-4);font-weight:var(--font-rg);line-height:1.5}.body-3,.body-3-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.body-4,.body-4-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.body-5,.body-5-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.interactive-1,.interactive-1-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.interactive-2,.interactive-2-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.interactive-3,.interactive-3-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.helper,.helper-sb{font-size:var(--font-size-1);font-style:italic;font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.section-title-1{font:var(--section-title-1)}.section-title-2{font:var(--section-title-2)}.section-title-3{font:var(--section-title-3)}.section-title-4{font:var(--section-title-4)}.section-title-5{font:var(--section-title-5)}.section-title-6{font:var(--section-title-6)}@media (min-width: 1152px){.heading-1,.heading-1-sb,.heading-1-lt{font-size:var(--font-size-8);font-weight:var(--font-rg);line-height:1.25}.heading-2,.heading-2-sb,.heading-2-lt{font-size:var(--font-size-7);font-weight:var(--font-rg);line-height:1.28}}@media (max-width: 767px){.mobile-heading-1,.mobile-heading-1-sb,.mobile-heading-1-lt{font-size:var(--font-size-7);font-weight:var(--font-rg);line-height:1.28}.mobile-heading-2,.mobile-heading-2-sb,.mobile-heading-2-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.mobile-heading-3,.mobile-heading-3-sb,.mobile-heading-3-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.mobile-heading-4,.mobile-heading-4-sb,.mobile-heading-4-lt{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.mobile-body-1,.mobile-body-1-sb{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.mobile-body-2,.mobile-body-2-sb{font-size:var(--font-size-4);font-weight:var(--font-rg);line-height:1.5}.mobile-body-3,.mobile-body-3-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.mobile-body-4,.mobile-body-4-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.mobile-body-5,.mobile-body-5-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.mobile-interactive-1,.mobile-interactive-1-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.mobile-interactive-2,.mobile-interactive-2-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.mobile-interactive-3,.mobile-interactive-3-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.mobile-section-title-1{font:var(--section-title-1)}.mobile-section-title-2{font:var(--section-title-2)}.mobile-section-title-3{font:var(--section-title-3)}.mobile-section-title-4{font:var(--section-title-4)}.mobile-section-title-5{font:var(--section-title-5)}.mobile-section-title-6{font:var(--section-title-6)}.mobile-heading-1-lt,.mobile-heading-2-lt,.mobile-heading-3-lt,.mobile-heading-4-lt{font-weight:var(--font-lt)}.mobile-heading-1-sb,.mobile-heading-2-sb,.mobile-heading-3-sb,.mobile-heading-4-sb,.mobile-body-1-sb,.mobile-body-2-sb,.mobile-body-3-sb,.mobile-body-4-sb,.mobile-body-5-sb,.mobile-interactive-1-sb,.mobile-interactive-2-sb,.mobile-interactive-3-sb{font-weight:var(--font-sb)}}@media (min-width: 768px) and (max-width: 1151px){.tablet-heading-1,.tablet-heading-1-sb,.tablet-heading-1-lt{font-size:var(--font-size-7);font-weight:var(--font-rg);line-height:1.28}.tablet-heading-2,.tablet-heading-2-sb,.tablet-heading-2-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.tablet-heading-3,.tablet-heading-3-sb,.tablet-heading-3-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.tablet-heading-4,.tablet-heading-4-sb,.tablet-heading-4-lt{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.tablet-body-1,.tablet-body-1-sb{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.tablet-body-2,.tablet-body-2-sb{font-size:var(--font-size-4);font-weight:var(--font-rg);line-height:1.5}.tablet-body-3,.tablet-body-3-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.tablet-body-4,.tablet-body-4-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.tablet-body-5,.tablet-body-5-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.tablet-interactive-1,.tablet-interactive-1-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.tablet-interactive-2,.tablet-interactive-2-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.tablet-interactive-3,.tablet-interactive-3-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.tablet-section-title-1{font:var(--section-title-1)}.tablet-section-title-2{font:var(--section-title-2)}.tablet-section-title-3{font:var(--section-title-3)}.tablet-section-title-4{font:var(--section-title-4)}.tablet-section-title-5{font:var(--section-title-5)}.tablet-section-title-6{font:var(--section-title-6)}.tablet-heading-1-lt,.tablet-heading-2-lt,.tablet-heading-3-lt,.tablet-heading-4-lt{font-weight:var(--font-lt)}.tablet-heading-1-sb,.tablet-heading-2-sb,.tablet-heading-3-sb,.tablet-heading-4-sb,.tablet-body-1-sb,.tablet-body-2-sb,.tablet-body-3-sb,.tablet-body-4-sb,.tablet-body-5-sb,.tablet-interactive-1-sb,.tablet-interactive-2-sb,.tablet-interactive-3-sb{font-weight:var(--font-sb)}}@media (min-width: 1152px) and (max-width: 1365px){.desktop-heading-1,.desktop-heading-1-sb,.desktop-heading-1-lt{font-size:var(--font-size-8);font-weight:var(--font-rg);line-height:1.25}.desktop-heading-2,.desktop-heading-2-sb,.desktop-heading-2-lt{font-size:var(--font-size-7);font-weight:var(--font-rg);line-height:1.28}.desktop-heading-3,.desktop-heading-3-sb,.desktop-heading-3-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.desktop-heading-4,.desktop-heading-4-sb,.desktop-heading-4-lt{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.desktop-body-1,.desktop-body-1-sb{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.desktop-body-2,.desktop-body-2-sb{font-size:var(--font-size-4);font-weight:var(--font-rg);line-height:1.5}.desktop-body-3,.desktop-body-3-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.desktop-body-4,.desktop-body-4-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.desktop-body-5,.desktop-body-5-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.desktop-interactive-1,.desktop-interactive-1-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.desktop-interactive-2,.desktop-interactive-2-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.desktop-interactive-3,.desktop-interactive-3-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.desktop-section-title-1{font:var(--section-title-1)}.desktop-section-title-2{font:var(--section-title-2)}.desktop-section-title-3{font:var(--section-title-3)}.desktop-section-title-4{font:var(--section-title-4)}.desktop-section-title-5{font:var(--section-title-5)}.desktop-section-title-6{font:var(--section-title-6)}.desktop-heading-1-lt,.desktop-heading-2-lt,.desktop-heading-3-lt,.desktop-heading-4-lt{font-weight:var(--font-lt)}.desktop-heading-1-sb,.desktop-heading-2-sb,.desktop-heading-3-sb,.desktop-heading-4-sb,.desktop-body-1-sb,.desktop-body-2-sb,.desktop-body-3-sb,.desktop-body-4-sb,.desktop-body-5-sb,.desktop-interactive-1-sb,.desktop-interactive-2-sb,.desktop-interactive-3-sb{font-weight:var(--font-sb)}}@media (min-width: 1366px){.wide-heading-1,.wide-heading-1-sb,.wide-heading-1-lt{font-size:var(--font-size-8);font-weight:var(--font-rg);line-height:1.25}.wide-heading-2,.wide-heading-2-sb,.wide-heading-2-lt{font-size:var(--font-size-7);font-weight:var(--font-rg);line-height:1.28}.wide-heading-3,.wide-heading-3-sb,.wide-heading-3-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.wide-heading-4,.wide-heading-4-sb,.wide-heading-4-lt{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.wide-body-1,.wide-body-1-sb{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.wide-body-2,.wide-body-2-sb{font-size:var(--font-size-4);font-weight:var(--font-rg);line-height:1.5}.wide-body-3,.wide-body-3-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.wide-body-4,.wide-body-4-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.wide-body-5,.wide-body-5-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.wide-interactive-1,.wide-interactive-1-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.wide-interactive-2,.wide-interactive-2-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.wide-interactive-3,.wide-interactive-3-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.wide-section-title-1{font:var(--section-title-1)}.wide-section-title-2{font:var(--section-title-2)}.wide-section-title-3{font:var(--section-title-3)}.wide-section-title-4{font:var(--section-title-4)}.wide-section-title-5{font:var(--section-title-5)}.wide-section-title-6{font:var(--section-title-6)}.wide-heading-1-lt,.wide-heading-2-lt,.wide-heading-3-lt,.wide-heading-4-lt{font-weight:var(--font-lt)}.wide-heading-1-sb,.wide-heading-2-sb,.wide-heading-3-sb,.wide-heading-4-sb,.wide-body-1-sb,.wide-body-2-sb,.wide-body-3-sb,.wide-body-4-sb,.wide-body-5-sb,.wide-interactive-1-sb,.wide-interactive-2-sb,.wide-interactive-3-sb{font-weight:var(--font-sb)}}.heading-1-lt,.heading-2-lt,.heading-3-lt,.heading-4-lt{font-weight:var(--font-lt)}.heading-1-sb,.heading-2-sb,.heading-3-sb,.heading-4-sb,.body-1-sb,.body-2-sb,.body-3-sb,.body-4-sb,.body-5-sb,.interactive-1-sb,.interactive-2-sb,.interactive-3-sb,.helper-sb{font-weight:var(--font-sb)}`;const c=t(class t extends e{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.indexChange=i(this,"indexChange",7);this.single=false;this.fixedArrows=true;this.ghostLoadingHeight=100;this.infinite=false;this.current=0;this.scrollingTo=null}onIndexChange(){this.indexChange.emit({currentItem:this.current})}onSingleModeChange(){if(this.single&&!this.intersectionObserver){this.setIntersectionObserver()}}onInfiniteModeChange(){this.checkNavigationValidity()}onLoadingChange(){if(!this.isLoading){this.setupObserversAndListeners()}}setupObserversAndListeners(){var t;this.setupItems();(t=this.itemsContainer)===null||t===void 0?void 0:t.addEventListener("scroll",this.checkNavigationValidity.bind(this),{passive:true});this.resizeObserver=new ResizeObserver(this.checkNavigationValidity.bind(this));this.resizeObserver.observe(this.itemsContainer);if(this.single){this.setIntersectionObserver()}this.checkNavigationValidity()}setIntersectionObserver(){this.intersectionObserver=new IntersectionObserver((t=>{const e=t.find((({isIntersecting:t})=>t));if(!e){return}const i=this.items.findIndex((t=>t===e.target));this.highlightedIndicator=i;if(this.scrollingTo!==null&&i!==this.scrollingTo){return}this.scrollingTo=null;this.current=i}),{root:this.itemsContainer,threshold:.5});this.items.forEach((t=>this.intersectionObserver.observe(t)))}onSlotChange(){this.items=Array.from(this.host.children);this.checkNavigationValidity();this.setIntersectionObserver();this.goTo(this.current)}onPrev(){if(this.single){this.goTo(this.infinite&&this.current-1<0?this.items.length-1:Math.max(0,this.current-1));return}this.itemsContainer.scrollBy({left:this.infinite&&this.itemsContainer.scrollLeft==0?this.itemsContainer.scrollWidth-this.itemsContainer.clientWidth:-this.itemsContainer.clientWidth/2,behavior:"smooth"})}onNext(){if(this.single){const t=this.infinite&&this.current+1>this.items.length-1?0:Math.min(this.current+1,this.items.length-1);return this.goTo(t)}this.itemsContainer.scrollBy({left:this.infinite&&this.itemsContainer.scrollLeft==this.itemsContainer.scrollWidth-this.itemsContainer.clientWidth?-this.itemsContainer.scrollWidth:this.itemsContainer.clientWidth/2,behavior:"smooth"})}checkNavigationValidity(){if(this.single){this.canNavigatePrev=this.current>0;this.canNavigateNext=this.current<this.items.length-1;return}this.canNavigatePrev=this.itemsContainer.scrollLeft>0;this.canNavigateNext=this.itemsContainer.scrollLeft<this.itemsContainer.scrollWidth-this.itemsContainer.clientWidth}canShowFooter(){if(!this.canNavigatePrev&&!this.canNavigateNext){return false}return this.arrowsPosition===a.BOTTOM||this.progressMode===r.DOTS||this.progressMode===r.NUMBERS}goTo(t){if(this.current===t){return}this.scrollingTo=t;const e=this.items.slice(0,t).reduce(((t,e)=>t+=e.clientWidth),0);this.itemsContainer.scroll({left:e,behavior:"smooth"})}get canNavigate(){return this.canNavigatePrev||this.canNavigateNext}setupItems(){this.items=Array.from(this.host.children);this.items.forEach((t=>{t.setAttribute("aria-roledescription","slide")}))}componentDidLoad(){if(this.isLoading){return}this.setupObserversAndListeners()}disconnectedCallback(){var t;(t=this.resizeObserver)===null||t===void 0?void 0:t.disconnect()}render(){if(this.isLoading){return n("div",{class:"z-carousel-container"},this.label&&n("div",{class:"heading-3-sb z-carousel-title"},this.label),n("div",{style:{height:`${this.ghostLoadingHeight}px`}},n("z-ghost-loading",null)))}return n(o,null,n("div",{class:"z-carousel-container","aria-roledescription":"carousel","aria-label":this.label||"Carousel"},this.label&&n("div",{class:"z-carousel-title heading-3-sb"},this.label),n("div",{class:"z-carousel-wrapper"},n("z-button",{class:"z-carousel-navigation-arrow",variant:l.SECONDARY,"data-direction":"prev",icon:"arrow-left",onClick:this.onPrev.bind(this),disabled:!this.infinite&&!this.canNavigatePrev,hidden:this.arrowsPosition!==a.OVER||!this.canNavigate,ariaLabel:this.single?"Mostra l'elemento precedente":"Mostra gli elementi precedenti"}),n("ul",{class:"z-carousel-items-container","aria-atomic":"false","aria-live":"polite",ref:t=>this.itemsContainer=t},n("slot",{onSlotchange:this.onSlotChange.bind(this)})),n("z-button",{class:"z-carousel-navigation-arrow",variant:l.SECONDARY,"data-direction":"next",icon:"arrow-right",onClick:this.onNext.bind(this),disabled:!this.infinite&&!this.canNavigateNext,hidden:this.arrowsPosition!==a.OVER||!this.canNavigate,ariaLabel:this.single?"Mostra l'elemento successivo":"Mostra gli elementi successivi"}))),this.canShowFooter()&&n("div",{class:"z-carousel-footer"},this.arrowsPosition===a.BOTTOM&&n("z-button",{class:"z-carousel-navigation-arrow",variant:l.TERTIARY,icon:"arrow-left",onClick:this.onPrev.bind(this),disabled:!this.infinite&&!this.canNavigatePrev,ariaLabel:this.single?"Mostra l'elemento precedente":"Mostra gli elementi precedenti"}),this.progressMode===r.DOTS&&this.single&&this.items&&n("div",{class:"dots-progress"},this.items.map(((t,e)=>n("button",{type:"button",class:{current:this.highlightedIndicator===e},"aria-label":this.highlightedIndicator===e?"Elemento corrente":`Spostati all'elemento ${e+1}`,onClick:()=>this.goTo(e)})))),this.progressMode===r.NUMBERS&&this.single&&this.items&&n("div",{class:"numbers-progress interactive-1"},n("span",{class:"current"},this.current+1),n("span",null,"di"),n("span",null,this.items.length)),this.arrowsPosition===a.BOTTOM&&n("z-button",{class:"z-carousel-navigation-arrow",variant:l.TERTIARY,icon:"arrow-right",onClick:this.onNext.bind(this),disabled:!this.infinite&&!this.canNavigateNext,ariaLabel:this.single?"Mostra l'elemento successivo":"Mostra gli elementi successivi"})))}get host(){return this}static get watchers(){return{current:[{onIndexChange:0}],single:[{onSingleModeChange:0}],infinite:[{onInfiniteModeChange:0}],isLoading:[{onLoadingChange:0}]}}static get style(){return d()+b()}},[257,"z-carousel",{isLoading:[4,"is-loading"],label:[1],single:[516],arrowsPosition:[513,"arrows-position"],progressMode:[1,"progress-mode"],fixedArrows:[516,"fixed-arrows"],ghostLoadingHeight:[2,"ghost-loading-height"],infinite:[4],current:[32],items:[32],highlightedIndicator:[32],canNavigatePrev:[32],canNavigateNext:[32]},undefined,{current:[{onIndexChange:0}],single:[{onSingleModeChange:0}],infinite:[{onInfiniteModeChange:0}],isLoading:[{onLoadingChange:0}]}]);function v(){if(typeof customElements==="undefined"){return}const t=["z-carousel","z-button","z-ghost-loading","z-icon"];t.forEach((t=>{switch(t){case"z-carousel":if(!customElements.get(s(t))){customElements.define(s(t),c)}break;case"z-button":if(!customElements.get(s(t))){h()}break;case"z-ghost-loading":if(!customElements.get(s(t))){f()}break;case"z-icon":if(!customElements.get(s(t))){g()}break}}))}const z=c;const p=v;export{z as ZCarousel,p as defineCustomElement};
|
|
1
|
+
import{p as t,H as e,c as i,h as n,d as o,t as s}from"./p-RmbDDbWd.js";import{U as a,V as r,B as l}from"./p-DdetsoIY.js";import{d as h}from"./p-BAguKZnb.js";import{d as f}from"./p-CaSvyuw6.js";import{d as g}from"./p-CbXEdwLi.js";const d=()=>`:host{--z-carousel-gutter:0;font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host([single]){display:flex;flex-direction:column;align-items:center;justify-content:center}:host([single]) .z-carousel-container{width:fit-content;max-width:100%}.z-carousel-container{display:flex;flex-direction:column}.z-carousel-title{margin-bottom:calc(var(--space-unit) * 2)}.z-carousel-wrapper{position:relative}.z-carousel-items-container{display:flex;max-width:100%;flex-direction:row;margin:0;box-shadow:var(--z-carousel-items-shadow, none);column-gap:var(--z-carousel-gutter);list-style:none;-ms-overflow-style:none;overflow-x:scroll;padding-inline-start:0;scroll-behavior:smooth;scroll-snap-type:x mandatory;scrollbar-width:none;}.z-carousel-items-container::-webkit-scrollbar{display:none}.z-carousel-items-container ::slotted(*){scroll-snap-align:center}.z-carousel-navigation-arrow[hidden]{display:none}.z-carousel-navigation-arrow[data-direction]{position:absolute;z-index:1;bottom:50%;transform:translateY(50%)}.z-carousel-navigation-arrow[data-direction="next"]{right:0}:host(:not([fixed-arrows])) .z-carousel-wrapper .z-carousel-navigation-arrow{display:none}.z-carousel-footer{display:flex;flex-direction:row;align-items:center;justify-content:center;column-gap:calc(var(--space-unit) * 3)}:host([arrows-position="bottom"]) .z-carousel-footer{margin-top:calc(var(--space-unit) * 0.75)}.z-carousel-footer .numbers-progress,.z-carousel-footer .dots-progress{display:flex;align-items:center;justify-content:center}.z-carousel-footer .dots-progress{column-gap:calc(var(--space-unit) * 3)}:host(:not([arrows-position="bottom"])) .z-carousel-footer .dots-progress{margin-top:calc(var(--space-unit) * 2)}.z-carousel-footer .dots-progress button{display:flex;width:calc(var(--space-unit) * 3);height:calc(var(--space-unit) * 3);align-items:center;padding:0;border:none;margin:0;background-color:var(--color-surface03);border-radius:calc(var(--space-unit) * 3)}.z-carousel-footer .dots-progress button.current{background-color:var(--color-primary01)}.z-carousel-footer .dots-progress button:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}.z-carousel-footer .dots-progress button:not(.current){cursor:pointer}.z-carousel-footer .numbers-progress{column-gap:calc(var(--space-unit) / 2)}:host(:not([arrows-position="bottom"])) .z-carousel-footer .numbers-progress{margin-top:var(--space-unit)}.z-carousel-footer .numbers-progress .current{font-weight:var(--font-sb)}@media (min-width: 768px){:host(:not([fixed-arrows])) .z-carousel-wrapper:hover .z-carousel-navigation-arrow:not([hidden]){display:flex}}`;const b=()=>`:root{--font-family-sans:"IBM Plex Sans", sans-serif;--font-family-serif:"IBM Plex Serif", serif;--font-lt:300;--font-rg:400;--font-sb:600;--font-bd:700;--font-size-1:0.75rem;--font-size-2:0.875rem;--font-size-3:1rem;--font-size-4:1.125rem;--font-size-5:1.25rem;--font-size-6:1.5rem;--font-size-7:1.75rem;--font-size-8:2rem;--font-size-9:2.25rem;--font-size-10:2.625rem;--font-size-11:3rem;--font-size-12:3.375rem;--font-size-13:3.75rem;--font-size-14:4.25rem;--font-size-15:4.75rem;--font-size-16:5.25rem;--font-size-17:5.75rem;--section-title-1:var(--font-sb) var(--font-size-11) / 1.083 var(--font-family-serif);--section-title-2:var(--font-sb) var(--font-size-10) / 1.142 var(--font-family-serif);--section-title-3:var(--font-sb) var(--font-size-9) / 1.222 var(--font-family-serif);--section-title-4:var(--font-sb) var(--font-size-8) / 1.25 var(--font-family-serif);--section-title-5:var(--font-sb) var(--font-size-7) / 1.2857 var(--font-family-serif);--section-title-6:var(--font-sb) var(--font-size-6) / 1.333 var(--font-family-serif)}.heading-1,.heading-1-sb,.heading-1-lt{font-size:var(--font-size-7);font-weight:var(--font-rg);line-height:1.28}.heading-2,.heading-2-sb,.heading-2-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.heading-3,.heading-3-sb,.heading-3-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.heading-4,.heading-4-sb,.heading-4-lt{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.body-1,.body-1-sb{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.body-2,.body-2-sb{font-size:var(--font-size-4);font-weight:var(--font-rg);line-height:1.5}.body-3,.body-3-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.body-4,.body-4-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.body-5,.body-5-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.interactive-1,.interactive-1-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.interactive-2,.interactive-2-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.interactive-3,.interactive-3-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.helper,.helper-sb{font-size:var(--font-size-1);font-style:italic;font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.section-title-1{font:var(--section-title-1)}.section-title-2{font:var(--section-title-2)}.section-title-3{font:var(--section-title-3)}.section-title-4{font:var(--section-title-4)}.section-title-5{font:var(--section-title-5)}.section-title-6{font:var(--section-title-6)}@media (min-width: 1152px){.heading-1,.heading-1-sb,.heading-1-lt{font-size:var(--font-size-8);font-weight:var(--font-rg);line-height:1.25}.heading-2,.heading-2-sb,.heading-2-lt{font-size:var(--font-size-7);font-weight:var(--font-rg);line-height:1.28}}@media (max-width: 767px){.mobile-heading-1,.mobile-heading-1-sb,.mobile-heading-1-lt{font-size:var(--font-size-7);font-weight:var(--font-rg);line-height:1.28}.mobile-heading-2,.mobile-heading-2-sb,.mobile-heading-2-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.mobile-heading-3,.mobile-heading-3-sb,.mobile-heading-3-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.mobile-heading-4,.mobile-heading-4-sb,.mobile-heading-4-lt{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.mobile-body-1,.mobile-body-1-sb{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.mobile-body-2,.mobile-body-2-sb{font-size:var(--font-size-4);font-weight:var(--font-rg);line-height:1.5}.mobile-body-3,.mobile-body-3-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.mobile-body-4,.mobile-body-4-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.mobile-body-5,.mobile-body-5-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.mobile-interactive-1,.mobile-interactive-1-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.mobile-interactive-2,.mobile-interactive-2-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.mobile-interactive-3,.mobile-interactive-3-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.mobile-section-title-1{font:var(--section-title-1)}.mobile-section-title-2{font:var(--section-title-2)}.mobile-section-title-3{font:var(--section-title-3)}.mobile-section-title-4{font:var(--section-title-4)}.mobile-section-title-5{font:var(--section-title-5)}.mobile-section-title-6{font:var(--section-title-6)}.mobile-heading-1-lt,.mobile-heading-2-lt,.mobile-heading-3-lt,.mobile-heading-4-lt{font-weight:var(--font-lt)}.mobile-heading-1-sb,.mobile-heading-2-sb,.mobile-heading-3-sb,.mobile-heading-4-sb,.mobile-body-1-sb,.mobile-body-2-sb,.mobile-body-3-sb,.mobile-body-4-sb,.mobile-body-5-sb,.mobile-interactive-1-sb,.mobile-interactive-2-sb,.mobile-interactive-3-sb{font-weight:var(--font-sb)}}@media (min-width: 768px) and (max-width: 1151px){.tablet-heading-1,.tablet-heading-1-sb,.tablet-heading-1-lt{font-size:var(--font-size-7);font-weight:var(--font-rg);line-height:1.28}.tablet-heading-2,.tablet-heading-2-sb,.tablet-heading-2-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.tablet-heading-3,.tablet-heading-3-sb,.tablet-heading-3-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.tablet-heading-4,.tablet-heading-4-sb,.tablet-heading-4-lt{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.tablet-body-1,.tablet-body-1-sb{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.tablet-body-2,.tablet-body-2-sb{font-size:var(--font-size-4);font-weight:var(--font-rg);line-height:1.5}.tablet-body-3,.tablet-body-3-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.tablet-body-4,.tablet-body-4-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.tablet-body-5,.tablet-body-5-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.tablet-interactive-1,.tablet-interactive-1-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.tablet-interactive-2,.tablet-interactive-2-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.tablet-interactive-3,.tablet-interactive-3-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.tablet-section-title-1{font:var(--section-title-1)}.tablet-section-title-2{font:var(--section-title-2)}.tablet-section-title-3{font:var(--section-title-3)}.tablet-section-title-4{font:var(--section-title-4)}.tablet-section-title-5{font:var(--section-title-5)}.tablet-section-title-6{font:var(--section-title-6)}.tablet-heading-1-lt,.tablet-heading-2-lt,.tablet-heading-3-lt,.tablet-heading-4-lt{font-weight:var(--font-lt)}.tablet-heading-1-sb,.tablet-heading-2-sb,.tablet-heading-3-sb,.tablet-heading-4-sb,.tablet-body-1-sb,.tablet-body-2-sb,.tablet-body-3-sb,.tablet-body-4-sb,.tablet-body-5-sb,.tablet-interactive-1-sb,.tablet-interactive-2-sb,.tablet-interactive-3-sb{font-weight:var(--font-sb)}}@media (min-width: 1152px) and (max-width: 1365px){.desktop-heading-1,.desktop-heading-1-sb,.desktop-heading-1-lt{font-size:var(--font-size-8);font-weight:var(--font-rg);line-height:1.25}.desktop-heading-2,.desktop-heading-2-sb,.desktop-heading-2-lt{font-size:var(--font-size-7);font-weight:var(--font-rg);line-height:1.28}.desktop-heading-3,.desktop-heading-3-sb,.desktop-heading-3-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.desktop-heading-4,.desktop-heading-4-sb,.desktop-heading-4-lt{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.desktop-body-1,.desktop-body-1-sb{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.desktop-body-2,.desktop-body-2-sb{font-size:var(--font-size-4);font-weight:var(--font-rg);line-height:1.5}.desktop-body-3,.desktop-body-3-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.desktop-body-4,.desktop-body-4-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.desktop-body-5,.desktop-body-5-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.desktop-interactive-1,.desktop-interactive-1-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.desktop-interactive-2,.desktop-interactive-2-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.desktop-interactive-3,.desktop-interactive-3-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.desktop-section-title-1{font:var(--section-title-1)}.desktop-section-title-2{font:var(--section-title-2)}.desktop-section-title-3{font:var(--section-title-3)}.desktop-section-title-4{font:var(--section-title-4)}.desktop-section-title-5{font:var(--section-title-5)}.desktop-section-title-6{font:var(--section-title-6)}.desktop-heading-1-lt,.desktop-heading-2-lt,.desktop-heading-3-lt,.desktop-heading-4-lt{font-weight:var(--font-lt)}.desktop-heading-1-sb,.desktop-heading-2-sb,.desktop-heading-3-sb,.desktop-heading-4-sb,.desktop-body-1-sb,.desktop-body-2-sb,.desktop-body-3-sb,.desktop-body-4-sb,.desktop-body-5-sb,.desktop-interactive-1-sb,.desktop-interactive-2-sb,.desktop-interactive-3-sb{font-weight:var(--font-sb)}}@media (min-width: 1366px){.wide-heading-1,.wide-heading-1-sb,.wide-heading-1-lt{font-size:var(--font-size-8);font-weight:var(--font-rg);line-height:1.25}.wide-heading-2,.wide-heading-2-sb,.wide-heading-2-lt{font-size:var(--font-size-7);font-weight:var(--font-rg);line-height:1.28}.wide-heading-3,.wide-heading-3-sb,.wide-heading-3-lt{font-size:var(--font-size-6);font-weight:var(--font-rg);line-height:1.333}.wide-heading-4,.wide-heading-4-sb,.wide-heading-4-lt{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.wide-body-1,.wide-body-1-sb{font-size:var(--font-size-5);font-weight:var(--font-rg);line-height:1.4}.wide-body-2,.wide-body-2-sb{font-size:var(--font-size-4);font-weight:var(--font-rg);line-height:1.5}.wide-body-3,.wide-body-3-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.wide-body-4,.wide-body-4-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.wide-body-5,.wide-body-5-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.wide-interactive-1,.wide-interactive-1-sb{font-size:var(--font-size-3);font-weight:var(--font-rg);line-height:1.5}.wide-interactive-2,.wide-interactive-2-sb{font-size:var(--font-size-2);font-weight:var(--font-rg);letter-spacing:0.16px;line-height:1.4}.wide-interactive-3,.wide-interactive-3-sb{font-size:var(--font-size-1);font-weight:var(--font-rg);letter-spacing:0.32px;line-height:1.333}.wide-section-title-1{font:var(--section-title-1)}.wide-section-title-2{font:var(--section-title-2)}.wide-section-title-3{font:var(--section-title-3)}.wide-section-title-4{font:var(--section-title-4)}.wide-section-title-5{font:var(--section-title-5)}.wide-section-title-6{font:var(--section-title-6)}.wide-heading-1-lt,.wide-heading-2-lt,.wide-heading-3-lt,.wide-heading-4-lt{font-weight:var(--font-lt)}.wide-heading-1-sb,.wide-heading-2-sb,.wide-heading-3-sb,.wide-heading-4-sb,.wide-body-1-sb,.wide-body-2-sb,.wide-body-3-sb,.wide-body-4-sb,.wide-body-5-sb,.wide-interactive-1-sb,.wide-interactive-2-sb,.wide-interactive-3-sb{font-weight:var(--font-sb)}}.heading-1-lt,.heading-2-lt,.heading-3-lt,.heading-4-lt{font-weight:var(--font-lt)}.heading-1-sb,.heading-2-sb,.heading-3-sb,.heading-4-sb,.body-1-sb,.body-2-sb,.body-3-sb,.body-4-sb,.body-5-sb,.interactive-1-sb,.interactive-2-sb,.interactive-3-sb,.helper-sb{font-weight:var(--font-sb)}`;const c=t(class t extends e{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.indexChange=i(this,"indexChange",7);this.single=false;this.fixedArrows=true;this.ghostLoadingHeight=100;this.infinite=false;this.current=0;this.scrollingTo=null}onIndexChange(){this.indexChange.emit({currentItem:this.current})}onSingleModeChange(){if(this.single&&!this.intersectionObserver){this.setIntersectionObserver()}}onInfiniteModeChange(){this.checkNavigationValidity()}onLoadingChange(){if(!this.isLoading){this.setupObserversAndListeners()}}setupObserversAndListeners(){var t;this.setupItems();(t=this.itemsContainer)===null||t===void 0?void 0:t.addEventListener("scroll",this.checkNavigationValidity.bind(this),{passive:true});this.resizeObserver=new ResizeObserver(this.checkNavigationValidity.bind(this));this.resizeObserver.observe(this.itemsContainer);if(this.single){this.setIntersectionObserver()}this.checkNavigationValidity()}setIntersectionObserver(){this.intersectionObserver=new IntersectionObserver((t=>{const e=t.find((({isIntersecting:t})=>t));if(!e){return}const i=this.items.findIndex((t=>t===e.target));this.highlightedIndicator=i;if(this.scrollingTo!==null&&i!==this.scrollingTo){return}this.scrollingTo=null;this.current=i}),{root:this.itemsContainer,threshold:.5});this.items.forEach((t=>this.intersectionObserver.observe(t)))}onSlotChange(){this.items=Array.from(this.host.children);this.checkNavigationValidity();this.setIntersectionObserver();this.goTo(this.current)}onPrev(){if(this.single){this.goTo(this.infinite&&this.current-1<0?this.items.length-1:Math.max(0,this.current-1));return}this.itemsContainer.scrollBy({left:this.infinite&&this.itemsContainer.scrollLeft==0?this.itemsContainer.scrollWidth-this.itemsContainer.clientWidth:-this.itemsContainer.clientWidth/2,behavior:"smooth"})}onNext(){if(this.single){const t=this.infinite&&this.current+1>this.items.length-1?0:Math.min(this.current+1,this.items.length-1);return this.goTo(t)}this.itemsContainer.scrollBy({left:this.infinite&&this.itemsContainer.scrollLeft==this.itemsContainer.scrollWidth-this.itemsContainer.clientWidth?-this.itemsContainer.scrollWidth:this.itemsContainer.clientWidth/2,behavior:"smooth"})}checkNavigationValidity(){if(this.single){this.canNavigatePrev=this.current>0;this.canNavigateNext=this.current<this.items.length-1;return}this.canNavigatePrev=this.itemsContainer.scrollLeft>0;this.canNavigateNext=this.itemsContainer.scrollLeft<this.itemsContainer.scrollWidth-this.itemsContainer.clientWidth}canShowFooter(){if(!this.canNavigatePrev&&!this.canNavigateNext){return false}return this.arrowsPosition===a.BOTTOM||this.progressMode===r.DOTS||this.progressMode===r.NUMBERS}goTo(t){if(this.current===t){return}this.scrollingTo=t;const e=this.items.slice(0,t).reduce(((t,e)=>t+=e.clientWidth),0);this.itemsContainer.scroll({left:e,behavior:"smooth"})}get canNavigate(){return this.canNavigatePrev||this.canNavigateNext}setupItems(){this.items=Array.from(this.host.children);this.items.forEach((t=>{t.setAttribute("aria-roledescription","slide")}))}componentDidLoad(){if(this.isLoading){return}this.setupObserversAndListeners()}disconnectedCallback(){var t;(t=this.resizeObserver)===null||t===void 0?void 0:t.disconnect()}render(){if(this.isLoading){return n("div",{class:"z-carousel-container"},this.label&&n("div",{class:"heading-3-sb z-carousel-title"},this.label),n("div",{style:{height:`${this.ghostLoadingHeight}px`}},n("z-ghost-loading",null)))}return n(o,null,n("div",{class:"z-carousel-container","aria-roledescription":"carousel","aria-label":this.label||"Carousel"},this.label&&n("div",{class:"z-carousel-title heading-3-sb"},this.label),n("div",{class:"z-carousel-wrapper"},n("z-button",{class:"z-carousel-navigation-arrow",variant:l.SECONDARY,"data-direction":"prev",icon:"arrow-left",onClick:this.onPrev.bind(this),disabled:!this.infinite&&!this.canNavigatePrev,hidden:this.arrowsPosition!==a.OVER||!this.canNavigate,ariaLabel:this.single?"Mostra l'elemento precedente":"Mostra gli elementi precedenti"}),n("ul",{class:"z-carousel-items-container","aria-atomic":"false","aria-live":"polite",ref:t=>this.itemsContainer=t},n("slot",{onSlotchange:this.onSlotChange.bind(this)})),n("z-button",{class:"z-carousel-navigation-arrow",variant:l.SECONDARY,"data-direction":"next",icon:"arrow-right",onClick:this.onNext.bind(this),disabled:!this.infinite&&!this.canNavigateNext,hidden:this.arrowsPosition!==a.OVER||!this.canNavigate,ariaLabel:this.single?"Mostra l'elemento successivo":"Mostra gli elementi successivi"}))),this.canShowFooter()&&n("div",{class:"z-carousel-footer"},this.arrowsPosition===a.BOTTOM&&n("z-button",{class:"z-carousel-navigation-arrow",variant:l.TERTIARY,icon:"arrow-left",onClick:this.onPrev.bind(this),disabled:!this.infinite&&!this.canNavigatePrev,ariaLabel:this.single?"Mostra l'elemento precedente":"Mostra gli elementi precedenti"}),this.progressMode===r.DOTS&&this.single&&this.items&&n("div",{class:"dots-progress"},this.items.map(((t,e)=>n("button",{type:"button",class:{current:this.highlightedIndicator===e},"aria-label":this.highlightedIndicator===e?"Elemento corrente":`Spostati all'elemento ${e+1}`,onClick:()=>this.goTo(e)})))),this.progressMode===r.NUMBERS&&this.single&&this.items&&n("div",{class:"numbers-progress interactive-1"},n("span",{class:"current"},this.current+1),n("span",null,"di"),n("span",null,this.items.length)),this.arrowsPosition===a.BOTTOM&&n("z-button",{class:"z-carousel-navigation-arrow",variant:l.TERTIARY,icon:"arrow-right",onClick:this.onNext.bind(this),disabled:!this.infinite&&!this.canNavigateNext,ariaLabel:this.single?"Mostra l'elemento successivo":"Mostra gli elementi successivi"})))}get host(){return this}static get watchers(){return{current:[{onIndexChange:0}],single:[{onSingleModeChange:0}],infinite:[{onInfiniteModeChange:0}],isLoading:[{onLoadingChange:0}]}}static get style(){return d()+b()}},[257,"z-carousel",{isLoading:[4,"is-loading"],label:[1],single:[516],arrowsPosition:[513,"arrows-position"],progressMode:[1,"progress-mode"],fixedArrows:[516,"fixed-arrows"],ghostLoadingHeight:[2,"ghost-loading-height"],infinite:[4],current:[32],items:[32],highlightedIndicator:[32],canNavigatePrev:[32],canNavigateNext:[32]},undefined,{current:[{onIndexChange:0}],single:[{onSingleModeChange:0}],infinite:[{onInfiniteModeChange:0}],isLoading:[{onLoadingChange:0}]}]);function v(){if(typeof customElements==="undefined"){return}const t=["z-carousel","z-button","z-ghost-loading","z-icon"];t.forEach((t=>{switch(t){case"z-carousel":if(!customElements.get(s(t))){customElements.define(s(t),c)}break;case"z-button":if(!customElements.get(s(t))){h()}break;case"z-ghost-loading":if(!customElements.get(s(t))){f()}break;case"z-icon":if(!customElements.get(s(t))){g()}break}}))}const z=c;const p=v;export{z as ZCarousel,p as defineCustomElement};
|
|
2
2
|
//# sourceMappingURL=z-carousel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["stylesCss","typographyCss","ZCarousel","__stencil_proxyCustomElement","HTMLElement","constructor","registerHost","this","single","fixedArrows","ghostLoadingHeight","infinite","current","scrollingTo","onIndexChange","indexChange","emit","currentItem","onSingleModeChange","intersectionObserver","setIntersectionObserver","onInfiniteModeChange","checkNavigationValidity","onLoadingChange","isLoading","setupObserversAndListeners","setupItems","_a","itemsContainer","addEventListener","bind","passive","resizeObserver","ResizeObserver","observe","IntersectionObserver","entries","entry","find","isIntersecting","entryIndex","items","findIndex","item","target","highlightedIndicator","root","threshold","forEach","element","onSlotChange","Array","from","host","children","goTo","onPrev","length","Math","max","scrollBy","left","scrollLeft","scrollWidth","clientWidth","behavior","onNext","next","min","canNavigatePrev","canNavigateNext","canShowFooter","arrowsPosition","CarouselArrowsPosition","BOTTOM","progressMode","CarouselProgressMode","DOTS","NUMBERS","index","slice","reduce","acc","scroll","canNavigate","setAttribute","componentDidLoad","disconnectedCallback","disconnect","render","h","class","label","style","height","Host","variant","ButtonVariant","SECONDARY","icon","onClick","disabled","hidden","OVER","ariaLabel","ref","el","onSlotchange","TERTIARY","map","_","type"],"sources":["src/components/z-carousel/styles.css?tag=z-carousel&encapsulation=shadow","src/tokens/typography.css?tag=z-carousel&encapsulation=shadow","src/components/z-carousel/index.tsx"],"sourcesContent":[":host {\n /**\n * @prop --z-carousel-gutter: The gutter between items.\n * @prop --z-carousel-items-shadow: The shadow around the items.\n */\n --z-carousel-gutter: 0;\n --z-carousel-items-shadow: ;\n\n font-family: var(--font-family-sans);\n font-weight: var(--font-rg);\n}\n\n:host([single]) {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n:host([single]) .z-carousel-container {\n width: fit-content;\n max-width: 100%;\n}\n\n.z-carousel-container {\n display: flex;\n flex-direction: column;\n}\n\n.z-carousel-title {\n margin-bottom: calc(var(--space-unit) * 2);\n}\n\n.z-carousel-wrapper {\n position: relative;\n}\n\n.z-carousel-items-container {\n display: flex;\n max-width: 100%;\n flex-direction: row;\n margin: 0;\n box-shadow: var(--z-carousel-items-shadow, none);\n column-gap: var(--z-carousel-gutter);\n list-style: none;\n -ms-overflow-style: none; /* IE and Edge */\n overflow-x: scroll;\n padding-inline-start: 0;\n scroll-behavior: smooth;\n scroll-snap-type: x mandatory;\n\n /* Hide scrollbar for IE, Edge and Firefox */\n scrollbar-width: none; /* Firefox */\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n.z-carousel-items-container::-webkit-scrollbar {\n display: none;\n}\n\n.z-carousel-items-container ::slotted(*) {\n scroll-snap-align: center;\n}\n\n.z-carousel-navigation-arrow[hidden] {\n display: none;\n}\n\n.z-carousel-navigation-arrow[data-direction] {\n position: absolute;\n z-index: 1;\n bottom: 50%;\n transform: translateY(50%);\n}\n\n.z-carousel-navigation-arrow[data-direction=\"next\"] {\n right: 0;\n}\n\n:host(:not([fixed-arrows])) .z-carousel-wrapper .z-carousel-navigation-arrow {\n display: none;\n}\n\n.z-carousel-footer {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n column-gap: calc(var(--space-unit) * 3);\n}\n\n:host([arrows-position=\"bottom\"]) .z-carousel-footer {\n margin-top: calc(var(--space-unit) * 0.75);\n}\n\n.z-carousel-footer .numbers-progress,\n.z-carousel-footer .dots-progress {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.z-carousel-footer .dots-progress {\n column-gap: calc(var(--space-unit) * 3);\n}\n\n:host(:not([arrows-position=\"bottom\"])) .z-carousel-footer .dots-progress {\n margin-top: calc(var(--space-unit) * 2);\n}\n\n.z-carousel-footer .dots-progress button {\n display: flex;\n width: calc(var(--space-unit) * 3);\n height: calc(var(--space-unit) * 3);\n align-items: center;\n padding: 0;\n border: none;\n margin: 0;\n background-color: var(--color-surface03);\n border-radius: calc(var(--space-unit) * 3);\n}\n\n.z-carousel-footer .dots-progress button.current {\n background-color: var(--color-primary01);\n}\n\n.z-carousel-footer .dots-progress button:focus:focus-visible {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n.z-carousel-footer .dots-progress button:not(.current) {\n cursor: pointer;\n}\n\n.z-carousel-footer .numbers-progress {\n column-gap: calc(var(--space-unit) / 2);\n}\n\n:host(:not([arrows-position=\"bottom\"])) .z-carousel-footer .numbers-progress {\n margin-top: var(--space-unit);\n}\n\n.z-carousel-footer .numbers-progress .current {\n font-weight: var(--font-sb);\n}\n\n@media (min-width: 768px) {\n :host(:not([fixed-arrows])) .z-carousel-wrapper:hover .z-carousel-navigation-arrow:not([hidden]) {\n display: flex;\n }\n}\n",":root {\n /* font-family */\n --font-family-sans: \"IBM Plex Sans\", sans-serif;\n --font-family-serif: \"IBM Plex Serif\", serif;\n\n /* font-weight */\n --font-lt: 300;\n --font-rg: 400;\n --font-sb: 600;\n --font-bd: 700;\n\n /* font-size type scale */\n --font-size-1: 0.75rem; /* 12px */\n --font-size-2: 0.875rem; /* 14px */\n --font-size-3: 1rem; /* assuming 16px */\n --font-size-4: 1.125rem; /* 18px */\n --font-size-5: 1.25rem; /* 20px */\n --font-size-6: 1.5rem; /* 24px */\n --font-size-7: 1.75rem; /* 28px */\n --font-size-8: 2rem; /* 32px */\n --font-size-9: 2.25rem; /* 36px */\n --font-size-10: 2.625rem; /* 42px */\n --font-size-11: 3rem; /* 48px */\n --font-size-12: 3.375rem; /* 54px */\n --font-size-13: 3.75rem; /* 60px */\n --font-size-14: 4.25rem; /* 68px */\n --font-size-15: 4.75rem; /* 76px */\n --font-size-16: 5.25rem; /* 84px */\n --font-size-17: 5.75rem; /* 92px */\n\n /* cssprops to use with `font` shorthand property */\n --section-title-1: var(--font-sb) var(--font-size-11) / 1.083 var(--font-family-serif);\n --section-title-2: var(--font-sb) var(--font-size-10) / 1.142 var(--font-family-serif);\n --section-title-3: var(--font-sb) var(--font-size-9) / 1.222 var(--font-family-serif);\n --section-title-4: var(--font-sb) var(--font-size-8) / 1.25 var(--font-family-serif);\n --section-title-5: var(--font-sb) var(--font-size-7) / 1.2857 var(--font-family-serif);\n --section-title-6: var(--font-sb) var(--font-size-6) / 1.333 var(--font-family-serif);\n}\n\n/* Typography classes */\n.heading-1,\n.heading-1-sb,\n.heading-1-lt {\n font-size: var(--font-size-7);\n font-weight: var(--font-rg);\n line-height: 1.28;\n}\n\n.heading-2,\n.heading-2-sb,\n.heading-2-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n}\n\n.heading-3,\n.heading-3-sb,\n.heading-3-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n}\n\n.heading-4,\n.heading-4-sb,\n.heading-4-lt {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n}\n\n.body-1,\n.body-1-sb {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n}\n\n.body-2,\n.body-2-sb {\n font-size: var(--font-size-4);\n font-weight: var(--font-rg);\n line-height: 1.5;\n}\n\n.body-3,\n.body-3-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n}\n\n.body-4,\n.body-4-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n}\n\n.body-5,\n.body-5-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n}\n\n.interactive-1,\n.interactive-1-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n}\n\n.interactive-2,\n.interactive-2-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n}\n\n.interactive-3,\n.interactive-3-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n}\n\n.helper,\n.helper-sb {\n font-size: var(--font-size-1);\n font-style: italic;\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n}\n\n/* section title */\n.section-title-1 {\n font: var(--section-title-1);\n}\n\n.section-title-2 {\n font: var(--section-title-2);\n}\n\n.section-title-3 {\n font: var(--section-title-3);\n}\n\n.section-title-4 {\n font: var(--section-title-4);\n}\n\n.section-title-5 {\n font: var(--section-title-5);\n}\n\n.section-title-6 {\n font: var(--section-title-6);\n}\n\n/* heading-1/2 for desktop and wide viewports */\n@media (min-width: 1152px) {\n .heading-1,\n .heading-1-sb,\n .heading-1-lt {\n font-size: var(--font-size-8);\n font-weight: var(--font-rg);\n line-height: 1.25;\n }\n\n .heading-2,\n .heading-2-sb,\n .heading-2-lt {\n font-size: var(--font-size-7);\n font-weight: var(--font-rg);\n line-height: 1.28;\n }\n}\n\n/* viewport classes */\n@media (max-width: 767px) {\n .mobile-heading-1,\n .mobile-heading-1-sb,\n .mobile-heading-1-lt {\n font-size: var(--font-size-7);\n font-weight: var(--font-rg);\n line-height: 1.28;\n }\n\n .mobile-heading-2,\n .mobile-heading-2-sb,\n .mobile-heading-2-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n }\n\n .mobile-heading-3,\n .mobile-heading-3-sb,\n .mobile-heading-3-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n }\n\n .mobile-heading-4,\n .mobile-heading-4-sb,\n .mobile-heading-4-lt {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .mobile-body-1,\n .mobile-body-1-sb {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .mobile-body-2,\n .mobile-body-2-sb {\n font-size: var(--font-size-4);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .mobile-body-3,\n .mobile-body-3-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .mobile-body-4,\n .mobile-body-4-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .mobile-body-5,\n .mobile-body-5-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .mobile-interactive-1,\n .mobile-interactive-1-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .mobile-interactive-2,\n .mobile-interactive-2-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .mobile-interactive-3,\n .mobile-interactive-3-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .mobile-section-title-1 {\n font: var(--section-title-1);\n }\n\n .mobile-section-title-2 {\n font: var(--section-title-2);\n }\n\n .mobile-section-title-3 {\n font: var(--section-title-3);\n }\n\n .mobile-section-title-4 {\n font: var(--section-title-4);\n }\n\n .mobile-section-title-5 {\n font: var(--section-title-5);\n }\n\n .mobile-section-title-6 {\n font: var(--section-title-6);\n }\n\n .mobile-heading-1-lt,\n .mobile-heading-2-lt,\n .mobile-heading-3-lt,\n .mobile-heading-4-lt {\n font-weight: var(--font-lt);\n }\n\n .mobile-heading-1-sb,\n .mobile-heading-2-sb,\n .mobile-heading-3-sb,\n .mobile-heading-4-sb,\n .mobile-body-1-sb,\n .mobile-body-2-sb,\n .mobile-body-3-sb,\n .mobile-body-4-sb,\n .mobile-body-5-sb,\n .mobile-interactive-1-sb,\n .mobile-interactive-2-sb,\n .mobile-interactive-3-sb {\n font-weight: var(--font-sb);\n }\n}\n\n@media (min-width: 768px) and (max-width: 1151px) {\n .tablet-heading-1,\n .tablet-heading-1-sb,\n .tablet-heading-1-lt {\n font-size: var(--font-size-7);\n font-weight: var(--font-rg);\n line-height: 1.28;\n }\n\n .tablet-heading-2,\n .tablet-heading-2-sb,\n .tablet-heading-2-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n }\n\n .tablet-heading-3,\n .tablet-heading-3-sb,\n .tablet-heading-3-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n }\n\n .tablet-heading-4,\n .tablet-heading-4-sb,\n .tablet-heading-4-lt {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .tablet-body-1,\n .tablet-body-1-sb {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .tablet-body-2,\n .tablet-body-2-sb {\n font-size: var(--font-size-4);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .tablet-body-3,\n .tablet-body-3-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .tablet-body-4,\n .tablet-body-4-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .tablet-body-5,\n .tablet-body-5-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .tablet-interactive-1,\n .tablet-interactive-1-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .tablet-interactive-2,\n .tablet-interactive-2-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .tablet-interactive-3,\n .tablet-interactive-3-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .tablet-section-title-1 {\n font: var(--section-title-1);\n }\n\n .tablet-section-title-2 {\n font: var(--section-title-2);\n }\n\n .tablet-section-title-3 {\n font: var(--section-title-3);\n }\n\n .tablet-section-title-4 {\n font: var(--section-title-4);\n }\n\n .tablet-section-title-5 {\n font: var(--section-title-5);\n }\n\n .tablet-section-title-6 {\n font: var(--section-title-6);\n }\n\n .tablet-heading-1-lt,\n .tablet-heading-2-lt,\n .tablet-heading-3-lt,\n .tablet-heading-4-lt {\n font-weight: var(--font-lt);\n }\n\n .tablet-heading-1-sb,\n .tablet-heading-2-sb,\n .tablet-heading-3-sb,\n .tablet-heading-4-sb,\n .tablet-body-1-sb,\n .tablet-body-2-sb,\n .tablet-body-3-sb,\n .tablet-body-4-sb,\n .tablet-body-5-sb,\n .tablet-interactive-1-sb,\n .tablet-interactive-2-sb,\n .tablet-interactive-3-sb {\n font-weight: var(--font-sb);\n }\n}\n\n@media (min-width: 1152px) and (max-width: 1365px) {\n .desktop-heading-1,\n .desktop-heading-1-sb,\n .desktop-heading-1-lt {\n font-size: var(--font-size-8);\n font-weight: var(--font-rg);\n line-height: 1.25;\n }\n\n .desktop-heading-2,\n .desktop-heading-2-sb,\n .desktop-heading-2-lt {\n font-size: var(--font-size-7);\n font-weight: var(--font-rg);\n line-height: 1.28;\n }\n\n .desktop-heading-3,\n .desktop-heading-3-sb,\n .desktop-heading-3-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n }\n\n .desktop-heading-4,\n .desktop-heading-4-sb,\n .desktop-heading-4-lt {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .desktop-body-1,\n .desktop-body-1-sb {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .desktop-body-2,\n .desktop-body-2-sb {\n font-size: var(--font-size-4);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .desktop-body-3,\n .desktop-body-3-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .desktop-body-4,\n .desktop-body-4-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .desktop-body-5,\n .desktop-body-5-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .desktop-interactive-1,\n .desktop-interactive-1-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .desktop-interactive-2,\n .desktop-interactive-2-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .desktop-interactive-3,\n .desktop-interactive-3-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .desktop-section-title-1 {\n font: var(--section-title-1);\n }\n\n .desktop-section-title-2 {\n font: var(--section-title-2);\n }\n\n .desktop-section-title-3 {\n font: var(--section-title-3);\n }\n\n .desktop-section-title-4 {\n font: var(--section-title-4);\n }\n\n .desktop-section-title-5 {\n font: var(--section-title-5);\n }\n\n .desktop-section-title-6 {\n font: var(--section-title-6);\n }\n\n .desktop-heading-1-lt,\n .desktop-heading-2-lt,\n .desktop-heading-3-lt,\n .desktop-heading-4-lt {\n font-weight: var(--font-lt);\n }\n\n .desktop-heading-1-sb,\n .desktop-heading-2-sb,\n .desktop-heading-3-sb,\n .desktop-heading-4-sb,\n .desktop-body-1-sb,\n .desktop-body-2-sb,\n .desktop-body-3-sb,\n .desktop-body-4-sb,\n .desktop-body-5-sb,\n .desktop-interactive-1-sb,\n .desktop-interactive-2-sb,\n .desktop-interactive-3-sb {\n font-weight: var(--font-sb);\n }\n}\n\n@media (min-width: 1366px) {\n .wide-heading-1,\n .wide-heading-1-sb,\n .wide-heading-1-lt {\n font-size: var(--font-size-8);\n font-weight: var(--font-rg);\n line-height: 1.25;\n }\n\n .wide-heading-2,\n .wide-heading-2-sb,\n .wide-heading-2-lt {\n font-size: var(--font-size-7);\n font-weight: var(--font-rg);\n line-height: 1.28;\n }\n\n .wide-heading-3,\n .wide-heading-3-sb,\n .wide-heading-3-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n }\n\n .wide-heading-4,\n .wide-heading-4-sb,\n .wide-heading-4-lt {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .wide-body-1,\n .wide-body-1-sb {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .wide-body-2,\n .wide-body-2-sb {\n font-size: var(--font-size-4);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .wide-body-3,\n .wide-body-3-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .wide-body-4,\n .wide-body-4-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .wide-body-5,\n .wide-body-5-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .wide-interactive-1,\n .wide-interactive-1-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .wide-interactive-2,\n .wide-interactive-2-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .wide-interactive-3,\n .wide-interactive-3-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .wide-section-title-1 {\n font: var(--section-title-1);\n }\n\n .wide-section-title-2 {\n font: var(--section-title-2);\n }\n\n .wide-section-title-3 {\n font: var(--section-title-3);\n }\n\n .wide-section-title-4 {\n font: var(--section-title-4);\n }\n\n .wide-section-title-5 {\n font: var(--section-title-5);\n }\n\n .wide-section-title-6 {\n font: var(--section-title-6);\n }\n\n .wide-heading-1-lt,\n .wide-heading-2-lt,\n .wide-heading-3-lt,\n .wide-heading-4-lt {\n font-weight: var(--font-lt);\n }\n\n .wide-heading-1-sb,\n .wide-heading-2-sb,\n .wide-heading-3-sb,\n .wide-heading-4-sb,\n .wide-body-1-sb,\n .wide-body-2-sb,\n .wide-body-3-sb,\n .wide-body-4-sb,\n .wide-body-5-sb,\n .wide-interactive-1-sb,\n .wide-interactive-2-sb,\n .wide-interactive-3-sb {\n font-weight: var(--font-sb);\n }\n}\n\n/* font-weight variants */\n.heading-1-lt,\n.heading-2-lt,\n.heading-3-lt,\n.heading-4-lt {\n font-weight: var(--font-lt);\n}\n\n.heading-1-sb,\n.heading-2-sb,\n.heading-3-sb,\n.heading-4-sb,\n.body-1-sb,\n.body-2-sb,\n.body-3-sb,\n.body-4-sb,\n.body-5-sb,\n.interactive-1-sb,\n.interactive-2-sb,\n.interactive-3-sb,\n.helper-sb {\n font-weight: var(--font-sb);\n}\n","import {Component, ComponentInterface, Element, Event, EventEmitter, Host, Prop, State, Watch, h} from \"@stencil/core\";\nimport {ButtonVariant, CarouselArrowsPosition, CarouselProgressMode} from \"../../beans\";\n\n/**\n * ZCarousel component.\n * @slot - Carousel items. Use `<li>` elements inside this slot.\n */\n@Component({\n tag: \"z-carousel\",\n styleUrls: [\"styles.css\", \"../../tokens/typography.css\"],\n shadow: true,\n})\nexport class ZCarousel implements ComponentInterface {\n @Element() host: HTMLZCarouselElement;\n\n /** The z-carousel is on loading state */\n @Prop()\n isLoading: boolean;\n\n /** The z-carousel title */\n @Prop()\n label?: string;\n\n /** Shows only one content at a time */\n @Prop({reflect: true})\n single = false;\n\n /** Arrow buttons position */\n @Prop({reflect: true})\n arrowsPosition?: CarouselArrowsPosition;\n\n /** Progress indicator type. Only available for `single` mode */\n @Prop()\n progressMode?: CarouselProgressMode;\n\n /**\n * Whether the navigation arrow buttons over the items are always visible or only on mouse hover.\n * If set to `false`, the arrows will not be visible on mobile.\n * Only meaningful with `arrowsPosition` set to `OVER`.\n */\n @Prop({reflect: true})\n fixedArrows = true;\n\n /** The height of the ghost loader (only visible when `isLoading` is set to `true`) */\n @Prop()\n ghostLoadingHeight = 100;\n\n /** When enabled, navigating next the last item will go back to the first item and vice versa. */\n @Prop()\n infinite = false;\n\n /** Current item index for single mode. */\n @State()\n current = 0;\n\n /** Items on the slider. */\n @State()\n items: HTMLLIElement[];\n\n /** Index of the indicator to highlight. */\n @State()\n highlightedIndicator: number;\n\n @State()\n canNavigatePrev: boolean;\n\n @State()\n canNavigateNext: boolean;\n\n /** Reference for the items container element. */\n protected itemsContainer: HTMLUListElement;\n\n /** Observer that handles current index change when scrolling on single mode. */\n private intersectionObserver: IntersectionObserver;\n\n /** Observer to check if navigation can still be enabled/showed when the size of the items' container changes */\n private resizeObserver: ResizeObserver;\n\n /** Flag indicating the items container is about to scroll programmatically towards the stored index. */\n private scrollingTo: number = null;\n\n /** Emitted on index change and only in `single` mode. */\n @Event()\n indexChange: EventEmitter<{currentItem: number}>;\n\n @Watch(\"current\")\n onIndexChange(): void {\n this.indexChange.emit({currentItem: this.current});\n }\n\n @Watch(\"single\")\n onSingleModeChange(): void {\n if (this.single && !this.intersectionObserver) {\n this.setIntersectionObserver();\n }\n }\n\n @Watch(\"infinite\")\n onInfiniteModeChange(): void {\n this.checkNavigationValidity();\n }\n\n @Watch(\"isLoading\")\n onLoadingChange(): void {\n if (!this.isLoading) {\n // when loading is finished, we need to set up things with the real items that were not present during the loading phase\n this.setupObserversAndListeners();\n }\n }\n\n /** Set up all observers and listeners related to the rendered items. */\n private setupObserversAndListeners(): void {\n this.setupItems();\n this.itemsContainer?.addEventListener(\"scroll\", this.checkNavigationValidity.bind(this), {passive: true});\n this.resizeObserver = new ResizeObserver(this.checkNavigationValidity.bind(this));\n this.resizeObserver.observe(this.itemsContainer);\n if (this.single) {\n this.setIntersectionObserver();\n }\n this.checkNavigationValidity();\n }\n\n /**\n * Set an intersection observer to:\n * - highlight the indicator of the intersecting item during scroll\n * - set the current item to the last intersecting item\n */\n private setIntersectionObserver(): void {\n this.intersectionObserver = new IntersectionObserver(\n (entries) => {\n const entry = entries.find(({isIntersecting}) => isIntersecting);\n if (!entry) {\n return;\n }\n\n const entryIndex = this.items.findIndex((item) => item === entry.target);\n this.highlightedIndicator = entryIndex;\n\n /* skip setting the current item if intersection has been triggered by a programmatic scroll\n (@see `goTo` function) and the final index has not been reached */\n if (this.scrollingTo !== null && entryIndex !== this.scrollingTo) {\n return;\n }\n\n this.scrollingTo = null;\n this.current = entryIndex;\n },\n {\n root: this.itemsContainer,\n threshold: 0.5,\n }\n );\n\n this.items.forEach((element) => this.intersectionObserver.observe(element));\n }\n\n /** Update items' list and check conditions to allow navigation */\n private onSlotChange(): void {\n this.items = Array.from(this.host.children) as HTMLLIElement[];\n this.checkNavigationValidity();\n this.setIntersectionObserver();\n this.goTo(this.current);\n }\n\n private onPrev(): void {\n if (this.single) {\n this.goTo(this.infinite && this.current - 1 < 0 ? this.items.length - 1 : Math.max(0, this.current - 1));\n\n return;\n }\n\n this.itemsContainer.scrollBy({\n left:\n this.infinite && this.itemsContainer.scrollLeft == 0\n ? this.itemsContainer.scrollWidth - this.itemsContainer.clientWidth\n : -this.itemsContainer.clientWidth / 2,\n behavior: \"smooth\",\n });\n }\n\n private onNext(): void {\n if (this.single) {\n const next =\n this.infinite && this.current + 1 > this.items.length - 1\n ? 0\n : Math.min(this.current + 1, this.items.length - 1);\n\n return this.goTo(next);\n }\n\n this.itemsContainer.scrollBy({\n left:\n this.infinite &&\n this.itemsContainer.scrollLeft == this.itemsContainer.scrollWidth - this.itemsContainer.clientWidth\n ? -this.itemsContainer.scrollWidth\n : this.itemsContainer.clientWidth / 2,\n behavior: \"smooth\",\n });\n }\n\n /**\n * Check if navigation buttons can be enabled and set the related local states.\n */\n private checkNavigationValidity(): void {\n if (this.single) {\n this.canNavigatePrev = this.current > 0;\n this.canNavigateNext = this.current < this.items.length - 1;\n\n return;\n }\n\n this.canNavigatePrev = this.itemsContainer.scrollLeft > 0;\n this.canNavigateNext =\n this.itemsContainer.scrollLeft < this.itemsContainer.scrollWidth - this.itemsContainer.clientWidth;\n }\n\n /**\n * Check if footer has to be rendered.\n */\n private canShowFooter(): boolean {\n if (!this.canNavigatePrev && !this.canNavigateNext) {\n return false;\n }\n\n return (\n this.arrowsPosition === CarouselArrowsPosition.BOTTOM ||\n this.progressMode === CarouselProgressMode.DOTS ||\n this.progressMode === CarouselProgressMode.NUMBERS\n );\n }\n\n /**\n * Set current item to passed index.\n * @param index Index to set\n */\n private goTo(index: number): void {\n if (this.current === index) {\n return;\n }\n\n this.scrollingTo = index;\n const left = this.items.slice(0, index).reduce((acc, item) => (acc += item.clientWidth), 0);\n // the scroll will trigger the IntersectionObserver and set the current item\n this.itemsContainer.scroll({\n left,\n behavior: \"smooth\",\n });\n }\n\n /** Check if navigation of at least one direction is enabled */\n private get canNavigate(): boolean {\n return this.canNavigatePrev || this.canNavigateNext;\n }\n\n private setupItems(): void {\n this.items = Array.from(this.host.children) as HTMLLIElement[];\n this.items.forEach((item) => {\n item.setAttribute(\"aria-roledescription\", \"slide\");\n });\n }\n\n componentDidLoad(): void {\n if (this.isLoading) {\n return;\n }\n\n this.setupObserversAndListeners();\n }\n\n disconnectedCallback(): void {\n this.resizeObserver?.disconnect();\n }\n\n render(): HTMLDivElement | HTMLZCarouselElement {\n if (this.isLoading) {\n return (\n <div class=\"z-carousel-container\">\n {this.label && <div class=\"heading-3-sb z-carousel-title\">{this.label}</div>}\n <div style={{height: `${this.ghostLoadingHeight}px`}}>\n <z-ghost-loading></z-ghost-loading>\n </div>\n </div>\n );\n }\n\n return (\n <Host>\n <div\n class=\"z-carousel-container\"\n aria-roledescription=\"carousel\"\n aria-label={this.label || \"Carousel\"}\n >\n {this.label && <div class=\"z-carousel-title heading-3-sb\">{this.label}</div>}\n <div class=\"z-carousel-wrapper\">\n <z-button\n class=\"z-carousel-navigation-arrow\"\n variant={ButtonVariant.SECONDARY}\n data-direction=\"prev\"\n icon=\"arrow-left\"\n onClick={this.onPrev.bind(this)}\n disabled={!this.infinite && !this.canNavigatePrev}\n hidden={this.arrowsPosition !== CarouselArrowsPosition.OVER || !this.canNavigate}\n ariaLabel={this.single ? \"Mostra l'elemento precedente\" : \"Mostra gli elementi precedenti\"}\n />\n <ul\n class=\"z-carousel-items-container\"\n aria-atomic=\"false\"\n aria-live=\"polite\"\n ref={(el) => (this.itemsContainer = el)}\n >\n <slot onSlotchange={this.onSlotChange.bind(this)} />\n </ul>\n <z-button\n class=\"z-carousel-navigation-arrow\"\n variant={ButtonVariant.SECONDARY}\n data-direction=\"next\"\n icon=\"arrow-right\"\n onClick={this.onNext.bind(this)}\n disabled={!this.infinite && !this.canNavigateNext}\n hidden={this.arrowsPosition !== CarouselArrowsPosition.OVER || !this.canNavigate}\n ariaLabel={this.single ? \"Mostra l'elemento successivo\" : \"Mostra gli elementi successivi\"}\n />\n </div>\n </div>\n\n {this.canShowFooter() && (\n <div class=\"z-carousel-footer\">\n {this.arrowsPosition === CarouselArrowsPosition.BOTTOM && (\n <z-button\n class=\"z-carousel-navigation-arrow\"\n variant={ButtonVariant.TERTIARY}\n icon=\"arrow-left\"\n onClick={this.onPrev.bind(this)}\n disabled={!this.infinite && !this.canNavigatePrev}\n ariaLabel={this.single ? \"Mostra l'elemento precedente\" : \"Mostra gli elementi precedenti\"}\n />\n )}\n {this.progressMode === CarouselProgressMode.DOTS && this.single && this.items && (\n <div class=\"dots-progress\">\n {this.items.map((_, index) => (\n <button\n type=\"button\"\n class={{current: this.highlightedIndicator === index}}\n aria-label={\n this.highlightedIndicator === index ? \"Elemento corrente\" : `Spostati all'elemento ${index + 1}`\n }\n onClick={() => this.goTo(index)}\n />\n ))}\n </div>\n )}\n {this.progressMode === CarouselProgressMode.NUMBERS && this.single && this.items && (\n <div class=\"numbers-progress interactive-1\">\n <span class=\"current\">{this.current + 1}</span>\n <span>di</span>\n <span>{this.items.length}</span>\n </div>\n )}\n {this.arrowsPosition === CarouselArrowsPosition.BOTTOM && (\n <z-button\n class=\"z-carousel-navigation-arrow\"\n variant={ButtonVariant.TERTIARY}\n icon=\"arrow-right\"\n onClick={this.onNext.bind(this)}\n disabled={!this.infinite && !this.canNavigateNext}\n ariaLabel={this.single ? \"Mostra l'elemento successivo\" : \"Mostra gli elementi successivi\"}\n />\n )}\n </div>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AKgD,KAAKwB,QAKhCxE,KAAKoE,eAAiBC,EAAqBE,SAAWvE,KAAKC,QAAUD,KAAKkC,OACzEiD,EAAA,OAAKC,MAAM,kCACTD,EAAA,QAAMC,MAAM,WAAWpF,KAAKK,QAAU,GACtC8E,EAAA,kBACAA,EAAA,YAAOnF,KAAKkC,MAAMgB,SAGrBlD,KAAKiE,iBAAmBC,EAAuBC,QAC9CgB,EAAA,YACEC,MAAM,8BACNK,QAASC,EAAcW,SACvBT,KAAK,cACLC,QAAS7F,KAAK2D,OAAOpC,KAAKvB,MAC1B8F,UAAW9F,KAAKI,WAAaJ,KAAK+D,gBAClCkC,UAAWjG,KAAKC,OAAS,+BAAiC,oC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["stylesCss","typographyCss","ZCarousel","__stencil_proxyCustomElement","HTMLElement","constructor","registerHost","this","single","fixedArrows","ghostLoadingHeight","infinite","current","scrollingTo","onIndexChange","indexChange","emit","currentItem","onSingleModeChange","intersectionObserver","setIntersectionObserver","onInfiniteModeChange","checkNavigationValidity","onLoadingChange","isLoading","setupObserversAndListeners","setupItems","_a","itemsContainer","addEventListener","bind","passive","resizeObserver","ResizeObserver","observe","IntersectionObserver","entries","entry","find","isIntersecting","entryIndex","items","findIndex","item","target","highlightedIndicator","root","threshold","forEach","element","onSlotChange","Array","from","host","children","goTo","onPrev","length","Math","max","scrollBy","left","scrollLeft","scrollWidth","clientWidth","behavior","onNext","next","min","canNavigatePrev","canNavigateNext","canShowFooter","arrowsPosition","CarouselArrowsPosition","BOTTOM","progressMode","CarouselProgressMode","DOTS","NUMBERS","index","slice","reduce","acc","scroll","canNavigate","setAttribute","componentDidLoad","disconnectedCallback","disconnect","render","h","class","label","style","height","Host","variant","ButtonVariant","SECONDARY","icon","onClick","disabled","hidden","OVER","ariaLabel","ref","el","onSlotchange","TERTIARY","map","_","type"],"sources":["src/components/z-carousel/styles.css?tag=z-carousel&encapsulation=shadow","src/tokens/typography.css?tag=z-carousel&encapsulation=shadow","src/components/z-carousel/index.tsx"],"sourcesContent":[":host {\n /**\n * @prop --z-carousel-gutter: The gutter between items.\n * @prop --z-carousel-items-shadow: The shadow around the items.\n */\n --z-carousel-gutter: 0;\n --z-carousel-items-shadow: ;\n\n font-family: var(--font-family-sans);\n font-weight: var(--font-rg);\n}\n\n:host([single]) {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n:host([single]) .z-carousel-container {\n width: fit-content;\n max-width: 100%;\n}\n\n.z-carousel-container {\n display: flex;\n flex-direction: column;\n}\n\n.z-carousel-title {\n margin-bottom: calc(var(--space-unit) * 2);\n}\n\n.z-carousel-wrapper {\n position: relative;\n}\n\n.z-carousel-items-container {\n display: flex;\n max-width: 100%;\n flex-direction: row;\n margin: 0;\n box-shadow: var(--z-carousel-items-shadow, none);\n column-gap: var(--z-carousel-gutter);\n list-style: none;\n -ms-overflow-style: none; /* IE and Edge */\n overflow-x: scroll;\n padding-inline-start: 0;\n scroll-behavior: smooth;\n scroll-snap-type: x mandatory;\n\n /* Hide scrollbar for IE, Edge and Firefox */\n scrollbar-width: none; /* Firefox */\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n.z-carousel-items-container::-webkit-scrollbar {\n display: none;\n}\n\n.z-carousel-items-container ::slotted(*) {\n scroll-snap-align: center;\n}\n\n.z-carousel-navigation-arrow[hidden] {\n display: none;\n}\n\n.z-carousel-navigation-arrow[data-direction] {\n position: absolute;\n z-index: 1;\n bottom: 50%;\n transform: translateY(50%);\n}\n\n.z-carousel-navigation-arrow[data-direction=\"next\"] {\n right: 0;\n}\n\n:host(:not([fixed-arrows])) .z-carousel-wrapper .z-carousel-navigation-arrow {\n display: none;\n}\n\n.z-carousel-footer {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n column-gap: calc(var(--space-unit) * 3);\n}\n\n:host([arrows-position=\"bottom\"]) .z-carousel-footer {\n margin-top: calc(var(--space-unit) * 0.75);\n}\n\n.z-carousel-footer .numbers-progress,\n.z-carousel-footer .dots-progress {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.z-carousel-footer .dots-progress {\n column-gap: calc(var(--space-unit) * 3);\n}\n\n:host(:not([arrows-position=\"bottom\"])) .z-carousel-footer .dots-progress {\n margin-top: calc(var(--space-unit) * 2);\n}\n\n.z-carousel-footer .dots-progress button {\n display: flex;\n width: calc(var(--space-unit) * 3);\n height: calc(var(--space-unit) * 3);\n align-items: center;\n padding: 0;\n border: none;\n margin: 0;\n background-color: var(--color-surface03);\n border-radius: calc(var(--space-unit) * 3);\n}\n\n.z-carousel-footer .dots-progress button.current {\n background-color: var(--color-primary01);\n}\n\n.z-carousel-footer .dots-progress button:focus:focus-visible {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n.z-carousel-footer .dots-progress button:not(.current) {\n cursor: pointer;\n}\n\n.z-carousel-footer .numbers-progress {\n column-gap: calc(var(--space-unit) / 2);\n}\n\n:host(:not([arrows-position=\"bottom\"])) .z-carousel-footer .numbers-progress {\n margin-top: var(--space-unit);\n}\n\n.z-carousel-footer .numbers-progress .current {\n font-weight: var(--font-sb);\n}\n\n@media (min-width: 768px) {\n :host(:not([fixed-arrows])) .z-carousel-wrapper:hover .z-carousel-navigation-arrow:not([hidden]) {\n display: flex;\n }\n}\n",":root {\n /* font-family */\n --font-family-sans: \"IBM Plex Sans\", sans-serif;\n --font-family-serif: \"IBM Plex Serif\", serif;\n\n /* font-weight */\n --font-lt: 300;\n --font-rg: 400;\n --font-sb: 600;\n --font-bd: 700;\n\n /* font-size type scale */\n --font-size-1: 0.75rem; /* 12px */\n --font-size-2: 0.875rem; /* 14px */\n --font-size-3: 1rem; /* assuming 16px */\n --font-size-4: 1.125rem; /* 18px */\n --font-size-5: 1.25rem; /* 20px */\n --font-size-6: 1.5rem; /* 24px */\n --font-size-7: 1.75rem; /* 28px */\n --font-size-8: 2rem; /* 32px */\n --font-size-9: 2.25rem; /* 36px */\n --font-size-10: 2.625rem; /* 42px */\n --font-size-11: 3rem; /* 48px */\n --font-size-12: 3.375rem; /* 54px */\n --font-size-13: 3.75rem; /* 60px */\n --font-size-14: 4.25rem; /* 68px */\n --font-size-15: 4.75rem; /* 76px */\n --font-size-16: 5.25rem; /* 84px */\n --font-size-17: 5.75rem; /* 92px */\n\n /* cssprops to use with `font` shorthand property */\n --section-title-1: var(--font-sb) var(--font-size-11) / 1.083 var(--font-family-serif);\n --section-title-2: var(--font-sb) var(--font-size-10) / 1.142 var(--font-family-serif);\n --section-title-3: var(--font-sb) var(--font-size-9) / 1.222 var(--font-family-serif);\n --section-title-4: var(--font-sb) var(--font-size-8) / 1.25 var(--font-family-serif);\n --section-title-5: var(--font-sb) var(--font-size-7) / 1.2857 var(--font-family-serif);\n --section-title-6: var(--font-sb) var(--font-size-6) / 1.333 var(--font-family-serif);\n}\n\n/* Typography classes */\n.heading-1,\n.heading-1-sb,\n.heading-1-lt {\n font-size: var(--font-size-7);\n font-weight: var(--font-rg);\n line-height: 1.28;\n}\n\n.heading-2,\n.heading-2-sb,\n.heading-2-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n}\n\n.heading-3,\n.heading-3-sb,\n.heading-3-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n}\n\n.heading-4,\n.heading-4-sb,\n.heading-4-lt {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n}\n\n.body-1,\n.body-1-sb {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n}\n\n.body-2,\n.body-2-sb {\n font-size: var(--font-size-4);\n font-weight: var(--font-rg);\n line-height: 1.5;\n}\n\n.body-3,\n.body-3-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n}\n\n.body-4,\n.body-4-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n}\n\n.body-5,\n.body-5-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n}\n\n.interactive-1,\n.interactive-1-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n}\n\n.interactive-2,\n.interactive-2-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n}\n\n.interactive-3,\n.interactive-3-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n}\n\n.helper,\n.helper-sb {\n font-size: var(--font-size-1);\n font-style: italic;\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n}\n\n/* section title */\n.section-title-1 {\n font: var(--section-title-1);\n}\n\n.section-title-2 {\n font: var(--section-title-2);\n}\n\n.section-title-3 {\n font: var(--section-title-3);\n}\n\n.section-title-4 {\n font: var(--section-title-4);\n}\n\n.section-title-5 {\n font: var(--section-title-5);\n}\n\n.section-title-6 {\n font: var(--section-title-6);\n}\n\n/* heading-1/2 for desktop and wide viewports */\n@media (min-width: 1152px) {\n .heading-1,\n .heading-1-sb,\n .heading-1-lt {\n font-size: var(--font-size-8);\n font-weight: var(--font-rg);\n line-height: 1.25;\n }\n\n .heading-2,\n .heading-2-sb,\n .heading-2-lt {\n font-size: var(--font-size-7);\n font-weight: var(--font-rg);\n line-height: 1.28;\n }\n}\n\n/* viewport classes */\n@media (max-width: 767px) {\n .mobile-heading-1,\n .mobile-heading-1-sb,\n .mobile-heading-1-lt {\n font-size: var(--font-size-7);\n font-weight: var(--font-rg);\n line-height: 1.28;\n }\n\n .mobile-heading-2,\n .mobile-heading-2-sb,\n .mobile-heading-2-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n }\n\n .mobile-heading-3,\n .mobile-heading-3-sb,\n .mobile-heading-3-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n }\n\n .mobile-heading-4,\n .mobile-heading-4-sb,\n .mobile-heading-4-lt {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .mobile-body-1,\n .mobile-body-1-sb {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .mobile-body-2,\n .mobile-body-2-sb {\n font-size: var(--font-size-4);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .mobile-body-3,\n .mobile-body-3-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .mobile-body-4,\n .mobile-body-4-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .mobile-body-5,\n .mobile-body-5-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .mobile-interactive-1,\n .mobile-interactive-1-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .mobile-interactive-2,\n .mobile-interactive-2-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .mobile-interactive-3,\n .mobile-interactive-3-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .mobile-section-title-1 {\n font: var(--section-title-1);\n }\n\n .mobile-section-title-2 {\n font: var(--section-title-2);\n }\n\n .mobile-section-title-3 {\n font: var(--section-title-3);\n }\n\n .mobile-section-title-4 {\n font: var(--section-title-4);\n }\n\n .mobile-section-title-5 {\n font: var(--section-title-5);\n }\n\n .mobile-section-title-6 {\n font: var(--section-title-6);\n }\n\n .mobile-heading-1-lt,\n .mobile-heading-2-lt,\n .mobile-heading-3-lt,\n .mobile-heading-4-lt {\n font-weight: var(--font-lt);\n }\n\n .mobile-heading-1-sb,\n .mobile-heading-2-sb,\n .mobile-heading-3-sb,\n .mobile-heading-4-sb,\n .mobile-body-1-sb,\n .mobile-body-2-sb,\n .mobile-body-3-sb,\n .mobile-body-4-sb,\n .mobile-body-5-sb,\n .mobile-interactive-1-sb,\n .mobile-interactive-2-sb,\n .mobile-interactive-3-sb {\n font-weight: var(--font-sb);\n }\n}\n\n@media (min-width: 768px) and (max-width: 1151px) {\n .tablet-heading-1,\n .tablet-heading-1-sb,\n .tablet-heading-1-lt {\n font-size: var(--font-size-7);\n font-weight: var(--font-rg);\n line-height: 1.28;\n }\n\n .tablet-heading-2,\n .tablet-heading-2-sb,\n .tablet-heading-2-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n }\n\n .tablet-heading-3,\n .tablet-heading-3-sb,\n .tablet-heading-3-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n }\n\n .tablet-heading-4,\n .tablet-heading-4-sb,\n .tablet-heading-4-lt {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .tablet-body-1,\n .tablet-body-1-sb {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .tablet-body-2,\n .tablet-body-2-sb {\n font-size: var(--font-size-4);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .tablet-body-3,\n .tablet-body-3-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .tablet-body-4,\n .tablet-body-4-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .tablet-body-5,\n .tablet-body-5-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .tablet-interactive-1,\n .tablet-interactive-1-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .tablet-interactive-2,\n .tablet-interactive-2-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .tablet-interactive-3,\n .tablet-interactive-3-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .tablet-section-title-1 {\n font: var(--section-title-1);\n }\n\n .tablet-section-title-2 {\n font: var(--section-title-2);\n }\n\n .tablet-section-title-3 {\n font: var(--section-title-3);\n }\n\n .tablet-section-title-4 {\n font: var(--section-title-4);\n }\n\n .tablet-section-title-5 {\n font: var(--section-title-5);\n }\n\n .tablet-section-title-6 {\n font: var(--section-title-6);\n }\n\n .tablet-heading-1-lt,\n .tablet-heading-2-lt,\n .tablet-heading-3-lt,\n .tablet-heading-4-lt {\n font-weight: var(--font-lt);\n }\n\n .tablet-heading-1-sb,\n .tablet-heading-2-sb,\n .tablet-heading-3-sb,\n .tablet-heading-4-sb,\n .tablet-body-1-sb,\n .tablet-body-2-sb,\n .tablet-body-3-sb,\n .tablet-body-4-sb,\n .tablet-body-5-sb,\n .tablet-interactive-1-sb,\n .tablet-interactive-2-sb,\n .tablet-interactive-3-sb {\n font-weight: var(--font-sb);\n }\n}\n\n@media (min-width: 1152px) and (max-width: 1365px) {\n .desktop-heading-1,\n .desktop-heading-1-sb,\n .desktop-heading-1-lt {\n font-size: var(--font-size-8);\n font-weight: var(--font-rg);\n line-height: 1.25;\n }\n\n .desktop-heading-2,\n .desktop-heading-2-sb,\n .desktop-heading-2-lt {\n font-size: var(--font-size-7);\n font-weight: var(--font-rg);\n line-height: 1.28;\n }\n\n .desktop-heading-3,\n .desktop-heading-3-sb,\n .desktop-heading-3-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n }\n\n .desktop-heading-4,\n .desktop-heading-4-sb,\n .desktop-heading-4-lt {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .desktop-body-1,\n .desktop-body-1-sb {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .desktop-body-2,\n .desktop-body-2-sb {\n font-size: var(--font-size-4);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .desktop-body-3,\n .desktop-body-3-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .desktop-body-4,\n .desktop-body-4-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .desktop-body-5,\n .desktop-body-5-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .desktop-interactive-1,\n .desktop-interactive-1-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .desktop-interactive-2,\n .desktop-interactive-2-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .desktop-interactive-3,\n .desktop-interactive-3-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .desktop-section-title-1 {\n font: var(--section-title-1);\n }\n\n .desktop-section-title-2 {\n font: var(--section-title-2);\n }\n\n .desktop-section-title-3 {\n font: var(--section-title-3);\n }\n\n .desktop-section-title-4 {\n font: var(--section-title-4);\n }\n\n .desktop-section-title-5 {\n font: var(--section-title-5);\n }\n\n .desktop-section-title-6 {\n font: var(--section-title-6);\n }\n\n .desktop-heading-1-lt,\n .desktop-heading-2-lt,\n .desktop-heading-3-lt,\n .desktop-heading-4-lt {\n font-weight: var(--font-lt);\n }\n\n .desktop-heading-1-sb,\n .desktop-heading-2-sb,\n .desktop-heading-3-sb,\n .desktop-heading-4-sb,\n .desktop-body-1-sb,\n .desktop-body-2-sb,\n .desktop-body-3-sb,\n .desktop-body-4-sb,\n .desktop-body-5-sb,\n .desktop-interactive-1-sb,\n .desktop-interactive-2-sb,\n .desktop-interactive-3-sb {\n font-weight: var(--font-sb);\n }\n}\n\n@media (min-width: 1366px) {\n .wide-heading-1,\n .wide-heading-1-sb,\n .wide-heading-1-lt {\n font-size: var(--font-size-8);\n font-weight: var(--font-rg);\n line-height: 1.25;\n }\n\n .wide-heading-2,\n .wide-heading-2-sb,\n .wide-heading-2-lt {\n font-size: var(--font-size-7);\n font-weight: var(--font-rg);\n line-height: 1.28;\n }\n\n .wide-heading-3,\n .wide-heading-3-sb,\n .wide-heading-3-lt {\n font-size: var(--font-size-6);\n font-weight: var(--font-rg);\n line-height: 1.333;\n }\n\n .wide-heading-4,\n .wide-heading-4-sb,\n .wide-heading-4-lt {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .wide-body-1,\n .wide-body-1-sb {\n font-size: var(--font-size-5);\n font-weight: var(--font-rg);\n line-height: 1.4;\n }\n\n .wide-body-2,\n .wide-body-2-sb {\n font-size: var(--font-size-4);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .wide-body-3,\n .wide-body-3-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .wide-body-4,\n .wide-body-4-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .wide-body-5,\n .wide-body-5-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .wide-interactive-1,\n .wide-interactive-1-sb {\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n line-height: 1.5;\n }\n\n .wide-interactive-2,\n .wide-interactive-2-sb {\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n letter-spacing: 0.16px;\n line-height: 1.4;\n }\n\n .wide-interactive-3,\n .wide-interactive-3-sb {\n font-size: var(--font-size-1);\n font-weight: var(--font-rg);\n letter-spacing: 0.32px;\n line-height: 1.333;\n }\n\n .wide-section-title-1 {\n font: var(--section-title-1);\n }\n\n .wide-section-title-2 {\n font: var(--section-title-2);\n }\n\n .wide-section-title-3 {\n font: var(--section-title-3);\n }\n\n .wide-section-title-4 {\n font: var(--section-title-4);\n }\n\n .wide-section-title-5 {\n font: var(--section-title-5);\n }\n\n .wide-section-title-6 {\n font: var(--section-title-6);\n }\n\n .wide-heading-1-lt,\n .wide-heading-2-lt,\n .wide-heading-3-lt,\n .wide-heading-4-lt {\n font-weight: var(--font-lt);\n }\n\n .wide-heading-1-sb,\n .wide-heading-2-sb,\n .wide-heading-3-sb,\n .wide-heading-4-sb,\n .wide-body-1-sb,\n .wide-body-2-sb,\n .wide-body-3-sb,\n .wide-body-4-sb,\n .wide-body-5-sb,\n .wide-interactive-1-sb,\n .wide-interactive-2-sb,\n .wide-interactive-3-sb {\n font-weight: var(--font-sb);\n }\n}\n\n/* font-weight variants */\n.heading-1-lt,\n.heading-2-lt,\n.heading-3-lt,\n.heading-4-lt {\n font-weight: var(--font-lt);\n}\n\n.heading-1-sb,\n.heading-2-sb,\n.heading-3-sb,\n.heading-4-sb,\n.body-1-sb,\n.body-2-sb,\n.body-3-sb,\n.body-4-sb,\n.body-5-sb,\n.interactive-1-sb,\n.interactive-2-sb,\n.interactive-3-sb,\n.helper-sb {\n font-weight: var(--font-sb);\n}\n","import {Component, ComponentInterface, Element, Event, EventEmitter, Host, Prop, State, Watch, h} from \"@stencil/core\";\nimport {ButtonVariant, CarouselArrowsPosition, CarouselProgressMode} from \"../../beans\";\n\n/**\n * ZCarousel component.\n * @slot - Carousel items. Use `<li>` elements inside this slot.\n */\n@Component({\n tag: \"z-carousel\",\n styleUrls: [\"styles.css\", \"../../tokens/typography.css\"],\n shadow: true,\n})\nexport class ZCarousel implements ComponentInterface {\n @Element() host: HTMLZCarouselElement;\n\n /** The z-carousel is on loading state */\n @Prop()\n isLoading: boolean;\n\n /** The z-carousel title */\n @Prop()\n label?: string;\n\n /** Shows only one content at a time */\n @Prop({reflect: true})\n single = false;\n\n /** Arrow buttons position */\n @Prop({reflect: true})\n arrowsPosition?: CarouselArrowsPosition;\n\n /** Progress indicator type. Only available for `single` mode */\n @Prop()\n progressMode?: CarouselProgressMode;\n\n /**\n * Whether the navigation arrow buttons over the items are always visible or only on mouse hover.\n * If set to `false`, the arrows will not be visible on mobile.\n * Only meaningful with `arrowsPosition` set to `OVER`.\n */\n @Prop({reflect: true})\n fixedArrows = true;\n\n /** The height of the ghost loader (only visible when `isLoading` is set to `true`) */\n @Prop()\n ghostLoadingHeight = 100;\n\n /** When enabled, navigating next the last item will go back to the first item and vice versa. */\n @Prop()\n infinite = false;\n\n /** Current item index for single mode. */\n @State()\n current = 0;\n\n /** Items on the slider. */\n @State()\n items: HTMLLIElement[];\n\n /** Index of the indicator to highlight. */\n @State()\n highlightedIndicator: number;\n\n @State()\n canNavigatePrev: boolean;\n\n @State()\n canNavigateNext: boolean;\n\n /** Reference for the items container element. */\n protected itemsContainer: HTMLUListElement;\n\n /** Observer that handles current index change when scrolling on single mode. */\n private intersectionObserver: IntersectionObserver;\n\n /** Observer to check if navigation can still be enabled/showed when the size of the items' container changes */\n private resizeObserver: ResizeObserver;\n\n /** Flag indicating the items container is about to scroll programmatically towards the stored index. */\n private scrollingTo: number = null;\n\n /** Emitted on index change and only in `single` mode. */\n @Event()\n indexChange: EventEmitter<{currentItem: number}>;\n\n @Watch(\"current\")\n onIndexChange(): void {\n this.indexChange.emit({currentItem: this.current});\n }\n\n @Watch(\"single\")\n onSingleModeChange(): void {\n if (this.single && !this.intersectionObserver) {\n this.setIntersectionObserver();\n }\n }\n\n @Watch(\"infinite\")\n onInfiniteModeChange(): void {\n this.checkNavigationValidity();\n }\n\n @Watch(\"isLoading\")\n onLoadingChange(): void {\n if (!this.isLoading) {\n // when loading is finished, we need to set up things with the real items that were not present during the loading phase\n this.setupObserversAndListeners();\n }\n }\n\n /** Set up all observers and listeners related to the rendered items. */\n private setupObserversAndListeners(): void {\n this.setupItems();\n this.itemsContainer?.addEventListener(\"scroll\", this.checkNavigationValidity.bind(this), {passive: true});\n this.resizeObserver = new ResizeObserver(this.checkNavigationValidity.bind(this));\n this.resizeObserver.observe(this.itemsContainer);\n if (this.single) {\n this.setIntersectionObserver();\n }\n this.checkNavigationValidity();\n }\n\n /**\n * Set an intersection observer to:\n * - highlight the indicator of the intersecting item during scroll\n * - set the current item to the last intersecting item\n */\n private setIntersectionObserver(): void {\n this.intersectionObserver = new IntersectionObserver(\n (entries) => {\n const entry = entries.find(({isIntersecting}) => isIntersecting);\n if (!entry) {\n return;\n }\n\n const entryIndex = this.items.findIndex((item) => item === entry.target);\n this.highlightedIndicator = entryIndex;\n\n /* skip setting the current item if intersection has been triggered by a programmatic scroll\n (@see `goTo` function) and the final index has not been reached */\n if (this.scrollingTo !== null && entryIndex !== this.scrollingTo) {\n return;\n }\n\n this.scrollingTo = null;\n this.current = entryIndex;\n },\n {\n root: this.itemsContainer,\n threshold: 0.5,\n }\n );\n\n this.items.forEach((element) => this.intersectionObserver.observe(element));\n }\n\n /** Update items' list and check conditions to allow navigation */\n private onSlotChange(): void {\n this.items = Array.from(this.host.children) as HTMLLIElement[];\n this.checkNavigationValidity();\n this.setIntersectionObserver();\n this.goTo(this.current);\n }\n\n private onPrev(): void {\n if (this.single) {\n this.goTo(this.infinite && this.current - 1 < 0 ? this.items.length - 1 : Math.max(0, this.current - 1));\n\n return;\n }\n\n this.itemsContainer.scrollBy({\n left:\n this.infinite && this.itemsContainer.scrollLeft == 0\n ? this.itemsContainer.scrollWidth - this.itemsContainer.clientWidth\n : -this.itemsContainer.clientWidth / 2,\n behavior: \"smooth\",\n });\n }\n\n private onNext(): void {\n if (this.single) {\n const next =\n this.infinite && this.current + 1 > this.items.length - 1\n ? 0\n : Math.min(this.current + 1, this.items.length - 1);\n\n return this.goTo(next);\n }\n\n this.itemsContainer.scrollBy({\n left:\n this.infinite &&\n this.itemsContainer.scrollLeft == this.itemsContainer.scrollWidth - this.itemsContainer.clientWidth\n ? -this.itemsContainer.scrollWidth\n : this.itemsContainer.clientWidth / 2,\n behavior: \"smooth\",\n });\n }\n\n /**\n * Check if navigation buttons can be enabled and set the related local states.\n */\n private checkNavigationValidity(): void {\n if (this.single) {\n this.canNavigatePrev = this.current > 0;\n this.canNavigateNext = this.current < this.items.length - 1;\n\n return;\n }\n\n this.canNavigatePrev = this.itemsContainer.scrollLeft > 0;\n this.canNavigateNext =\n this.itemsContainer.scrollLeft < this.itemsContainer.scrollWidth - this.itemsContainer.clientWidth;\n }\n\n /**\n * Check if footer has to be rendered.\n */\n private canShowFooter(): boolean {\n if (!this.canNavigatePrev && !this.canNavigateNext) {\n return false;\n }\n\n return (\n this.arrowsPosition === CarouselArrowsPosition.BOTTOM ||\n this.progressMode === CarouselProgressMode.DOTS ||\n this.progressMode === CarouselProgressMode.NUMBERS\n );\n }\n\n /**\n * Set current item to passed index.\n * @param index Index to set\n */\n private goTo(index: number): void {\n if (this.current === index) {\n return;\n }\n\n this.scrollingTo = index;\n const left = this.items.slice(0, index).reduce((acc, item) => (acc += item.clientWidth), 0);\n // the scroll will trigger the IntersectionObserver and set the current item\n this.itemsContainer.scroll({\n left,\n behavior: \"smooth\",\n });\n }\n\n /** Check if navigation of at least one direction is enabled */\n private get canNavigate(): boolean {\n return this.canNavigatePrev || this.canNavigateNext;\n }\n\n private setupItems(): void {\n this.items = Array.from(this.host.children) as HTMLLIElement[];\n this.items.forEach((item) => {\n item.setAttribute(\"aria-roledescription\", \"slide\");\n });\n }\n\n componentDidLoad(): void {\n if (this.isLoading) {\n return;\n }\n\n this.setupObserversAndListeners();\n }\n\n disconnectedCallback(): void {\n this.resizeObserver?.disconnect();\n }\n\n render(): HTMLDivElement | HTMLZCarouselElement {\n if (this.isLoading) {\n return (\n <div class=\"z-carousel-container\">\n {this.label && <div class=\"heading-3-sb z-carousel-title\">{this.label}</div>}\n <div style={{height: `${this.ghostLoadingHeight}px`}}>\n <z-ghost-loading></z-ghost-loading>\n </div>\n </div>\n );\n }\n\n return (\n <Host>\n <div\n class=\"z-carousel-container\"\n aria-roledescription=\"carousel\"\n aria-label={this.label || \"Carousel\"}\n >\n {this.label && <div class=\"z-carousel-title heading-3-sb\">{this.label}</div>}\n <div class=\"z-carousel-wrapper\">\n <z-button\n class=\"z-carousel-navigation-arrow\"\n variant={ButtonVariant.SECONDARY}\n data-direction=\"prev\"\n icon=\"arrow-left\"\n onClick={this.onPrev.bind(this)}\n disabled={!this.infinite && !this.canNavigatePrev}\n hidden={this.arrowsPosition !== CarouselArrowsPosition.OVER || !this.canNavigate}\n ariaLabel={this.single ? \"Mostra l'elemento precedente\" : \"Mostra gli elementi precedenti\"}\n />\n <ul\n class=\"z-carousel-items-container\"\n aria-atomic=\"false\"\n aria-live=\"polite\"\n ref={(el) => (this.itemsContainer = el)}\n >\n <slot onSlotchange={this.onSlotChange.bind(this)} />\n </ul>\n <z-button\n class=\"z-carousel-navigation-arrow\"\n variant={ButtonVariant.SECONDARY}\n data-direction=\"next\"\n icon=\"arrow-right\"\n onClick={this.onNext.bind(this)}\n disabled={!this.infinite && !this.canNavigateNext}\n hidden={this.arrowsPosition !== CarouselArrowsPosition.OVER || !this.canNavigate}\n ariaLabel={this.single ? \"Mostra l'elemento successivo\" : \"Mostra gli elementi successivi\"}\n />\n </div>\n </div>\n\n {this.canShowFooter() && (\n <div class=\"z-carousel-footer\">\n {this.arrowsPosition === CarouselArrowsPosition.BOTTOM && (\n <z-button\n class=\"z-carousel-navigation-arrow\"\n variant={ButtonVariant.TERTIARY}\n icon=\"arrow-left\"\n onClick={this.onPrev.bind(this)}\n disabled={!this.infinite && !this.canNavigatePrev}\n ariaLabel={this.single ? \"Mostra l'elemento precedente\" : \"Mostra gli elementi precedenti\"}\n />\n )}\n {this.progressMode === CarouselProgressMode.DOTS && this.single && this.items && (\n <div class=\"dots-progress\">\n {this.items.map((_, index) => (\n <button\n type=\"button\"\n class={{current: this.highlightedIndicator === index}}\n aria-label={\n this.highlightedIndicator === index ? \"Elemento corrente\" : `Spostati all'elemento ${index + 1}`\n }\n onClick={() => this.goTo(index)}\n />\n ))}\n </div>\n )}\n {this.progressMode === CarouselProgressMode.NUMBERS && this.single && this.items && (\n <div class=\"numbers-progress interactive-1\">\n <span class=\"current\">{this.current + 1}</span>\n <span>di</span>\n <span>{this.items.length}</span>\n </div>\n )}\n {this.arrowsPosition === CarouselArrowsPosition.BOTTOM && (\n <z-button\n class=\"z-carousel-navigation-arrow\"\n variant={ButtonVariant.TERTIARY}\n icon=\"arrow-right\"\n onClick={this.onNext.bind(this)}\n disabled={!this.infinite && !this.canNavigateNext}\n ariaLabel={this.single ? \"Mostra l'elemento successivo\" : \"Mostra gli elementi successivi\"}\n />\n )}\n </div>\n )}\n </Host>\n );\n }\n}\n"],"mappings":"qOAAA,MAAMA,EAAY,IAAM,skFCAxB,MAAMC,EAAgB,IAAM,k8X,MCYfC,EAASC,EAAA,MAAAD,UAAAE,EALtB,WAAAC,CAAAC,G,2GAkBEC,KAAAC,OAAS,MAgBTD,KAAAE,YAAc,KAIdF,KAAAG,mBAAqB,IAIrBH,KAAAI,SAAW,MAIXJ,KAAAK,QAAU,EA0BFL,KAAAM,YAAsB,IAsS/B,CA/RC,aAAAC,GACEP,KAAKQ,YAAYC,KAAK,CAACC,YAAaV,KAAKK,S,CAI3C,kBAAAM,GACE,GAAIX,KAAKC,SAAWD,KAAKY,qBAAsB,CAC7CZ,KAAKa,yB,EAKT,oBAAAC,GACEd,KAAKe,yB,CAIP,eAAAC,GACE,IAAKhB,KAAKiB,UAAW,CAEnBjB,KAAKkB,4B,EAKD,0BAAAA,G,MACNlB,KAAKmB,cACLC,EAAApB,KAAKqB,kBAAc,MAAAD,SAAA,SAAAA,EAAEE,iBAAiB,SAAUtB,KAAKe,wBAAwBQ,KAAKvB,MAAO,CAACwB,QAAS,OACnGxB,KAAKyB,eAAiB,IAAIC,eAAe1B,KAAK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AAmBC,EAAuBC,QAC9CgB,EAAA,YACEC,MAAM,8BACNK,QAASC,EAAcW,SACvBT,KAAK,aACLC,QAAS7F,KAAKiD,OAAO1B,KAAKvB,MAC1B8F,UAAW9F,KAAKI,WAAaJ,KAAK8D,gBAClCmC,UAAWjG,KAAKC,OAAS,+BAAiC,mCAG7DD,KAAKoE,eAAiBC,EAAqBC,MAAQtE,KAAKC,QAAUD,KAAKkC,OACtEiD,EAAA,OAAKC,MAAM,iBACRpF,KAAKkC,MAAMoE,KAAI,CAACC,EAAG/B,IAClBW,EAAA,UACEqB,KAAK,SACLpB,MAAO,CAAC/E,QAASL,KAAKsC,uBAAyBkC,GAAM,aAEnDxE,KAAKsC,uBAAyBkC,EAAQ,oBAAsB,yBAAyBA,EAAQ,IAE/FqB,QAAS,IAAM7F,KAAKgD,KAAKwB,QAKhCxE,KAAKoE,eAAiBC,EAAqBE,SAAWvE,KAAKC,QAAUD,KAAKkC,OACzEiD,EAAA,OAAKC,MAAM,kCACTD,EAAA,QAAMC,MAAM,WAAWpF,KAAKK,QAAU,GACtC8E,EAAA,kBACAA,EAAA,YAAOnF,KAAKkC,MAAMgB,SAGrBlD,KAAKiE,iBAAmBC,EAAuBC,QAC9CgB,EAAA,YACEC,MAAM,8BACNK,QAASC,EAAcW,SACvBT,KAAK,cACLC,QAAS7F,KAAK2D,OAAOpC,KAAKvB,MAC1B8F,UAAW9F,KAAKI,WAAaJ,KAAK+D,gBAClCkC,UAAWjG,KAAKC,OAAS,+BAAiC,oC","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Z as o,d as s}from"./
|
|
1
|
+
import{Z as o,d as s}from"./p-Bj8MyegH.js";const t=o;const p=s;export{t as ZChip,p as defineCustomElement};
|
|
2
2
|
//# sourceMappingURL=z-chip.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{p as t,H as o,c as r,h as e,d as a,t as s}from"./p-RmbDDbWd.js";import{a2 as i}from"./p-DdetsoIY.js";import{a as l}from"./p-8C_CrFxp.js";const c=()=>`:host{display:grid;width:fit-content;padding:calc(var(--space-unit) * 2);background:var(--color-surface01);gap:var(--space-unit);grid-template-columns:repeat(9, calc(var(--space-unit) * 3));grid-template-rows:repeat(5, calc(var(--space-unit) * 3))}:host,*{box-sizing:border-box}button{--border-color:var(--color-surface05);padding:0;border:none;appearance:none;background:none;border-radius:var(--border-radius);cursor:pointer}button[data-color="#FFFFFF00"]{position:relative}button[data-color="#FFFFFF00"]::after{position:absolute;top:0;right:0;width:100%;height:100%;background:linear-gradient( -45deg, transparent 48%, var(--border-color) 48%, var(--border-color) 52%, transparent 52% );border-radius:var(--border-radius);content:""}button[aria-selected="true"]{box-shadow:0 0 0 1px var(--color-white), 0 0 0 3px var(--color-active-primary)}button:focus-visible{box-shadow:var(--shadow-focus-primary)}button .color-swatch{width:calc(var(--space-unit) * 3);height:calc(var(--space-unit) * 3);border:var(--border-size-small) solid var(--border-color);border-radius:var(--border-radius)}button[data-color="#FFFFFF00"]:disabled{--border-color:var(--color-disabled01-icon);cursor:not-allowed}button[data-color="#FFFFFF00"]:disabled .color-swatch{background-color:var(--color-disabled02)}`;const n={it:{"Select a color":"Seleziona un colore","Color swatch":"Campione di colore"},en:{"Select a color":"Select a color","Color swatch":"Color swatch"}};const d=5;const h=9;const u=t(class t extends o{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.colorSelected=r(this,"colorSelected",7);this.lng="it";this.disableTransparent=false;this.colorKeysByRow=[];this._colorButtons=[]}get colorButtons(){if(!this._colorButtons.length){this._colorButtons=Array.from(this.host.shadowRoot.querySelectorAll("button"))}return this._colorButtons}sortColorKeysByRow(){const t=Object.keys(i);const o=[];for(let r=0;r<d;r++){for(let e=0;e<h;e++){const a=e*d+r;if(a<t.length){o.push(t[a])}}}return o}moveFocusTo(t){this.colorButtons.forEach(((o,r)=>o.tabIndex=r===t?0:-1));this.colorButtons[t].focus()}validateTransparentSelection(){if(this.disableTransparent&&this.selectedColor==="#FFFFFF00"){this.selectedColor="#333333"}}emitColorSelected(){this.colorSelected.emit(this.selectedColor)}async setFocus(){this.colorButtons.forEach((t=>t.tabIndex=-1));const t=this.colorButtons.find((t=>t.ariaSelected==="true"))||this.colorButtons.find((t=>!t.disabled));if(!t){return}t.tabIndex=0;setTimeout((()=>{t.focus()}),50);this.host.tabIndex=-1}getNextIndexByKey(t,o,r){const e=Math.floor(t/h);const a=t%h;let s=t;switch(o){case"ArrowRight":{const t=a+1;const o=t>=h?(e+1)%d:e;s=o*h+t%h;if(s>=r){s=0}break}case"ArrowLeft":{const t=a-1;const o=t<0?(e-1+d)%d:e;s=o*h+(t+h)%h;if(s>=r){s=r-1}break}case"ArrowDown":{let t=e+1;let o=a;if(t>=d){t=0;o=(a+1)%h}s=t*h+o;if(s>=r){s=0}break}case"ArrowUp":{let t=e-1;let o=a;if(t<0){t=d-1;o=(a-1+h)%h}s=t*h+o;if(s>=r){s=r-1}break}}return s}handleKeyDown(t){var o,r;const e=t.composedPath()[0];if(!e.dataset.color){return}const a=this.colorButtons.indexOf(e);const s=this.colorButtons.length;if(a<0||!["ArrowRight","ArrowLeft","ArrowDown","ArrowUp"].includes(t.key)){return}let i=a;let l=0;do{i=this.getNextIndexByKey(i,t.key,s);l++}while(l<s&&((o=this.colorButtons[i])===null||o===void 0?void 0:o.disabled));if(i!==a&&i>=0&&i<s&&!((r=this.colorButtons[i])===null||r===void 0?void 0:r.disabled)){this.moveFocusTo(i);t.preventDefault();t.stopPropagation()}}handleBlur(t){const o=t.relatedTarget;if(!l(this.host,o)){this.host.tabIndex=0;this.colorButtons.forEach((t=>t.tabIndex=-1))}}componentWillLoad(){this.colorKeysByRow=this.sortColorKeysByRow()}render(){return e(a,{key:"f667faadf21b5b31093f9287fe1bd481e02a2474",role:"listbox","aria-label":this.htmlAriaLabel||n[this.lng]["Select a color"],tabIndex:0},this.colorKeysByRow.map((t=>{var o;return e("button",{class:"color-swatch","data-color":t,role:"option","aria-selected":((o=this.selectedColor)===null||o===void 0?void 0:o.toUpperCase())===t.toUpperCase()?"true":"false",tabIndex:-1,onClick:()=>this.selectedColor=t,disabled:this.disableTransparent&&t==="#FFFFFF00"},e("div",{class:"color-swatch",role:"img","aria-roledescription":n[this.lng]["Color swatch"],"aria-label":i[t][this.lng],title:i[t][this.lng],style:{backgroundColor:t}}))})))}get host(){return this}static get watchers(){return{disableTransparent:[{validateTransparentSelection:0}],selectedColor:[{validateTransparentSelection:0},{emitColorSelected:0}]}}static get style(){return c()}},[1,"z-color-picker",{selectedColor:[1025,"selected-color"],lng:[1],htmlAriaLabel:[1,"html-aria-label"],disableTransparent:[4,"disable-transparent"],setFocus:[64]},[[0,"focus","setFocus"],[0,"keydown","handleKeyDown"],[0,"blur","handleBlur"]],{disableTransparent:[{validateTransparentSelection:0}],selectedColor:[{validateTransparentSelection:0},{emitColorSelected:0}]}]);function b(){if(typeof customElements==="undefined"){return}const t=["z-color-picker"];t.forEach((t=>{switch(t){case"z-color-picker":if(!customElements.get(s(t))){customElements.define(s(t),u)}break}}))}const p=u;const f=b;export{p as ZColorPicker,f as defineCustomElement};
|
|
2
2
|
//# sourceMappingURL=z-color-picker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["stylesCss","LOCALES","it","en","COLOR_GROUP_SIZE","COLOR_GROUPS","ZColorPicker","__stencil_proxyCustomElement","HTMLElement","constructor","registerHost","this","lng","disableTransparent","colorKeysByRow","_colorButtons","colorButtons","length","Array","from","host","shadowRoot","querySelectorAll","sortColorKeysByRow","allKeys","Object","keys","ColorPickerPalette","ordered","row","col","columnMajorIndex","push","moveFocusTo","index","forEach","btn","i","tabIndex","focus","validateTransparentSelection","selectedColor","emitColorSelected","colorSelected","emit","setFocus","firstSelectedOrEnabled","find","ariaSelected","disabled","setTimeout","getNextIndexByKey","currentIndex","key","totalColors","Math","floor","newIndex","newCol","newRow","handleKeyDown","event","target","composedPath","dataset","color","indexOf","includes","attempts","_a","_b","preventDefault","stopPropagation","handleBlur","relatedTarget","containsElement","componentWillLoad","render","h","Host","role","htmlAriaLabel","map","colorKey","class","toUpperCase","onClick","title","style","backgroundColor"],"sources":["src/components/z-color-picker/styles.css?tag=z-color-picker&encapsulation=shadow","src/components/z-color-picker/index.tsx"],"sourcesContent":[":host {\n display: grid;\n width: fit-content;\n padding: calc(var(--space-unit) * 2);\n background: var(--color-surface01);\n gap: var(--space-unit);\n grid-template-columns: repeat(9, calc(var(--space-unit) * 3));\n grid-template-rows: repeat(5, calc(var(--space-unit) * 3));\n}\n\n:host,\n* {\n box-sizing: border-box;\n}\n\nbutton {\n --border-color: var(--color-surface05);\n\n padding: 0;\n border: none;\n appearance: none;\n background: none;\n border-radius: var(--border-radius);\n cursor: pointer;\n}\n\nbutton[data-color=\"#FFFFFF00\"] {\n position: relative;\n}\n\n/* draw a diagonal line from top right corner */\nbutton[data-color=\"#FFFFFF00\"]::after {\n position: absolute;\n top: 0;\n right: 0;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n -45deg,\n transparent 48%,\n var(--border-color) 48%,\n var(--border-color) 52%,\n transparent 52%\n );\n border-radius: var(--border-radius);\n content: \"\";\n}\n\nbutton[aria-selected=\"true\"] {\n box-shadow:\n 0 0 0 1px var(--color-white),\n 0 0 0 3px var(--color-active-primary);\n}\n\nbutton:focus-visible {\n box-shadow: var(--shadow-focus-primary);\n}\n\nbutton .color-swatch {\n width: calc(var(--space-unit) * 3);\n height: calc(var(--space-unit) * 3);\n border: var(--border-size-small) solid var(--border-color);\n border-radius: var(--border-radius);\n}\n\nbutton[data-color=\"#FFFFFF00\"]:disabled {\n --border-color: var(--color-disabled01-icon);\n\n cursor: not-allowed;\n}\n\nbutton[data-color=\"#FFFFFF00\"]:disabled .color-swatch {\n background-color: var(--color-disabled02);\n}\n","import {\n Component,\n ComponentInterface,\n Element,\n Event,\n EventEmitter,\n Host,\n Listen,\n Method,\n Prop,\n Watch,\n h,\n} from \"@stencil/core\";\nimport {ColorPickerPalette} from \"../../beans\";\nimport {containsElement} from \"../../utils/utils\";\n\nconst LOCALES = {\n it: {\n \"Select a color\": \"Seleziona un colore\",\n \"Color swatch\": \"Campione di colore\",\n },\n en: {\n \"Select a color\": \"Select a color\",\n \"Color swatch\": \"Color swatch\",\n },\n} as const;\n\n/** Number of colors in each group (column) of the grid. */\nconst COLOR_GROUP_SIZE = 5;\n\n/** Number of color groups (columns) in the grid. */\nconst COLOR_GROUPS = 9;\n\n/**\n * Color picker component.\n * This component allows the user to pick a color from a predefined set.\n */\n@Component({\n tag: \"z-color-picker\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZColorPicker implements ComponentInterface {\n @Element() host: HTMLZColorPickerElement;\n\n /**\n * The selected color to highlight.\n */\n @Prop({mutable: true})\n selectedColor: ColorPickerPalette;\n\n /**\n * The language for the aria labels inside the color picker.\n */\n @Prop()\n lng: \"it\" | \"en\" = \"it\";\n\n /**\n * The aria-label for the color picker, e.g. \"Select a background color for the label\".\n */\n @Prop()\n htmlAriaLabel: string;\n\n /**\n * Disables the transparent color option.\n * Setting `selectedColor` prop to `#FFFFFF00` while `disableTransparent` is true will default to `#333333` (\"dark gray 2\").\n */\n @Prop()\n disableTransparent = false;\n\n /**\n * Event emitted when a color is selected.\n */\n @Event()\n colorSelected: EventEmitter<ColorPickerPalette>;\n\n /**\n * The color keys arranged in row-major order for rendering and navigation.\n */\n private colorKeysByRow: ColorPickerPalette[] = [];\n\n private _colorButtons: HTMLButtonElement[] = [];\n\n private get colorButtons(): HTMLButtonElement[] {\n if (!this._colorButtons.length) {\n this._colorButtons = Array.from(this.host.shadowRoot.querySelectorAll(\"button\")) as HTMLButtonElement[];\n }\n\n return this._colorButtons;\n }\n\n /**\n * Reorders color keys from column-major (the format of the `ColorPickerPalette` object) to row-major (visual/navigation order).\n * This ensures button indices in the DOM match their visual position in the grid.\n */\n private sortColorKeysByRow(): ColorPickerPalette[] {\n const allKeys = Object.keys(ColorPickerPalette) as ColorPickerPalette[];\n const ordered: ColorPickerPalette[] = [];\n\n // Iterate through visual positions (row by row, left to right)\n for (let row = 0; row < COLOR_GROUP_SIZE; row++) {\n for (let col = 0; col < COLOR_GROUPS; col++) {\n const columnMajorIndex = col * COLOR_GROUP_SIZE + row;\n if (columnMajorIndex < allKeys.length) {\n ordered.push(allKeys[columnMajorIndex]);\n }\n }\n }\n\n return ordered;\n }\n\n /** Move focus to the specified color button by index. */\n private moveFocusTo(index: number): void {\n // Reset tabindex of other buttons and set tabindex to 0 on selected button\n this.colorButtons.forEach((btn, i) => (btn.tabIndex = i === index ? 0 : -1));\n this.colorButtons[index].focus();\n }\n\n @Watch(\"disableTransparent\")\n @Watch(\"selectedColor\")\n validateTransparentSelection(): void {\n if (this.disableTransparent && this.selectedColor === \"#FFFFFF00\") {\n this.selectedColor = \"#333333\"; // Default to dark gray 2 if transparent is disabled and currently selected\n }\n }\n\n @Watch(\"selectedColor\")\n emitColorSelected(): void {\n this.colorSelected.emit(this.selectedColor);\n }\n\n /**\n * Focuses the selected or first enabled color button and makes the container non-tabbable.\n */\n @Listen(\"focus\")\n @Method()\n async setFocus(): Promise<void> {\n // Reset tabindex of all buttons\n this.colorButtons.forEach((btn) => (btn.tabIndex = -1));\n const firstSelectedOrEnabled =\n this.colorButtons.find((btn) => btn.ariaSelected === \"true\") || this.colorButtons.find((btn) => !btn.disabled);\n if (!firstSelectedOrEnabled) {\n return;\n }\n\n firstSelectedOrEnabled.tabIndex = 0;\n setTimeout(() => {\n firstSelectedOrEnabled.focus();\n }, 50);\n // Set container as non-tabbable\n this.host.tabIndex = -1;\n }\n\n /**\n * Compute next index in row-major grid according to keyboard direction.\n */\n private getNextIndexByKey(currentIndex: number, key: string, totalColors: number): number {\n const row = Math.floor(currentIndex / COLOR_GROUPS);\n const col = currentIndex % COLOR_GROUPS;\n let newIndex = currentIndex;\n\n switch (key) {\n case \"ArrowRight\": {\n const newCol = col + 1;\n const newRow = newCol >= COLOR_GROUPS ? (row + 1) % COLOR_GROUP_SIZE : row;\n newIndex = newRow * COLOR_GROUPS + (newCol % COLOR_GROUPS);\n if (newIndex >= totalColors) {\n newIndex = 0; // Wrap to first item\n }\n\n break;\n }\n case \"ArrowLeft\": {\n const newCol = col - 1;\n const newRow = newCol < 0 ? (row - 1 + COLOR_GROUP_SIZE) % COLOR_GROUP_SIZE : row;\n newIndex = newRow * COLOR_GROUPS + ((newCol + COLOR_GROUPS) % COLOR_GROUPS);\n if (newIndex >= totalColors) {\n newIndex = totalColors - 1; // Wrap to last item\n }\n\n break;\n }\n case \"ArrowDown\": {\n let newRow = row + 1;\n let newCol = col;\n if (newRow >= COLOR_GROUP_SIZE) {\n // Wrap to first item of next column\n newRow = 0;\n newCol = (col + 1) % COLOR_GROUPS;\n }\n newIndex = newRow * COLOR_GROUPS + newCol;\n if (newIndex >= totalColors) {\n newIndex = 0; // Wrap to first item\n }\n\n break;\n }\n case \"ArrowUp\": {\n let newRow = row - 1;\n let newCol = col;\n if (newRow < 0) {\n // Wrap to last item of previous column\n newRow = COLOR_GROUP_SIZE - 1;\n newCol = (col - 1 + COLOR_GROUPS) % COLOR_GROUPS;\n }\n newIndex = newRow * COLOR_GROUPS + newCol;\n if (newIndex >= totalColors) {\n newIndex = totalColors - 1; // Wrap to last item\n }\n\n break;\n }\n }\n\n return newIndex;\n }\n\n /**\n * Handle keyboard navigation within the color picker.\n * Arrow keys move focus in the expected direction, wrapping around edges. The grid is navigated in row-major order.\n */\n @Listen(\"keydown\")\n handleKeyDown(event: KeyboardEvent): void {\n const target = event.composedPath()[0] as HTMLElement;\n if (!target.dataset.color) {\n return;\n }\n\n const currentIndex = this.colorButtons.indexOf(target as HTMLButtonElement);\n const totalColors = this.colorButtons.length;\n if (currentIndex < 0 || ![\"ArrowRight\", \"ArrowLeft\", \"ArrowDown\", \"ArrowUp\"].includes(event.key)) {\n return;\n }\n\n let newIndex = currentIndex;\n let attempts = 0;\n\n do {\n newIndex = this.getNextIndexByKey(newIndex, event.key, totalColors);\n attempts++;\n } while (attempts < totalColors && this.colorButtons[newIndex]?.disabled);\n\n if (\n newIndex !== currentIndex &&\n newIndex >= 0 &&\n newIndex < totalColors &&\n !this.colorButtons[newIndex]?.disabled\n ) {\n this.moveFocusTo(newIndex);\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * When focus leaves the color picker (e.g. user tabs away), reset all buttons to non-tabbable and make the container tabbable again.\n */\n @Listen(\"blur\")\n handleBlur(event: FocusEvent): void {\n const relatedTarget = event.relatedTarget as HTMLElement;\n if (!containsElement(this.host, relatedTarget)) {\n this.host.tabIndex = 0;\n this.colorButtons.forEach((btn) => (btn.tabIndex = -1));\n }\n }\n\n componentWillLoad(): void {\n this.colorKeysByRow = this.sortColorKeysByRow();\n }\n\n render(): HTMLZColorPickerElement {\n return (\n <Host\n role=\"listbox\"\n aria-label={this.htmlAriaLabel || LOCALES[this.lng][\"Select a color\"]}\n tabIndex={0}\n >\n {this.colorKeysByRow.map((colorKey: ColorPickerPalette) => (\n <button\n class=\"color-swatch\"\n data-color={colorKey}\n role=\"option\"\n aria-selected={this.selectedColor?.toUpperCase() === colorKey.toUpperCase() ? \"true\" : \"false\"}\n tabIndex={-1}\n onClick={() => (this.selectedColor = colorKey)}\n disabled={this.disableTransparent && colorKey === \"#FFFFFF00\"}\n >\n <div\n class=\"color-swatch\"\n role=\"img\"\n aria-roledescription={LOCALES[this.lng][\"Color swatch\"]}\n aria-label={ColorPickerPalette[colorKey][this.lng]}\n title={ColorPickerPalette[colorKey][this.lng]}\n style={{backgroundColor: colorKey}}\n ></div>\n </button>\n ))}\n </Host>\n );\n }\n}\n"],"mappings":"wMAAA,MAAMA,EAAY,IAAM,kyCCgBxB,MAAMC,EAAU,CACdC,GAAI,CACF,iBAAkB,sBAClB,eAAgB,sBAElBC,GAAI,CACF,iBAAkB,iBAClB,eAAgB,iBAKpB,MAAMC,EAAmB,EAGzB,MAAMC,EAAe,E,MAWRC,EAAYC,EAAA,MAAAD,UAAAE,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,KAEpB,I","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["stylesCss","LOCALES","it","en","COLOR_GROUP_SIZE","COLOR_GROUPS","ZColorPicker","__stencil_proxyCustomElement","HTMLElement","constructor","registerHost","this","lng","disableTransparent","colorKeysByRow","_colorButtons","colorButtons","length","Array","from","host","shadowRoot","querySelectorAll","sortColorKeysByRow","allKeys","Object","keys","ColorPickerPalette","ordered","row","col","columnMajorIndex","push","moveFocusTo","index","forEach","btn","i","tabIndex","focus","validateTransparentSelection","selectedColor","emitColorSelected","colorSelected","emit","setFocus","firstSelectedOrEnabled","find","ariaSelected","disabled","setTimeout","getNextIndexByKey","currentIndex","key","totalColors","Math","floor","newIndex","newCol","newRow","handleKeyDown","event","target","composedPath","dataset","color","indexOf","includes","attempts","_a","_b","preventDefault","stopPropagation","handleBlur","relatedTarget","containsElement","componentWillLoad","render","h","Host","role","htmlAriaLabel","map","colorKey","class","toUpperCase","onClick","title","style","backgroundColor"],"sources":["src/components/z-color-picker/styles.css?tag=z-color-picker&encapsulation=shadow","src/components/z-color-picker/index.tsx"],"sourcesContent":[":host {\n display: grid;\n width: fit-content;\n padding: calc(var(--space-unit) * 2);\n background: var(--color-surface01);\n gap: var(--space-unit);\n grid-template-columns: repeat(9, calc(var(--space-unit) * 3));\n grid-template-rows: repeat(5, calc(var(--space-unit) * 3));\n}\n\n:host,\n* {\n box-sizing: border-box;\n}\n\nbutton {\n --border-color: var(--color-surface05);\n\n padding: 0;\n border: none;\n appearance: none;\n background: none;\n border-radius: var(--border-radius);\n cursor: pointer;\n}\n\nbutton[data-color=\"#FFFFFF00\"] {\n position: relative;\n}\n\n/* draw a diagonal line from top right corner */\nbutton[data-color=\"#FFFFFF00\"]::after {\n position: absolute;\n top: 0;\n right: 0;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n -45deg,\n transparent 48%,\n var(--border-color) 48%,\n var(--border-color) 52%,\n transparent 52%\n );\n border-radius: var(--border-radius);\n content: \"\";\n}\n\nbutton[aria-selected=\"true\"] {\n box-shadow:\n 0 0 0 1px var(--color-white),\n 0 0 0 3px var(--color-active-primary);\n}\n\nbutton:focus-visible {\n box-shadow: var(--shadow-focus-primary);\n}\n\nbutton .color-swatch {\n width: calc(var(--space-unit) * 3);\n height: calc(var(--space-unit) * 3);\n border: var(--border-size-small) solid var(--border-color);\n border-radius: var(--border-radius);\n}\n\nbutton[data-color=\"#FFFFFF00\"]:disabled {\n --border-color: var(--color-disabled01-icon);\n\n cursor: not-allowed;\n}\n\nbutton[data-color=\"#FFFFFF00\"]:disabled .color-swatch {\n background-color: var(--color-disabled02);\n}\n","import {\n Component,\n ComponentInterface,\n Element,\n Event,\n EventEmitter,\n Host,\n Listen,\n Method,\n Prop,\n Watch,\n h,\n} from \"@stencil/core\";\nimport {ColorPickerPalette} from \"../../beans\";\nimport {containsElement} from \"../../utils/utils\";\n\nconst LOCALES = {\n it: {\n \"Select a color\": \"Seleziona un colore\",\n \"Color swatch\": \"Campione di colore\",\n },\n en: {\n \"Select a color\": \"Select a color\",\n \"Color swatch\": \"Color swatch\",\n },\n} as const;\n\n/** Number of colors in each group (column) of the grid. */\nconst COLOR_GROUP_SIZE = 5;\n\n/** Number of color groups (columns) in the grid. */\nconst COLOR_GROUPS = 9;\n\n/**\n * Color picker component.\n * This component allows the user to pick a color from a predefined set.\n */\n@Component({\n tag: \"z-color-picker\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZColorPicker implements ComponentInterface {\n @Element() host: HTMLZColorPickerElement;\n\n /**\n * The selected color to highlight.\n */\n @Prop({mutable: true})\n selectedColor: ColorPickerPalette;\n\n /**\n * The language for the aria labels inside the color picker.\n */\n @Prop()\n lng: \"it\" | \"en\" = \"it\";\n\n /**\n * The aria-label for the color picker, e.g. \"Select a background color for the label\".\n */\n @Prop()\n htmlAriaLabel: string;\n\n /**\n * Disables the transparent color option.\n * Setting `selectedColor` prop to `#FFFFFF00` while `disableTransparent` is true will default to `#333333` (\"dark gray 2\").\n */\n @Prop()\n disableTransparent = false;\n\n /**\n * Event emitted when a color is selected.\n */\n @Event()\n colorSelected: EventEmitter<ColorPickerPalette>;\n\n /**\n * The color keys arranged in row-major order for rendering and navigation.\n */\n private colorKeysByRow: ColorPickerPalette[] = [];\n\n private _colorButtons: HTMLButtonElement[] = [];\n\n private get colorButtons(): HTMLButtonElement[] {\n if (!this._colorButtons.length) {\n this._colorButtons = Array.from(this.host.shadowRoot.querySelectorAll(\"button\")) as HTMLButtonElement[];\n }\n\n return this._colorButtons;\n }\n\n /**\n * Reorders color keys from column-major (the format of the `ColorPickerPalette` object) to row-major (visual/navigation order).\n * This ensures button indices in the DOM match their visual position in the grid.\n */\n private sortColorKeysByRow(): ColorPickerPalette[] {\n const allKeys = Object.keys(ColorPickerPalette) as ColorPickerPalette[];\n const ordered: ColorPickerPalette[] = [];\n\n // Iterate through visual positions (row by row, left to right)\n for (let row = 0; row < COLOR_GROUP_SIZE; row++) {\n for (let col = 0; col < COLOR_GROUPS; col++) {\n const columnMajorIndex = col * COLOR_GROUP_SIZE + row;\n if (columnMajorIndex < allKeys.length) {\n ordered.push(allKeys[columnMajorIndex]);\n }\n }\n }\n\n return ordered;\n }\n\n /** Move focus to the specified color button by index. */\n private moveFocusTo(index: number): void {\n // Reset tabindex of other buttons and set tabindex to 0 on selected button\n this.colorButtons.forEach((btn, i) => (btn.tabIndex = i === index ? 0 : -1));\n this.colorButtons[index].focus();\n }\n\n @Watch(\"disableTransparent\")\n @Watch(\"selectedColor\")\n validateTransparentSelection(): void {\n if (this.disableTransparent && this.selectedColor === \"#FFFFFF00\") {\n this.selectedColor = \"#333333\"; // Default to dark gray 2 if transparent is disabled and currently selected\n }\n }\n\n @Watch(\"selectedColor\")\n emitColorSelected(): void {\n this.colorSelected.emit(this.selectedColor);\n }\n\n /**\n * Focuses the selected or first enabled color button and makes the container non-tabbable.\n */\n @Listen(\"focus\")\n @Method()\n async setFocus(): Promise<void> {\n // Reset tabindex of all buttons\n this.colorButtons.forEach((btn) => (btn.tabIndex = -1));\n const firstSelectedOrEnabled =\n this.colorButtons.find((btn) => btn.ariaSelected === \"true\") || this.colorButtons.find((btn) => !btn.disabled);\n if (!firstSelectedOrEnabled) {\n return;\n }\n\n firstSelectedOrEnabled.tabIndex = 0;\n setTimeout(() => {\n firstSelectedOrEnabled.focus();\n }, 50);\n // Set container as non-tabbable\n this.host.tabIndex = -1;\n }\n\n /**\n * Compute next index in row-major grid according to keyboard direction.\n */\n private getNextIndexByKey(currentIndex: number, key: string, totalColors: number): number {\n const row = Math.floor(currentIndex / COLOR_GROUPS);\n const col = currentIndex % COLOR_GROUPS;\n let newIndex = currentIndex;\n\n switch (key) {\n case \"ArrowRight\": {\n const newCol = col + 1;\n const newRow = newCol >= COLOR_GROUPS ? (row + 1) % COLOR_GROUP_SIZE : row;\n newIndex = newRow * COLOR_GROUPS + (newCol % COLOR_GROUPS);\n if (newIndex >= totalColors) {\n newIndex = 0; // Wrap to first item\n }\n\n break;\n }\n case \"ArrowLeft\": {\n const newCol = col - 1;\n const newRow = newCol < 0 ? (row - 1 + COLOR_GROUP_SIZE) % COLOR_GROUP_SIZE : row;\n newIndex = newRow * COLOR_GROUPS + ((newCol + COLOR_GROUPS) % COLOR_GROUPS);\n if (newIndex >= totalColors) {\n newIndex = totalColors - 1; // Wrap to last item\n }\n\n break;\n }\n case \"ArrowDown\": {\n let newRow = row + 1;\n let newCol = col;\n if (newRow >= COLOR_GROUP_SIZE) {\n // Wrap to first item of next column\n newRow = 0;\n newCol = (col + 1) % COLOR_GROUPS;\n }\n newIndex = newRow * COLOR_GROUPS + newCol;\n if (newIndex >= totalColors) {\n newIndex = 0; // Wrap to first item\n }\n\n break;\n }\n case \"ArrowUp\": {\n let newRow = row - 1;\n let newCol = col;\n if (newRow < 0) {\n // Wrap to last item of previous column\n newRow = COLOR_GROUP_SIZE - 1;\n newCol = (col - 1 + COLOR_GROUPS) % COLOR_GROUPS;\n }\n newIndex = newRow * COLOR_GROUPS + newCol;\n if (newIndex >= totalColors) {\n newIndex = totalColors - 1; // Wrap to last item\n }\n\n break;\n }\n }\n\n return newIndex;\n }\n\n /**\n * Handle keyboard navigation within the color picker.\n * Arrow keys move focus in the expected direction, wrapping around edges. The grid is navigated in row-major order.\n */\n @Listen(\"keydown\")\n handleKeyDown(event: KeyboardEvent): void {\n const target = event.composedPath()[0] as HTMLElement;\n if (!target.dataset.color) {\n return;\n }\n\n const currentIndex = this.colorButtons.indexOf(target as HTMLButtonElement);\n const totalColors = this.colorButtons.length;\n if (currentIndex < 0 || ![\"ArrowRight\", \"ArrowLeft\", \"ArrowDown\", \"ArrowUp\"].includes(event.key)) {\n return;\n }\n\n let newIndex = currentIndex;\n let attempts = 0;\n\n do {\n newIndex = this.getNextIndexByKey(newIndex, event.key, totalColors);\n attempts++;\n } while (attempts < totalColors && this.colorButtons[newIndex]?.disabled);\n\n if (\n newIndex !== currentIndex &&\n newIndex >= 0 &&\n newIndex < totalColors &&\n !this.colorButtons[newIndex]?.disabled\n ) {\n this.moveFocusTo(newIndex);\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * When focus leaves the color picker (e.g. user tabs away), reset all buttons to non-tabbable and make the container tabbable again.\n */\n @Listen(\"blur\")\n handleBlur(event: FocusEvent): void {\n const relatedTarget = event.relatedTarget as HTMLElement;\n if (!containsElement(this.host, relatedTarget)) {\n this.host.tabIndex = 0;\n this.colorButtons.forEach((btn) => (btn.tabIndex = -1));\n }\n }\n\n componentWillLoad(): void {\n this.colorKeysByRow = this.sortColorKeysByRow();\n }\n\n render(): HTMLZColorPickerElement {\n return (\n <Host\n role=\"listbox\"\n aria-label={this.htmlAriaLabel || LOCALES[this.lng][\"Select a color\"]}\n tabIndex={0}\n >\n {this.colorKeysByRow.map((colorKey: ColorPickerPalette) => (\n <button\n class=\"color-swatch\"\n data-color={colorKey}\n role=\"option\"\n aria-selected={this.selectedColor?.toUpperCase() === colorKey.toUpperCase() ? \"true\" : \"false\"}\n tabIndex={-1}\n onClick={() => (this.selectedColor = colorKey)}\n disabled={this.disableTransparent && colorKey === \"#FFFFFF00\"}\n >\n <div\n class=\"color-swatch\"\n role=\"img\"\n aria-roledescription={LOCALES[this.lng][\"Color swatch\"]}\n aria-label={ColorPickerPalette[colorKey][this.lng]}\n title={ColorPickerPalette[colorKey][this.lng]}\n style={{backgroundColor: colorKey}}\n ></div>\n </button>\n ))}\n </Host>\n );\n }\n}\n"],"mappings":"gJAAA,MAAMA,EAAY,IAAM,kyCCgBxB,MAAMC,EAAU,CACdC,GAAI,CACF,iBAAkB,sBAClB,eAAgB,sBAElBC,GAAI,CACF,iBAAkB,iBAClB,eAAgB,iBAKpB,MAAMC,EAAmB,EAGzB,MAAMC,EAAe,E,MAWRC,EAAYC,EAAA,MAAAD,UAAAE,EALzB,WAAAC,CAAAC,G,+GAkBEC,KAAAC,IAAmB,KAanBD,KAAAE,mBAAqB,MAWbF,KAAAG,eAAuC,GAEvCH,KAAAI,cAAqC,EA4N9C,CA1NC,gBAAYC,GACV,IAAKL,KAAKI,cAAcE,OAAQ,CAC9BN,KAAKI,cAAgBG,MAAMC,KAAKR,KAAKS,KAAKC,WAAWC,iBAAiB,U,CAGxE,OAAOX,KAAKI,a,CAON,kBAAAQ,GACN,MAAMC,EAAUC,OAAOC,KAAKC,GAC5B,MAAMC,EAAgC,GAGtC,IAAK,IAAIC,EAAM,EAAGA,EAAMzB,EAAkByB,IAAO,CAC/C,IAAK,IAAIC,EAAM,EAAGA,EAAMzB,EAAcyB,IAAO,CAC3C,MAAMC,EAAmBD,EAAM1B,EAAmByB,EAClD,GAAIE,EAAmBP,EAAQP,OAAQ,CACrCW,EAAQI,KAAKR,EAAQO,G,GAK3B,OAAOH,C,CAID,WAAAK,CAAYC,GAElBvB,KAAKK,aAAamB,SAAQ,CAACC,EAAKC,IAAOD,EAAIE,SAAWD,IAAMH,EAAQ,GAAI,IACxEvB,KAAKK,aAAakB,GAAOK,O,CAK3B,4BAAAC,GACE,GAAI7B,KAAKE,o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kBACpD0B,SAAU,GAET3B,KAAKG,eAAeoE,KAAKC,I,MAAiC,OACzDL,EAAA,UACEM,MAAM,eAAc,aACRD,EACZH,KAAK,SAAQ,kBACEX,EAAA1D,KAAK8B,iBAAa,MAAA4B,SAAA,SAAAA,EAAEgB,iBAAkBF,EAASE,cAAgB,OAAS,QACvF/C,UAAU,EACVgD,QAAS,IAAO3E,KAAK8B,cAAgB0C,EACrClC,SAAUtC,KAAKE,oBAAsBsE,IAAa,aAElDL,EAAA,OACEM,MAAM,eACNJ,KAAK,MAAK,uBACY/E,EAAQU,KAAKC,KAAK,gBAAe,aAC3Ce,EAAmBwD,GAAUxE,KAAKC,KAC9C2E,MAAO5D,EAAmBwD,GAAUxE,KAAKC,KACzC4E,MAAO,CAACC,gBAAiBN,KAEpB,I","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as t,createEvent as i,h as s,transformTag as o}from"@stencil/core/internal/client";import{e as a,I as r,i as n,g as l,l as c}from"./index2.js";import{r as h,e as d,b as p}from"./utils.js";import{d as m}from"./index5.js";import{d as u}from"./index3.js";import{d as b}from"./index6.js";import{d as v}from"./index7.js";import{d as f}from"./index9.js";import{d as g}from"./index10.js";const x=()=>`.z-label{display:block;padding-bottom:var(--space-unit);color:var(--color-default-text);font-family:var(--font-family-sans);font-size:var(--font-size-1);font-weight:var(--font-sb);text-align:left;text-transform:uppercase}`;const z=()=>`:host{display:block;min-width:290px;color:var(--color-form-default-text);fill:var(--color-form-default-icon);font-family:var(--font-family-sans)}:host>div.fixed{position:relative}:host>div>.header{position:relative;z-index:10;display:flex;min-height:42px;align-items:center;justify-content:space-between;padding:0 calc(var(--space-unit) * 1.5);border:var(--border-size-small) solid var(--color-form-surface04);margin:0;background-color:var(--color-form-background);border-radius:var(--border-radius-small);cursor:pointer}:host([size="small"])>div>.header{min-height:34px;font-size:var(--font-size-2)}:host([size="x-small"])>div>.header{min-height:30px;font-size:var(--font-size-2)}:host>div>.header:hover{outline:var(--border-size-medium) solid var(--color-form-surface04);outline-offset:-2px}:host>div>div.header:focus:focus-visible{z-index:16;box-shadow:var(--shadow-focus-primary);outline:none}:host>div>.header>span.body-3>span{font-weight:var(--font-sb)}:host>div>.header>z-icon{fill:var(--color-form-default-icon);transform:rotate(360deg);transition:all 200ms linear}:host>div>.header>z-icon.small,:host>div>.header>z-icon.x-small{--z-icon-width:16px;--z-icon-height:16px}:host>div.open>.header{border:var(--border-size-small) solid var(--color-form-active-primary);border-radius:var(--border-radius-small) var(--border-radius-small) 0 0}:host>div.disabled{pointer-events:none}:host>div.disabled .header{border-color:var(--color-form-disabled03);fill:var(--color-form-disabled01-icon)}:host>div.disabled .header>span.body-3{color:var(--color-form-disabled03)}:host>div.disabled .header>z-icon:last-child{fill:var(--color-form-disabled01-icon)}:host>div.open>.header>z-icon{fill:var(--color-form-default-icon);transform:rotate(180deg);transition:all 200ms linear}:host>div>div.open-combo-data{display:none}:host>div.open>div.open-combo-data{position:relative;z-index:12;display:block;padding:var(--space-unit) calc(var(--space-unit) * 2);border:var(--border-size-small) solid var(--color-form-surface03);border-top:0;background-color:var(--color-form-background);border-radius:0;box-shadow:var(--shadow-2)}:host .open .open-combo-data z-input .z-label{color:var(--color-form-default-text)}:host>div.open>div.open-combo-data>div>div{overflow:auto;max-height:235px;padding:0;padding-left:var(--space-unit);margin-left:calc(var(--space-unit) * -1);}:host>div.open>div.open-combo-data>z-input{width:100%;margin-bottom:calc(var(--space-unit) * 2)}:host>div.open>div.open-combo-data>div>div>ul{max-height:235px;padding:0 calc(var(--space-unit) * 0.5);margin:0}:host .open-combo-data z-list-element{--background-color-list-element:var(--color-form-background);--background-hover-color-list-element:var(--color-form-surface03);--background-active-color-list-element:var(--color-form-surface03)}:host .open-combo-data z-list-element[disabled]{pointer-events:none}:host .open-combo-data z-list-element .option-wrap{display:flex;flex-direction:row;align-items:center;cursor:pointer;gap:var(--space-unit)}:host .open-combo-data z-list-element[size="medium"] .option-wrap,:host .open-combo-data z-list-element[size="small"] .option-wrap{--z-icon-width:16px;--z-icon-height:16px;font-size:var(--font-size-2);gap:calc(var(--space-unit) / 2)}:host .open-combo-data z-list-element .option-wrap>z-icon{fill:var(--color-primary01-icon)}:host .open-combo-data z-list-element[disabled] .option-wrap>z-icon{fill:var(--color-disabled01)}:host .open-combo-data z-list-element .option-wrap>z-icon.focused{border-radius:var(--border-radius-small);box-shadow:var(--shadow-focus-primary);outline:none}:host .open-combo-data z-list-element .option-wrap>[role="option"]:focus,:host .open-combo-data z-list-element .option-wrap>[role="option"]:focus-visible{outline:none}::-webkit-scrollbar{width:6px;background:linear-gradient(to right, transparent 0 1px, var(--gray200) 1px 5px, transparent 5px 6px)}::-webkit-scrollbar-thumb{background-color:var(--color-primary01)}::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}@supports not selector(::-webkit-scrollbar-track){:host{scrollbar-color:var(--color-primary01) transparent}}:host>div.open>z-input{position:relative;z-index:1;width:238px;margin:0 calc(var(--space-unit) * 2);color:var(--color-form-active-primary)}:host>div.open>div.open-combo-data>div>div.search{overflow:hidden;max-height:none;margin-top:0}:host>div.open>div.open-combo-data>div>div.search>ul{overflow:auto;max-height:180px;padding:var(--space-unit) calc(var(--space-unit) * 2)}:host .open .open-combo-data .search .no-results{display:flex;align-items:center;column-gap:var(--space-unit)}:host>.open>.open-combo-data .search .close-search{display:flex;justify-content:center}:host>div.open>div.open-combo-data>div>div.search .close-search>a{display:inline-block;height:44px;color:var(--color-form-active-primary);cursor:pointer;font-size:14px;font-weight:var(--font-sb);line-height:44px;text-align:center;text-transform:uppercase}:host>div.open>div.open-combo-data>div>div.search .close-search>a:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}:host>div.open>div.open-combo-data>div>div.check-all-wrapper{padding:calc(var(--space-unit) * 2) calc(var(--space-unit) * 0.5) calc(var(--space-unit) * 2) calc(var(--space-unit) * 1.5);border-bottom:var(--border-size-small) solid var(--gray800);margin-bottom:var(--space-unit);margin-left:calc(var(--space-unit) * -1);text-align:left}:host([size="small"])>div.open>div.open-combo-data>div>div.check-all-wrapper{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 0.5)}:host([size="x-small"])>div.open>div.open-combo-data>div>div.check-all-wrapper{padding:var(--space-unit) calc(var(--space-unit) * 0.5)}`;const k=e(class e extends t{watchItems(){this.itemsList=typeof this.items==="string"?JSON.parse(this.items):this.items;this.selectedCounter=this.itemsList.filter((e=>e.checked)).length;this.updateRenderItemsList()}watchSearchValue(){this.filterItems(this.searchValue)}emitComboboxChange(){this.comboboxChange.emit({id:this.inputid,items:this.itemsList})}constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.comboboxChange=i(this,"comboboxChange",7);this.inputid=`combo-${h()}`;this.disabled=false;this.hassearch=false;this.noresultslabel="Nessun risultato";this.isopen=false;this.isfixed=false;this.hascheckall=false;this.checkalltext="Seleziona tutti";this.uncheckalltext="Deseleziona tutti";this.maxcheckableitems=0;this.size=a.BIG;this.renderItemsList=[];this.focusedItemId="";this.itemsList=[];this.inputType=r.TEXT;this.toggleComboBox=this.toggleComboBox.bind(this);this.closeFilterItems=this.closeFilterItems.bind(this)}componentWillLoad(){this.watchItems()}componentWillRender(){this.selectedCounter=this.itemsList.filter((e=>e.checked)).length}getControlToListSize(){switch(this.size){case a.X_SMALL:return n.SMALL;case a.SMALL:return n.MEDIUM;default:return n.LARGE}}getOptionId(e){return`${this.inputid}-option-${e.id?d(`${e.id}`):d(`${e.name}`)}`}getCheckAllOptionId(){return`${this.inputid}-check-all`}allOptionsSelected(){return this.selectedCounter===this.itemsList.length}hasReachedMaxSelections(){return!!(this.maxcheckableitems&&this.selectedCounter>=this.maxcheckableitems)}handleHeaderKeyDown(e){if(e.code===l.ENTER&&!this.focusedItemId){this.toggleComboBox()}if(!this.isopen||this.hassearch){return}switch(e.code){case l.SPACE:case l.ENTER:if(this.focusedItemId){e.preventDefault();this.checkOption(this.focusedItemId)}break;case l.ESC:if(this.focusedItemId){this.focusedItemId=""}break;case l.ARROW_DOWN:case l.ARROW_UP:this.handleArrowsNavigation(e);break}}handleInputKeyDown(e){switch(e.code){case l.ENTER:case l.SPACE:if(this.focusedItemId){e.preventDefault();this.checkOption(this.focusedItemId);break}break;case l.ARROW_DOWN:case l.ARROW_UP:this.handleArrowsNavigation(e);break;case l.ESC:if(this.focusedItemId){this.focusedItemId="";break}this.closeFilterItems();break;case l.TAB:this.focusedItemId="";break}}checkOption(e){if(e===this.getCheckAllOptionId()){this.itemsList=this.itemsList.map((e=>Object.assign(Object.assign({},e),{checked:!this.allOptionsSelected()})));this.focusedItemId=this.getCheckAllOptionId()}else{this.itemsList=this.itemsList.map((t=>{if(e===this.getOptionId(t)){t.checked=!t.checked}return t}))}this.updateRenderItemsList();this.emitComboboxChange()}handleArrowsNavigation(e){if(![l.ARROW_DOWN,l.ARROW_UP].includes(e.code)||!this.isopen){return}e.preventDefault();e.stopPropagation();const t=this.focusedItemId?this.element.shadowRoot.querySelector(`#${this.focusedItemId}`):null;const i=Array.from(this.element.shadowRoot.querySelectorAll('[role="option"]'));if(!i.length){return}const s=t?i.indexOf(t):null;const o=0;const a=i.length-1;let r=null;if(e.code===l.ARROW_DOWN){r=s===null?i[o]:i[s+1]||i[a]}else if(e.code===l.ARROW_UP){r=s===null?i[a]:i[s-1]||i[o]}this.focusedItemId=r.id;r.scrollIntoView({block:"nearest",container:"nearest"})}updateRenderItemsList(){if(this.searchValue){this.filterItems(this.searchValue)}else{this.resetRenderItemsList()}}resetRenderItemsList(){const e=[];this.itemsList.forEach((t=>{e.push(Object.assign({},t))}));this.renderItemsList=e}filterItems(e){if(!e){return this.closeFilterItems()}this.resetRenderItemsList();this.renderItemsList=this.renderItemsList.filter((t=>{const i=t.name.toUpperCase().indexOf(e.toUpperCase());const s=i+e.length;const o=t.name.substring(0,i)+"<strong>"+t.name.substring(i,s)+"</strong>"+t.name.substring(s,t.name.length);t.name=o;return i>=0}))}closeFilterItems(){this.searchValue="";this.resetRenderItemsList()}toggleComboBox(){this.isopen=!this.isopen}getHeaderAriaLabel(){if(!this.label||this.selectedCounter<=0){return undefined}const e=this.selectedCounter===1?"elemento selezionato":"elementi selezionati";return`${this.label}: ${this.selectedCounter} ${e}`}getComboboxA11yAttributes(e){const t="combobox";const i=this.isopen?"true":"false";const s=this.isopen?this.focusedItemId:"";const o=`${this.inputid}_list`;if(e){return{role:t,"aria-label":this.htmlAriaLabel,"html-aria-expanded":i,"html-aria-activedescendant":s,"html-aria-controls":o}}return{role:t,"aria-expanded":i,"aria-activedescendant":s,"aria-controls":o}}renderHeader(){const e=!this.hassearch?this.getComboboxA11yAttributes(false):{};return s("div",Object.assign({class:"header",onClick:()=>this.toggleComboBox(),onKeyDown:e=>this.handleHeaderKeyDown(e),role:"button",tabindex:0,"aria-controls":"open-combo-data","aria-expanded":this.isopen?"true":"false","aria-label":this.getHeaderAriaLabel()},e),s("span",{class:"body-3"},this.label,s("span",null,this.selectedCounter>0&&` (${this.selectedCounter})`)),s("z-icon",{name:"caret-down",class:this.size}))}renderContent(){return s("div",{id:"open-combo-data",class:"open-combo-data"},this.hassearch&&this.renderSearchInput(),s("div",{role:"listbox","aria-label":this.label,"aria-multiselectable":"true",id:`${this.inputid}_list`,"aria-owns":`${this.hascheckall?`${this.getCheckAllOptionId()} `:``}${this.itemsList.map((e=>this.getOptionId(e))).join(" ")}`},this.renderItems()))}renderItems(){return s("div",{class:this.searchValue&&"search",tabIndex:-1,role:"presentation"},this.renderList(this.renderItemsList))}renderItem(e,t,i){const o=this.getOptionId(e);const a=!e.checked&&this.hasReachedMaxSelections();return s("z-list-element",{htmlTabindex:-1,dividerType:t!==i-1?c.ELEMENT:c.NONE,size:this.getControlToListSize(),role:"presentation",disabled:!!a},s("span",{class:"option-wrap",role:"presentation",onClick:()=>{this.focusedItemId="";this.checkOption(o)}},s("z-icon",{name:e.checked?"checkbox-checked":"checkbox",class:this.focusedItemId===o?"focused":""}),s("span",{id:o,role:a?"presentation":"option","aria-selected":e.checked?"true":"false","aria-label":a?undefined:p(e.name)},s("span",{"aria-hidden":"true",innerHTML:e.name}))))}renderList(e){if(!e){return}if(!e.length&&this.searchValue){return this.renderNoSearchResults()}if(this.hasgroupitems){return this.renderGroups(e)}return s("ul",{role:"presentation"},this.renderCheckAll(),e.map(((t,i)=>this.renderItem(t,i,e.length))))}renderGroups(e){const t=e.reduce(((t,i,s)=>{var o;const a=i.category||"Altra categoria";const r=this.renderItem(i,s,e.length);t[a]=(o=t[a])!==null&&o!==void 0?o:[];t[a].push(r);return t}),{});const i=Object.entries(t).map((([e,t],i)=>s("z-list-group",{size:this.getControlToListSize(),"divider-type":c.ELEMENT,"aria-labelledby":`${this.inputid}_list_group_${i}`},s("span",{class:"body-3-sb z-list-group-title",slot:"header-title",id:`${this.inputid}_list_group_${i}`,"aria-hidden":"true"},e),t.map((e=>e)))));return s("ul",{role:"presentation"},this.renderCheckAll(),i)}renderNoSearchResults(){return s("div",{class:"no-results"},s("span",null,this.noresultslabel))}renderSearchInput(){return s("z-input",Object.assign({htmlid:`${this.inputid}_search`,label:this.searchlabel,placeholder:this.searchplaceholder,htmltitle:this.searchtitle,type:this.inputType,value:this.searchValue,message:false,size:this.size,"html-aria-autocomplete":"list"},this.getComboboxA11yAttributes(true),{onKeyDown:e=>this.handleInputKeyDown(e),onInputChange:e=>{this.searchValue=e.detail.value;this.focusedItemId=""}}))}renderCheckAll(){if(!this.hascheckall||this.searchValue){return}const e=this.getCheckAllOptionId();const t=this.allOptionsSelected();const i=this.selectedCounter>0&&!t;const o=!t&&(this.hasReachedMaxSelections()||this.maxcheckableitems&&this.maxcheckableitems<this.itemsList.length);return s("z-list-element",{class:"check-all-wrapper",role:"presentation",htmlTabindex:-1,dividerType:c.ELEMENT,dividerColor:"gray800",size:this.getControlToListSize(),disabled:!!o},s("span",{class:"option-wrap",role:"presentation",onClick:()=>this.checkOption(e)},s("z-icon",{name:i?"indeterminated-checkbox":t?"checkbox-checked":"checkbox",class:this.focusedItemId===e?"focused":""}),s("span",{id:e,role:o?"presentation":"option","aria-selected":t?"true":"false"},t?this.uncheckalltext:this.checkalltext)))}render(){return s("div",{key:"683f9ed203e8c3843d0e20daf0acade8a0ff1a49","data-action":`combo-${this.inputid}`,class:{open:this.isopen,fixed:this.isfixed,disabled:this.disabled},id:this.inputid},this.renderHeader(),!this.disabled&&this.renderContent())}get element(){return this}static get watchers(){return{items:[{watchItems:0}],searchValue:[{watchSearchValue:0}]}}static get style(){return x()+z()}},[1,"z-combobox",{inputid:[1],items:[1],label:[1],disabled:[516],hassearch:[4],searchlabel:[1],searchplaceholder:[1],searchtitle:[1],noresultslabel:[1],isopen:[1028],isfixed:[4],hascheckall:[4],checkalltext:[1],uncheckalltext:[1],maxcheckableitems:[2],hasgroupitems:[4],size:[1],htmlAriaLabel:[1,"html-aria-label"],searchValue:[32],selectedCounter:[32],renderItemsList:[32],focusedItemId:[32]},undefined,{items:[{watchItems:0}],searchValue:[{watchSearchValue:0}]}]);function w(){if(typeof customElements==="undefined"){return}const e=["z-combobox","z-divider","z-icon","z-input","z-input-message","z-list-element","z-list-group"];e.forEach((e=>{switch(e){case"z-combobox":if(!customElements.get(o(e))){customElements.define(o(e),k)}break;case"z-divider":if(!customElements.get(o(e))){m()}break;case"z-icon":if(!customElements.get(o(e))){u()}break;case"z-input":if(!customElements.get(o(e))){b()}break;case"z-input-message":if(!customElements.get(o(e))){v()}break;case"z-list-element":if(!customElements.get(o(e))){f()}break;case"z-list-group":if(!customElements.get(o(e))){g()}break}}))}const y=k;const $=w;export{y as ZCombobox,$ as defineCustomElement};
|
|
1
|
+
import{p as e,H as t,c as i,h as s,t as o}from"./p-RmbDDbWd.js";import{e as a,I as r,i as n,g as l,l as c}from"./p-DdetsoIY.js";import{r as h,e as d,b as p}from"./p-8C_CrFxp.js";import{d as m}from"./p-BolVsvfr.js";import{d as u}from"./p-CbXEdwLi.js";import{d as b}from"./p-LXvmZzZa.js";import{d as v}from"./p-CdBqnUF6.js";import{d as f}from"./p-BeSVHdId.js";import{d as g}from"./p-mphirYN3.js";const z=()=>`.z-label{display:block;padding-bottom:var(--space-unit);color:var(--color-default-text);font-family:var(--font-family-sans);font-size:var(--font-size-1);font-weight:var(--font-sb);text-align:left;text-transform:uppercase}`;const x=()=>`:host{display:block;min-width:290px;color:var(--color-form-default-text);fill:var(--color-form-default-icon);font-family:var(--font-family-sans)}:host>div.fixed{position:relative}:host>div>.header{position:relative;z-index:10;display:flex;min-height:42px;align-items:center;justify-content:space-between;padding:0 calc(var(--space-unit) * 1.5);border:var(--border-size-small) solid var(--color-form-surface04);margin:0;background-color:var(--color-form-background);border-radius:var(--border-radius-small);cursor:pointer}:host([size="small"])>div>.header{min-height:34px;font-size:var(--font-size-2)}:host([size="x-small"])>div>.header{min-height:30px;font-size:var(--font-size-2)}:host>div>.header:hover{outline:var(--border-size-medium) solid var(--color-form-surface04);outline-offset:-2px}:host>div>div.header:focus:focus-visible{z-index:16;box-shadow:var(--shadow-focus-primary);outline:none}:host>div>.header>span.body-3>span{font-weight:var(--font-sb)}:host>div>.header>z-icon{fill:var(--color-form-default-icon);transform:rotate(360deg);transition:all 200ms linear}:host>div>.header>z-icon.small,:host>div>.header>z-icon.x-small{--z-icon-width:16px;--z-icon-height:16px}:host>div.open>.header{border:var(--border-size-small) solid var(--color-form-active-primary);border-radius:var(--border-radius-small) var(--border-radius-small) 0 0}:host>div.disabled{pointer-events:none}:host>div.disabled .header{border-color:var(--color-form-disabled03);fill:var(--color-form-disabled01-icon)}:host>div.disabled .header>span.body-3{color:var(--color-form-disabled03)}:host>div.disabled .header>z-icon:last-child{fill:var(--color-form-disabled01-icon)}:host>div.open>.header>z-icon{fill:var(--color-form-default-icon);transform:rotate(180deg);transition:all 200ms linear}:host>div>div.open-combo-data{display:none}:host>div.open>div.open-combo-data{position:relative;z-index:12;display:block;padding:var(--space-unit) calc(var(--space-unit) * 2);border:var(--border-size-small) solid var(--color-form-surface03);border-top:0;background-color:var(--color-form-background);border-radius:0;box-shadow:var(--shadow-2)}:host .open .open-combo-data z-input .z-label{color:var(--color-form-default-text)}:host>div.open>div.open-combo-data>div>div{overflow:auto;max-height:235px;padding:0;padding-left:var(--space-unit);margin-left:calc(var(--space-unit) * -1);}:host>div.open>div.open-combo-data>z-input{width:100%;margin-bottom:calc(var(--space-unit) * 2)}:host>div.open>div.open-combo-data>div>div>ul{max-height:235px;padding:0 calc(var(--space-unit) * 0.5);margin:0}:host .open-combo-data z-list-element{--background-color-list-element:var(--color-form-background);--background-hover-color-list-element:var(--color-form-surface03);--background-active-color-list-element:var(--color-form-surface03)}:host .open-combo-data z-list-element[disabled]{pointer-events:none}:host .open-combo-data z-list-element .option-wrap{display:flex;flex-direction:row;align-items:center;cursor:pointer;gap:var(--space-unit)}:host .open-combo-data z-list-element[size="medium"] .option-wrap,:host .open-combo-data z-list-element[size="small"] .option-wrap{--z-icon-width:16px;--z-icon-height:16px;font-size:var(--font-size-2);gap:calc(var(--space-unit) / 2)}:host .open-combo-data z-list-element .option-wrap>z-icon{fill:var(--color-primary01-icon)}:host .open-combo-data z-list-element[disabled] .option-wrap>z-icon{fill:var(--color-disabled01)}:host .open-combo-data z-list-element .option-wrap>z-icon.focused{border-radius:var(--border-radius-small);box-shadow:var(--shadow-focus-primary);outline:none}:host .open-combo-data z-list-element .option-wrap>[role="option"]:focus,:host .open-combo-data z-list-element .option-wrap>[role="option"]:focus-visible{outline:none}::-webkit-scrollbar{width:6px;background:linear-gradient(to right, transparent 0 1px, var(--gray200) 1px 5px, transparent 5px 6px)}::-webkit-scrollbar-thumb{background-color:var(--color-primary01)}::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}@supports not selector(::-webkit-scrollbar-track){:host{scrollbar-color:var(--color-primary01) transparent}}:host>div.open>z-input{position:relative;z-index:1;width:238px;margin:0 calc(var(--space-unit) * 2);color:var(--color-form-active-primary)}:host>div.open>div.open-combo-data>div>div.search{overflow:hidden;max-height:none;margin-top:0}:host>div.open>div.open-combo-data>div>div.search>ul{overflow:auto;max-height:180px;padding:var(--space-unit) calc(var(--space-unit) * 2)}:host .open .open-combo-data .search .no-results{display:flex;align-items:center;column-gap:var(--space-unit)}:host>.open>.open-combo-data .search .close-search{display:flex;justify-content:center}:host>div.open>div.open-combo-data>div>div.search .close-search>a{display:inline-block;height:44px;color:var(--color-form-active-primary);cursor:pointer;font-size:14px;font-weight:var(--font-sb);line-height:44px;text-align:center;text-transform:uppercase}:host>div.open>div.open-combo-data>div>div.search .close-search>a:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}:host>div.open>div.open-combo-data>div>div.check-all-wrapper{padding:calc(var(--space-unit) * 2) calc(var(--space-unit) * 0.5) calc(var(--space-unit) * 2) calc(var(--space-unit) * 1.5);border-bottom:var(--border-size-small) solid var(--gray800);margin-bottom:var(--space-unit);margin-left:calc(var(--space-unit) * -1);text-align:left}:host([size="small"])>div.open>div.open-combo-data>div>div.check-all-wrapper{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 0.5)}:host([size="x-small"])>div.open>div.open-combo-data>div>div.check-all-wrapper{padding:var(--space-unit) calc(var(--space-unit) * 0.5)}`;const k=e(class e extends t{watchItems(){this.itemsList=typeof this.items==="string"?JSON.parse(this.items):this.items;this.selectedCounter=this.itemsList.filter((e=>e.checked)).length;this.updateRenderItemsList()}watchSearchValue(){this.filterItems(this.searchValue)}emitComboboxChange(){this.comboboxChange.emit({id:this.inputid,items:this.itemsList})}constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.comboboxChange=i(this,"comboboxChange",7);this.inputid=`combo-${h()}`;this.disabled=false;this.hassearch=false;this.noresultslabel="Nessun risultato";this.isopen=false;this.isfixed=false;this.hascheckall=false;this.checkalltext="Seleziona tutti";this.uncheckalltext="Deseleziona tutti";this.maxcheckableitems=0;this.size=a.BIG;this.renderItemsList=[];this.focusedItemId="";this.itemsList=[];this.inputType=r.TEXT;this.toggleComboBox=this.toggleComboBox.bind(this);this.closeFilterItems=this.closeFilterItems.bind(this)}componentWillLoad(){this.watchItems()}componentWillRender(){this.selectedCounter=this.itemsList.filter((e=>e.checked)).length}getControlToListSize(){switch(this.size){case a.X_SMALL:return n.SMALL;case a.SMALL:return n.MEDIUM;default:return n.LARGE}}getOptionId(e){return`${this.inputid}-option-${e.id?d(`${e.id}`):d(`${e.name}`)}`}getCheckAllOptionId(){return`${this.inputid}-check-all`}allOptionsSelected(){return this.selectedCounter===this.itemsList.length}hasReachedMaxSelections(){return!!(this.maxcheckableitems&&this.selectedCounter>=this.maxcheckableitems)}handleHeaderKeyDown(e){if(e.code===l.ENTER&&!this.focusedItemId){this.toggleComboBox()}if(!this.isopen||this.hassearch){return}switch(e.code){case l.SPACE:case l.ENTER:if(this.focusedItemId){e.preventDefault();this.checkOption(this.focusedItemId)}break;case l.ESC:if(this.focusedItemId){this.focusedItemId=""}break;case l.ARROW_DOWN:case l.ARROW_UP:this.handleArrowsNavigation(e);break}}handleInputKeyDown(e){switch(e.code){case l.ENTER:case l.SPACE:if(this.focusedItemId){e.preventDefault();this.checkOption(this.focusedItemId);break}break;case l.ARROW_DOWN:case l.ARROW_UP:this.handleArrowsNavigation(e);break;case l.ESC:if(this.focusedItemId){this.focusedItemId="";break}this.closeFilterItems();break;case l.TAB:this.focusedItemId="";break}}checkOption(e){if(e===this.getCheckAllOptionId()){this.itemsList=this.itemsList.map((e=>Object.assign(Object.assign({},e),{checked:!this.allOptionsSelected()})));this.focusedItemId=this.getCheckAllOptionId()}else{this.itemsList=this.itemsList.map((t=>{if(e===this.getOptionId(t)){t.checked=!t.checked}return t}))}this.updateRenderItemsList();this.emitComboboxChange()}handleArrowsNavigation(e){if(![l.ARROW_DOWN,l.ARROW_UP].includes(e.code)||!this.isopen){return}e.preventDefault();e.stopPropagation();const t=this.focusedItemId?this.element.shadowRoot.querySelector(`#${this.focusedItemId}`):null;const i=Array.from(this.element.shadowRoot.querySelectorAll('[role="option"]'));if(!i.length){return}const s=t?i.indexOf(t):null;const o=0;const a=i.length-1;let r=null;if(e.code===l.ARROW_DOWN){r=s===null?i[o]:i[s+1]||i[a]}else if(e.code===l.ARROW_UP){r=s===null?i[a]:i[s-1]||i[o]}this.focusedItemId=r.id;r.scrollIntoView({block:"nearest",container:"nearest"})}updateRenderItemsList(){if(this.searchValue){this.filterItems(this.searchValue)}else{this.resetRenderItemsList()}}resetRenderItemsList(){const e=[];this.itemsList.forEach((t=>{e.push(Object.assign({},t))}));this.renderItemsList=e}filterItems(e){if(!e){return this.closeFilterItems()}this.resetRenderItemsList();this.renderItemsList=this.renderItemsList.filter((t=>{const i=t.name.toUpperCase().indexOf(e.toUpperCase());const s=i+e.length;const o=t.name.substring(0,i)+"<strong>"+t.name.substring(i,s)+"</strong>"+t.name.substring(s,t.name.length);t.name=o;return i>=0}))}closeFilterItems(){this.searchValue="";this.resetRenderItemsList()}toggleComboBox(){this.isopen=!this.isopen}getHeaderAriaLabel(){if(!this.label||this.selectedCounter<=0){return undefined}const e=this.selectedCounter===1?"elemento selezionato":"elementi selezionati";return`${this.label}: ${this.selectedCounter} ${e}`}getComboboxA11yAttributes(e){const t="combobox";const i=this.isopen?"true":"false";const s=this.isopen?this.focusedItemId:"";const o=`${this.inputid}_list`;if(e){return{role:t,"aria-label":this.htmlAriaLabel,"html-aria-expanded":i,"html-aria-activedescendant":s,"html-aria-controls":o}}return{role:t,"aria-expanded":i,"aria-activedescendant":s,"aria-controls":o}}renderHeader(){const e=!this.hassearch?this.getComboboxA11yAttributes(false):{};return s("div",Object.assign({class:"header",onClick:()=>this.toggleComboBox(),onKeyDown:e=>this.handleHeaderKeyDown(e),role:"button",tabindex:0,"aria-controls":"open-combo-data","aria-expanded":this.isopen?"true":"false","aria-label":this.getHeaderAriaLabel()},e),s("span",{class:"body-3"},this.label,s("span",null,this.selectedCounter>0&&` (${this.selectedCounter})`)),s("z-icon",{name:"caret-down",class:this.size}))}renderContent(){return s("div",{id:"open-combo-data",class:"open-combo-data"},this.hassearch&&this.renderSearchInput(),s("div",{role:"listbox","aria-label":this.label,"aria-multiselectable":"true",id:`${this.inputid}_list`,"aria-owns":`${this.hascheckall?`${this.getCheckAllOptionId()} `:``}${this.itemsList.map((e=>this.getOptionId(e))).join(" ")}`},this.renderItems()))}renderItems(){return s("div",{class:this.searchValue&&"search",tabIndex:-1,role:"presentation"},this.renderList(this.renderItemsList))}renderItem(e,t,i){const o=this.getOptionId(e);const a=!e.checked&&this.hasReachedMaxSelections();return s("z-list-element",{htmlTabindex:-1,dividerType:t!==i-1?c.ELEMENT:c.NONE,size:this.getControlToListSize(),role:"presentation",disabled:!!a},s("span",{class:"option-wrap",role:"presentation",onClick:()=>{this.focusedItemId="";this.checkOption(o)}},s("z-icon",{name:e.checked?"checkbox-checked":"checkbox",class:this.focusedItemId===o?"focused":""}),s("span",{id:o,role:a?"presentation":"option","aria-selected":e.checked?"true":"false","aria-label":a?undefined:p(e.name)},s("span",{"aria-hidden":"true",innerHTML:e.name}))))}renderList(e){if(!e){return}if(!e.length&&this.searchValue){return this.renderNoSearchResults()}if(this.hasgroupitems){return this.renderGroups(e)}return s("ul",{role:"presentation"},this.renderCheckAll(),e.map(((t,i)=>this.renderItem(t,i,e.length))))}renderGroups(e){const t=e.reduce(((t,i,s)=>{var o;const a=i.category||"Altra categoria";const r=this.renderItem(i,s,e.length);t[a]=(o=t[a])!==null&&o!==void 0?o:[];t[a].push(r);return t}),{});const i=Object.entries(t).map((([e,t],i)=>s("z-list-group",{size:this.getControlToListSize(),"divider-type":c.ELEMENT,"aria-labelledby":`${this.inputid}_list_group_${i}`},s("span",{class:"body-3-sb z-list-group-title",slot:"header-title",id:`${this.inputid}_list_group_${i}`,"aria-hidden":"true"},e),t.map((e=>e)))));return s("ul",{role:"presentation"},this.renderCheckAll(),i)}renderNoSearchResults(){return s("div",{class:"no-results"},s("span",null,this.noresultslabel))}renderSearchInput(){return s("z-input",Object.assign({htmlid:`${this.inputid}_search`,label:this.searchlabel,placeholder:this.searchplaceholder,htmltitle:this.searchtitle,type:this.inputType,value:this.searchValue,message:false,size:this.size,"html-aria-autocomplete":"list"},this.getComboboxA11yAttributes(true),{onKeyDown:e=>this.handleInputKeyDown(e),onInputChange:e=>{this.searchValue=e.detail.value;this.focusedItemId=""}}))}renderCheckAll(){if(!this.hascheckall||this.searchValue){return}const e=this.getCheckAllOptionId();const t=this.allOptionsSelected();const i=this.selectedCounter>0&&!t;const o=!t&&(this.hasReachedMaxSelections()||this.maxcheckableitems&&this.maxcheckableitems<this.itemsList.length);return s("z-list-element",{class:"check-all-wrapper",role:"presentation",htmlTabindex:-1,dividerType:c.ELEMENT,dividerColor:"gray800",size:this.getControlToListSize(),disabled:!!o},s("span",{class:"option-wrap",role:"presentation",onClick:()=>this.checkOption(e)},s("z-icon",{name:i?"indeterminated-checkbox":t?"checkbox-checked":"checkbox",class:this.focusedItemId===e?"focused":""}),s("span",{id:e,role:o?"presentation":"option","aria-selected":t?"true":"false"},t?this.uncheckalltext:this.checkalltext)))}render(){return s("div",{key:"683f9ed203e8c3843d0e20daf0acade8a0ff1a49","data-action":`combo-${this.inputid}`,class:{open:this.isopen,fixed:this.isfixed,disabled:this.disabled},id:this.inputid},this.renderHeader(),!this.disabled&&this.renderContent())}get element(){return this}static get watchers(){return{items:[{watchItems:0}],searchValue:[{watchSearchValue:0}]}}static get style(){return z()+x()}},[1,"z-combobox",{inputid:[1],items:[1],label:[1],disabled:[516],hassearch:[4],searchlabel:[1],searchplaceholder:[1],searchtitle:[1],noresultslabel:[1],isopen:[1028],isfixed:[4],hascheckall:[4],checkalltext:[1],uncheckalltext:[1],maxcheckableitems:[2],hasgroupitems:[4],size:[1],htmlAriaLabel:[1,"html-aria-label"],searchValue:[32],selectedCounter:[32],renderItemsList:[32],focusedItemId:[32]},undefined,{items:[{watchItems:0}],searchValue:[{watchSearchValue:0}]}]);function w(){if(typeof customElements==="undefined"){return}const e=["z-combobox","z-divider","z-icon","z-input","z-input-message","z-list-element","z-list-group"];e.forEach((e=>{switch(e){case"z-combobox":if(!customElements.get(o(e))){customElements.define(o(e),k)}break;case"z-divider":if(!customElements.get(o(e))){m()}break;case"z-icon":if(!customElements.get(o(e))){u()}break;case"z-input":if(!customElements.get(o(e))){b()}break;case"z-input-message":if(!customElements.get(o(e))){v()}break;case"z-list-element":if(!customElements.get(o(e))){f()}break;case"z-list-group":if(!customElements.get(o(e))){g()}break}}))}const y=k;const $=w;export{y as ZCombobox,$ as defineCustomElement};
|
|
2
2
|
//# sourceMappingURL=z-combobox.js.map
|