@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
@@ -65,7 +65,7 @@ export declare class ZAppHeader {
65
65
  private container?;
66
66
  private menuElements;
67
67
  private menuWidth;
68
- private closeMenuButton;
68
+ private closeDrawerButton;
69
69
  private burgerButton;
70
70
  private menuResizeObserver;
71
71
  private stuckIntersecObserver?;
@@ -83,9 +83,10 @@ export declare class ZAppHeader {
83
83
  private setupMenuResizeObserver;
84
84
  private hasSlot;
85
85
  private moveFocus;
86
- /** Close each menu except the one receiving focus/click */
86
+ private onOffcanvasKeydown;
87
+ /** Close each menu except the one receiving focus/click, if any */
87
88
  manageMenus(ev: FocusEvent | PointerEvent): void;
88
- handleMenubarKeydown(ev: KeyboardEvent): void;
89
+ handleKeydown(ev: KeyboardEvent): void;
89
90
  private renderSeachbar;
90
91
  private renderProductLogos;
91
92
  private renderMenuButton;
@@ -60,19 +60,27 @@ export declare class ZMenu {
60
60
  */
61
61
  private setItemsA11yAttrs;
62
62
  private onItemsChange;
63
+ private setItemTabindex;
63
64
  /**
64
65
  * Move focus and adjust the tabindex value of `receiver` and `current` elements,
65
66
  * setting -1 to the `current` and 0 to the `receiver`, then focus the `receiver` element.
66
67
  * If the receiver is a ZMenuSection and it's open, focus its first focusable item.
67
68
  */
68
69
  private moveFocus;
70
+ private onLabelClick;
69
71
  private onLabelKeydown;
70
72
  /** Set tabindex of the label to 0, then focus it. */
71
73
  setFocus(): Promise<void>;
72
- /** Focus the last item. */
74
+ /**
75
+ * Focus the last item.
76
+ */
73
77
  focusLastItem(): Promise<void>;
74
78
  onOpenChanged(): void;
75
79
  setLabelA11yAttrs(): void;
80
+ /**
81
+ * Set tabindex to -1 to all siblings of the clicked item.
82
+ */
83
+ onItemClick(ev: MouseEvent): void;
76
84
  onKeyDown(ev: KeyboardEvent): void;
77
85
  constructor();
78
86
  connectedCallback(): void;
@@ -31,16 +31,18 @@ export declare class ZMenuSection {
31
31
  * @param ev Slotchange event
32
32
  */
33
33
  private onLabelSlotChange;
34
+ private onLabelClick;
34
35
  private onLabelKeydown;
35
36
  /**
36
37
  * Move focus and adjust the tabindex value of `receiver` and `current` elements,
37
38
  * setting -1 to the `current` and 0 to the `receiver`, then focus the `receiver` element.
38
39
  */
39
40
  private moveFocus;
40
- /** Set tabindex of the label to 0, then focus it. */
41
- setFocus(): Promise<void>;
41
+ private focustFirstItem;
42
42
  /** Focus the last item. */
43
43
  focusLastItem(): Promise<void>;
44
+ /** Set tabindex of the label to 0, then focus it. */
45
+ setFocus(): Promise<void>;
44
46
  onOpenChange(): void;
45
47
  onTabindexChange(): void;
46
48
  private onItemsKeydown;
@@ -38,6 +38,7 @@ export declare class ZSearchbar {
38
38
  currResultsCount: number;
39
39
  showResults: boolean;
40
40
  isMobile: boolean;
41
+ selectedItem?: SearchbarItem;
41
42
  element: HTMLZSearchbarElement;
42
43
  private resultsItemsList;
43
44
  private inputRef;
@@ -0,0 +1,2 @@
1
+ import{r as t,c as e,h as s,a as i,g as o}from"./p-75c4a726.js";import{g as n}from"./p-6037cdf3.js";const a=':host{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;padding:0;font-family:var(--font-family-sans)}:host,::slotted(*),*{box-sizing:border-box}::slotted(a){text-decoration:none}::slotted(*){color:var(--color-default-text);font-family:var(--font-family-sans);font-weight:var(--font-rg)}.label{display:flex;width:100%;align-items:center;padding:var(--space-unit) 0;border:0;border-bottom:var(--border-size-small) solid var(--color-surface03);margin:0;background:transparent;border-radius:0;cursor:pointer;text-align:left}:host(:last-child:not([open])) .label{border-bottom:none}:host(:is([active],[open])) .label,.label:focus:focus-visible,.label:hover{border-color:var(--color-secondary01)}.label:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}:host(:is([active],[open])) .label ::slotted(*),.label:focus:focus-visible ::slotted(*),.label:hover ::slotted(*){font-weight:var(--font-bd)}::slotted([data-text]){display:inline-flex;flex-direction:column}::slotted([data-text])::after{overflow:hidden;height:0;content:attr(data-text);content:attr(data-text) / "";font-weight:var(--font-bd);pointer-events:none;user-select:none;visibility:hidden}@media speech{::slotted([data-text])::after{display:none}}.label ::slotted(*){width:100%;margin:0;font-size:var(--font-size-3);line-height:1.5}.label z-icon{margin-left:calc(var(--space-unit) * 4);fill:var(--color-default-icon)}.items{display:flex;width:100%;flex-direction:column;padding:calc(var(--space-unit) / 2);padding-bottom:calc(var(--space-unit) * 1.5)}.items[hidden]{display:none}::slotted([slot="section"]){display:inline-flex;padding:calc(var(--space-unit) / 2);margin:0;font-size:var(--font-size-1);line-height:1.333;outline:none}::slotted([slot="section"]:last-of-type){border:none}::slotted([slot="section"]:focus:focus-visible){box-shadow:var(--shadow-focus-primary);color:var(--color-secondary01)}::slotted([slot="section"]:hover),::slotted([slot="section"]:focus:focus-visible),::slotted([slot="section"][active]){color:var(--color-secondary01);font-weight:var(--font-bd)}';const h=a;const l=class{get focusableItem(){return this.items.find((({tabIndex:t})=>t===0))}toggle(){if(!this.hasItems){return}this.open=!this.open}setItemsA11yAttrs(){if(!this.hasItems){return}this.items.forEach((t=>{t.setAttribute("role","menuitem");t.tabIndex=-1}))}onItemsChange(){this.items=Array.from(this.host.querySelectorAll('[slot="section"]'));this.hasItems=this.items.length>0;this.setItemsA11yAttrs()}onLabelSlotChange(t){const e=t.target.assignedElements()[0];e.dataset.text=e===null||e===void 0?void 0:e.textContent}onLabelClick(){this.toggle();this.setFocus()}onLabelKeydown(t){if(t.key===n.ENTER||t.key===n.SPACE){t.preventDefault();t.stopPropagation();this.toggle();if(this.open){this.focustFirstItem()}}}moveFocus(t,e){t.tabIndex=0;setTimeout((()=>{t.focus()}),100);if(e){e.tabIndex=-1}}focustFirstItem(){this.moveFocus(this.items[0])}async focusLastItem(){this.moveFocus(this.items[this.items.length-1])}async setFocus(){this.htmlTabindex=0;setTimeout((()=>{this.label.focus()}),100)}onOpenChange(){if(!this.open){this.setItemsA11yAttrs();this.closed.emit()}else{this.opened.emit()}}onTabindexChange(){this.label.tabIndex=this.htmlTabindex}onItemsKeydown(t){switch(t.key){case n.ESC:case n.ARROW_LEFT:if(!this.open){break}t.preventDefault();t.stopPropagation();this.moveFocus(this.label,this.focusableItem);this.open=false;break;case n.ARROW_RIGHT:if(this.open){break}t.preventDefault();t.stopPropagation();this.open=true;this.focustFirstItem();break;case n.ARROW_DOWN:{if(!this.open){break}if(document.activeElement===this.host){t.preventDefault();t.stopPropagation();this.focustFirstItem();break}const e=this.items.indexOf(this.focusableItem);const s=this.items[e+1];if(s){t.preventDefault();t.stopPropagation();this.moveFocus(s,this.focusableItem)}else{this.htmlTabindex=0;this.focusableItem.tabIndex=-1}break}case n.ARROW_UP:{if(!this.open||document.activeElement===this.host){break}const e=this.items.indexOf(this.focusableItem);const s=this.items[e-1];t.preventDefault();t.stopPropagation();if(s){this.moveFocus(s,this.focusableItem)}else{this.focusableItem.tabIndex=-1;this.setFocus()}break}}}constructor(s){t(this,s);this.opened=e(this,"opened",7);this.closed=e(this,"closed",7);this.active=undefined;this.htmlTabindex=-1;this.open=undefined;this.hasItems=undefined;this.items=undefined;this.toggle=this.toggle.bind(this);this.onItemsChange=this.onItemsChange.bind(this);this.onLabelSlotChange=this.onLabelSlotChange.bind(this);this.onLabelClick=this.onLabelClick.bind(this);this.onLabelKeydown=this.onLabelKeydown.bind(this);this.onItemsKeydown=this.onItemsKeydown.bind(this)}connectedCallback(){this.onItemsChange()}render(){return s(i,{key:"4d9223bebf25df5eb224a7674c920ebc17470826",open:this.open},s("button",{key:"2f75c046ad4519df706283d3b37c2d9feb8734d3",ref:t=>this.label=t,class:"label","aria-haspopup":`${!!this.hasItems}`,"aria-expanded":`${!!this.open}`,role:"menuitem",tabindex:this.htmlTabindex,onClick:this.onLabelClick,onKeyDown:this.onLabelKeydown},s("slot",{key:"0a3b20723371deac12792436d977c343c237720b",onSlotchange:this.onLabelSlotChange}),this.hasItems&&s("z-icon",{key:"7fe5e9dc4a9eac28f0f3a381fedbe0ec3e7ca99d",name:this.open?"chevron-up":"chevron-down"})),s("div",{key:"80e167ce90df12c27eddc1e28b6bf6dd3b5d0dd7",class:"items",role:"menu",hidden:!this.open},s("slot",{key:"a0e88a56848abf198ced22e4fc390267aea6114e",name:"section",onSlotchange:this.onItemsChange})))}get host(){return o(this)}static get watchers(){return{open:["onOpenChange"],htmlTabindex:["onTabindexChange"]}}};l.style=h;export{l as z_menu_section};
2
+ //# sourceMappingURL=p-8e5f1ae0.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["stylesCss","ZMenuSectionStyle0","ZMenuSection","focusableItem","this","items","find","tabIndex","toggle","hasItems","open","setItemsA11yAttrs","forEach","item","setAttribute","onItemsChange","Array","from","host","querySelectorAll","length","onLabelSlotChange","ev","labelElement","target","assignedElements","dataset","text","textContent","onLabelClick","setFocus","onLabelKeydown","key","KeyboardCode","ENTER","SPACE","preventDefault","stopPropagation","focustFirstItem","moveFocus","receiver","current","setTimeout","focus","focusLastItem","htmlTabindex","label","onOpenChange","closed","emit","opened","onTabindexChange","onItemsKeydown","ESC","ARROW_LEFT","ARROW_RIGHT","ARROW_DOWN","document","activeElement","currentIndex","indexOf","ARROW_UP","constructor","hostRef","bind","connectedCallback","render","h","Host","ref","el","class","role","tabindex","onClick","onKeyDown","onSlotchange","name","hidden"],"sources":["src/components/z-menu-section/styles.css?tag=z-menu-section&encapsulation=shadow","src/components/z-menu-section/index.tsx"],"sourcesContent":[":host {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n padding: 0;\n font-family: var(--font-family-sans);\n}\n\n:host,\n::slotted(*),\n* {\n box-sizing: border-box;\n}\n\n::slotted(a) {\n text-decoration: none;\n}\n\n::slotted(*) {\n color: var(--color-default-text);\n font-family: var(--font-family-sans);\n font-weight: var(--font-rg);\n}\n\n.label {\n display: flex;\n width: 100%;\n align-items: center;\n padding: var(--space-unit) 0;\n border: 0;\n border-bottom: var(--border-size-small) solid var(--color-surface03);\n margin: 0;\n background: transparent;\n border-radius: 0;\n cursor: pointer;\n text-align: left;\n}\n\n:host(:last-child:not([open])) .label {\n border-bottom: none;\n}\n\n:host(:is([active], [open])) .label,\n.label:focus:focus-visible,\n.label:hover {\n border-color: var(--color-secondary01);\n}\n\n.label:focus:focus-visible {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n:host(:is([active], [open])) .label ::slotted(*),\n.label:focus:focus-visible ::slotted(*),\n.label:hover ::slotted(*) {\n font-weight: var(--font-bd);\n}\n\n::slotted([data-text]) {\n display: inline-flex;\n flex-direction: column;\n}\n\n/* Trick to prevent layout shifts on font-weight changes.\nThe trick is to put an hidden copy of the text already set to bold,\nso the needed space is correctly calculated before any hover/active state changes the\nfont-weight of the real text.\nThe hidden text has an height of 0px so it can expand the width without changing the height\nwhen placed below the real text using `flex-direction: column`. */\n::slotted([data-text])::after {\n overflow: hidden;\n height: 0;\n content: attr(data-text);\n content: attr(data-text) / \"\";\n font-weight: var(--font-bd);\n pointer-events: none;\n user-select: none;\n visibility: hidden;\n}\n\n@media speech {\n ::slotted([data-text])::after {\n display: none;\n }\n}\n\n.label ::slotted(*) {\n width: 100%;\n margin: 0;\n font-size: var(--font-size-3);\n line-height: 1.5;\n}\n\n.label z-icon {\n margin-left: calc(var(--space-unit) * 4);\n fill: var(--color-default-icon);\n}\n\n.items {\n display: flex;\n width: 100%;\n flex-direction: column;\n padding: calc(var(--space-unit) / 2);\n padding-bottom: calc(var(--space-unit) * 1.5);\n}\n\n.items[hidden] {\n display: none;\n}\n\n::slotted([slot=\"section\"]) {\n display: inline-flex;\n padding: calc(var(--space-unit) / 2);\n margin: 0;\n font-size: var(--font-size-1);\n line-height: 1.333;\n outline: none;\n}\n\n::slotted([slot=\"section\"]:last-of-type) {\n border: none;\n}\n\n::slotted([slot=\"section\"]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n color: var(--color-secondary01);\n}\n\n::slotted([slot=\"section\"]:hover),\n::slotted([slot=\"section\"]:focus:focus-visible),\n::slotted([slot=\"section\"][active]) {\n color: var(--color-secondary01);\n font-weight: var(--font-bd);\n}\n","import {Component, Element, Event, EventEmitter, Host, Listen, Method, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode} from \"../../beans\";\n\n/**\n * A component to create submenus inside the ZMenu.\n * @slot - Label of the menu section.\n * @slot item - Single entry of the section. Set the same slot name to different items to put many of them. Add the `active` attribute to a slotted item to highlight it.\n */\n@Component({\n tag: \"z-menu-section\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZMenuSection {\n @Element() host: HTMLZMenuSectionElement;\n\n /** Active state */\n @Prop({reflect: true})\n active?: boolean;\n\n /**\n * Tabindex value to set on the label button.\n * Useful to manage keyboard navigation focus with roving tabindex handled by this component's parent (usually ZMenu).\n */\n @Prop()\n htmlTabindex = -1;\n\n /** The opening state of the section. */\n @Prop({mutable: true})\n open: boolean;\n\n @State()\n hasItems: boolean;\n\n @State()\n items: HTMLElement[];\n\n /** The section has been opened. */\n @Event()\n opened: EventEmitter;\n\n /** The section has been closed. */\n @Event()\n closed: EventEmitter;\n\n private label: HTMLButtonElement;\n\n private get focusableItem(): HTMLElement {\n return this.items.find(({tabIndex}) => tabIndex === 0);\n }\n\n private toggle(): void {\n if (!this.hasItems) {\n return;\n }\n\n this.open = !this.open;\n }\n\n private setItemsA11yAttrs(): void {\n if (!this.hasItems) {\n return;\n }\n\n this.items.forEach((item) => {\n item.setAttribute(\"role\", \"menuitem\");\n item.tabIndex = -1;\n });\n }\n\n private onItemsChange(): void {\n this.items = Array.from(this.host.querySelectorAll('[slot=\"section\"]')) as HTMLElement[];\n this.hasItems = this.items.length > 0;\n this.setItemsA11yAttrs();\n }\n\n /**\n * Sets slotted item text as `data-text` attribute value, to let CSS use it through `attr()`.\n * @param ev Slotchange event\n */\n private onLabelSlotChange(ev: Event): void {\n const labelElement = (ev.target as HTMLSlotElement).assignedElements()[0] as HTMLElement;\n labelElement.dataset.text = labelElement?.textContent;\n }\n\n private onLabelClick(): void {\n this.toggle();\n this.setFocus();\n }\n\n private onLabelKeydown(ev: KeyboardEvent): void {\n if (ev.key === KeyboardCode.ENTER || ev.key === KeyboardCode.SPACE) {\n ev.preventDefault();\n ev.stopPropagation();\n this.toggle();\n if (this.open) {\n this.focustFirstItem();\n }\n }\n }\n\n /**\n * Move focus and adjust the tabindex value of `receiver` and `current` elements,\n * setting -1 to the `current` and 0 to the `receiver`, then focus the `receiver` element.\n */\n private moveFocus(receiver: HTMLElement, current?: HTMLElement): void {\n receiver.tabIndex = 0;\n setTimeout(() => {\n receiver.focus();\n }, 100);\n if (current) {\n current.tabIndex = -1;\n }\n }\n\n private focustFirstItem(): void {\n this.moveFocus(this.items[0]);\n }\n\n /** Focus the last item. */\n @Method()\n async focusLastItem(): Promise<void> {\n this.moveFocus(this.items[this.items.length - 1]);\n }\n\n /** Set tabindex of the label to 0, then focus it. */\n @Method()\n async setFocus(): Promise<void> {\n this.htmlTabindex = 0;\n setTimeout(() => {\n this.label.focus();\n }, 100);\n }\n\n @Watch(\"open\")\n onOpenChange(): void {\n if (!this.open) {\n this.setItemsA11yAttrs();\n this.closed.emit();\n } else {\n this.opened.emit();\n }\n }\n\n @Watch(\"htmlTabindex\")\n onTabindexChange(): void {\n this.label.tabIndex = this.htmlTabindex;\n }\n\n @Listen(\"keydown\")\n private onItemsKeydown(ev: KeyboardEvent): void {\n switch (ev.key) {\n case KeyboardCode.ESC:\n case KeyboardCode.ARROW_LEFT:\n if (!this.open) {\n break;\n }\n ev.preventDefault();\n ev.stopPropagation();\n this.moveFocus(this.label, this.focusableItem);\n this.open = false;\n break;\n case KeyboardCode.ARROW_RIGHT:\n if (this.open) {\n break;\n }\n ev.preventDefault();\n ev.stopPropagation();\n this.open = true;\n this.focustFirstItem();\n break;\n case KeyboardCode.ARROW_DOWN: {\n if (!this.open) {\n break;\n }\n if (document.activeElement === this.host) {\n ev.preventDefault();\n ev.stopPropagation();\n this.focustFirstItem();\n break;\n }\n const currentIndex = this.items.indexOf(this.focusableItem);\n const receiver = this.items[currentIndex + 1];\n if (receiver) {\n ev.preventDefault();\n ev.stopPropagation();\n this.moveFocus(receiver, this.focusableItem);\n } else {\n this.htmlTabindex = 0;\n this.focusableItem.tabIndex = -1;\n }\n break;\n }\n case KeyboardCode.ARROW_UP: {\n if (!this.open || document.activeElement === this.host) {\n break;\n }\n const currentIndex = this.items.indexOf(this.focusableItem);\n const receiver = this.items[currentIndex - 1];\n ev.preventDefault();\n ev.stopPropagation();\n if (receiver) {\n this.moveFocus(receiver, this.focusableItem);\n } else {\n // since there isn't a previous item to focus, give the focus to the label element\n this.focusableItem.tabIndex = -1;\n this.setFocus();\n }\n break;\n }\n }\n }\n\n constructor() {\n this.toggle = this.toggle.bind(this);\n this.onItemsChange = this.onItemsChange.bind(this);\n this.onLabelSlotChange = this.onLabelSlotChange.bind(this);\n this.onLabelClick = this.onLabelClick.bind(this);\n this.onLabelKeydown = this.onLabelKeydown.bind(this);\n this.onItemsKeydown = this.onItemsKeydown.bind(this);\n }\n\n connectedCallback(): void {\n this.onItemsChange();\n }\n\n render(): HTMLZMenuSectionElement {\n return (\n <Host open={this.open}>\n <button\n ref={(el) => (this.label = el)}\n class=\"label\"\n aria-haspopup={`${!!this.hasItems}`}\n aria-expanded={`${!!this.open}`}\n role=\"menuitem\"\n tabindex={this.htmlTabindex}\n onClick={this.onLabelClick}\n onKeyDown={this.onLabelKeydown}\n >\n <slot onSlotchange={this.onLabelSlotChange} />\n {this.hasItems && <z-icon name={this.open ? \"chevron-up\" : \"chevron-down\"} />}\n </button>\n <div\n class=\"items\"\n role=\"menu\"\n hidden={!this.open}\n >\n <slot\n name=\"section\"\n onSlotchange={this.onItemsChange}\n />\n </div>\n </Host>\n );\n }\n}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H,KAAK0B,U,CAEP,K,GAKN,WAAAgC,CAAAC,G,iHA5LgB,E,iEA6Ld3D,KAAKI,OAASJ,KAAKI,OAAOwD,KAAK5D,MAC/BA,KAAKW,cAAgBX,KAAKW,cAAciD,KAAK5D,MAC7CA,KAAKiB,kBAAoBjB,KAAKiB,kBAAkB2C,KAAK5D,MACrDA,KAAKyB,aAAezB,KAAKyB,aAAamC,KAAK5D,MAC3CA,KAAK2B,eAAiB3B,KAAK2B,eAAeiC,KAAK5D,MAC/CA,KAAKgD,eAAiBhD,KAAKgD,eAAeY,KAAK5D,K,CAGjD,iBAAA6D,GACE7D,KAAKW,e,CAGP,MAAAmD,GACE,OACEC,EAACC,EAAI,CAAApC,IAAA,2CAACtB,KAAMN,KAAKM,MACfyD,EAAA,UAAAnC,IAAA,2CACEqC,IAAMC,GAAQlE,KAAK0C,MAAQwB,EAC3BC,MAAM,QAAO,gBACE,KAAKnE,KAAKK,WAAU,gBACpB,KAAKL,KAAKM,OACzB8D,KAAK,WACLC,SAAUrE,KAAKyC,aACf6B,QAAStE,KAAKyB,aACd8C,UAAWvE,KAAK2B,gBAEhBoC,EAAA,QAAAnC,IAAA,2CAAM4C,aAAcxE,KAAKiB,oBACxBjB,KAAKK,UAAY0D,EAAA,UAAAnC,IAAA,2CAAQ6C,KAAMzE,KAAKM,KAAO,aAAe,kBAE7DyD,EAAA,OAAAnC,IAAA,2CACEuC,MAAM,QACNC,KAAK,OACLM,QAAS1E,KAAKM,MAEdyD,EAAA,QAAAnC,IAAA,2CACE6C,KAAK,UACLD,aAAcxE,KAAKW,iB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import{r as t,c as e,h as i,a as s,g as o}from"./p-75c4a726.js";import{g as n}from"./p-6037cdf3.js";import{a}from"./p-67e5e8ed.js";import"./p-5145a606.js";const h=':host,::slotted(*),*{box-sizing:border-box;outline:none}:host{position:relative;display:inline-flex;height:fit-content;flex-direction:column}::slotted(a){text-decoration:none}::slotted(*){color:var(--color-default-text);font-family:var(--font-family-sans);font-weight:var(--font-rg)}.menu-label{position:relative;display:flex;width:100%;align-items:center;padding:0;border:0;border-bottom:var(--border-size-large) solid transparent;margin:0;background:transparent;border-radius:0;color:inherit;text-align:left}button.menu-label{cursor:pointer}.menu-label:focus-visible,div.menu-label:focus-within{box-shadow:var(--shadow-focus-primary)}:host(:is([active],[open])) .menu-label ::slotted(*),.menu-label:focus-visible ::slotted(*),div.menu-label:focus-within ::slotted(*){color:var(--color-primary01);font-weight:var(--font-bd)}:host([vertical-context]) .menu-label{padding:var(--space-unit) 0;border-width:var(--border-size-small);border-color:var(--color-surface03)}:host(:is([active],[open])) .menu-label,.menu-label:hover,.menu-label:focus-visible,div.menu-label:focus-within{border-color:var(--color-secondary01)}:host([vertical-context]:is([active],[open])) .menu-label::after,:host([vertical-context]) .menu-label:hover::after,:host([vertical-context]) .menu-label:focus-visible::after,:host([vertical-context]) div.menu-label:focus-within::after{position:absolute;bottom:0;left:0;width:100%;height:var(--border-size-large);background-color:var(--color-secondary01);content:""}:host([vertical-context]) .menu-label ::slotted(*){padding:0}.menu-label ::slotted(*){display:inline-flex;width:100%;min-width:fit-content;padding-bottom:2px;margin:0;appearance:none;color:var(--z-menu-label-color, var(--color-default-text));font-family:var(--font-family-sans);font-size:var(--font-size-3);font-weight:inherit;line-height:1.5}.menu-label z-icon{margin-left:calc(var(--space-unit) * 1.5);fill:var(--color-default-icon)}::slotted([data-text]:not([slot]))::after{height:0;content:attr(data-text);content:attr(data-text) / "";font-weight:var(--font-bd);letter-spacing:normal;pointer-events:none;user-select:none;visibility:hidden}@media speech{::slotted([data-text]:not([slot]))::after{display:none}}::slotted([data-text]:not([slot])){display:inline-flex;flex-direction:column}.content{background:var(--color-surface01)}:host(:not([open])) .content{display:none}:host([floating]:not([vertical-context])) .content{position:absolute;top:100%;left:0;width:375px;min-width:100%;max-width:100vw;padding:0 calc(var(--space-unit) * 2);box-shadow:var(--shadow-2)}:host(:not([floating])) .content{width:100%}.header{display:flex;align-items:center;padding:var(--space-unit) 0 calc(var(--space-unit) * 2)}.header ::slotted(img[slot="header"]){width:calc(var(--space-unit) * 11.25);height:auto;object-fit:contain}.header ::slotted([slot="header"]:not(:first-child)){margin:auto 0;margin-left:calc(var(--space-unit) * 2.5);font-size:var(--font-size-3);font-weight:var(--font-sb);line-height:1.5}.items{display:flex;flex-direction:column;align-items:flex-start;background:inherit}.items>::slotted([slot="item"]){width:100%;margin:0;font-size:var(--font-size-3);line-height:1.5}.items>::slotted([slot="item"]:focus:focus-visible){box-shadow:var(--shadow-focus-primary)}.items>::slotted([slot="item"]:not(z-menu-section)){padding:var(--space-unit) 0;border-bottom:var(--border-size-small) solid var(--color-surface03)}:host(:not([vertical-context])) .items>::slotted([slot="item"]:last-child){border-bottom:0}.items>::slotted([slot="item"]:hover),.items>::slotted([slot="item"]:focus:focus-visible),.items>::slotted([slot="item"]:active){border-color:var(--color-secondary01);font-weight:var(--font-bd)}';const r=h;const l=t=>(t===null||t===void 0?void 0:t.tagName)==="Z-MENU-SECTION";const c=class{get focusableItem(){return this.items.find((t=>l(t)?t.htmlTabindex===0:t.tabIndex===0))}toggle(){if(!this.hasContent){return}this.open=!this.open}onLabelSlotChange(t){const e=t.target.assignedElements()[0];e.dataset.text=e===null||e===void 0?void 0:e.textContent;this.setLabelA11yAttrs()}reflow(t=false){if(this.content&&this.hasContent){const{style:t}=this.content;const{left:e}=this.host.getBoundingClientRect();const i=getComputedStyle(this.content).width;const s=i?parseFloat(i.replace("px","")):375;const o=30;t.left=`${Math.min(window.innerWidth-e-s-o,0)}px`}if(t){this.raf=requestAnimationFrame(this.reflow.bind(this,t))}}checkContent(){this.hasHeader=!!this.host.querySelectorAll("[slot=header]").length;this.hasContent=!!this.host.querySelectorAll("[slot=item]").length||this.hasHeader}setItemsA11yAttrs(){this.items.forEach(((t,e)=>{const i=e===0?0:-1;this.setItemTabindex(t,i);if(!l(t)){t.setAttribute("role","menuitem")}}))}onItemsChange(){this.checkContent();this.items=Array.from(this.host.children).filter((({slot:t})=>t==="item"));this.setItemsA11yAttrs();this.items.forEach((t=>{if(!l(t)){t.dataset.text=t.textContent}}))}setItemTabindex(t,e){if(l(t)){t.htmlTabindex=e}else{t.tabIndex=e}}moveFocus(t,e){if(l(t)){t.setFocus()}else{t.tabIndex=0;setTimeout((()=>{t.focus()}),100)}if(!e){return}this.setItemTabindex(e,-1)}onLabelClick(){this.toggle();this.setFocus()}onLabelKeydown(t){if(t.key===n.ENTER||t.key===n.SPACE){t.preventDefault();t.stopPropagation();this.toggle();if(this.open){this.moveFocus(this.items[0])}return}if(!this.verticalContext){return}if(t.key===n.ARROW_RIGHT&&!this.open){t.preventDefault();t.stopPropagation();this.open=true;this.moveFocus(this.items[0])}}async setFocus(){this.htmlTabindex=0;const t=this.hasContent?this.labelButton:this.host.firstElementChild;t.focus()}async focusLastItem(){const t=this.items[this.items.length-1];if(l(t)&&t.open){t.focusLastItem();return}this.moveFocus(t)}onOpenChanged(){if(!this.open){cancelAnimationFrame(this.raf);this.closed.emit();this.items.forEach((t=>{if(l(t)&&t.open){t.open=false}}));return}this.setItemsA11yAttrs();this.opened.emit();if(this.floating){this.reflow(true)}}setLabelA11yAttrs(){if(this.hasContent&&!this.labelButton){return}if(this.hasContent){this.labelButton.tabIndex=this.htmlTabindex;return}const t=this.host.firstElementChild;t.role="menuitem";t.tabIndex=this.htmlTabindex}onItemClick(t){const e=this.items.find((e=>a(e,t.target)));if(e){this.items.forEach((t=>{if(t===e){return}if(l(t)){t.htmlTabindex=-1}else{t.tabIndex=-1}}))}}onKeyDown(t){var e;if(!this.hasContent){return}switch(t.key){case n.ESC:if(!this.open){break}t.stopPropagation();t.preventDefault();this.open=false;this.setFocus();break;case n.ARROW_DOWN:{if(document.activeElement===this.host){if(this.verticalContext&&!this.open){break}t.stopPropagation();t.preventDefault();if(!this.open){this.open=true}this.moveFocus(this.items[0]);break}const e=this.items.indexOf(this.focusableItem);if(this.verticalContext&&e===this.items.length-1){this.setItemTabindex(this.items[e],-1);this.htmlTabindex=0;break}t.stopPropagation();t.preventDefault();const i=this.items[e+1];this.moveFocus(i!==null&&i!==void 0?i:this.items[0],this.focusableItem);break}case n.ARROW_UP:{if(document.activeElement===this.host){if(this.verticalContext){break}t.stopPropagation();t.preventDefault();if(!this.open){this.open=true}this.moveFocus(this.items[this.items.length-1],this.focusableItem);break}t.stopPropagation();t.preventDefault();const i=this.items.indexOf(this.focusableItem);if(i===0&&this.verticalContext){this.setItemTabindex(this.focusableItem,-1);this.setFocus();break}const s=(e=this.items[i-1])!==null&&e!==void 0?e:this.items[this.items.length-1];if(l(s)&&s.open){this.setItemTabindex(this.focusableItem,-1);s.focusLastItem();break}this.moveFocus(s,this.focusableItem);break}case n.ARROW_LEFT:if(!this.open||!this.verticalContext){break}t.preventDefault();t.stopPropagation();this.open=false;this.setFocus()}}constructor(i){t(this,i);this.opened=e(this,"opened",7);this.closed=e(this,"closed",7);this.active=undefined;this.floating=true;this.open=false;this.verticalContext=false;this.htmlTabindex=-1;this.hasHeader=undefined;this.hasContent=undefined;this.toggle=this.toggle.bind(this);this.checkContent=this.checkContent.bind(this);this.onLabelSlotChange=this.onLabelSlotChange.bind(this);this.onLabelClick=this.onLabelClick.bind(this);this.onItemsChange=this.onItemsChange.bind(this);this.onLabelKeydown=this.onLabelKeydown.bind(this)}connectedCallback(){this.onItemsChange();this.setLabelA11yAttrs()}render(){if(!this.hasContent){return i("div",{class:"menu-label"},i("slot",{onSlotchange:this.onLabelSlotChange}))}return i(s,null,i("button",{ref:t=>this.labelButton=t,class:"menu-label","aria-expanded":`${!!this.open}`,"aria-haspopup":`${this.hasContent}`,"aria-label":this.open?"Chiudi menù":"Apri menù",role:"menuitem",tabIndex:this.htmlTabindex,onClick:this.onLabelClick,onKeyDown:this.onLabelKeydown},i("slot",{onSlotchange:this.onLabelSlotChange}),i("z-icon",{name:this.open?"chevron-up":"chevron-down"})),i("div",{class:"content",ref:t=>this.content=t},this.hasHeader&&i("header",{class:"header"},i("slot",{name:"header",onSlotchange:this.checkContent})),i("div",{class:"items",role:"menu"},i("slot",{name:"item",onSlotchange:this.onItemsChange}))))}get host(){return o(this)}static get watchers(){return{open:["onOpenChanged"],htmlTabindex:["setLabelA11yAttrs"]}}};c.style=r;export{c as z_menu};
2
+ //# sourceMappingURL=p-b6e7866f.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["stylesCss","ZMenuStyle0","isZMenuSection","el","tagName","ZMenu","focusableItem","this","items","find","item","htmlTabindex","tabIndex","toggle","hasContent","open","onLabelSlotChange","ev","labelElement","target","assignedElements","dataset","text","textContent","setLabelA11yAttrs","reflow","live","content","style","left","host","getBoundingClientRect","widthPx","getComputedStyle","width","parseFloat","replace","safeScrollbarSpace","Math","min","window","innerWidth","raf","requestAnimationFrame","bind","checkContent","hasHeader","querySelectorAll","length","setItemsA11yAttrs","forEach","index","tabindex","setItemTabindex","setAttribute","onItemsChange","Array","from","children","filter","slot","moveFocus","receiver","current","setFocus","setTimeout","focus","onLabelClick","onLabelKeydown","key","KeyboardCode","ENTER","SPACE","preventDefault","stopPropagation","verticalContext","ARROW_RIGHT","label","labelButton","firstElementChild","focusLastItem","lastItem","onOpenChanged","cancelAnimationFrame","closed","emit","opened","floating","slottedLabel","role","onItemClick","clickedItem","containsElement","onKeyDown","ESC","ARROW_DOWN","document","activeElement","currentIndex","indexOf","ARROW_UP","_a","ARROW_LEFT","constructor","hostRef","connectedCallback","render","h","class","onSlotchange","Host","ref","onClick","name"],"sources":["src/components/z-menu/styles.css?tag=z-menu&encapsulation=shadow","src/components/z-menu/index.tsx"],"sourcesContent":[":host,\n::slotted(*),\n* {\n box-sizing: border-box;\n outline: none;\n}\n\n:host {\n --z-menu-label-color: ;\n\n position: relative;\n display: inline-flex;\n height: fit-content;\n flex-direction: column;\n}\n\n::slotted(a) {\n text-decoration: none;\n}\n\n::slotted(*) {\n color: var(--color-default-text);\n font-family: var(--font-family-sans);\n font-weight: var(--font-rg);\n}\n\n.menu-label {\n position: relative;\n display: flex;\n width: 100%;\n align-items: center;\n padding: 0;\n border: 0;\n border-bottom: var(--border-size-large) solid transparent;\n margin: 0;\n background: transparent;\n border-radius: 0;\n color: inherit;\n text-align: left;\n}\n\nbutton.menu-label {\n cursor: pointer;\n}\n\n.menu-label:focus-visible,\ndiv.menu-label:focus-within {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host(:is([active], [open])) .menu-label ::slotted(*),\n.menu-label:focus-visible ::slotted(*),\ndiv.menu-label:focus-within ::slotted(*) {\n color: var(--color-primary01);\n font-weight: var(--font-bd);\n}\n\n:host([vertical-context]) .menu-label {\n padding: var(--space-unit) 0;\n border-width: var(--border-size-small);\n border-color: var(--color-surface03);\n}\n\n:host(:is([active], [open])) .menu-label,\n.menu-label:hover,\n.menu-label:focus-visible,\ndiv.menu-label:focus-within {\n border-color: var(--color-secondary01);\n}\n\n:host([vertical-context]:is([active], [open])) .menu-label::after,\n:host([vertical-context]) .menu-label:hover::after,\n:host([vertical-context]) .menu-label:focus-visible::after,\n:host([vertical-context]) div.menu-label:focus-within::after {\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n height: var(--border-size-large);\n background-color: var(--color-secondary01);\n content: \"\";\n}\n\n:host([vertical-context]) .menu-label ::slotted(*) {\n padding: 0;\n}\n\n.menu-label ::slotted(*) {\n display: inline-flex;\n width: 100%;\n min-width: fit-content;\n padding-bottom: 2px;\n margin: 0;\n appearance: none;\n color: var(--z-menu-label-color, var(--color-default-text));\n font-family: var(--font-family-sans);\n font-size: var(--font-size-3);\n font-weight: inherit;\n line-height: 1.5;\n}\n\n.menu-label z-icon {\n margin-left: calc(var(--space-unit) * 1.5);\n fill: var(--color-default-icon);\n}\n\n/* Prevents layout shifts on font-weight changes.\nThe trick is to put an hidden copy of the text already set to bold,\nso the needed space is correctly calculated before any hover/active state changes the\nfont-weight of the real text.\nThe hidden text has an height of 0px so it can expand the width without changing the height\nwhen placed below the real text using `flex-direction: column`. */\n::slotted([data-text]:not([slot]))::after {\n height: 0;\n content: attr(data-text);\n content: attr(data-text) / \"\";\n font-weight: var(--font-bd);\n letter-spacing: normal;\n pointer-events: none;\n user-select: none;\n visibility: hidden;\n}\n\n@media speech {\n ::slotted([data-text]:not([slot]))::after {\n display: none;\n }\n}\n\n::slotted([data-text]:not([slot])) {\n display: inline-flex;\n flex-direction: column;\n}\n\n.content {\n background: var(--color-surface01);\n}\n\n:host(:not([open])) .content {\n display: none;\n}\n\n:host([floating]:not([vertical-context])) .content {\n position: absolute;\n top: 100%;\n left: 0;\n width: 375px;\n min-width: 100%;\n max-width: 100vw;\n padding: 0 calc(var(--space-unit) * 2);\n box-shadow: var(--shadow-2);\n}\n\n:host(:not([floating])) .content {\n width: 100%;\n}\n\n.header {\n display: flex;\n align-items: center;\n padding: var(--space-unit) 0 calc(var(--space-unit) * 2);\n}\n\n.header ::slotted(img[slot=\"header\"]) {\n width: calc(var(--space-unit) * 11.25);\n height: auto;\n object-fit: contain;\n}\n\n.header ::slotted([slot=\"header\"]:not(:first-child)) {\n margin: auto 0;\n margin-left: calc(var(--space-unit) * 2.5);\n font-size: var(--font-size-3);\n font-weight: var(--font-sb);\n line-height: 1.5;\n}\n\n.items {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n background: inherit;\n}\n\n.items > ::slotted([slot=\"item\"]) {\n width: 100%;\n margin: 0;\n font-size: var(--font-size-3);\n line-height: 1.5;\n}\n\n.items > ::slotted([slot=\"item\"]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n}\n\n.items > ::slotted([slot=\"item\"]:not(z-menu-section)) {\n padding: var(--space-unit) 0;\n border-bottom: var(--border-size-small) solid var(--color-surface03);\n}\n\n:host(:not([vertical-context])) .items > ::slotted([slot=\"item\"]:last-child) {\n border-bottom: 0;\n}\n\n.items > ::slotted([slot=\"item\"]:hover),\n.items > ::slotted([slot=\"item\"]:focus:focus-visible),\n.items > ::slotted([slot=\"item\"]:active) {\n border-color: var(--color-secondary01);\n font-weight: var(--font-bd);\n}\n","import {Component, Element, Event, EventEmitter, Host, Listen, Method, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode} from \"../../beans\";\nimport {containsElement} from \"../../utils/utils\";\n\nconst isZMenuSection = (el: HTMLElement | HTMLZMenuSectionElement): el is HTMLZMenuSectionElement =>\n el?.tagName === \"Z-MENU-SECTION\";\n\n/**\n * @slot - Menu label\n * @slot header - Header to display as the first entry of the open menu.\n * @slot item - Single entry of the section. Can be slotted multiple times to insert items onto the menu. Set the `active` HTML attribute on the element to highlight it. Use `z-menu-section` for submenus.\n * @cssprop --z-menu-label-color - Color of the label's text.\n */\n@Component({\n tag: \"z-menu\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZMenu {\n @Element() host: HTMLZMenuElement;\n\n /** Flag to set the active status of the menu. */\n @Prop({reflect: true})\n active?: boolean;\n\n /**\n * Flag to set the display mode of the list.\n * If true, the list will be absolutely positioned under the menu label,\n * stacked beneath it otherwise.\n */\n @Prop({reflect: true})\n floating? = true;\n\n /** The opening state of the menu. */\n @Prop({mutable: true, reflect: true})\n open = false;\n\n /**\n * Tells the component that it's placed in a vertical context with other `ZMenu`s (usually in the ZAppHeader's offcanvas).\n * A small border is placed under it as a separator from other elements.\n */\n @Prop({reflect: true})\n verticalContext = false;\n\n /**\n * Tabindex value to set on the menu label.\n * Useful to manage keyboard navigation focus with roving tabindex handled by this component's parent (usually ZAppHeader).\n */\n @Prop()\n htmlTabindex = -1;\n\n @State()\n hasHeader: boolean;\n\n @State()\n hasContent: boolean;\n\n /** The menu has been opened. */\n @Event()\n opened: EventEmitter;\n\n /** The menu has been closed. */\n @Event()\n closed: EventEmitter;\n\n private labelButton: HTMLButtonElement;\n\n private content: HTMLElement;\n\n private items: (HTMLElement | HTMLZMenuSectionElement)[];\n\n /** Animation frame request id. */\n private raf: number;\n\n private get focusableItem(): HTMLZMenuSectionElement | HTMLElement | null {\n return this.items.find((item) => (isZMenuSection(item) ? item.htmlTabindex === 0 : item.tabIndex === 0));\n }\n\n private toggle(): void {\n if (!this.hasContent) {\n return;\n }\n\n this.open = !this.open;\n }\n\n /**\n * Sets slotted item text as `data-text` attribute value, to let CSS use it through `attr()`.\n * @param ev Slotchange event\n */\n private onLabelSlotChange(ev: Event): void {\n const labelElement = (ev.target as HTMLSlotElement).assignedElements()[0] as HTMLElement;\n labelElement.dataset.text = labelElement?.textContent;\n this.setLabelA11yAttrs();\n }\n\n /**\n * Correctly set position of the floating menu in order to prevent overflow.\n * @param live Should run the method on every refresh frame.\n */\n private reflow(live = false): void {\n if (this.content && this.hasContent) {\n const {style} = this.content;\n const {left} = this.host.getBoundingClientRect();\n const widthPx = getComputedStyle(this.content).width;\n const width = widthPx ? parseFloat(widthPx.replace(\"px\", \"\")) : 375;\n const safeScrollbarSpace = 30;\n style.left = `${Math.min(window.innerWidth - left - width - safeScrollbarSpace, 0)}px`;\n }\n if (live) {\n this.raf = requestAnimationFrame(this.reflow.bind(this, live));\n }\n }\n\n /**\n * Check if some content slot is set.\n */\n private checkContent(): void {\n this.hasHeader = !!this.host.querySelectorAll(\"[slot=header]\").length;\n this.hasContent = !!this.host.querySelectorAll(\"[slot=item]\").length || this.hasHeader;\n }\n\n /**\n * Set `menuitem` role to all menu items (ZMenuSection items already have it).\n * Set -1 to the tabindex of the items and 0 to the first one.\n */\n private setItemsA11yAttrs(): void {\n this.items.forEach((item, index) => {\n const tabindex = index === 0 ? 0 : -1;\n this.setItemTabindex(item, tabindex);\n if (!isZMenuSection(item)) {\n item.setAttribute(\"role\", \"menuitem\");\n }\n });\n }\n\n private onItemsChange(): void {\n this.checkContent();\n this.items = Array.from(this.host.children).filter(({slot}) => slot === \"item\") as HTMLElement[];\n this.setItemsA11yAttrs();\n this.items.forEach((item) => {\n if (!isZMenuSection(item)) {\n item.dataset.text = item.textContent;\n }\n });\n }\n\n private setItemTabindex(item: HTMLElement | HTMLZMenuSectionElement, tabIndex: number): void {\n if (isZMenuSection(item)) {\n item.htmlTabindex = tabIndex;\n } else {\n item.tabIndex = tabIndex;\n }\n }\n\n /**\n * Move focus and adjust the tabindex value of `receiver` and `current` elements,\n * setting -1 to the `current` and 0 to the `receiver`, then focus the `receiver` element.\n * If the receiver is a ZMenuSection and it's open, focus its first focusable item.\n */\n private moveFocus(\n receiver: HTMLElement | HTMLZMenuSectionElement,\n current?: HTMLElement | HTMLZMenuSectionElement\n ): void {\n if (isZMenuSection(receiver)) {\n receiver.setFocus();\n } else {\n receiver.tabIndex = 0;\n setTimeout(() => {\n receiver.focus();\n }, 100);\n }\n if (!current) {\n return;\n }\n\n this.setItemTabindex(current, -1);\n }\n\n private onLabelClick(): void {\n this.toggle();\n this.setFocus();\n }\n\n private onLabelKeydown(ev: KeyboardEvent): void {\n if (ev.key === KeyboardCode.ENTER || ev.key === KeyboardCode.SPACE) {\n ev.preventDefault();\n ev.stopPropagation();\n this.toggle();\n if (this.open) {\n this.moveFocus(this.items[0]);\n }\n\n return;\n }\n\n if (!this.verticalContext) {\n return;\n }\n\n if (ev.key === KeyboardCode.ARROW_RIGHT && !this.open) {\n ev.preventDefault();\n ev.stopPropagation();\n this.open = true;\n this.moveFocus(this.items[0]);\n }\n }\n\n /** Set tabindex of the label to 0, then focus it. */\n @Method()\n async setFocus(): Promise<void> {\n this.htmlTabindex = 0;\n const label = this.hasContent ? this.labelButton : (this.host.firstElementChild as HTMLElement);\n label.focus();\n }\n\n /**\n * Focus the last item.\n */\n @Method()\n async focusLastItem(): Promise<void> {\n const lastItem = this.items[this.items.length - 1];\n if (isZMenuSection(lastItem) && lastItem.open) {\n lastItem.focusLastItem();\n\n return;\n }\n\n this.moveFocus(lastItem);\n }\n\n @Watch(\"open\")\n onOpenChanged(): void {\n if (!this.open) {\n cancelAnimationFrame(this.raf);\n this.closed.emit();\n this.items.forEach((item) => {\n if (isZMenuSection(item) && item.open) {\n item.open = false;\n }\n });\n\n return;\n }\n\n this.setItemsA11yAttrs();\n this.opened.emit();\n if (this.floating) {\n this.reflow(true);\n }\n }\n\n @Watch(\"htmlTabindex\")\n setLabelA11yAttrs(): void {\n if (this.hasContent && !this.labelButton) {\n return;\n }\n\n if (this.hasContent) {\n this.labelButton.tabIndex = this.htmlTabindex;\n\n return;\n }\n\n const slottedLabel = this.host.firstElementChild as HTMLElement;\n slottedLabel.role = \"menuitem\";\n slottedLabel.tabIndex = this.htmlTabindex;\n }\n\n /**\n * Set tabindex to -1 to all siblings of the clicked item.\n */\n @Listen(\"click\", {target: \"document\"})\n onItemClick(ev: MouseEvent): void {\n const clickedItem = this.items.find((item) => containsElement(item, ev.target as HTMLElement));\n if (clickedItem) {\n this.items.forEach((item) => {\n if (item === clickedItem) {\n return;\n }\n\n if (isZMenuSection(item)) {\n item.htmlTabindex = -1;\n } else {\n item.tabIndex = -1;\n }\n });\n }\n }\n\n @Listen(\"keydown\")\n onKeyDown(ev: KeyboardEvent): void {\n if (!this.hasContent) {\n return;\n }\n\n switch (ev.key) {\n case KeyboardCode.ESC:\n if (!this.open) {\n break;\n }\n ev.stopPropagation();\n ev.preventDefault();\n this.open = false;\n this.setFocus();\n break;\n case KeyboardCode.ARROW_DOWN: {\n if (document.activeElement === this.host) {\n if (this.verticalContext && !this.open) {\n break;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n if (!this.open) {\n this.open = true;\n }\n this.moveFocus(this.items[0]);\n break;\n }\n\n const currentIndex = this.items.indexOf(this.focusableItem);\n if (this.verticalContext && currentIndex === this.items.length - 1) {\n // navigation is going to leave this menu. restore tabindex to the label and let the parent handle it\n this.setItemTabindex(this.items[currentIndex], -1);\n this.htmlTabindex = 0;\n break;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n const receiver = this.items[currentIndex + 1];\n // if the last item is already focused, navigate to the first one\n this.moveFocus(receiver ?? this.items[0], this.focusableItem);\n break;\n }\n case KeyboardCode.ARROW_UP: {\n if (document.activeElement === this.host) {\n if (this.verticalContext) {\n break;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n // open the menu and focus the last item\n if (!this.open) {\n this.open = true;\n }\n this.moveFocus(this.items[this.items.length - 1], this.focusableItem);\n break;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n const currentIndex = this.items.indexOf(this.focusableItem);\n if (currentIndex === 0 && this.verticalContext) {\n this.setItemTabindex(this.focusableItem, -1);\n this.setFocus();\n break;\n }\n\n const receiver = this.items[currentIndex - 1] ?? this.items[this.items.length - 1];\n // if the receiver is a ZMenuSection and it's open, focus its last item\n if (isZMenuSection(receiver) && receiver.open) {\n this.setItemTabindex(this.focusableItem, -1);\n receiver.focusLastItem();\n break;\n }\n\n this.moveFocus(receiver, this.focusableItem);\n break;\n }\n case KeyboardCode.ARROW_LEFT:\n if (!this.open || !this.verticalContext) {\n break;\n }\n\n // close the menu and focus the label\n ev.preventDefault();\n ev.stopPropagation();\n this.open = false;\n this.setFocus();\n }\n }\n\n constructor() {\n this.toggle = this.toggle.bind(this);\n this.checkContent = this.checkContent.bind(this);\n this.onLabelSlotChange = this.onLabelSlotChange.bind(this);\n this.onLabelClick = this.onLabelClick.bind(this);\n this.onItemsChange = this.onItemsChange.bind(this);\n this.onLabelKeydown = this.onLabelKeydown.bind(this);\n }\n\n connectedCallback(): void {\n this.onItemsChange();\n this.setLabelA11yAttrs();\n }\n\n render(): HTMLDivElement | HTMLZMenuElement {\n if (!this.hasContent) {\n return (\n <div class=\"menu-label\">\n <slot onSlotchange={this.onLabelSlotChange} />\n </div>\n );\n }\n\n return (\n <Host>\n <button\n ref={(el) => (this.labelButton = el)}\n class=\"menu-label\"\n aria-expanded={`${!!this.open}`}\n aria-haspopup={`${this.hasContent}`}\n aria-label={this.open ? \"Chiudi menù\" : \"Apri menù\"}\n role=\"menuitem\"\n tabIndex={this.htmlTabindex}\n onClick={this.onLabelClick}\n onKeyDown={this.onLabelKeydown}\n >\n <slot onSlotchange={this.onLabelSlotChange} />\n <z-icon name={this.open ? \"chevron-up\" : \"chevron-down\"} />\n </button>\n\n <div\n class=\"content\"\n ref={(el) => (this.content = el)}\n >\n {this.hasHeader && (\n <header class=\"header\">\n <slot\n name=\"header\"\n onSlotchange={this.checkContent}\n />\n </header>\n )}\n\n <div\n class=\"items\"\n role=\"menu\"\n >\n <slot\n name=\"item\"\n onSlotchange={this.onItemsChange}\n />\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"2JAAA,MAAMA,EAAY,qmHAClB,MAAAC,EAAeD,ECGf,MAAME,EAAkBC,IACtBA,IAAE,MAAFA,SAAE,SAAFA,EAAIC,WAAY,iB,MAaLC,EAAK,MAwDhB,iBAAYC,GACV,OAAOC,KAAKC,MAAMC,MAAMC,GAAUR,EAAeQ,GAAQA,EAAKC,eAAiB,EAAID,EAAKE,WAAa,G,CAG/F,MAAAC,GACN,IAAKN,KAAKO,WAAY,CACpB,M,CAGFP,KAAKQ,MAAQR,KAAKQ,I,CAOZ,iBAAAC,CAAkBC,GACxB,MAAMC,EAAgBD,EAAGE,OAA2BC,mBAAmB,GACvEF,EAAaG,QAAQC,KAAOJ,IAAY,MAAZA,SAAY,SAAZA,EAAcK,YAC1ChB,KAAKiB,mB,CAOC,MAAAC,CAAOC,EAAO,OACpB,GAAInB,KAAKoB,SAAWpB,KAAKO,WAAY,CACnC,MAAMc,MAACA,GAASrB,KAAKoB,QACrB,MAAME,KAACA,GAAQtB,KAAKuB,KAAKC,wBACzB,MAAMC,EAAUC,iBAAiB1B,KAAKoB,SAASO,MAC/C,MAAMA,EAAQF,EAAUG,WAAWH,EAAQI,QAAQ,KAAM,KAAO,IAChE,MAAMC,EAAqB,GAC3BT,EAAMC,KAAO,GAAGS,KAAKC,IAAIC,OAAOC,WAAaZ,EAAOK,EAAQG,EAAoB,M,CAElF,GAAIX,EAAM,CACRnB,KAAKmC,IAAMC,sBAAsBpC,KAAKkB,OAAOmB,KAAKrC,KAAMmB,G,EAOpD,YAAAmB,GACNtC,KAAKuC,YAAcvC,KAAKuB,KAAKiB,iBAAiB,iBAAiBC,OAC/DzC,KAAKO,aAAeP,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