@zanichelli/zanichelli-it-frontend-kit 1.0.0 → 1.0.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 (102) hide show
  1. package/dist/cjs/index-xkrZykI_.js +1532 -0
  2. package/dist/cjs/index-xkrZykI_.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +5 -0
  4. package/dist/cjs/index.cjs.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +15 -0
  6. package/dist/cjs/loader.cjs.js.map +1 -0
  7. package/dist/cjs/zanichelli-it-frontend-kit.cjs.js +27 -0
  8. package/dist/cjs/zanichelli-it-frontend-kit.cjs.js.map +1 -0
  9. package/dist/cjs/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.cjs.js.map +1 -0
  10. package/dist/cjs/zanit-menubar_3.cjs.entry.js +676 -0
  11. package/dist/cjs/zanit-menubar_3.cjs.entry.js.map +1 -0
  12. package/dist/collection/collection-manifest.json +14 -0
  13. package/dist/collection/components/menubar/menu/menu.css +98 -0
  14. package/dist/collection/components/menubar/menu/menu.js +38 -0
  15. package/dist/collection/components/menubar/menu/menu.js.map +1 -0
  16. package/dist/collection/components/menubar/menubar.css +167 -0
  17. package/{www/build/zanit-menubar.entry.js → dist/collection/components/menubar/menubar.js} +157 -25
  18. package/dist/collection/components/menubar/menubar.js.map +1 -0
  19. package/dist/collection/components/menubar/mobile-menubar/mobile-menubar.css +114 -0
  20. package/{www/build/zanit-mobile-menubar.entry.js → dist/collection/components/menubar/mobile-menubar/mobile-menubar.js} +149 -25
  21. package/dist/collection/components/menubar/mobile-menubar/mobile-menubar.js.map +1 -0
  22. package/dist/collection/components/menubar/search-form/search-form.css +147 -0
  23. package/{www/build/zanit-search-form.entry.js → dist/collection/components/menubar/search-form/search-form.js} +98 -22
  24. package/dist/collection/components/menubar/search-form/search-form.js.map +1 -0
  25. package/dist/collection/index.js +11 -0
  26. package/dist/collection/index.js.map +1 -0
  27. package/dist/collection/utils/types.js +2 -0
  28. package/dist/collection/utils/types.js.map +1 -0
  29. package/dist/{zanichelli-it-frontend-kit/utils-CaxAWyZI.js → collection/utils/utils.js} +3 -7
  30. package/dist/collection/utils/utils.js.map +1 -0
  31. package/dist/components/index.js +1290 -0
  32. package/dist/components/index.js.map +1 -0
  33. package/dist/{zanichelli-it-frontend-kit/zanit-mobile-menubar.entry.js → components/p-CQEWv_Pv.js} +87 -14
  34. package/dist/components/p-CQEWv_Pv.js.map +1 -0
  35. package/dist/{zanichelli-it-frontend-kit/zanit-search-form.entry.js → components/p-CiHl-h3q.js} +52 -13
  36. package/dist/components/p-CiHl-h3q.js.map +1 -0
  37. package/dist/{zanichelli-it-frontend-kit/zanit-menubar.entry.js → components/zanit-menubar.js} +56 -13
  38. package/dist/components/zanit-menubar.js.map +1 -0
  39. package/dist/components/zanit-mobile-menubar.js +9 -0
  40. package/dist/components/zanit-mobile-menubar.js.map +1 -0
  41. package/dist/components/zanit-search-form.js +9 -0
  42. package/dist/components/zanit-search-form.js.map +1 -0
  43. package/dist/esm/index-BWVQ0LD4.js +1504 -0
  44. package/dist/esm/index-BWVQ0LD4.js.map +1 -0
  45. package/dist/esm/index.js +4 -0
  46. package/dist/esm/index.js.map +1 -0
  47. package/dist/esm/loader.js +13 -0
  48. package/dist/esm/loader.js.map +1 -0
  49. package/dist/esm/zanichelli-it-frontend-kit.js +23 -0
  50. package/dist/esm/zanichelli-it-frontend-kit.js.map +1 -0
  51. package/dist/esm/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.js.map +1 -0
  52. package/dist/esm/zanit-menubar_3.entry.js +672 -0
  53. package/dist/esm/zanit-menubar_3.entry.js.map +1 -0
  54. package/dist/index.cjs.js +1 -0
  55. package/dist/index.js +1 -0
  56. package/dist/zanichelli-it-frontend-kit/index.esm.js +0 -10
  57. package/dist/zanichelli-it-frontend-kit/index.esm.js.map +1 -1
  58. package/dist/zanichelli-it-frontend-kit/p-BWVQ0LD4.js +3 -0
  59. package/dist/zanichelli-it-frontend-kit/p-BWVQ0LD4.js.map +1 -0
  60. package/dist/zanichelli-it-frontend-kit/p-b6c74a1e.entry.js +2 -0
  61. package/dist/zanichelli-it-frontend-kit/p-b6c74a1e.entry.js.map +1 -0
  62. package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.css +1 -993
  63. package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.esm.js +1 -49
  64. package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.esm.js.map +1 -1
  65. package/dist/zanichelli-it-frontend-kit/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.esm.js.map +1 -0
  66. package/package.json +1 -1
  67. package/www/build/index.esm.js +0 -10
  68. package/www/build/index.esm.js.map +1 -1
  69. package/www/build/p-984b8fa6.css +1 -0
  70. package/www/build/p-BWVQ0LD4.js +3 -0
  71. package/www/build/p-BWVQ0LD4.js.map +1 -0
  72. package/www/build/p-b6c74a1e.entry.js +2 -0
  73. package/www/build/p-b6c74a1e.entry.js.map +1 -0
  74. package/www/build/p-d36eb550.js +2 -0
  75. package/www/build/zanichelli-it-frontend-kit.css +1 -993
  76. package/www/build/zanichelli-it-frontend-kit.esm.js +1 -49
  77. package/www/build/zanichelli-it-frontend-kit.esm.js.map +1 -1
  78. package/www/build/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.esm.js.map +1 -0
  79. package/www/index.html +2 -11
  80. package/dist/zanichelli-it-frontend-kit/index-Cn3aX5eK.js +0 -4170
  81. package/dist/zanichelli-it-frontend-kit/index-Cn3aX5eK.js.map +0 -1
  82. package/dist/zanichelli-it-frontend-kit/menu-DZlhu_pe.js +0 -46
  83. package/dist/zanichelli-it-frontend-kit/menu-DZlhu_pe.js.map +0 -1
  84. package/dist/zanichelli-it-frontend-kit/utils-CaxAWyZI.js.map +0 -1
  85. package/dist/zanichelli-it-frontend-kit/zanit-menubar.entry.esm.js.map +0 -1
  86. package/dist/zanichelli-it-frontend-kit/zanit-menubar.entry.js.map +0 -1
  87. package/dist/zanichelli-it-frontend-kit/zanit-mobile-menubar.entry.esm.js.map +0 -1
  88. package/dist/zanichelli-it-frontend-kit/zanit-mobile-menubar.entry.js.map +0 -1
  89. package/dist/zanichelli-it-frontend-kit/zanit-search-form.entry.esm.js.map +0 -1
  90. package/dist/zanichelli-it-frontend-kit/zanit-search-form.entry.js.map +0 -1
  91. package/www/build/index-Cn3aX5eK.js +0 -4170
  92. package/www/build/index-Cn3aX5eK.js.map +0 -1
  93. package/www/build/menu-DZlhu_pe.js +0 -46
  94. package/www/build/menu-DZlhu_pe.js.map +0 -1
  95. package/www/build/utils-CaxAWyZI.js +0 -21
  96. package/www/build/utils-CaxAWyZI.js.map +0 -1
  97. package/www/build/zanit-menubar.entry.esm.js.map +0 -1
  98. package/www/build/zanit-menubar.entry.js.map +0 -1
  99. package/www/build/zanit-mobile-menubar.entry.esm.js.map +0 -1
  100. package/www/build/zanit-mobile-menubar.entry.js.map +0 -1
  101. package/www/build/zanit-search-form.entry.esm.js.map +0 -1
  102. package/www/build/zanit-search-form.entry.js.map +0 -1
@@ -1,16 +1,13 @@
1
- import { r as registerInstance, a as getElement, h, F as Fragment } from './index-Cn3aX5eK.js';
2
- import { c as containsTarget, m as moveFocus } from './utils-CaxAWyZI.js';
3
- import { M as Menu } from './menu-DZlhu_pe.js';
4
-
5
- const menubarCss = ":host{position:relative;z-index:2;display:flex;width:100%;background-color:#fff;color:var(--gray900);font-family:var(--font-family-sans)}:host,*,::before,::after{box-sizing:border-box}*:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}ul{padding:0;margin:0;list-style:none}a{color:var(--gray900);cursor:pointer;text-decoration:none}button{all:unset;cursor:pointer}:host nav{width:100%}.shadow-wrapper{position:relative;z-index:1;display:flex;width:100%}.shadow-wrapper::after{position:absolute;top:0;right:0;width:100%;height:100%;background:transparent;box-shadow:var(--shadow-1);content:'';pointer-events:none}.width-limiter{position:relative;display:flex;width:100%;max-width:var(--zanit-menubar-max-width, 1366px);margin:0 auto}.shadow-wrapper+.shadow-wrapper{z-index:0}.sub-menubar>ul{gap:28px}.width-limiter>ul,.sub-menubar>ul{position:relative;display:flex;width:100%;align-items:center;padding:0 var(--grid-margin);margin-right:auto;margin-left:auto;gap:20px}.shadow-wrapper>.width-limiter,.shadow-wrapper>ul{width:100%;max-width:var(--zanit-menubar-max-width, 1366px)}ul.menubar{padding-right:0}.menubar z-ghost-loading{display:block;width:120px;height:1.25rem}.menubar>li[role='separator']{width:1px;height:1.25rem;background-color:#000}.menubar-item{position:relative;display:flex;align-items:center;padding:14px 0;font-size:1rem;gap:8px;line-height:1.25rem}.menubar .menubar-item{text-transform:uppercase}.menubar-item [data-text]{display:flex;flex-direction:column}.menubar-item.active>[data-text],.menubar-item:hover>[data-text],.menubar-item:focus:focus-visible>[data-text]{font-weight:var(--font-bd)}.menubar-item>[data-text]::after{height:0;content:attr(data-text) / '';font-weight:var(--font-bd);letter-spacing:normal;pointer-events:none;user-select:none;visibility:hidden}.sub-menubar .menubar-item.active::after{position:absolute;z-index:-1;bottom:0;left:-4px;width:calc(100% + 8px);height:4px;background-color:var(--red500);content:''}zanit-search-form{margin-left:auto}";
6
-
7
- const menuCss = ".menu-wrapper{width:100%;background-color:#fff}.menu{position:relative;display:flex;width:100%;flex-direction:column;gap:32px 0}.menu .group{display:flex;flex-direction:column}.menu .group .group-name{border-bottom:1px solid currentcolor;margin-bottom:4px;color:var(--red500);font-size:0.875rem;font-weight:var(--font-rg)}.menu .group .menu-list{display:flex;flex-direction:column;gap:4px}.menu .group .menu-list .menu-item{border-bottom:2px solid transparent;font-size:0.875rem;font-weight:var(--font-md)}.menu .menu-list .menu-item.active,.menu .menu-list .menu-item:hover{border-bottom-color:var(--red500)}.menu .group.highlight .menu-list .menu-item{font-size:1rem}@media (width >= 768px){.menu-wrapper{position:absolute;top:100%;left:0;display:flex;justify-content:center;box-shadow:var(--shadow-1)}.menu{display:grid;width:100%;max-width:var(--zanit-menubar-max-width, 1366px);padding:16px var(--grid-margin);gap:0 24px;grid-auto-columns:minmax(0, max-content);grid-auto-flow:column;grid-template-rows:minmax(0, max-content) max-content}.menu .group{display:grid;grid-row:1 / -1;grid-template-columns:1fr;grid-template-rows:subgrid}@supports not (grid-template-rows: subgrid){.menu .group{grid-template-rows:repeat(auto-fit, minmax(0, max-content))}}.menu .group .group-name{border:none;margin-bottom:16px}.menu .group .menu-list .menu-item{font-size:1rem}.menu .group.highlight .menu-list .menu-item{font-size:1.5rem}.menu .group.highlight .menu-list{gap:24px}}";
8
-
9
- const ZanitMenubar = class {
10
- constructor(hostRef) {
11
- registerInstance(this, hostRef);
12
- }
13
- get host() { return getElement(this); }
1
+ import { Fragment, h } from "@stencil/core";
2
+ import { containsTarget, moveFocus } from "../../utils/utils";
3
+ import { Menu } from "./menu/menu";
4
+ /**
5
+ * Main menubar component. Each item can have a menu with subitems
6
+ * When a main menubar item is the current active one, a sub-menubar is shown and each subitem can have a menu with subitems.
7
+ * @cssprop {--zanit-menubar-max-width} Maximum width of the menubar.
8
+ */
9
+ export class ZanitMenubar {
10
+ host;
14
11
  /** Menubar items extracted from `data`. */
15
12
  items = [];
16
13
  /** ID of the currently open menu. */
@@ -363,15 +360,150 @@ const ZanitMenubar = class {
363
360
  'active': this.isActive(subitem),
364
361
  }, href: subitem.href, id: subitem.id, role: "menuitem", tabIndex: -1, "aria-haspopup": subitem.menuItems?.length ? 'true' : 'false', "aria-expanded": subitem.menuItems?.length ? (this.openMenu === subitem.id ? 'true' : 'false') : undefined, "aria-current": this.current.includes(subitem.id) ? 'page' : 'false', onPointerOver: () => this.showMenu(subitem), onKeyDown: (event) => this.handleItemKeydown(event, subitem), target: item.target }, h("span", null, subitem.label), subitem.menuItems?.length > 0 && (h("z-icon", { name: this.openMenu === subitem.id ? 'chevron-up' : 'chevron-down', width: "0.75rem", height: "0.75rem" })))))))), item.navbarItems.map((subitem) => this.openMenu === subitem.id && (h(Menu, { controlledBy: subitem.id, items: subitem.menuItems, currentPath: this.currentPath, onItemKeyDown: (event) => this.handleMenuKeydown(event) }))))))));
365
362
  }
366
- static get watchers() { return {
367
- "data": ["parseData"],
368
- "items": ["onItemsChange"],
369
- "current": ["onCurrentChange"]
370
- }; }
371
- };
372
- ZanitMenubar.style = menubarCss + menuCss;
373
-
374
- export { ZanitMenubar as zanit_menubar };
375
- //# sourceMappingURL=zanit-menubar.entry.esm.js.map
376
-
377
- //# sourceMappingURL=zanit-menubar.entry.js.map
363
+ static get is() { return "zanit-menubar"; }
364
+ static get encapsulation() { return "shadow"; }
365
+ static get originalStyleUrls() {
366
+ return {
367
+ "$": ["menubar.css", "menu/menu.css"]
368
+ };
369
+ }
370
+ static get styleUrls() {
371
+ return {
372
+ "$": ["menubar.css", "menu/menu.css"]
373
+ };
374
+ }
375
+ static get properties() {
376
+ return {
377
+ "data": {
378
+ "type": "string",
379
+ "attribute": "data",
380
+ "mutable": false,
381
+ "complexType": {
382
+ "original": "Promise<MenubarItem[]> | MenubarItem[] | URL | string",
383
+ "resolved": "MenubarItem[] | Promise<MenubarItem[]> | URL | string",
384
+ "references": {
385
+ "Promise": {
386
+ "location": "global",
387
+ "id": "global::Promise"
388
+ },
389
+ "MenubarItem": {
390
+ "location": "import",
391
+ "path": "../../utils/types",
392
+ "id": "src/utils/types.ts::MenubarItem"
393
+ },
394
+ "URL": {
395
+ "location": "global",
396
+ "id": "global::URL"
397
+ }
398
+ }
399
+ },
400
+ "required": false,
401
+ "optional": false,
402
+ "docs": {
403
+ "tags": [],
404
+ "text": "The data to build the menu (as an array of `MenubarItem` or a JSON array) or the url to fetch to retrieve it."
405
+ },
406
+ "getter": false,
407
+ "setter": false,
408
+ "reflect": false
409
+ },
410
+ "current": {
411
+ "type": "string",
412
+ "attribute": "current",
413
+ "mutable": false,
414
+ "complexType": {
415
+ "original": "string | undefined",
416
+ "resolved": "string",
417
+ "references": {}
418
+ },
419
+ "required": false,
420
+ "optional": false,
421
+ "docs": {
422
+ "tags": [],
423
+ "text": "Path of the current item."
424
+ },
425
+ "getter": false,
426
+ "setter": false,
427
+ "reflect": false,
428
+ "defaultValue": "undefined"
429
+ },
430
+ "searchQuery": {
431
+ "type": "string",
432
+ "attribute": "search-query",
433
+ "mutable": true,
434
+ "complexType": {
435
+ "original": "string | undefined",
436
+ "resolved": "string",
437
+ "references": {}
438
+ },
439
+ "required": false,
440
+ "optional": false,
441
+ "docs": {
442
+ "tags": [],
443
+ "text": "Initial search query."
444
+ },
445
+ "getter": false,
446
+ "setter": false,
447
+ "reflect": false,
448
+ "defaultValue": "undefined"
449
+ }
450
+ };
451
+ }
452
+ static get states() {
453
+ return {
454
+ "items": {},
455
+ "openMenu": {},
456
+ "openNavbar": {},
457
+ "currentPath": {},
458
+ "isMobile": {},
459
+ "loading": {}
460
+ };
461
+ }
462
+ static get elementRef() { return "host"; }
463
+ static get watchers() {
464
+ return [{
465
+ "propName": "data",
466
+ "methodName": "parseData"
467
+ }, {
468
+ "propName": "items",
469
+ "methodName": "onItemsChange"
470
+ }, {
471
+ "propName": "current",
472
+ "methodName": "onCurrentChange"
473
+ }];
474
+ }
475
+ static get listeners() {
476
+ return [{
477
+ "name": "click",
478
+ "method": "handleOutsideClick",
479
+ "target": "document",
480
+ "capture": false,
481
+ "passive": true
482
+ }, {
483
+ "name": "keydown",
484
+ "method": "handleKeydown",
485
+ "target": undefined,
486
+ "capture": false,
487
+ "passive": true
488
+ }, {
489
+ "name": "mouseover",
490
+ "method": "handleMouseover",
491
+ "target": undefined,
492
+ "capture": false,
493
+ "passive": true
494
+ }, {
495
+ "name": "mouseout",
496
+ "method": "handleMouseout",
497
+ "target": undefined,
498
+ "capture": false,
499
+ "passive": true
500
+ }, {
501
+ "name": "focusout",
502
+ "method": "handleFocusout",
503
+ "target": undefined,
504
+ "capture": false,
505
+ "passive": true
506
+ }];
507
+ }
508
+ }
509
+ //# sourceMappingURL=menubar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menubar.js","sourceRoot":"","sources":["../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AO,EAClE,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAC3C,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,EAC5D,MAAM,EAAE,IAAI,CAAC,MAAM;4BAEnB,gBAAO,OAAO,CAAC,KAAK,CAAQ;4BAC3B,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,CAAC,IAAI,CAChC,cACE,IAAI,EAAE,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,EAClE,KAAK,EAAC,SAAS,EACf,MAAM,EAAC,SAAS,GAChB,CACH,CACC,CACD,CACI,CACZ,CAAC,CACC;gBACJ,IAAI,CAAC,WAAW,CAAC,GAAG,CACnB,CAAC,OAAO,EAAE,EAAE,CACV,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,EAAE,IAAI,CAC9B,EAAC,IAAI,IACH,YAAY,EAAE,OAAO,CAAC,EAAE,EACxB,KAAK,EAAE,OAAO,CAAC,SAAS,EACxB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,GACvD,CACH,CACJ,CACG,CACP,CACJ,CACC,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Fragment, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { MenubarItem } from '../../utils/types';\nimport { containsTarget, moveFocus } from '../../utils/utils';\nimport { Menu } from './menu/menu';\n\n/**\n * Main menubar component. Each item can have a menu with subitems\n * When a main menubar item is the current active one, a sub-menubar is shown and each subitem can have a menu with subitems.\n * @cssprop {--zanit-menubar-max-width} Maximum width of the menubar.\n */\n@Component({\n tag: 'zanit-menubar',\n styleUrls: ['menubar.css', 'menu/menu.css'],\n shadow: true,\n})\nexport class ZanitMenubar {\n @Element() host: HTMLZanitMenubarElement;\n\n /** Menubar items extracted from `data`. */\n @State()\n items: MenubarItem[] = [];\n\n /** ID of the currently open menu. */\n @State()\n openMenu: string | undefined = undefined;\n\n /** ID of the item to show the subitems navbar for. */\n @State()\n openNavbar: string | undefined = undefined;\n\n /** IDs of the current prop */\n @State()\n currentPath: string[] = [];\n\n @State()\n isMobile: boolean = false;\n\n @State()\n loading: boolean = false;\n\n /** The data to build the menu (as an array of `MenubarItem` or a JSON array) or the url to fetch to retrieve it. */\n @Prop()\n data: Promise<MenubarItem[]> | MenubarItem[] | URL | string;\n\n /** Path of the current item. */\n @Prop()\n current: string | undefined = undefined;\n\n /** Initial search query. */\n @Prop({ mutable: true })\n searchQuery: string | undefined = undefined;\n\n private timerId: number;\n\n /** Setup the list of items. */\n @Watch('data')\n async parseData(data: typeof this.data) {\n if (!data) {\n return;\n }\n\n if (data instanceof URL) {\n this.items = await this.fetchData(data);\n } else if (data instanceof Promise) {\n this.loading = true;\n this.items = await data;\n this.loading = false;\n } else if (typeof data === 'string') {\n try {\n this.items = JSON.parse(data);\n if (!Array.isArray(this.items) || !this.items?.every((item) => item satisfies MenubarItem)) {\n throw new Error('Expected an array of MenubarItem objects.');\n }\n } catch {\n let url: URL;\n try {\n url = new URL(data);\n } catch {\n throw new Error('Invalid string provided for `data` property: not a valid url or JSON.');\n }\n\n this.items = await this.fetchData(url);\n }\n } else if (Array.isArray(data) && data.every((item) => item satisfies MenubarItem)) {\n this.items = data;\n } else {\n throw new Error(\n 'Invalid `data` property value. Expected an url, a JSON or an array/promise of MenubarItem objects.'\n );\n }\n }\n\n @Watch('items')\n onItemsChange() {\n this.initTabindex();\n }\n\n @Watch('current')\n onCurrentChange() {\n this.currentPath = this.current?.split('/').filter(Boolean) || [];\n }\n\n async connectedCallback() {\n const mobileMediaQuery = window.matchMedia('(width < 768px)');\n this.isMobile = mobileMediaQuery.matches;\n mobileMediaQuery.onchange = (mql) => {\n this.isMobile = mql.matches;\n this.initTabindex();\n this.openMenu = undefined;\n };\n await this.parseData(this.data);\n this.onCurrentChange();\n this.initTabindex();\n }\n\n /** Close any open menu when clicking outside. */\n @Listen('click', { target: 'document', passive: true })\n handleOutsideClick(event: MouseEvent) {\n if (!this.openMenu || containsTarget(this.host, event)) {\n return;\n }\n\n this.openMenu = undefined;\n }\n\n /** Close any open menu when pressing Escape or Tab. */\n @Listen('keydown', { passive: true })\n handleKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'Escape':\n case 'Tab':\n this.openMenu = undefined;\n break;\n }\n }\n\n @Listen('mouseover', { passive: true })\n handleMouseover() {\n clearTimeout(this.timerId);\n }\n\n /**\n * Automatically close any open menu on mouseout after with a little delay.\n * The delay is useful to avoid immediate closing when the pointer briefly leaves the component.\n */\n @Listen('mouseout', { passive: true })\n handleMouseout(event: MouseEvent) {\n this.timerId = window.setTimeout(() => {\n if (!this.openMenu || containsTarget(this.host, event)) {\n return;\n }\n\n this.openMenu = undefined;\n }, 500);\n }\n\n /** Close the menu when it loses focus. */\n @Listen('focusout', { passive: true })\n handleFocusout(event: FocusEvent) {\n const relatedTarget = event.relatedTarget as HTMLElement;\n if (!this.openMenu || this.host.shadowRoot.querySelector('.menu')?.contains(relatedTarget)) {\n return;\n }\n\n this.openMenu = undefined;\n }\n\n /** Fetch data from passed URL. */\n private async fetchData(url: URL) {\n try {\n this.loading = true;\n const data = await (await fetch(url)).json();\n this.loading = false;\n if (!Array.isArray(data) || !data.every((item) => item satisfies MenubarItem)) {\n throw new Error('Invalid data structure. Expected an array of MenuItem objects.');\n }\n\n return data as MenubarItem[];\n } catch (error) {\n this.loading = false;\n console.error('Error fetching menubar data:', error);\n throw new Error('Failed to fetch menubar data from the provided URL.', { cause: error });\n }\n }\n\n /** Initialize tabindex on menuitems of menubars, setting -1 to all but the first one. */\n private initTabindex() {\n setTimeout(() => {\n this.host.shadowRoot.querySelectorAll('[role=\"menubar\"]')?.forEach((menubar) => {\n menubar\n .querySelectorAll('[role=\"menuitem\"]')\n ?.forEach((item, index) => item.setAttribute('tabindex', index === 0 ? '0' : '-1'));\n });\n }, 100);\n }\n\n /** Indicates whether the element has to be highlighted by checking whether it is set as current or one of its descendants is. */\n private isActive(item: MenubarItem) {\n if (this.currentPath.length === 0) {\n return false;\n }\n\n if (this.currentPath.includes(item.id)) {\n return true;\n }\n\n if (item.menuItems?.length) {\n return item.menuItems.some((menuItem) => menuItem.id === this.current);\n }\n\n if (item.navbarItems?.length) {\n const isActive = item.navbarItems.some((navbarItem) => this.isActive(navbarItem));\n if (isActive) {\n return true;\n }\n }\n\n return false;\n }\n\n /** Opens the menu associated with the menubar `item`, if any. */\n private showMenu(item: MenubarItem) {\n this.openMenu = undefined; // close any open menu first\n if (!item.menuItems?.length) {\n return;\n }\n\n this.openMenu = item.id;\n }\n\n /** Get all elements with `menuitem` role inside parent's `menubar`. * */\n private getParentMenubarElements(itemEl: HTMLElement) {\n return Array.from(\n itemEl?.closest('[role=\"menubar\"]')?.querySelectorAll(':scope > li a[role=\"menuitem\"]') ?? []\n ) as HTMLElement[];\n }\n\n /** Move the focus to the previous menubar item, or the last one. Then open its menu if any other menu was open. */\n private focusPreviousItem(itemEl: HTMLElement) {\n this.openMenu = undefined; // close any open menu first\n const menubarElements = this.getParentMenubarElements(itemEl);\n itemEl.tabIndex = -1;\n const currentIndex = menubarElements.indexOf(itemEl);\n const prevItem = menubarElements[(currentIndex - 1 + menubarElements.length) % menubarElements.length]; // get previous item or last one\n prevItem.tabIndex = 0;\n prevItem.focus();\n // open the item's menu if any other menu was open\n if (prevItem.ariaHasPopup === 'true' && this.openMenu) {\n this.openMenu = prevItem.id;\n }\n }\n\n /** Move the focus to the next menubar item, or the first one. Then open its menu if any other menu was open. */\n private focusNextItem(itemEl: HTMLElement) {\n this.openMenu = undefined; // close any open menu first\n const menubarElements = this.getParentMenubarElements(itemEl);\n itemEl.tabIndex = -1;\n const currentIndex = menubarElements.indexOf(itemEl);\n const nextItem = menubarElements[(currentIndex + 1) % menubarElements.length]; // get next item or first one\n nextItem.tabIndex = 0;\n nextItem.focus();\n // open the item's menu if any other menu was open\n if (nextItem.ariaHasPopup === 'true' && this.openMenu) {\n this.openMenu = nextItem.id;\n }\n }\n\n /** Handles keyboard navigation on menubar items. */\n private handleItemKeydown(event: KeyboardEvent, item: MenubarItem) {\n const target = event.target as HTMLElement;\n switch (event.key) {\n case 'Home': {\n event.preventDefault();\n event.stopPropagation();\n const firstItem = this.getParentMenubarElements(target)[0];\n moveFocus(target, firstItem);\n break;\n }\n case 'End': {\n event.preventDefault();\n event.stopPropagation();\n const lastItem = this.getParentMenubarElements(target).pop();\n moveFocus(target, lastItem);\n break;\n }\n case 'ArrowUp': {\n if (!item.menuItems?.length) {\n break;\n }\n event.preventDefault();\n event.stopPropagation();\n this.openMenu = item.id;\n // focus last item of the menu\n setTimeout(() => {\n const menuItems = Array.from(\n this.host.shadowRoot.querySelectorAll(`[aria-labelledby=${item.id}] [role=\"menuitem\"]`)\n ) as HTMLElement[];\n moveFocus(target, menuItems[menuItems.length - 1]);\n }, 100);\n break;\n }\n case 'ArrowRight': {\n event.preventDefault();\n event.stopPropagation();\n this.focusNextItem(target);\n break;\n }\n case 'ArrowDown': {\n if (!item.menuItems?.length) {\n break;\n }\n this.openMenu = item.id;\n setTimeout(() => {\n // focus first item of the menu\n const firsMenuItem = this.host.shadowRoot.querySelector(\n `[aria-labelledby=${item.id}] [role=\"menuitem\"]`\n ) as HTMLElement;\n firsMenuItem.tabIndex = 0;\n firsMenuItem.focus();\n }, 100);\n break;\n }\n case 'ArrowLeft': {\n event.preventDefault();\n event.stopPropagation();\n this.focusPreviousItem(target);\n break;\n }\n }\n }\n\n /** Get the previous element with `role=group`. */\n private getPreviousGroup(groupContainer: HTMLElement) {\n const groups = Array.from(\n groupContainer?.closest('[role=\"menu\"]')?.querySelectorAll('[role=\"group\"]') ?? []\n ) as HTMLElement[];\n const currentIndex = groups.indexOf(groupContainer);\n\n return groups[currentIndex - 1];\n }\n\n /** Get the next element with `role=group`. */\n private getNextGroup(groupContainer: HTMLElement) {\n const groups = Array.from(\n groupContainer?.closest('[role=\"menu\"]')?.querySelectorAll('[role=\"group\"]') ?? []\n ) as HTMLElement[];\n const currentIndex = groups.indexOf(groupContainer);\n\n return groups[currentIndex + 1];\n }\n\n /** Handles keyboard navigation events from `Menu` component. */\n private handleMenuKeydown(event: KeyboardEvent) {\n const itemElement = event.target as HTMLElement;\n const items = Array.from(\n itemElement.closest('[role=\"menu\"]')?.querySelectorAll('[role=\"menuitem\"]') ?? []\n ) as HTMLElement[];\n const currentIndex = items.indexOf(itemElement);\n switch (event.key) {\n case 'ArrowUp': {\n event.preventDefault();\n event.stopPropagation();\n const prevItem = items[currentIndex - 1] || items[items.length - 1];\n moveFocus(itemElement, prevItem);\n break;\n }\n // Move the focus to the first item of the next group if any, otherwise move it to the next menubar item\n case 'ArrowRight': {\n event.preventDefault();\n event.stopPropagation();\n const currentGroup = itemElement.closest('[role=group]') as HTMLElement;\n const nextGroup = this.getNextGroup(currentGroup);\n if (!nextGroup) {\n itemElement.tabIndex = -1;\n const menuTriggerId = itemElement.closest('[role=\"menu\"][aria-labelledby]').getAttribute('aria-labelledby');\n const focusedItem = this.host.shadowRoot.getElementById(menuTriggerId);\n this.focusNextItem(focusedItem);\n break;\n }\n\n const nextGroupItems = (nextGroup.querySelectorAll('[role=\"menuitem\"]') ?? []) as HTMLElement[];\n moveFocus(itemElement, nextGroupItems[0]);\n break;\n }\n case 'ArrowDown': {\n event.preventDefault();\n event.stopPropagation();\n const nextItem = items[currentIndex + 1] || items[0];\n moveFocus(itemElement, nextItem);\n break;\n }\n // Move the focus to the first item of the previous group if any, otherwise move it to the previous menubar item\n case 'ArrowLeft': {\n event.preventDefault();\n event.stopPropagation();\n const currentGroup = itemElement.closest('[role=group]') as HTMLElement;\n const prevGroup = this.getPreviousGroup(currentGroup);\n if (!prevGroup) {\n itemElement.tabIndex = -1;\n const menuTriggerId = itemElement.closest('[role=\"menu\"][aria-labelledby]').getAttribute('aria-labelledby');\n const focusedItem = this.host.shadowRoot.getElementById(menuTriggerId);\n this.focusPreviousItem(focusedItem);\n break;\n }\n\n const prevGroupItems = (prevGroup.querySelectorAll('[role=\"menuitem\"]') ?? []) as HTMLElement[];\n moveFocus(itemElement, prevGroupItems[0]);\n break;\n }\n case 'Home':\n // Move to the first menu item\n event.preventDefault();\n event.stopPropagation();\n moveFocus(itemElement, items[0]);\n break;\n case 'End':\n // Move to the last menu item\n event.preventDefault();\n event.stopPropagation();\n moveFocus(itemElement, items[items.length - 1]);\n break;\n }\n }\n\n render() {\n if (this.isMobile) {\n return (\n <zanit-mobile-menubar\n items={this.items}\n currentPath={this.currentPath}\n searchQuery={this.searchQuery}\n loading={this.loading}\n />\n );\n }\n\n return (\n <nav aria-label=\"Zanichelli.it\">\n <div class=\"shadow-wrapper\">\n <div class=\"width-limiter\">\n <ul\n class=\"menubar\"\n role=\"menubar\"\n aria-label=\"Zanichelli.it\"\n >\n {this.loading &&\n [...new Array(4)].map((_, index) => (\n <Fragment>\n <li role=\"none\">\n <div class=\"menubar-item\">\n <z-ghost-loading></z-ghost-loading>\n </div>\n </li>\n {index < 3 && <li role=\"separator\"></li>}\n </Fragment>\n ))}\n {this.items?.map((item, index) => (\n <Fragment>\n <li role=\"none\">\n <a\n class={{\n 'menubar-item': true,\n 'active': this.isActive(item),\n }}\n href={item.href}\n id={item.id}\n role=\"menuitem\"\n tabIndex={-1}\n aria-expanded={\n item.menuItems?.length ? (this.openMenu === item.id ? 'true' : 'false') : undefined\n }\n aria-haspopup={item.menuItems?.length ? 'true' : 'false'}\n aria-current={this.current.includes(item.id) ? 'page' : 'false'}\n onPointerOver={() => this.showMenu(item)}\n onKeyDown={(event) => this.handleItemKeydown(event, item)}\n target={item.target}\n >\n <span data-text={item.label}>{item.label}</span>\n {item.menuItems?.length > 0 && (\n <z-icon\n name={this.openMenu === item.id ? 'chevron-up' : 'chevron-down'}\n width=\"0.875rem\"\n height=\"0.875rem\"\n />\n )}\n </a>\n </li>\n {index < this.items?.length - 1 && <li role=\"separator\"></li>}\n </Fragment>\n ))}\n </ul>\n <zanit-search-form\n searchQuery={this.searchQuery}\n onResetSearch={() => (this.searchQuery = undefined)}\n />\n </div>\n\n {this.items.map(\n (item) =>\n this.openMenu === item.id && (\n <Menu\n controlledBy={item.id}\n items={item.menuItems}\n currentPath={this.currentPath}\n onItemKeyDown={(event) => this.handleMenuKeydown(event)}\n />\n )\n )}\n </div>\n\n {this.items\n ?.filter((item) => this.isActive(item))\n .map(\n (item) =>\n item.navbarItems?.length && (\n <nav class={{ 'sub-menubar': true, 'shadow-wrapper': true }}>\n <ul role=\"menubar\">\n {item.navbarItems.map((subitem) => (\n <Fragment>\n <li role=\"none\">\n <a\n class={{\n 'menubar-item': true,\n 'active': this.isActive(subitem),\n }}\n href={subitem.href}\n id={subitem.id}\n role=\"menuitem\"\n tabIndex={-1}\n aria-haspopup={subitem.menuItems?.length ? 'true' : 'false'}\n aria-expanded={\n subitem.menuItems?.length ? (this.openMenu === subitem.id ? 'true' : 'false') : undefined\n }\n aria-current={this.current.includes(subitem.id) ? 'page' : 'false'}\n onPointerOver={() => this.showMenu(subitem)}\n onKeyDown={(event) => this.handleItemKeydown(event, subitem)}\n target={item.target}\n >\n <span>{subitem.label}</span>\n {subitem.menuItems?.length > 0 && (\n <z-icon\n name={this.openMenu === subitem.id ? 'chevron-up' : 'chevron-down'}\n width=\"0.75rem\"\n height=\"0.75rem\"\n />\n )}\n </a>\n </li>\n </Fragment>\n ))}\n </ul>\n {item.navbarItems.map(\n (subitem) =>\n this.openMenu === subitem.id && (\n <Menu\n controlledBy={subitem.id}\n items={subitem.menuItems}\n currentPath={this.currentPath}\n onItemKeyDown={(event) => this.handleMenuKeydown(event)}\n />\n )\n )}\n </nav>\n )\n )}\n </nav>\n );\n }\n}\n"]}
@@ -0,0 +1,114 @@
1
+ :host {
2
+ position: relative;
3
+ z-index: 2;
4
+ display: block;
5
+ width: 100%;
6
+ max-width: 100%;
7
+ background-color: #fff;
8
+ color: var(--gray900);
9
+ fill: var(--gray900);
10
+ font-family: var(--font-family-sans);
11
+ }
12
+
13
+ :host,
14
+ *,
15
+ ::before,
16
+ ::after {
17
+ box-sizing: border-box;
18
+ }
19
+
20
+ *:focus:focus-visible {
21
+ box-shadow: var(--shadow-focus-primary);
22
+ outline: none;
23
+ }
24
+
25
+ ul {
26
+ padding: 0;
27
+ margin: 0;
28
+ list-style: none;
29
+ }
30
+
31
+ a {
32
+ color: var(--gray900);
33
+ cursor: pointer;
34
+ text-decoration: none;
35
+ }
36
+
37
+ button {
38
+ all: unset;
39
+ cursor: pointer;
40
+ }
41
+
42
+ nav {
43
+ display: flex;
44
+ width: 100%;
45
+ align-items: center;
46
+ padding: 8px var(--grid-margin);
47
+ }
48
+
49
+ nav::after {
50
+ position: absolute;
51
+ top: 0;
52
+ right: 0;
53
+ width: 100%;
54
+ height: 100%;
55
+ background: transparent;
56
+ box-shadow: var(--shadow-1);
57
+ content: '';
58
+ pointer-events: none;
59
+ }
60
+
61
+ .burger-button {
62
+ margin-left: auto;
63
+ }
64
+
65
+ .mobile-menu {
66
+ position: absolute;
67
+ top: 100%;
68
+ left: 0;
69
+ display: flex;
70
+ width: 100%;
71
+ flex-direction: column;
72
+ padding: 16px var(--grid-margin) 32px;
73
+ background-color: #fff;
74
+ box-shadow: var(--shadow-2);
75
+ gap: 8px;
76
+ }
77
+
78
+ .mobile-menu li {
79
+ width: 100%;
80
+ }
81
+
82
+ .mobile-menu .items-container {
83
+ display: flex;
84
+ min-height: 256px;
85
+ flex-direction: column;
86
+ gap: 8px;
87
+ }
88
+
89
+ .mobile-menu .items-container z-ghost-loading {
90
+ width: 40%;
91
+ height: 1.2rem;
92
+ }
93
+
94
+ .mobile-menu .items-container .menubar-item {
95
+ display: block;
96
+ width: 100%;
97
+ padding: 8px 0;
98
+ font-size: 1rem;
99
+ text-align: left;
100
+ }
101
+
102
+ .mobile-menu .items-container li:not(:last-child) .menubar-item {
103
+ border-bottom: 1px solid #000;
104
+ }
105
+
106
+ [role='menuitem'].parent {
107
+ display: flex;
108
+ width: fit-content;
109
+ align-items: center;
110
+ padding: 0;
111
+ border: none;
112
+ font-size: 0.875rem;
113
+ gap: 8px;
114
+ }
@@ -1,16 +1,9 @@
1
- import { r as registerInstance, a as getElement, h } from './index-Cn3aX5eK.js';
2
- import { m as moveFocus, c as containsTarget } from './utils-CaxAWyZI.js';
3
- import { M as Menu } from './menu-DZlhu_pe.js';
4
-
5
- const mobileMenubarCss = ":host{position:relative;z-index:2;display:block;width:100%;max-width:100%;background-color:#fff;color:var(--gray900);fill:var(--gray900);font-family:var(--font-family-sans)}:host,*,::before,::after{box-sizing:border-box}*:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}ul{padding:0;margin:0;list-style:none}a{color:var(--gray900);cursor:pointer;text-decoration:none}button{all:unset;cursor:pointer}nav{display:flex;width:100%;align-items:center;padding:8px var(--grid-margin)}nav::after{position:absolute;top:0;right:0;width:100%;height:100%;background:transparent;box-shadow:var(--shadow-1);content:'';pointer-events:none}.burger-button{margin-left:auto}.mobile-menu{position:absolute;top:100%;left:0;display:flex;width:100%;flex-direction:column;padding:16px var(--grid-margin) 32px;background-color:#fff;box-shadow:var(--shadow-2);gap:8px}.mobile-menu li{width:100%}.mobile-menu .items-container{display:flex;min-height:256px;flex-direction:column;gap:8px}.mobile-menu .items-container z-ghost-loading{width:40%;height:1.2rem}.mobile-menu .items-container .menubar-item{display:block;width:100%;padding:8px 0;font-size:1rem;text-align:left}.mobile-menu .items-container li:not(:last-child) .menubar-item{border-bottom:1px solid #000}[role='menuitem'].parent{display:flex;width:fit-content;align-items:center;padding:0;border:none;font-size:0.875rem;gap:8px}";
6
-
7
- const menuCss = ".menu-wrapper{width:100%;background-color:#fff}.menu{position:relative;display:flex;width:100%;flex-direction:column;gap:32px 0}.menu .group{display:flex;flex-direction:column}.menu .group .group-name{border-bottom:1px solid currentcolor;margin-bottom:4px;color:var(--red500);font-size:0.875rem;font-weight:var(--font-rg)}.menu .group .menu-list{display:flex;flex-direction:column;gap:4px}.menu .group .menu-list .menu-item{border-bottom:2px solid transparent;font-size:0.875rem;font-weight:var(--font-md)}.menu .menu-list .menu-item.active,.menu .menu-list .menu-item:hover{border-bottom-color:var(--red500)}.menu .group.highlight .menu-list .menu-item{font-size:1rem}@media (width >= 768px){.menu-wrapper{position:absolute;top:100%;left:0;display:flex;justify-content:center;box-shadow:var(--shadow-1)}.menu{display:grid;width:100%;max-width:var(--zanit-menubar-max-width, 1366px);padding:16px var(--grid-margin);gap:0 24px;grid-auto-columns:minmax(0, max-content);grid-auto-flow:column;grid-template-rows:minmax(0, max-content) max-content}.menu .group{display:grid;grid-row:1 / -1;grid-template-columns:1fr;grid-template-rows:subgrid}@supports not (grid-template-rows: subgrid){.menu .group{grid-template-rows:repeat(auto-fit, minmax(0, max-content))}}.menu .group .group-name{border:none;margin-bottom:16px}.menu .group .menu-list .menu-item{font-size:1rem}.menu .group.highlight .menu-list .menu-item{font-size:1.5rem}.menu .group.highlight .menu-list{gap:24px}}";
8
-
9
- const ZanitMobileMenubar = class {
10
- constructor(hostRef) {
11
- registerInstance(this, hostRef);
12
- }
13
- get host() { return getElement(this); }
1
+ import { h } from "@stencil/core";
2
+ import { containsTarget, moveFocus } from "../../../utils/utils";
3
+ import { Menu } from "../menu/menu";
4
+ /** Mobile menubar component. */
5
+ export class ZanitMobileMenubar {
6
+ host;
14
7
  /** IDs path of the current item. */
15
8
  currentPath = [];
16
9
  /** Menubar items. */
@@ -148,19 +141,150 @@ const ZanitMobileMenubar = class {
148
141
  this.open = false;
149
142
  }
150
143
  render() {
151
- return (h("nav", { key: '6f472325f692f0582bb42d4553a17bc38ac1ce48', "aria-label": "Zanichelli.it" }, h("z-logo", { key: '66a38e067b302dbe25d0edfbb807d8e99c903afb', imageAlt: "Logo Zanichelli", link: "/", height: 32, width: 126 }), h("button", { key: '34030eb38bebfd51e368ad2e8016733c31e63cd5', class: "burger-button", type: "button", "aria-expanded": this.open ? 'true' : 'false', "aria-controls": "mobile-menu", "aria-label": this.open ? 'Chiudi menù' : 'Apri menù', onClick: () => this.toggleMenu() }, h("z-icon", { key: 'f032c729ee356ead6b936641bc066429f4f22a1d', name: this.open ? 'multiply' : 'burger-menu', width: "1.5rem", height: "1.5rem" })), this.open && (h("ul", { key: '2ef5862c35a19ad8918c97eab05a9c9bd0f5bac8', class: "mobile-menu", role: "menubar" }, h("li", { key: '04306dfb957d01a3b49e0d61dc1bc7a8bf1aeaf2', role: "none" }, h("zanit-search-form", { key: 'f0058ca930c6ce03230d8138f81330b69b57a56d', searchQuery: this.searchQuery, onResetSearch: () => (this.searchQuery = undefined) })), !this.loading && this.currentPath && this.currentPath.length > 0 && (h("li", { key: '988ed6bc38969ada5ed2f64d2ab906966d66856f', role: "none" }, h("a", { key: 'e26443d5a8222647dcc65a65efb4d5c0d79e813f', class: "parent", href: this.parentItem?.href ?? '/', id: this.parentItem?.id ?? undefined, role: "menuitem", tabIndex: -1, onKeyDown: (event) => this.handleItemKeydown(event), target: this.parentItem?.target }, h("z-icon", { key: 'bce8ab61434a97dbe5a1d8d2cd89735366bf2db3', name: "arrow-left", width: "0.5rem", height: "0.5rem" }), h("span", { key: '39e79fc0af7a648a244ef53964dc0efddb17ffd0' }, this.parentItem?.label || 'Home')))), this.loading ? (h("div", { class: "items-container", role: "none" }, [...new Array(4)].map(() => (h("li", { role: "none" }, h("div", { class: "menubar-item", role: "none" }, h("z-ghost-loading", null))))))) : this.menuType === 'menu' ? (h(Menu, { items: this.menuItems, controlledBy: this.parentItem?.id, currentPath: this.currentPath, onItemKeyDown: (event) => this.handleItemKeydown(event) })) : (this.menuItems?.length > 0 && (h("div", { class: "items-container", role: "none" }, this.menuItems.map((item) => (h("li", { role: "none" }, h("a", { class: {
144
+ return (h("nav", { key: '8670451f03909d3008f6e21d02ee5c7412d86bac', "aria-label": "Zanichelli.it" }, h("z-logo", { key: '8f8704851b84185e6c01bc6cd5e2a3b3cda53a61', imageAlt: "Logo Zanichelli", link: "/", height: 32, width: 126 }), h("button", { key: '02271df658a071f9ae0d91f8140b9e8e15064ccc', class: "burger-button", type: "button", "aria-expanded": this.open ? 'true' : 'false', "aria-controls": "mobile-menu", "aria-label": this.open ? 'Chiudi menù' : 'Apri menù', onClick: () => this.toggleMenu() }, h("z-icon", { key: 'fcbff94368d67da8a237190518452048276882a0', name: this.open ? 'multiply' : 'burger-menu', width: "1.5rem", height: "1.5rem" })), this.open && (h("ul", { key: '94fae1693d0ebd41d86cfe55450a40cbff88b7dd', class: "mobile-menu", role: "menubar" }, h("li", { key: '5e09e8484e6450646d4da570a0791da92e477fc7', role: "none" }, h("zanit-search-form", { key: '564813af11cc4b6c62db80ee2acdbeb54cec935f', searchQuery: this.searchQuery, onResetSearch: () => (this.searchQuery = undefined) })), !this.loading && this.currentPath && this.currentPath.length > 0 && (h("li", { key: '7b501d3a1c7dcf705bd1bfd8d03a29573c27f891', role: "none" }, h("a", { key: '949db4a79629f0d0ab44cc94d11f717abc87cb4d', class: "parent", href: this.parentItem?.href ?? '/', id: this.parentItem?.id ?? undefined, role: "menuitem", tabIndex: -1, onKeyDown: (event) => this.handleItemKeydown(event), target: this.parentItem?.target }, h("z-icon", { key: '2537588429f0185c67f87702d040fdc8ad7fbe06', name: "arrow-left", width: "0.5rem", height: "0.5rem" }), h("span", { key: '732de0ec2a09d41ecacd62d7fa8e5c799e67e533' }, this.parentItem?.label || 'Home')))), this.loading ? (h("div", { class: "items-container", role: "none" }, [...new Array(4)].map(() => (h("li", { role: "none" }, h("div", { class: "menubar-item", role: "none" }, h("z-ghost-loading", null))))))) : this.menuType === 'menu' ? (h(Menu, { items: this.menuItems, controlledBy: this.parentItem?.id, currentPath: this.currentPath, onItemKeyDown: (event) => this.handleItemKeydown(event) })) : (this.menuItems?.length > 0 && (h("div", { class: "items-container", role: "none" }, this.menuItems.map((item) => (h("li", { role: "none" }, h("a", { class: {
152
145
  'menu-item': this.menuType === 'menu',
153
146
  'menubar-item': this.menuType === 'menubar',
154
147
  }, href: item.href, id: item.id, role: "menuitem", "aria-current": this.lastCurrent === item.id ? 'page' : 'false', tabIndex: -1, onKeyDown: (event) => this.handleItemKeydown(event), target: item.target }, h("span", { "data-text": item.label }, item.label))))))))))));
155
148
  }
156
- static get watchers() { return {
157
- "items": ["onItemsChange"],
158
- "currentPath": ["onItemsChange"]
159
- }; }
160
- };
161
- ZanitMobileMenubar.style = mobileMenubarCss + menuCss;
162
-
163
- export { ZanitMobileMenubar as zanit_mobile_menubar };
164
- //# sourceMappingURL=zanit-mobile-menubar.entry.esm.js.map
165
-
166
- //# sourceMappingURL=zanit-mobile-menubar.entry.js.map
149
+ static get is() { return "zanit-mobile-menubar"; }
150
+ static get encapsulation() { return "shadow"; }
151
+ static get originalStyleUrls() {
152
+ return {
153
+ "$": ["mobile-menubar.css", "../menu/menu.css"]
154
+ };
155
+ }
156
+ static get styleUrls() {
157
+ return {
158
+ "$": ["mobile-menubar.css", "../menu/menu.css"]
159
+ };
160
+ }
161
+ static get properties() {
162
+ return {
163
+ "currentPath": {
164
+ "type": "unknown",
165
+ "attribute": "current-path",
166
+ "mutable": false,
167
+ "complexType": {
168
+ "original": "string[]",
169
+ "resolved": "string[]",
170
+ "references": {}
171
+ },
172
+ "required": false,
173
+ "optional": false,
174
+ "docs": {
175
+ "tags": [],
176
+ "text": "IDs path of the current item."
177
+ },
178
+ "getter": false,
179
+ "setter": false,
180
+ "defaultValue": "[]"
181
+ },
182
+ "items": {
183
+ "type": "unknown",
184
+ "attribute": "items",
185
+ "mutable": false,
186
+ "complexType": {
187
+ "original": "MenubarItem[]",
188
+ "resolved": "MenubarItem[]",
189
+ "references": {
190
+ "MenubarItem": {
191
+ "location": "import",
192
+ "path": "../../../utils/types",
193
+ "id": "src/utils/types.ts::MenubarItem"
194
+ }
195
+ }
196
+ },
197
+ "required": false,
198
+ "optional": false,
199
+ "docs": {
200
+ "tags": [],
201
+ "text": "Menubar items."
202
+ },
203
+ "getter": false,
204
+ "setter": false,
205
+ "defaultValue": "[]"
206
+ },
207
+ "searchQuery": {
208
+ "type": "string",
209
+ "attribute": "search-query",
210
+ "mutable": true,
211
+ "complexType": {
212
+ "original": "string | undefined",
213
+ "resolved": "string",
214
+ "references": {}
215
+ },
216
+ "required": false,
217
+ "optional": false,
218
+ "docs": {
219
+ "tags": [],
220
+ "text": "Initial search query."
221
+ },
222
+ "getter": false,
223
+ "setter": false,
224
+ "reflect": false,
225
+ "defaultValue": "undefined"
226
+ },
227
+ "loading": {
228
+ "type": "boolean",
229
+ "attribute": "loading",
230
+ "mutable": false,
231
+ "complexType": {
232
+ "original": "boolean",
233
+ "resolved": "boolean",
234
+ "references": {}
235
+ },
236
+ "required": false,
237
+ "optional": false,
238
+ "docs": {
239
+ "tags": [],
240
+ "text": "Whether the menubar is loading the data."
241
+ },
242
+ "getter": false,
243
+ "setter": false,
244
+ "reflect": false,
245
+ "defaultValue": "false"
246
+ }
247
+ };
248
+ }
249
+ static get states() {
250
+ return {
251
+ "lastCurrent": {},
252
+ "parentItem": {},
253
+ "menuItems": {},
254
+ "menuType": {},
255
+ "open": {}
256
+ };
257
+ }
258
+ static get elementRef() { return "host"; }
259
+ static get watchers() {
260
+ return [{
261
+ "propName": "items",
262
+ "methodName": "onItemsChange"
263
+ }, {
264
+ "propName": "currentPath",
265
+ "methodName": "onItemsChange"
266
+ }];
267
+ }
268
+ static get listeners() {
269
+ return [{
270
+ "name": "click",
271
+ "method": "handleOutsideClick",
272
+ "target": "document",
273
+ "capture": false,
274
+ "passive": true
275
+ }, {
276
+ "name": "keydown",
277
+ "method": "handleKeydown",
278
+ "target": undefined,
279
+ "capture": false,
280
+ "passive": true
281
+ }, {
282
+ "name": "focusin",
283
+ "method": "handleFocusout",
284
+ "target": "document",
285
+ "capture": false,
286
+ "passive": true
287
+ }];
288
+ }
289
+ }
290
+ //# sourceMappingURL=mobile-menubar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-menubar.js","sourceRoot":"","sources":["../../../../src/components/menubar/mobile-menubar/mobile-menubar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAElF,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,gCAAgC;AAMhC,MAAM,OAAO,kBAAkB;IAClB,IAAI,CAAgC;IAE/C,oCAAoC;IAC5B,WAAW,GAAa,EAAE,CAAC;IAEnC,qBAAqB;IACb,KAAK,GAAkB,EAAE,CAAC;IAElC,4BAA4B;IACH,WAAW,GAAuB,SAAS,CAAC;IAErE,+CAA+C;IACvC,OAAO,GAAY,KAAK,CAAC;IAEjC,2BAA2B;IAClB,WAAW,GAAuB,SAAS,CAAC;IAC5C,UAAU,GAA4B,SAAS,CAAC;IAChD,SAAS,GAA2C,SAAS,CAAC;IACvE,iEAAiE;IACxD,QAAQ,GAAmC,SAAS,CAAC;IACrD,IAAI,CAAU;IAIvB,aAAa;QACX,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACxG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACK,SAAS,CAAC,KAAoB,EAAE,M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Q,CAC9C,CACD,CACN,CAAC,CACE,CACP,CACF,CACE,CACN,CACG,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Listen, Prop, State, Watch } from '@stencil/core';\nimport { MenubarItem, MenuItem } from '../../../utils/types';\nimport { containsTarget, moveFocus } from '../../../utils/utils';\nimport { Menu } from '../menu/menu';\n\n/** Mobile menubar component. */\n@Component({\n tag: 'zanit-mobile-menubar',\n styleUrls: ['mobile-menubar.css', '../menu/menu.css'],\n shadow: true,\n})\nexport class ZanitMobileMenubar {\n @Element() host: HTMLZanitMobileMenubarElement;\n\n /** IDs path of the current item. */\n @Prop() currentPath: string[] = [];\n\n /** Menubar items. */\n @Prop() items: MenubarItem[] = [];\n\n /** Initial search query. */\n @Prop({ mutable: true }) searchQuery: string | undefined = undefined;\n\n /** Whether the menubar is loading the data. */\n @Prop() loading: boolean = false;\n\n /** Last active item ID. */\n @State() lastCurrent: string | undefined = undefined;\n @State() parentItem: MenubarItem | undefined = undefined;\n @State() menuItems: MenubarItem[] | MenuItem[] | undefined = undefined;\n /** Whether the items to render come from a menubar or a menu. */\n @State() menuType: 'menubar' | 'menu' | undefined = undefined;\n @State() open: boolean;\n\n @Watch('items')\n @Watch('currentPath')\n onItemsChange() {\n this.lastCurrent = this.currentPath?.length ? this.currentPath[this.currentPath.length - 1] : undefined;\n this.setupData(this.items);\n }\n\n /**\n * Find the current item and take its parent, `menuItems` or the `navbarItems`.\n */\n private setupData(items: MenubarItem[], parent?: MenubarItem) {\n // If no current item is defined, we show all items\n if (this.lastCurrent === undefined) {\n this.parentItem = undefined;\n this.menuType = 'menubar';\n this.menuItems = items;\n return;\n }\n\n for (const item of items) {\n if (item.id === this.lastCurrent) {\n this.parentItem = parent;\n this.menuType = item.menuItems?.length ? 'menu' : 'menubar';\n this.menuItems = item.menuItems || item.navbarItems;\n return;\n }\n\n if (\n this.currentPath.length > 1 &&\n item.id === this.currentPath[this.currentPath.length - 2] &&\n item.menuItems?.some(({ id }) => id === this.lastCurrent)\n ) {\n this.parentItem = item;\n this.menuType = item.menuItems?.length ? 'menu' : 'menubar';\n this.menuItems = item.menuItems || item.navbarItems;\n return;\n }\n\n if (item.navbarItems?.length) {\n this.setupData(item.navbarItems, item);\n }\n }\n }\n\n private get menuItemsElement() {\n return Array.from(this.host.shadowRoot.querySelectorAll('[role=\"menuitem\"]')) as HTMLElement[];\n }\n\n /** Initialize tabindex on menuitems, setting -1 to all but the first one. */\n private initTabindex() {\n this.menuItemsElement.forEach((item, index) => item.setAttribute('tabindex', index === 0 ? '0' : '-1'));\n }\n\n private toggleMenu() {\n if (this.open) {\n this.open = false;\n } else {\n this.open = true;\n setTimeout(() => {\n this.initTabindex();\n this.menuItemsElement[0]?.focus();\n }, 200);\n }\n }\n\n /** Handles keyboard navigation on mobile menu. */\n private handleItemKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'ArrowUp': {\n event.preventDefault();\n event.stopPropagation();\n const items = this.menuItemsElement;\n const currentIndex = items.indexOf(event.target as HTMLElement);\n const prevItem = items[(currentIndex - 1 + items.length) % items.length];\n moveFocus(items[currentIndex], prevItem);\n break;\n }\n case 'ArrowDown': {\n event.preventDefault();\n event.stopPropagation();\n const items = this.menuItemsElement;\n const currentIndex = items.indexOf(event.target as HTMLElement);\n const nextItem = items[(currentIndex + 1) % items.length];\n moveFocus(items[currentIndex], nextItem);\n break;\n }\n case 'Home': {\n event.preventDefault();\n event.stopPropagation();\n moveFocus(event.target as HTMLElement, this.menuItemsElement[0]);\n break;\n }\n case 'End': {\n event.preventDefault();\n event.stopPropagation();\n moveFocus(event.target as HTMLElement, this.menuItemsElement.pop());\n break;\n }\n }\n }\n\n connectedCallback() {\n this.lastCurrent = this.currentPath?.length ? this.currentPath[this.currentPath.length - 1] : undefined;\n this.setupData(this.items);\n }\n\n /** Close the menu when clicking outside. */\n @Listen('click', { target: 'document', passive: true })\n handleOutsideClick(event: MouseEvent) {\n if (containsTarget(this.host, event)) {\n return;\n }\n\n this.open = false;\n }\n\n /** Close the menu when pressing Escape or Tab. */\n @Listen('keydown', { passive: true })\n handleKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'Escape':\n this.open = false;\n break;\n case 'Tab':\n if (containsTarget(this.host, event)) {\n break;\n }\n\n this.open = false;\n break;\n }\n }\n\n /** Close the menu when the focus goes out. */\n @Listen('focusin', { target: 'document', passive: true })\n handleFocusout(event: FocusEvent) {\n if (containsTarget(this.host, event)) {\n return;\n }\n\n this.open = false;\n }\n\n render() {\n return (\n <nav aria-label=\"Zanichelli.it\">\n <z-logo\n imageAlt=\"Logo Zanichelli\"\n link=\"/\"\n height={32}\n width={126}\n ></z-logo>\n <button\n class=\"burger-button\"\n type=\"button\"\n aria-expanded={this.open ? 'true' : 'false'}\n aria-controls=\"mobile-menu\"\n aria-label={this.open ? 'Chiudi menù' : 'Apri menù'}\n onClick={() => this.toggleMenu()}\n >\n <z-icon\n name={this.open ? 'multiply' : 'burger-menu'}\n width=\"1.5rem\"\n height=\"1.5rem\"\n ></z-icon>\n </button>\n {this.open && (\n <ul\n class=\"mobile-menu\"\n role=\"menubar\"\n >\n <li role=\"none\">\n <zanit-search-form\n searchQuery={this.searchQuery}\n onResetSearch={() => (this.searchQuery = undefined)}\n />\n </li>\n\n {!this.loading && this.currentPath && this.currentPath.length > 0 && (\n <li role=\"none\">\n <a\n class=\"parent\"\n href={this.parentItem?.href ?? '/'}\n id={this.parentItem?.id ?? undefined}\n role=\"menuitem\"\n tabIndex={-1}\n onKeyDown={(event) => this.handleItemKeydown(event)}\n target={this.parentItem?.target}\n >\n <z-icon\n name=\"arrow-left\"\n width=\"0.5rem\"\n height=\"0.5rem\"\n ></z-icon>\n <span>\n {/* Show the 'Home' label if the current item is a root child. */}\n {this.parentItem?.label || 'Home'}\n </span>\n </a>\n </li>\n )}\n\n {this.loading ? (\n <div\n class=\"items-container\"\n role=\"none\"\n >\n {[...new Array(4)].map(() => (\n <li role=\"none\">\n <div\n class=\"menubar-item\"\n role=\"none\"\n >\n <z-ghost-loading></z-ghost-loading>\n </div>\n </li>\n ))}\n </div>\n ) : this.menuType === 'menu' ? (\n <Menu\n items={this.menuItems}\n controlledBy={this.parentItem?.id}\n currentPath={this.currentPath}\n onItemKeyDown={(event) => this.handleItemKeydown(event)}\n />\n ) : (\n this.menuItems?.length > 0 && (\n <div\n class=\"items-container\"\n role=\"none\"\n >\n {this.menuItems.map((item) => (\n <li role=\"none\">\n <a\n class={{\n 'menu-item': this.menuType === 'menu',\n 'menubar-item': this.menuType === 'menubar',\n }}\n href={item.href}\n id={item.id}\n role=\"menuitem\"\n aria-current={this.lastCurrent === item.id ? 'page' : 'false'}\n tabIndex={-1}\n onKeyDown={(event) => this.handleItemKeydown(event)}\n target={item.target}\n >\n <span data-text={item.label}>{item.label}</span>\n </a>\n </li>\n ))}\n </div>\n )\n )}\n </ul>\n )}\n </nav>\n );\n }\n}\n"]}