@zanichelli/albe-web-components 16.3.1 → 16.3.2

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/web-components-library.cjs.js +1 -1
  4. package/dist/cjs/z-app-header_12.cjs.entry.js +67 -17
  5. package/dist/cjs/z-app-header_12.cjs.entry.js.map +1 -1
  6. package/dist/cjs/z-menu-section.cjs.entry.js +28 -13
  7. package/dist/cjs/z-menu-section.cjs.entry.js.map +1 -1
  8. package/dist/cjs/z-menu.cjs.entry.js +89 -43
  9. package/dist/cjs/z-menu.cjs.entry.js.map +1 -1
  10. package/dist/collection/components/z-app-header/index.js +55 -13
  11. package/dist/collection/components/z-app-header/index.js.map +1 -1
  12. package/dist/collection/components/z-app-header/index.stories.js +50 -116
  13. package/dist/collection/components/z-app-header/index.stories.js.map +1 -1
  14. package/dist/collection/components/z-app-header/styles.css +34 -25
  15. package/dist/collection/components/z-menu/index.js +93 -42
  16. package/dist/collection/components/z-menu/index.js.map +1 -1
  17. package/dist/collection/components/z-menu/styles.css +40 -52
  18. package/dist/collection/components/z-menu-section/index.js +31 -16
  19. package/dist/collection/components/z-menu-section/index.js.map +1 -1
  20. package/dist/collection/components/z-menu-section/styles.css +8 -0
  21. package/dist/collection/components/z-searchbar/index.js +14 -5
  22. package/dist/collection/components/z-searchbar/index.js.map +1 -1
  23. package/dist/components/index23.js +14 -5
  24. package/dist/components/index23.js.map +1 -1
  25. package/dist/components/z-app-header.js +56 -14
  26. package/dist/components/z-app-header.js.map +1 -1
  27. package/dist/components/z-menu-section.js +30 -15
  28. package/dist/components/z-menu-section.js.map +1 -1
  29. package/dist/components/z-menu.js +89 -44
  30. package/dist/components/z-menu.js.map +1 -1
  31. package/dist/esm/loader.js +1 -1
  32. package/dist/esm/web-components-library.js +1 -1
  33. package/dist/esm/z-app-header_12.entry.js +67 -17
  34. package/dist/esm/z-app-header_12.entry.js.map +1 -1
  35. package/dist/esm/z-menu-section.entry.js +28 -13
  36. package/dist/esm/z-menu-section.entry.js.map +1 -1
  37. package/dist/esm/z-menu.entry.js +89 -43
  38. package/dist/esm/z-menu.entry.js.map +1 -1
  39. package/dist/types/components/z-app-header/index.d.ts +4 -3
  40. package/dist/types/components/z-menu/index.d.ts +9 -1
  41. package/dist/types/components/z-menu-section/index.d.ts +4 -2
  42. package/dist/types/components/z-searchbar/index.d.ts +1 -0
  43. package/dist/web-components-library/p-8e5f1ae0.entry.js +2 -0
  44. package/dist/web-components-library/p-8e5f1ae0.entry.js.map +1 -0
  45. package/dist/web-components-library/p-b6e7866f.entry.js +2 -0
  46. package/dist/web-components-library/p-b6e7866f.entry.js.map +1 -0
  47. package/dist/web-components-library/p-fb0b11cd.entry.js +2 -0
  48. package/dist/web-components-library/p-fb0b11cd.entry.js.map +1 -0
  49. package/dist/web-components-library/web-components-library.esm.js +1 -1
  50. package/dist/web-components-library/web-components-library.esm.js.map +1 -1
  51. package/package.json +1 -1
  52. package/www/build/p-38bf2bfc.js +2 -0
  53. package/www/build/p-8e5f1ae0.entry.js +2 -0
  54. package/www/build/p-8e5f1ae0.entry.js.map +1 -0
  55. package/www/build/p-b6e7866f.entry.js +2 -0
  56. package/www/build/p-b6e7866f.entry.js.map +1 -0
  57. package/www/build/p-fb0b11cd.entry.js +2 -0
  58. package/www/build/p-fb0b11cd.entry.js.map +1 -0
  59. package/www/build/web-components-library.esm.js +1 -1
  60. package/www/build/web-components-library.esm.js.map +1 -1
  61. package/www/index.html +1 -1
  62. package/dist/web-components-library/p-04c39e8a.entry.js +0 -2
  63. package/dist/web-components-library/p-04c39e8a.entry.js.map +0 -1
  64. package/dist/web-components-library/p-0542a3c9.entry.js +0 -2
  65. package/dist/web-components-library/p-0542a3c9.entry.js.map +0 -1
  66. package/dist/web-components-library/p-16d625b3.entry.js +0 -2
  67. package/dist/web-components-library/p-16d625b3.entry.js.map +0 -1
  68. package/www/build/p-04c39e8a.entry.js +0 -2
  69. package/www/build/p-04c39e8a.entry.js.map +0 -1
  70. package/www/build/p-0542a3c9.entry.js +0 -2
  71. package/www/build/p-0542a3c9.entry.js.map +0 -1
  72. package/www/build/p-16d625b3.entry.js +0 -2
  73. package/www/build/p-16d625b3.entry.js.map +0 -1
  74. package/www/build/p-ae5cec65.js +0 -2
@@ -3,7 +3,7 @@ import { g as KeyboardCode, O as OffCanvasVariant, u as TransitionDirection, B a
3
3
  import { B as Breakpoints } from './breakpoints-d148bfde.js';
4
4
  import { a as containsElement, r as randomId, b as boolean, g as getDevice, h as handleEnterKeydSubmit } from './utils-acc8bdd0.js';
5
5
 
6
- const stylesCss$b = ":host{position:relative;display:block;box-shadow:var(--shadow-2)}:host,*{box-sizing:border-box}.heading-panel{--title-line-height:1.333;--title-font-size:var(--font-size-6);position:relative;display:flex;width:100%;max-width:var(--app-header-content-max-width, 100%);flex-direction:column;flex-grow:0;flex-shrink:0;align-items:baseline;padding:calc(var(--space-unit) * 2);margin:0 auto;background:var(--app-header-bg)}:host(:empty) .heading-panel{padding:0}.heading-container{position:relative;z-index:1;display:flex;width:100%;max-width:100%;flex:1 auto;flex-direction:column;justify-content:flex-start}.heading-panel.has-menubar{padding-bottom:0}.heading-panel .heading-container{flex-direction:column-reverse}:host([enable-search]) .heading-panel .heading-container{flex-direction:column}:host([enable-search][search-page-url]) .heading-panel .heading-container{flex-direction:row}.heading-title{display:flex;width:100%;flex-direction:row;align-items:flex-start}.z-logo{display:flex;height:calc(var(--title-font-size) * var(--title-line-height));align-items:center}.z-logo img{height:24px;margin:0 var(--space-unit) 0 0;content:url('data:image/svg+xml,<svg width=\"61\" height=\"32\" viewBox=\"0 0 61 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M15.9874 32C7.1595 32 0 24.8349 0 16C0 7.16513 7.1595 0 15.9874 0H45.0126C53.8405 0 61 7.16513 61 16C61 24.8349 53.8405 32 45.0126 32H15.9874Z\" fill=\"%23E2011A\"/><path d=\"M58.5435 15.9992C58.5435 23.4743 52.4892 29.5403 45.0129 29.5403C37.5367 29.5403 31.4824 23.4813 31.4824 15.9992C31.4824 8.51701 37.5367 2.45801 45.0129 2.45801C52.4892 2.45801 58.5435 8.51701 58.5435 15.9992Z\" fill=\"white\"/><path d=\"M40.7107 8.01862H49.8976V11.3158L44.139 21.7077H50.0384V24.6457H39.9785V21.4048L45.7371 10.9636H40.7107V8.01862Z\" fill=\"%23E2011A\"/><path d=\"M12.2914 24.6449C10.982 24.6449 10.271 23.8136 10.271 22.6722V7.04565H12.1718V22.9822H13.981V24.6449H12.2914Z\" fill=\"white\"/><path d=\"M25.6461 24.6448C24.2452 24.6448 23.675 23.7853 23.5342 22.6439H23.4145C22.8935 24.1446 21.5841 24.9266 19.8735 24.9266C17.2828 24.9266 15.7622 23.4964 15.7622 21.2137C15.7622 18.931 17.4236 17.6206 20.9928 17.6206H23.4145V16.4088C23.4145 14.6756 22.4641 13.7245 20.5141 13.7245C19.0428 13.7245 18.0642 14.4361 17.4025 15.5563L16.262 14.4854C16.9308 13.175 18.4021 12.0829 20.6126 12.0829C23.5623 12.0829 25.3152 13.6259 25.3152 16.2186V22.9751H26.7162V24.6378H25.6461V24.6448ZM23.4145 21.0799V19.0578H20.8942C18.733 19.0578 17.7545 19.7272 17.7545 20.9108V21.411C17.7545 22.6228 18.7049 23.3132 20.1762 23.3132C22.0558 23.3132 23.4074 22.341 23.4074 21.0799H23.4145Z\" fill=\"white\"/></svg>')}.product-logo{display:none}.product-logo ::slotted([slot=\"product-logo\"]){width:32px;height:32px;margin-right:var(--space-unit);border-radius:50%}::slotted([slot=\"title\"]),::slotted([slot=\"stucked-title\"]),.stucked-title{margin:0;color:var(--app-header-text-color, var(--gray950));font-family:var(--font-family-serif);font-weight:var(--font-sb)}::slotted([slot=\"title\"]){display:-webkit-box;overflow:hidden;flex-grow:1;-webkit-box-orient:vertical;font-size:var(--title-font-size);-webkit-line-clamp:2;line-clamp:2;line-height:var(--title-line-height);text-overflow:ellipsis}:host([enable-search]) ::slotted([slot=\"title\"])+*{margin-left:calc(var(--space-unit) * 2)}:host([enable-offcanvas]:not([menu-length=\"0\"])) .top-subtitle{padding-left:calc(var(--space-unit) * 4 + var(--space-unit))}::slotted([slot=\"top-subtitle\"]){display:-webkit-box;overflow:hidden;max-width:80%;margin:0;-webkit-box-orient:vertical;color:var(--color-default-text);font-family:var(--font-family-sans);font-size:var(--font-size-2);font-style:italic;font-weight:var(--font-rg);-webkit-line-clamp:2;line-clamp:2}.menu-container{display:flex;flex:1 auto;column-gap:calc(var(--space-unit) * 4)}.menu-container:focus:focus-visible{outline:none}:host([menu-length=\"0\"]) .menu-container,.menu-container:empty{display:none}.menu-container ::slotted([open]){position:relative;z-index:3}.menu-container ::slotted([slot=\"menu\"]:not(:last-child))::after{position:absolute;top:calc(1.5em / 2);right:calc(var(--space-unit) * -2);width:var(--border-size-small);height:1em;background-color:currentcolor;content:\"\";transform:translateY(-50%)}z-searchbar{z-index:0;display:flex;width:100%;align-items:center;padding-top:calc(var(--space-unit) * 2)}.heading-stuck{position:fixed;z-index:20;top:var(--app-header-top-offset, 48px);left:0;width:100%;max-width:100%;animation:slide-stuck-heading-in 250ms ease-out;background:var(--app-header-stucked-bg, var(--color-surface01));box-shadow:var(--shadow-2);color:var(--app-header-stucked-text-color, var(--color-default-text))}.heading-stuck-content{display:flex;max-width:var(--app-header-content-max-width, 100%);align-items:center;padding:var(--space-unit) var(--grid-margin);margin:0 auto}.heading-stuck .heading-title{--title-font-size:var(--font-size-5);--title-line-height:1.4;overflow:hidden;align-items:center}.heading-stuck .heading-title:not(:last-child){margin-right:calc(var(--space-unit) * 2)}.heading-stuck .stucked-title{overflow:hidden;font-size:var(--title-font-size);line-height:var(--title-line-height);text-overflow:ellipsis;white-space:nowrap}.heading-stuck-content z-button.search-page-button{margin-left:auto}.drawer-trigger{display:flex;height:calc(var(--title-font-size) * var(--title-line-height));align-items:center;padding:0;border:0;margin-right:var(--space-unit);appearance:none;background:none;border-radius:0;color:inherit;cursor:pointer;outline:none}.drawer-trigger:focus:focus-visible z-icon{box-shadow:var(--shadow-focus-primary)}.drawer-trigger z-icon{--z-icon-width:calc(var(--space-unit) * 4);--z-icon-height:calc(var(--space-unit) * 4);fill:currentcolor}.heading-container z-button.search-page-button{margin-left:auto}.drawer-content{display:none}z-offcanvas[open] .drawer-content{display:flex;width:100%;flex:1 auto;flex-direction:column}z-offcanvas[open] .drawer-content ::slotted(z-menu){width:100%}.drawer-close{--z-icon-width:calc(var(--space-unit) * 4);--z-icon-height:calc(var(--space-unit) * 4);padding:0;border:0;margin:var(--space-unit) 0 calc(var(--space-unit) * 2.5);appearance:none;background:transparent;border-radius:0;cursor:pointer;fill:currentcolor;outline:none}.drawer-close:focus-visible{box-shadow:var(--shadow-focus-primary)}@media (min-width: 768px){.heading-panel{--title-font-size:var(--font-size-9);padding:calc(var(--space-unit) * 1.5) var(--grid-margin) calc(var(--space-unit) * 1.25)}:host([enable-search][search-page-url]) .heading-panel .heading-container{flex-direction:column}.heading-panel .heading-container{flex-direction:column;margin-right:auto}.z-logo img{height:32px}.product-logo{display:flex;height:calc(var(--title-font-size) * var(--title-line-height));align-items:center}:host([enable-search]:not([search-page-url])) .heading-container .heading-title{flex-wrap:nowrap}z-searchbar{width:30%;height:calc(var(--title-font-size) * var(--title-line-height));padding-top:0}.menu-container{flex:initial}.menu-container>[role=\"menubar\"]{display:contents}:host(:not([enable-offcanvas])) .menu-container{margin-top:calc((var(--space-unit) * 1.75))}:host(:not([enable-offcanvas])) .heading-container .drawer-trigger{display:none}.heading-stuck .heading-title{--title-font-size:var(--font-size-8);--title-line-height:1.5}.heading-stuck-content{padding:6px var(--grid-margin)}:host(:not([enable-offcanvas],[menu-length=\"0\"])){padding-left:0}}@media (min-width: 1152px){z-searchbar{min-width:calc(var(--space-unit) * 45);flex:initial}}@keyframes slide-stuck-heading-in{0%{transform:translate3d(0, -100%, 0)}100%{transform:none}}";
6
+ const stylesCss$b = ":host{position:relative;display:block;box-shadow:var(--shadow-2)}:host,*{box-sizing:border-box}.heading-panel{--title-line-height:1.333;--title-font-size:var(--font-size-6);position:relative;display:flex;width:100%;max-width:var(--app-header-content-max-width, 100%);flex-direction:column;flex-grow:0;flex-shrink:0;align-items:baseline;padding:calc(var(--space-unit) * 2);margin:0 auto;background:var(--app-header-bg)}:host(:empty) .heading-panel{padding:0}.heading-container{position:relative;z-index:1;display:flex;width:100%;max-width:100%;flex:1 auto;flex-direction:column;justify-content:flex-start}.heading-panel.has-menubar{padding-bottom:0}.heading-panel .heading-container{flex-direction:column-reverse}:host([enable-search]) .heading-panel .heading-container{flex-direction:column}:host([enable-search][search-page-url]) .heading-panel .heading-container{flex-direction:row}.heading-title{display:flex;width:100%;flex-direction:row;align-items:flex-start}.heading-title:not(:last-child){margin-right:var(--space-unit)}.z-logo,.search-page-button{display:flex;height:calc(var(--title-font-size) * var(--title-line-height));align-items:center}.z-logo img{height:24px;margin:0 var(--space-unit) 0 0;content:url('data:image/svg+xml,<svg width=\"61\" height=\"32\" viewBox=\"0 0 61 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M15.9874 32C7.1595 32 0 24.8349 0 16C0 7.16513 7.1595 0 15.9874 0H45.0126C53.8405 0 61 7.16513 61 16C61 24.8349 53.8405 32 45.0126 32H15.9874Z\" fill=\"%23E2011A\"/><path d=\"M58.5435 15.9992C58.5435 23.4743 52.4892 29.5403 45.0129 29.5403C37.5367 29.5403 31.4824 23.4813 31.4824 15.9992C31.4824 8.51701 37.5367 2.45801 45.0129 2.45801C52.4892 2.45801 58.5435 8.51701 58.5435 15.9992Z\" fill=\"white\"/><path d=\"M40.7107 8.01862H49.8976V11.3158L44.139 21.7077H50.0384V24.6457H39.9785V21.4048L45.7371 10.9636H40.7107V8.01862Z\" fill=\"%23E2011A\"/><path d=\"M12.2914 24.6449C10.982 24.6449 10.271 23.8136 10.271 22.6722V7.04565H12.1718V22.9822H13.981V24.6449H12.2914Z\" fill=\"white\"/><path d=\"M25.6461 24.6448C24.2452 24.6448 23.675 23.7853 23.5342 22.6439H23.4145C22.8935 24.1446 21.5841 24.9266 19.8735 24.9266C17.2828 24.9266 15.7622 23.4964 15.7622 21.2137C15.7622 18.931 17.4236 17.6206 20.9928 17.6206H23.4145V16.4088C23.4145 14.6756 22.4641 13.7245 20.5141 13.7245C19.0428 13.7245 18.0642 14.4361 17.4025 15.5563L16.262 14.4854C16.9308 13.175 18.4021 12.0829 20.6126 12.0829C23.5623 12.0829 25.3152 13.6259 25.3152 16.2186V22.9751H26.7162V24.6378H25.6461V24.6448ZM23.4145 21.0799V19.0578H20.8942C18.733 19.0578 17.7545 19.7272 17.7545 20.9108V21.411C17.7545 22.6228 18.7049 23.3132 20.1762 23.3132C22.0558 23.3132 23.4074 22.341 23.4074 21.0799H23.4145Z\" fill=\"white\"/></svg>')}.product-logo{display:none}.product-logo ::slotted([slot=\"product-logo\"]){width:32px;height:32px;margin-right:var(--space-unit)}.product-logo ::slotted([slot=\"product-logo\"]) img{width:100%;height:100%;object-fit:cover}::slotted([slot=\"title\"]),::slotted([slot=\"stucked-title\"]),.stucked-title{margin:0;color:var(--app-header-text-color, var(--color-default-text));font-family:var(--font-family-serif);font-weight:var(--font-sb)}::slotted([slot=\"title\"]){display:-webkit-box;overflow:hidden;flex-grow:1;-webkit-box-orient:vertical;font-size:var(--title-font-size);-webkit-line-clamp:2;line-clamp:2;line-height:var(--title-line-height);text-overflow:ellipsis}::slotted(a:is([slot=\"title\"],[slot=\"stucked-title\"])){text-decoration:none}:host([enable-search]) ::slotted([slot=\"title\"])+*{margin-left:calc(var(--space-unit) * 2)}:host([enable-offcanvas]:not([menu-length=\"0\"])) .top-subtitle{padding-left:calc(var(--space-unit) * 4 + var(--space-unit))}::slotted([slot=\"top-subtitle\"]){display:-webkit-box;overflow:hidden;max-width:80%;margin:0;-webkit-box-orient:vertical;color:var(--color-default-text);font-family:var(--font-family-sans);font-size:var(--font-size-2);font-style:italic;font-weight:var(--font-rg);-webkit-line-clamp:2;line-clamp:2}.search-page-button{margin-left:auto}.menu-container{display:flex;flex:1 auto;column-gap:calc(var(--space-unit) * 4)}.menu-container:focus:focus-visible{outline:none}:host([menu-length=\"0\"]) .menu-container,.menu-container:empty{display:none}.menu-container ::slotted([open]){position:relative;z-index:3}.menu-container ::slotted([slot=\"menu\"]:not(:last-child))::after{position:absolute;top:calc(1.5em / 2);right:calc(var(--space-unit) * -2);width:var(--border-size-small);height:1em;background-color:currentcolor;content:\"\";transform:translateY(-50%)}z-searchbar{z-index:0;display:flex;width:100%;align-items:center}.heading-stuck{position:fixed;z-index:20;top:var(--app-header-top-offset, 48px);left:0;width:100%;max-width:100%;animation:slide-stuck-heading-in 250ms ease-out;background:var(--app-header-stucked-bg, var(--color-surface01));box-shadow:var(--shadow-2);color:var(--app-header-stucked-text-color, var(--color-default-text))}.heading-stuck-content{display:flex;max-width:var(--app-header-content-max-width, 100%);align-items:center;padding:var(--space-unit) var(--grid-margin);margin:0 auto}.heading-stuck .heading-title{--title-font-size:var(--font-size-5);--title-line-height:1.4;overflow:hidden;align-items:center}.heading-stuck .stucked-title{overflow:hidden;font-size:var(--title-font-size);line-height:var(--title-line-height);text-overflow:ellipsis;white-space:nowrap}.drawer-trigger{display:flex;height:calc(var(--title-font-size) * var(--title-line-height));align-items:center;padding:0;border:0;margin-right:var(--space-unit);appearance:none;background:none;border-radius:0;color:inherit;cursor:pointer;outline:none}.drawer-trigger:focus:focus-visible z-icon{box-shadow:var(--shadow-focus-primary)}.drawer-trigger z-icon{--z-icon-width:calc(var(--space-unit) * 4);--z-icon-height:calc(var(--space-unit) * 4);fill:var(--color-default-icon)}.drawer-content{display:none}z-offcanvas[open] .drawer-content{display:flex;width:100%;flex:1 auto;flex-direction:column}z-offcanvas[open] .drawer-content ::slotted(z-menu){width:100%}.drawer-close{--z-icon-width:calc(var(--space-unit) * 4);--z-icon-height:calc(var(--space-unit) * 4);padding:0;border:0;margin:var(--space-unit) 0 calc(var(--space-unit) * 2.5);appearance:none;background:transparent;border-radius:0;cursor:pointer;outline:none}.drawer-close z-icon{fill:var(--color-default-icon)}.drawer-close:focus:focus-visible{box-shadow:var(--shadow-focus-primary)}@media (max-width: 767px){:host([enable-search]) .heading-panel .heading-container{row-gap:calc(var(--space-unit) * 1.5)}}@media (min-width: 768px){.heading-panel{--title-font-size:var(--font-size-9);padding:calc(var(--space-unit) * 1.5) var(--grid-margin) calc(var(--space-unit) * 1.25)}:host([enable-search][search-page-url]) .heading-panel .heading-container{flex-direction:column}.heading-panel .heading-container{flex-direction:column;margin-right:auto}.z-logo img{height:32px}.product-logo{display:flex;height:calc(var(--title-font-size) * var(--title-line-height));align-items:center}z-searchbar{width:30%;height:calc(var(--title-font-size) * var(--title-line-height));margin-left:auto}.menu-container{flex:initial}.menu-container>[role=\"menubar\"]{display:contents}:host(:not([enable-offcanvas])) .menu-container{margin-top:calc((var(--space-unit) * 1.75))}:host(:not([enable-offcanvas])) .heading-container .drawer-trigger{display:none}.heading-stuck .heading-title{--title-font-size:var(--font-size-8);--title-line-height:1.5}.heading-stuck-content{padding:6px var(--grid-margin)}:host(:not([enable-offcanvas],[menu-length=\"0\"])){padding-left:0}}@media (min-width: 1152px){z-searchbar{min-width:calc(var(--space-unit) * 45)}}@keyframes slide-stuck-heading-in{0%{transform:translate3d(0, -100%, 0)}100%{transform:none}}";
7
7
  const ZAppHeaderStyle0 = stylesCss$b;
8
8
 
9
9
  const SUPPORT_INTERSECTION_OBSERVER = typeof IntersectionObserver !== "undefined";
@@ -54,7 +54,7 @@ const ZAppHeader = class {
54
54
  openDrawer() {
55
55
  this.drawerOpen = true;
56
56
  this.menuElements.forEach((element, index) => (element.htmlTabindex = index === 0 ? 0 : -1));
57
- setTimeout(() => this.closeMenuButton.focus(), 100);
57
+ setTimeout(() => this.menuElements[0].setFocus(), 400); /* wait for the 400ms offcanvas transition */
58
58
  }
59
59
  closeDrawer() {
60
60
  this.drawerOpen = false;
@@ -101,17 +101,58 @@ const ZAppHeader = class {
101
101
  current.htmlTabindex = -1;
102
102
  receiver.setFocus();
103
103
  }
104
- /** Close each menu except the one receiving focus/click */
105
- manageMenus(ev) {
106
- this.menuElements.forEach((menu) => {
107
- if (!menu.open || !menu.floating || menu.verticalContext || containsElement(menu, ev.target)) {
108
- return;
104
+ onOffcanvasKeydown(ev) {
105
+ var _a, _b;
106
+ if (ev.key !== KeyboardCode.TAB || !this.drawerOpen) {
107
+ return;
108
+ }
109
+ const closestMenu = ev.target.closest("z-menu");
110
+ if (closestMenu) {
111
+ ev.preventDefault();
112
+ ev.stopPropagation();
113
+ // restore tabindex to the zmenu containing the focused element
114
+ closestMenu.htmlTabindex = 0;
115
+ this.closeDrawerButton.focus();
116
+ }
117
+ else if (ev.target === this.closeDrawerButton) {
118
+ ev.preventDefault();
119
+ ev.stopPropagation();
120
+ if (ev.shiftKey) {
121
+ // give focus to the last open menu if any or the last menu otherwhise
122
+ ((_a = this.menuElements.filter((menu) => menu.open).pop()) !== null && _a !== void 0 ? _a : this.menuElements[this.menuLength - 1]).setFocus();
109
123
  }
110
- menu.open = false;
111
- });
124
+ else {
125
+ // give focus to the first open menu if any or the first menu otherwhise
126
+ ((_b = this.menuElements.find((menu) => menu.open)) !== null && _b !== void 0 ? _b : this.menuElements[0]).setFocus();
127
+ }
128
+ }
129
+ }
130
+ /** Close each menu except the one receiving focus/click, if any */
131
+ manageMenus(ev) {
132
+ const targetMenu = this.menuElements.find((menu) => containsElement(menu, ev.target));
133
+ if (targetMenu) {
134
+ this.menuElements.forEach((menu) => {
135
+ if (menu === targetMenu) {
136
+ return;
137
+ }
138
+ menu.htmlTabindex = -1;
139
+ if (!this.drawerOpen) {
140
+ menu.open = false;
141
+ }
142
+ });
143
+ }
144
+ else if (!this.drawerOpen) {
145
+ this.menuElements.forEach((menu) => {
146
+ menu.open = false;
147
+ });
148
+ }
112
149
  }
113
- handleMenubarKeydown(ev) {
150
+ handleKeydown(ev) {
114
151
  var _a, _b;
152
+ if (ev.key === KeyboardCode.ESC && this.drawerOpen) {
153
+ this.closeDrawer();
154
+ return;
155
+ }
115
156
  if (!this.menuElements.some((elem) => elem.contains(ev.target))) {
116
157
  return;
117
158
  }
@@ -152,10 +193,10 @@ const ZAppHeader = class {
152
193
  }
153
194
  renderMenuButton() {
154
195
  return (this.menuLength > 0 &&
155
- (this.enableOffcanvas || this._stuck || this.isMobile) && (h("button", { ref: (el) => (this.burgerButton = el), "aria-label": "Apri menu", "aria-haspopup": "menu", "aria-expanded": `${this.drawerOpen}`, "aria-controls": "offcanvas-menu", class: "drawer-trigger", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))));
196
+ (this.enableOffcanvas || this._stuck || this.isMobile) && (h("button", { ref: (el) => (this.burgerButton = el), class: "drawer-trigger", "aria-label": "Apri menu", "aria-haspopup": "menu", "aria-expanded": `${this.drawerOpen}`, "aria-controls": "offcanvas-menu", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))));
156
197
  }
157
198
  renderOffcanvas() {
158
- return (h("z-offcanvas", { id: "offcanvas-menu", variant: OffCanvasVariant.OVERLAY, transitiondirection: TransitionDirection.RIGHT, open: this.drawerOpen, onCanvasOpenStatusChanged: (ev) => (this.drawerOpen = ev.detail) }, h("div", { slot: "canvasContent" }, h("button", { ref: (el) => (this.closeMenuButton = el), class: "drawer-close", "aria-label": "Chiudi menu", onClick: this.closeDrawer, "aria-hidden": `${!this.drawerOpen}`, disabled: !this.drawerOpen }, h("z-icon", { name: "close" })), h("div", { class: "drawer-content", "aria-hidden": `${!this.drawerOpen}` }, h("slot", { name: "menu", onSlotchange: this.collectMenuElements })))));
199
+ return (h("z-offcanvas", { id: "offcanvas-menu", variant: OffCanvasVariant.OVERLAY, transitiondirection: TransitionDirection.RIGHT, open: this.drawerOpen, onCanvasOpenStatusChanged: (ev) => (this.drawerOpen = ev.detail), onKeyDown: this.onOffcanvasKeydown }, h("div", { slot: "canvasContent" }, h("button", { ref: (el) => (this.closeDrawerButton = el), class: "drawer-close", "aria-label": "Chiudi menu", onClick: this.closeDrawer, "aria-hidden": `${!this.drawerOpen}`, disabled: !this.drawerOpen }, h("z-icon", { name: "close" })), h("div", { class: "drawer-content", "aria-hidden": `${!this.drawerOpen}` }, h("slot", { name: "menu", onSlotchange: this.collectMenuElements })))));
159
200
  }
160
201
  renderStuck() {
161
202
  return (h("div", { class: "heading-stuck" }, h("div", { class: "heading-stuck-content" }, this.renderMenuButton(), h("div", { class: "heading-title" }, this.renderProductLogos(), h("div", { class: "stucked-title" }, h("slot", { name: "stucked-title" }, this.title))), this.enableSearch && this.renderSeachbar())));
@@ -184,6 +225,7 @@ const ZAppHeader = class {
184
225
  this.openDrawer = this.openDrawer.bind(this);
185
226
  this.closeDrawer = this.closeDrawer.bind(this);
186
227
  this.collectMenuElements = this.collectMenuElements.bind(this);
228
+ this.onOffcanvasKeydown = this.onOffcanvasKeydown.bind(this);
187
229
  }
188
230
  componentWillLoad() {
189
231
  this.collectMenuElements();
@@ -205,7 +247,7 @@ const ZAppHeader = class {
205
247
  }
206
248
  render() {
207
249
  const hasTopSubtitle = this.hasSlot("top-subtitle");
208
- return (h(Host, { key: '7e11b4451932dc22ef2b1379bafceacadc4ce45a', "menu-length": this.menuLength }, h("div", { key: 'd5885b5ebfaf18aa55c83eabaee0d76f335c3f95', class: { "heading-panel": true, "has-menubar": this.menuLength > 0 && !this.enableOffcanvas }, ref: (el) => (this.container = el) }, h("div", { key: 'f98e05c6f10213c8d04e1b9217bea3119a678af5', class: "heading-container" }, ((!this.enableSearch && this.isMobile) || !this.isMobile) && (h("div", { key: '8331716775beda5ef8f90472d20d0a13e8842e87', class: "top-subtitle" }, h("slot", { key: '55080f2143085802d7e9f5e77330120409dbf650', name: "top-subtitle" }))), h("div", { key: 'bda64ee9d54163101cb53b9cdab40764ab6501b8', class: "heading-title" }, this.renderMenuButton(), !hasTopSubtitle && !this._stuck && this.renderProductLogos(), h("slot", { key: '45d66d5b36ed1bde12a27f8b79e7b11dc5f1c8f3', name: "title" }), this.enableSearch && !this.isMobile && this.renderSeachbar()), this.enableSearch && this.isMobile && this.renderSeachbar()), h("nav", { key: '45e17efbf3ad93ad9cd0b55f5515022e1fe26d3f', class: "menu-container", "aria-label": this.title || undefined }, this.canShowMenu && (h("div", { key: '0c8d73e0c9dc85c341dc1ca999ada16eb9188ada', role: "menubar", "aria-label": this.title || undefined }, h("slot", { key: 'b907682a3866680a84557192a163fa179a01374a', name: "menu", onSlotchange: this.collectMenuElements }))))), this.renderOffcanvas(), this._stuck && this.renderStuck()));
250
+ return (h(Host, { key: 'f75168a2f0382aa913d97f584d3633a5bdfbfa9c', "menu-length": this.menuLength }, h("div", { key: '124e4e42c49b555e9e0a7fbf74fbed58a34eff26', class: { "heading-panel": true, "has-menubar": this.menuLength > 0 && !this.enableOffcanvas }, ref: (el) => (this.container = el) }, h("div", { key: '59a0f19801d6667ba0bb2ab532e8fef017b7a1f4', class: "heading-container" }, ((!this.enableSearch && this.isMobile) || !this.isMobile) && (h("div", { key: '90477c97647ac20836742a0f66cf33f4a314b096', class: "top-subtitle" }, h("slot", { key: '79635b43939be93a2c8453760325e438a88ac7a6', name: "top-subtitle" }))), h("div", { key: '886bc226038945a58945f76e327c700bf046c573', class: "heading-title" }, this.renderMenuButton(), !hasTopSubtitle && !this._stuck && this.renderProductLogos(), h("slot", { key: 'eec8098326dfc1c57dacfbd1b7c048b0cda46163', name: "title" }), this.enableSearch && !this.isMobile && this.renderSeachbar()), this.enableSearch && this.isMobile && this.renderSeachbar()), h("nav", { key: '4fab027ebeb20cb1be744961c86566328535cc39', class: "menu-container", "aria-label": this.title || undefined }, this.canShowMenu && (h("div", { key: 'e7b8a2c2131e550144a5203c07cc09a77af7f977', role: "menubar", "aria-label": this.title || undefined }, h("slot", { key: '4e020acf3f33bb6fef9da32e9dd69a8b6ed40412', name: "menu", onSlotchange: this.collectMenuElements }))))), this.renderOffcanvas(), this._stuck && this.renderStuck()));
209
251
  }
210
252
  get hostElement() { return getElement(this); }
211
253
  static get watchers() { return {
@@ -1744,6 +1786,7 @@ const ZSearchbar = class {
1744
1786
  this.currResultsCount = 0;
1745
1787
  this.showResults = false;
1746
1788
  this.isMobile = false;
1789
+ this.selectedItem = undefined;
1747
1790
  }
1748
1791
  emitSearchSubmit() {
1749
1792
  this.searchSubmit.emit(this.inputRef.value);
@@ -1753,6 +1796,8 @@ const ZSearchbar = class {
1753
1796
  }
1754
1797
  emitSearchItemClick(item) {
1755
1798
  this.searchItemClick.emit(item);
1799
+ this.selectedItem = item;
1800
+ this.searchString = "";
1756
1801
  }
1757
1802
  watchItems() {
1758
1803
  this.resultsItemsList = this.getResultsItemsList();
@@ -1838,6 +1883,9 @@ const ZSearchbar = class {
1838
1883
  handleStopTyping(e) {
1839
1884
  e.stopPropagation();
1840
1885
  this.searchString = e.detail.value;
1886
+ if (this.selectedItem) {
1887
+ this.selectedItem = undefined;
1888
+ }
1841
1889
  }
1842
1890
  handleSubmit() {
1843
1891
  if (this.preventSubmit) {
@@ -1859,12 +1907,13 @@ const ZSearchbar = class {
1859
1907
  this.showResults = false;
1860
1908
  }
1861
1909
  renderInput() {
1910
+ var _a;
1862
1911
  return (h("z-input", { ref: (val) => {
1863
1912
  this.inputRef = val;
1864
- }, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => {
1913
+ }, htmlid: `input-${this.htmlid}`, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => {
1865
1914
  handleEnterKeydSubmit(e, () => this.handleSubmit());
1866
1915
  this.handleArrowsNavigation(e);
1867
- }, value: this.value, ariaLabel: this.placeholder, size: this.size }));
1916
+ }, value: this.searchString || ((_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.label), ariaLabel: this.placeholder, size: this.size }));
1868
1917
  }
1869
1918
  renderButton() {
1870
1919
  if (!this.showSearchButton) {
@@ -1872,7 +1921,8 @@ const ZSearchbar = class {
1872
1921
  }
1873
1922
  const iconProp = this.searchButtonIconOnly ? { icon: "search" } : null;
1874
1923
  const buttonLabel = this.searchButtonIconOnly ? "" : "CERCA";
1875
- const defaultProps = Object.assign({ disabled: this.preventSubmit, variant: this.variant, size: this.size, onClick: () => this.handleSubmit() }, iconProp);
1924
+ const ariaLabel = this.searchButtonIconOnly ? { "aria-label": "CERCA" } : null;
1925
+ const defaultProps = Object.assign(Object.assign({ disabled: this.preventSubmit, variant: this.variant, size: this.size, onClick: () => this.handleSubmit() }, iconProp), ariaLabel);
1876
1926
  return h("z-button", Object.assign({}, defaultProps), buttonLabel);
1877
1927
  }
1878
1928
  renderResults() {
@@ -1994,7 +2044,7 @@ const ZSearchbar = class {
1994
2044
  return (h("z-list-element", { role: "option", tabindex: 0, clickable: true, id: `list-item-${this.htmlid}-show-all`, onClickItem: () => (this.currResultsCount = 0), color: "color-primary01" }, h("div", { class: "item-show-all" }, "Vedi tutti i risultati")));
1995
2045
  }
1996
2046
  render() {
1997
- return (h(Host, { key: 'aa20154a2cde6b9302f800c467a5b1fdd7052647', onFocus: () => (this.showResults = true), onClick: (e) => this.handleOutsideClick(e), class: { "has-submit": this.showSearchButton, "has-results": this.autocomplete } }, h("div", { key: '0b15d76f9252ba940393fa38c05f8dc35ec04cb6', class: "input-container" }, this.renderInput(), this.renderResults()), this.renderButton()));
2047
+ return (h(Host, { key: '243f08cf95d215a4585da2a99877d778bdc604ef', onFocus: () => (this.showResults = true), onClick: (e) => this.handleOutsideClick(e), class: { "has-submit": this.showSearchButton, "has-results": this.autocomplete } }, h("div", { key: 'b65b0dca0741a719e254813641bca14400573723', class: "input-container" }, this.renderInput(), this.renderResults()), this.renderButton()));
1998
2048
  }
1999
2049
  get element() { return getElement(this); }
2000
2050
  static get watchers() { return {