@zanichelli/zanichelli-it-frontend-kit 1.4.1-RC1 → 1.4.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.
- package/dist/cjs/{index-BLzQAHAI.js → index-BKkNg6ed.js} +498 -358
- package/dist/cjs/index.cjs.js +0 -3
- package/dist/cjs/loader.cjs.js +2 -5
- package/dist/cjs/zanichelli-it-frontend-kit.cjs.js +3 -6
- package/dist/cjs/zanit-back-to-top_4.cjs.entry.js +76 -64
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/back-to-top/back-to-top.js +3 -4
- package/dist/collection/components/menubar/menu/menu.js +0 -1
- package/dist/collection/components/menubar/menubar.js +12 -11
- package/dist/collection/components/menubar/mobile-menubar/mobile-menubar.js +12 -13
- package/dist/collection/components/menubar/search-form/search-form.js +14 -13
- package/dist/collection/components/menubar/search-form/suggestions.js +1 -2
- package/dist/collection/index.js +0 -1
- package/dist/collection/utils/index.js +0 -1
- package/dist/collection/utils/subjects.api.js +0 -1
- package/dist/collection/utils/utils.js +0 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -1335
- package/dist/components/p-BMtMaJq9.js +1 -0
- package/dist/components/p-BXeRLfHX.js +1 -0
- package/dist/components/zanit-back-to-top.js +1 -88
- package/dist/components/zanit-menubar.js +1 -455
- package/dist/components/zanit-mobile-menubar.js +1 -9
- package/dist/components/zanit-search-form.js +1 -9
- package/dist/esm/{index-DSdvvVFj.js → index-CFgcJxsy.js} +498 -358
- package/dist/esm/index.js +0 -3
- package/dist/esm/loader.js +3 -6
- package/dist/esm/zanichelli-it-frontend-kit.js +4 -7
- package/dist/esm/zanit-back-to-top_4.entry.js +76 -64
- package/dist/types/components/back-to-top/back-to-top.d.ts +2 -1
- package/dist/types/components/menubar/menubar.d.ts +2 -1
- package/dist/types/components/menubar/mobile-menubar/mobile-menubar.d.ts +2 -1
- package/dist/types/components/menubar/search-form/search-form.d.ts +3 -2
- package/dist/types/components.d.ts +35 -8
- package/dist/types/stencil-public-runtime.d.ts +169 -11
- package/dist/zanichelli-it-frontend-kit/index.esm.js +0 -2
- package/dist/zanichelli-it-frontend-kit/p-93d8b277.entry.js +1 -0
- package/dist/zanichelli-it-frontend-kit/p-CFgcJxsy.js +2 -0
- package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.esm.js +1 -2
- package/package.json +17 -15
- package/www/build/index.esm.js +0 -2
- package/www/build/p-93d8b277.entry.js +1 -0
- package/www/build/p-CFgcJxsy.js +2 -0
- package/www/build/p-ec9829f4.js +1 -0
- package/www/build/zanichelli-it-frontend-kit.esm.js +1 -2
- package/www/index.html +3 -2
- package/dist/cjs/index-BLzQAHAI.js.map +0 -1
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/zanichelli-it-frontend-kit.cjs.js.map +0 -1
- package/dist/cjs/zanit-back-to-top.zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.cjs.js.map +0 -1
- package/dist/cjs/zanit-back-to-top_4.cjs.entry.js.map +0 -1
- package/dist/collection/components/back-to-top/back-to-top.js.map +0 -1
- package/dist/collection/components/menubar/menu/menu.js.map +0 -1
- package/dist/collection/components/menubar/menubar.js.map +0 -1
- package/dist/collection/components/menubar/mobile-menubar/mobile-menubar.js.map +0 -1
- package/dist/collection/components/menubar/search-form/search-form.js.map +0 -1
- package/dist/collection/components/menubar/search-form/suggestions.js.map +0 -1
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/utils/index.js.map +0 -1
- package/dist/collection/utils/subjects.api.js.map +0 -1
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/p-CPhDV9oz.js +0 -246
- package/dist/components/p-CPhDV9oz.js.map +0 -1
- package/dist/components/p-DR2f_bjz.js +0 -387
- package/dist/components/p-DR2f_bjz.js.map +0 -1
- package/dist/components/zanit-back-to-top.js.map +0 -1
- package/dist/components/zanit-menubar.js.map +0 -1
- package/dist/components/zanit-mobile-menubar.js.map +0 -1
- package/dist/components/zanit-search-form.js.map +0 -1
- package/dist/esm/index-DSdvvVFj.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/zanichelli-it-frontend-kit.js.map +0 -1
- package/dist/esm/zanit-back-to-top.zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.js.map +0 -1
- package/dist/esm/zanit-back-to-top_4.entry.js.map +0 -1
- package/dist/zanichelli-it-frontend-kit/index.esm.js.map +0 -1
- package/dist/zanichelli-it-frontend-kit/loader.esm.js.map +0 -1
- package/dist/zanichelli-it-frontend-kit/p-12c6519e.entry.js +0 -2
- package/dist/zanichelli-it-frontend-kit/p-12c6519e.entry.js.map +0 -1
- package/dist/zanichelli-it-frontend-kit/p-DSdvvVFj.js +0 -3
- package/dist/zanichelli-it-frontend-kit/p-DSdvvVFj.js.map +0 -1
- package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.esm.js.map +0 -1
- package/dist/zanichelli-it-frontend-kit/zanit-back-to-top.zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.esm.js.map +0 -1
- package/www/build/index.esm.js.map +0 -1
- package/www/build/loader.esm.js.map +0 -1
- package/www/build/p-12c6519e.entry.js +0 -2
- package/www/build/p-12c6519e.entry.js.map +0 -1
- package/www/build/p-17633e25.js +0 -2
- package/www/build/p-DSdvvVFj.js +0 -3
- package/www/build/p-DSdvvVFj.js.map +0 -1
- package/www/build/zanichelli-it-frontend-kit.esm.js.map +0 -1
- package/www/build/zanit-back-to-top.zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.esm.js.map +0 -1
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { h, p as proxyCustomElement, H } from './index.js';
|
|
2
|
-
import { d as defineCustomElement$1, S as SearchEnv, m as moveFocus, c as containsTarget } from './p-DR2f_bjz.js';
|
|
3
|
-
|
|
4
|
-
const DEFAULT_GROUP_KEY = 'default';
|
|
5
|
-
const DEFAULT_GROUP = {
|
|
6
|
-
id: DEFAULT_GROUP_KEY,
|
|
7
|
-
label: DEFAULT_GROUP_KEY,
|
|
8
|
-
};
|
|
9
|
-
/** Get the items grouped by their group. */
|
|
10
|
-
const getGroupedItems = (items) => {
|
|
11
|
-
const groups = items.reduce((grouped, item) => {
|
|
12
|
-
const itemGroup = grouped.find(({ group }) => group.id === (item.group?.id || DEFAULT_GROUP.id));
|
|
13
|
-
if (!itemGroup) {
|
|
14
|
-
grouped.push({ group: item.group ?? DEFAULT_GROUP, items: [item] });
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
itemGroup.items.push(item);
|
|
18
|
-
}
|
|
19
|
-
return grouped;
|
|
20
|
-
}, []);
|
|
21
|
-
// Sort to keep default group at the end
|
|
22
|
-
return groups.sort((a, b) => (a.group.id === DEFAULT_GROUP_KEY ? 1 : b.group.id === DEFAULT_GROUP_KEY ? -1 : 0));
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Floating menu component. It shows a list of items that can be grouped.
|
|
26
|
-
*/
|
|
27
|
-
const Menu = ({ controlledBy, items, currentPath = [], onItemKeyDown }) => {
|
|
28
|
-
if (!items?.length) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const groups = getGroupedItems(items);
|
|
32
|
-
const isActive = (item) => currentPath.includes(controlledBy) && currentPath.includes(item.id);
|
|
33
|
-
return (h("div", { class: "menu-wrapper", role: "none" },
|
|
34
|
-
h("div", { class: "menu", "aria-labelledby": controlledBy ?? undefined, role: "menu" }, groups.map(({ group, items }) => (h("div", { class: { group: true, highlight: items.some((item) => item.highlight) } },
|
|
35
|
-
group.id !== DEFAULT_GROUP_KEY ? (h("div", { class: "group-name", id: group.id }, group.label)) : groups.length > 1 ? (
|
|
36
|
-
// empty div to keep the same height as the other groups
|
|
37
|
-
h("div", { class: "group-name" })) : null,
|
|
38
|
-
h("ul", { class: "menu-list", role: "group", "aria-labelledby": group.id !== DEFAULT_GROUP_KEY ? group.id : undefined }, items.map((item) => (h("li", { role: "none" }, item.href && (h("a", { class: {
|
|
39
|
-
'menu-item': true,
|
|
40
|
-
'active': isActive(item),
|
|
41
|
-
}, href: item.href, role: "menuitem", tabIndex: -1, "aria-current": isActive(item) ? 'page' : 'false', onKeyDown: (event) => onItemKeyDown(event), target: item.target }, item.label))))))))))));
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const mobileMenubarCss = ":host{position:relative;z-index:2;display:block;width:100%;max-width:100%;height:3rem;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-left:var(--grid-margin);gap:8px}nav::after{position:absolute;top:0;right:0;width:100%;height:100%;background:transparent;box-shadow:var(--shadow-1);content:'';pointer-events:none}z-logo{margin:8px 0}.mobile-menu{position:absolute;top:100%;left:0;display:flex;overflow:auto;width:100%;max-height:calc(100vh - 48px - var(--zanit-menubar-top-offset, 0px));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}zanit-search-form{margin-left:auto}";
|
|
45
|
-
|
|
46
|
-
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-md)}.menu .group .menu-list{display:flex;flex-direction:column;gap:8px}.menu .group .menu-list .menu-item{display:block;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}}";
|
|
47
|
-
|
|
48
|
-
const ZanitMobileMenubar = /*@__PURE__*/ proxyCustomElement(class ZanitMobileMenubar extends H {
|
|
49
|
-
constructor() {
|
|
50
|
-
super();
|
|
51
|
-
this.__registerHost();
|
|
52
|
-
this.__attachShadow();
|
|
53
|
-
}
|
|
54
|
-
get host() { return this; }
|
|
55
|
-
/** IDs path of the current item. */
|
|
56
|
-
currentPath = [];
|
|
57
|
-
/** Menubar items. */
|
|
58
|
-
items = [];
|
|
59
|
-
/** Initial search query. */
|
|
60
|
-
searchQuery = undefined;
|
|
61
|
-
/** Whether the menubar is loading the data. */
|
|
62
|
-
loading = false;
|
|
63
|
-
/** Environment for search suggestions */
|
|
64
|
-
searchEnv = SearchEnv.PROD;
|
|
65
|
-
/** Search area (e.g. "SCUOLA", "UNIVERSITÀ", "DIZIONARI"). */
|
|
66
|
-
searchArea;
|
|
67
|
-
/** Last active item ID. */
|
|
68
|
-
lastCurrent = undefined;
|
|
69
|
-
parentItem = undefined;
|
|
70
|
-
menuItems = undefined;
|
|
71
|
-
/** Whether the items to render come from a menubar or a menu. */
|
|
72
|
-
menuType = undefined;
|
|
73
|
-
open;
|
|
74
|
-
onItemsChange() {
|
|
75
|
-
this.lastCurrent = this.currentPath?.length ? this.currentPath[this.currentPath.length - 1] : undefined;
|
|
76
|
-
this.setupData(this.items);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Find the current item and take its parent, `menuItems` or the `navbarItems`.
|
|
80
|
-
*/
|
|
81
|
-
setupData(items, parent) {
|
|
82
|
-
// If no current item is defined, we show all items
|
|
83
|
-
if (this.lastCurrent === undefined) {
|
|
84
|
-
this.parentItem = undefined;
|
|
85
|
-
this.menuType = 'menubar';
|
|
86
|
-
this.menuItems = items;
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
for (const item of items) {
|
|
90
|
-
if (item.id === this.lastCurrent) {
|
|
91
|
-
this.parentItem = parent;
|
|
92
|
-
this.menuType = item.menuItems?.length ? 'menu' : 'menubar';
|
|
93
|
-
this.menuItems = item.menuItems || item.navbarItems;
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (this.currentPath.length > 1 &&
|
|
97
|
-
item.id === this.currentPath[this.currentPath.length - 2] &&
|
|
98
|
-
item.menuItems?.some(({ id }) => id === this.lastCurrent)) {
|
|
99
|
-
this.parentItem = item;
|
|
100
|
-
this.menuType = item.menuItems?.length ? 'menu' : 'menubar';
|
|
101
|
-
this.menuItems = item.menuItems || item.navbarItems;
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (item.navbarItems?.length) {
|
|
105
|
-
this.setupData(item.navbarItems, item);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
get menuItemsElement() {
|
|
110
|
-
return Array.from(this.host.shadowRoot.querySelectorAll('[role="menuitem"]'));
|
|
111
|
-
}
|
|
112
|
-
/** Initialize tabindex on menuitems, setting -1 to all but the first one. */
|
|
113
|
-
initTabindex() {
|
|
114
|
-
this.menuItemsElement.forEach((item, index) => item.setAttribute('tabindex', index === 0 ? '0' : '-1'));
|
|
115
|
-
}
|
|
116
|
-
toggleMenu() {
|
|
117
|
-
if (this.open) {
|
|
118
|
-
this.open = false;
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
this.open = true;
|
|
122
|
-
setTimeout(() => {
|
|
123
|
-
this.initTabindex();
|
|
124
|
-
this.menuItemsElement[0]?.focus({ preventScroll: true });
|
|
125
|
-
}, 200);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
/** Handles keyboard navigation on mobile menu. */
|
|
129
|
-
handleItemKeydown(event) {
|
|
130
|
-
switch (event.key) {
|
|
131
|
-
case 'ArrowUp': {
|
|
132
|
-
event.preventDefault();
|
|
133
|
-
event.stopPropagation();
|
|
134
|
-
const items = this.menuItemsElement;
|
|
135
|
-
const currentIndex = items.indexOf(event.target);
|
|
136
|
-
const prevItem = items[(currentIndex - 1 + items.length) % items.length];
|
|
137
|
-
moveFocus(items[currentIndex], prevItem);
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
case 'ArrowDown': {
|
|
141
|
-
event.preventDefault();
|
|
142
|
-
event.stopPropagation();
|
|
143
|
-
const items = this.menuItemsElement;
|
|
144
|
-
const currentIndex = items.indexOf(event.target);
|
|
145
|
-
const nextItem = items[(currentIndex + 1) % items.length];
|
|
146
|
-
moveFocus(items[currentIndex], nextItem);
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
case 'Home': {
|
|
150
|
-
event.preventDefault();
|
|
151
|
-
event.stopPropagation();
|
|
152
|
-
moveFocus(event.target, this.menuItemsElement[0]);
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
case 'End': {
|
|
156
|
-
event.preventDefault();
|
|
157
|
-
event.stopPropagation();
|
|
158
|
-
moveFocus(event.target, this.menuItemsElement.pop());
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
connectedCallback() {
|
|
164
|
-
this.lastCurrent = this.currentPath?.length ? this.currentPath[this.currentPath.length - 1] : undefined;
|
|
165
|
-
this.setupData(this.items);
|
|
166
|
-
}
|
|
167
|
-
/** Close the menu when clicking outside. */
|
|
168
|
-
handleOutsideClick(event) {
|
|
169
|
-
if (containsTarget(this.host, event)) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
this.open = false;
|
|
173
|
-
}
|
|
174
|
-
/** Close the menu when pressing Escape or Tab. */
|
|
175
|
-
handleKeydown(event) {
|
|
176
|
-
switch (event.key) {
|
|
177
|
-
case 'Escape':
|
|
178
|
-
this.open = false;
|
|
179
|
-
break;
|
|
180
|
-
case 'Tab':
|
|
181
|
-
if (containsTarget(this.host, event)) {
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
this.open = false;
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
/** Close the menu when the focus goes out. */
|
|
189
|
-
handleFocusout(event) {
|
|
190
|
-
if (containsTarget(this.host, event)) {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
this.open = false;
|
|
194
|
-
}
|
|
195
|
-
render() {
|
|
196
|
-
return (h("nav", { key: '76079ce1e66f1b568f6e7eac1f67b91af0f2f48a', "aria-label": "Zanichelli.it" }, h("button", { key: '630b16be60aba3d7027fbe4b9e19e440cb454267', 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: '4c86d84d421ab93fb1c815c5a667dd55ce8254ac', name: this.open ? 'multiply' : 'burger-menu', width: "1.5rem", height: "1.5rem" })), h("z-logo", { key: '03c7b8613698098cf3a1ff4b1b8d649cb7d5b92a', imageAlt: "Logo Zanichelli", link: "/", height: 32, width: 126 }), h("zanit-search-form", { key: '5a1385991eebcf17ac8c275c8c69f6662f75e3b7', searchQuery: this.searchQuery, onResetSearch: () => (this.searchQuery = undefined), searchArea: this.searchArea, searchEnv: this.searchEnv }), this.open && (h("ul", { key: 'bc627e55f902beaac658f02d90ed78836fde193b', class: "mobile-menu", role: "menubar" }, !this.loading && this.currentPath && this.currentPath.length > 0 && (h("li", { key: '4708f9ee160d62a6cbf6333e11c1b9d02ae3d34c', role: "none" }, h("a", { key: '9fd59125f8cb87f6c86108eea7ba79a04bc4d68c', 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: '615bc59a1f058a745bdadd90c6f51f9abc757df1', name: "arrow-left", width: "0.5rem", height: "0.5rem" }), h("span", { key: '66a80691639e97b2d7d7d61cc45f8b47dcdabafe' }, 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: {
|
|
197
|
-
'menu-item': this.menuType === 'menu',
|
|
198
|
-
'menubar-item': this.menuType === 'menubar',
|
|
199
|
-
}, 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))))))))))));
|
|
200
|
-
}
|
|
201
|
-
static get delegatesFocus() { return true; }
|
|
202
|
-
static get watchers() { return {
|
|
203
|
-
"items": ["onItemsChange"],
|
|
204
|
-
"currentPath": ["onItemsChange"]
|
|
205
|
-
}; }
|
|
206
|
-
static get style() { return mobileMenubarCss + menuCss; }
|
|
207
|
-
}, [17, "zanit-mobile-menubar", {
|
|
208
|
-
"currentPath": [16, "current-path"],
|
|
209
|
-
"items": [16],
|
|
210
|
-
"searchQuery": [1025, "search-query"],
|
|
211
|
-
"loading": [4],
|
|
212
|
-
"searchEnv": [1, "search-env"],
|
|
213
|
-
"searchArea": [1, "search-area"],
|
|
214
|
-
"lastCurrent": [32],
|
|
215
|
-
"parentItem": [32],
|
|
216
|
-
"menuItems": [32],
|
|
217
|
-
"menuType": [32],
|
|
218
|
-
"open": [32]
|
|
219
|
-
}, [[5, "click", "handleOutsideClick"], [1, "keydown", "handleKeydown"], [5, "focusin", "handleFocusout"]], {
|
|
220
|
-
"items": ["onItemsChange"],
|
|
221
|
-
"currentPath": ["onItemsChange"]
|
|
222
|
-
}]);
|
|
223
|
-
function defineCustomElement() {
|
|
224
|
-
if (typeof customElements === "undefined") {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
const components = ["zanit-mobile-menubar", "zanit-search-form"];
|
|
228
|
-
components.forEach(tagName => { switch (tagName) {
|
|
229
|
-
case "zanit-mobile-menubar":
|
|
230
|
-
if (!customElements.get(tagName)) {
|
|
231
|
-
customElements.define(tagName, ZanitMobileMenubar);
|
|
232
|
-
}
|
|
233
|
-
break;
|
|
234
|
-
case "zanit-search-form":
|
|
235
|
-
if (!customElements.get(tagName)) {
|
|
236
|
-
defineCustomElement$1();
|
|
237
|
-
}
|
|
238
|
-
break;
|
|
239
|
-
} });
|
|
240
|
-
}
|
|
241
|
-
defineCustomElement();
|
|
242
|
-
|
|
243
|
-
export { Menu as M, ZanitMobileMenubar as Z, defineCustomElement as d };
|
|
244
|
-
//# sourceMappingURL=p-CPhDV9oz.js.map
|
|
245
|
-
|
|
246
|
-
//# sourceMappingURL=p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","src/components/menubar/mobile-menubar/mobile-menubar.css?tag=zanit-mobile-menubar&encapsulation=shadow","src/components/menubar/menu/menu.css?tag=zanit-mobile-menubar&encapsulation=shadow","src/components/menubar/mobile-menubar/mobile-menubar.tsx"],"sourcesContent":["import { FunctionalComponent, h } from '@stencil/core';\nimport { MenuItem } from '../../../utils';\n\n/**\n * Menu of items that can be grouped.\n * @member {string} controlledBy - The HTML id of the element that controls the menu.\n * @member {MenuItem[]} items - The items to show in the menu.\n * @member {string[]} currentPath - Path of current item.\n * @member {function} onItemKeyDown - The function to call when a key is pressed from a menuitem.\n */\nexport interface MenuProps {\n controlledBy?: string;\n items?: MenuItem[];\n currentPath?: string[];\n onItemKeyDown?: (event: KeyboardEvent) => void;\n}\n\nconst DEFAULT_GROUP_KEY = 'default';\nconst DEFAULT_GROUP = {\n id: DEFAULT_GROUP_KEY,\n label: DEFAULT_GROUP_KEY,\n};\n\n/** Get the items grouped by their group. */\nconst getGroupedItems = (items: MenuItem[]) => {\n const groups = items.reduce<{ group: MenuProps['items'][number]['group']; items: MenuItem[] }[]>((grouped, item) => {\n const itemGroup = grouped.find(({ group }) => group.id === (item.group?.id || DEFAULT_GROUP.id));\n if (!itemGroup) {\n grouped.push({ group: item.group ?? DEFAULT_GROUP, items: [item] });\n } else {\n itemGroup.items.push(item);\n }\n\n return grouped;\n }, []);\n\n // Sort to keep default group at the end\n return groups.sort((a, b) => (a.group.id === DEFAULT_GROUP_KEY ? 1 : b.group.id === DEFAULT_GROUP_KEY ? -1 : 0));\n};\n\n/**\n * Floating menu component. It shows a list of items that can be grouped.\n */\nexport const Menu: FunctionalComponent<MenuProps> = ({ controlledBy, items, currentPath = [], onItemKeyDown }) => {\n if (!items?.length) {\n return null;\n }\n\n const groups = getGroupedItems(items);\n\n const isActive = (item: MenuItem) => currentPath.includes(controlledBy) && currentPath.includes(item.id);\n\n return (\n <div\n class=\"menu-wrapper\"\n role=\"none\"\n >\n <div\n class=\"menu\"\n aria-labelledby={controlledBy ?? undefined}\n role=\"menu\"\n >\n {groups.map(({ group, items }) => (\n <div class={{ group: true, highlight: items.some((item) => item.highlight) }}>\n {group.id !== DEFAULT_GROUP_KEY ? (\n <div\n class=\"group-name\"\n id={group.id}\n >\n {group.label}\n </div>\n ) : groups.length > 1 ? (\n // empty div to keep the same height as the other groups\n <div class=\"group-name\" />\n ) : null}\n <ul\n class=\"menu-list\"\n role=\"group\"\n aria-labelledby={group.id !== DEFAULT_GROUP_KEY ? group.id : undefined}\n >\n {items.map((item) => (\n <li role=\"none\">\n {item.href && (\n <a\n class={{\n 'menu-item': true,\n 'active': isActive(item),\n }}\n href={item.href}\n role=\"menuitem\"\n tabIndex={-1}\n aria-current={isActive(item) ? 'page' : 'false'}\n onKeyDown={(event) => onItemKeyDown(event)}\n target={item.target}\n >\n {item.label}\n </a>\n )}\n </li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n </div>\n );\n};\n",":host {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n max-width: 100%;\n height: 3rem;\n background-color: #fff;\n color: var(--gray900);\n fill: var(--gray900);\n font-family: var(--font-family-sans);\n}\n\n:host,\n*,\n::before,\n::after {\n box-sizing: border-box;\n}\n\n*:focus:focus-visible {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\nul {\n padding: 0;\n margin: 0;\n list-style: none;\n}\n\na {\n color: var(--gray900);\n cursor: pointer;\n text-decoration: none;\n}\n\nbutton {\n all: unset;\n cursor: pointer;\n}\n\nnav {\n display: flex;\n width: 100%;\n align-items: center;\n padding-left: var(--grid-margin);\n gap: 8px;\n}\n\nnav::after {\n position: absolute;\n top: 0;\n right: 0;\n width: 100%;\n height: 100%;\n background: transparent;\n box-shadow: var(--shadow-1);\n content: '';\n pointer-events: none;\n}\n\nz-logo {\n margin: 8px 0;\n}\n\n.mobile-menu {\n position: absolute;\n top: 100%;\n left: 0;\n display: flex;\n overflow: auto;\n width: 100%;\n max-height: calc(100vh - 48px - var(--zanit-menubar-top-offset, 0px));\n flex-direction: column;\n padding: 16px var(--grid-margin) 32px;\n background-color: #fff;\n box-shadow: var(--shadow-2);\n gap: 8px;\n}\n\n.mobile-menu li {\n width: 100%;\n}\n\n.mobile-menu .items-container {\n display: flex;\n min-height: 256px;\n flex-direction: column;\n gap: 8px;\n}\n\n.mobile-menu .items-container z-ghost-loading {\n width: 40%;\n height: 1.2rem;\n}\n\n.mobile-menu .items-container .menubar-item {\n display: block;\n width: 100%;\n padding: 8px 0;\n font-size: 1rem;\n text-align: left;\n}\n\n.mobile-menu .items-container li:not(:last-child) .menubar-item {\n border-bottom: 1px solid #000;\n}\n\n[role='menuitem'].parent {\n display: flex;\n width: fit-content;\n align-items: center;\n padding: 0;\n border: none;\n font-size: 0.875rem;\n gap: 8px;\n}\n\nzanit-search-form {\n margin-left: auto;\n}\n",".menu-wrapper {\n width: 100%;\n background-color: #fff;\n}\n\n.menu {\n position: relative;\n display: flex;\n width: 100%;\n flex-direction: column;\n gap: 32px 0;\n}\n\n.menu .group {\n display: flex;\n flex-direction: column;\n}\n\n.menu .group .group-name {\n border-bottom: 1px solid currentcolor;\n margin-bottom: 4px;\n color: var(--red500);\n font-size: 0.875rem;\n font-weight: var(--font-md);\n}\n\n.menu .group .menu-list {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.menu .group .menu-list .menu-item {\n display: block;\n border-bottom: 2px solid transparent;\n font-size: 0.875rem;\n font-weight: var(--font-md);\n}\n\n.menu .menu-list .menu-item.active,\n.menu .menu-list .menu-item:hover {\n border-bottom-color: var(--red500);\n}\n\n.menu .group.highlight .menu-list .menu-item {\n font-size: 1rem;\n}\n\n@media (width >= 768px) {\n .menu-wrapper {\n position: absolute;\n top: 100%;\n left: 0;\n display: flex;\n justify-content: center;\n box-shadow: var(--shadow-1);\n }\n\n .menu {\n display: grid;\n width: 100%;\n max-width: var(--zanit-menubar-max-width, 1366px);\n padding: 16px var(--grid-margin);\n gap: 0 24px;\n grid-auto-columns: minmax(0, max-content);\n grid-auto-flow: column;\n grid-template-rows: minmax(0, max-content) max-content;\n }\n\n .menu .group {\n display: grid;\n grid-row: 1 / -1;\n grid-template-columns: 1fr;\n grid-template-rows: subgrid;\n }\n\n @supports not (grid-template-rows: subgrid) {\n .menu .group {\n grid-template-rows: repeat(auto-fit, minmax(0, max-content));\n }\n }\n\n .menu .group .group-name {\n border: none;\n margin-bottom: 16px;\n }\n\n .menu .group .menu-list .menu-item {\n font-size: 1rem;\n }\n\n .menu .group.highlight .menu-list .menu-item {\n font-size: 1.5rem;\n }\n}\n","import { Component, Element, h, Listen, Prop, State, Watch } from '@stencil/core';\nimport { MenubarItem, MenuItem } from '../../../utils';\nimport { Menu } from '../menu/menu';\nimport { containsTarget, moveFocus } from '../../../utils';\nimport { SearchEnv } from '../../../utils/subjects.api';\n\n/** Mobile menubar component. */\n@Component({\n tag: 'zanit-mobile-menubar',\n styleUrls: ['mobile-menubar.css', '../menu/menu.css'],\n shadow: {\n delegatesFocus: true,\n },\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 /** Environment for search suggestions */\n @Prop() searchEnv: SearchEnv = SearchEnv.PROD;\n\n /** Search area (e.g. \"SCUOLA\", \"UNIVERSITÀ\", \"DIZIONARI\"). */\n @Prop() searchArea?: string | undefined;\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({ preventScroll: true });\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 <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\n <z-logo\n imageAlt=\"Logo Zanichelli\"\n link=\"/\"\n height={32}\n width={126}\n ></z-logo>\n\n <zanit-search-form\n searchQuery={this.searchQuery}\n onResetSearch={() => (this.searchQuery = undefined)}\n searchArea={this.searchArea}\n searchEnv={this.searchEnv}\n />\n\n {this.open && (\n <ul\n class=\"mobile-menu\"\n role=\"menubar\"\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"],"version":3}
|