@zanichelli/zanichelli-it-frontend-kit 0.1.2 → 0.1.3
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/types/components/menubar/menu/menu.d.ts +2 -2
- package/dist/types/components/menubar/menubar.d.ts +4 -1
- package/dist/types/components/menubar/mobile-menubar/mobile-menubar.d.ts +4 -3
- package/dist/types/components.d.ts +8 -8
- package/dist/zanichelli-it-frontend-kit/index-BQ_orCyU.js +4170 -0
- package/dist/zanichelli-it-frontend-kit/index-BQ_orCyU.js.map +1 -0
- package/dist/zanichelli-it-frontend-kit/index.esm.js +10 -0
- package/dist/zanichelli-it-frontend-kit/index.esm.js.map +1 -1
- package/dist/zanichelli-it-frontend-kit/menu-Cd2leC2L.js +46 -0
- package/dist/zanichelli-it-frontend-kit/menu-Cd2leC2L.js.map +1 -0
- package/dist/{collection/utils/utils.js → zanichelli-it-frontend-kit/utils-CaxAWyZI.js} +7 -3
- package/dist/zanichelli-it-frontend-kit/utils-CaxAWyZI.js.map +1 -0
- package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.css +993 -1
- package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.esm.js +49 -1
- package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.esm.js.map +1 -1
- package/dist/zanichelli-it-frontend-kit/zanit-menubar.entry.esm.js.map +1 -0
- package/dist/{components/zanit-menubar.js → zanichelli-it-frontend-kit/zanit-menubar.entry.js} +36 -60
- package/dist/zanichelli-it-frontend-kit/zanit-menubar.entry.js.map +1 -0
- package/dist/zanichelli-it-frontend-kit/zanit-mobile-menubar.entry.esm.js.map +1 -0
- package/dist/{components/p-CWNmI_TK.js → zanichelli-it-frontend-kit/zanit-mobile-menubar.entry.js} +31 -96
- package/dist/zanichelli-it-frontend-kit/zanit-mobile-menubar.entry.js.map +1 -0
- package/dist/zanichelli-it-frontend-kit/zanit-search-form.entry.esm.js.map +1 -0
- package/dist/{components/p-Cphl7FvH.js → zanichelli-it-frontend-kit/zanit-search-form.entry.js} +13 -53
- package/dist/zanichelli-it-frontend-kit/zanit-search-form.entry.js.map +1 -0
- package/package.json +1 -1
- package/www/build/index-BQ_orCyU.js +4170 -0
- package/www/build/index-BQ_orCyU.js.map +1 -0
- package/www/build/index.esm.js +10 -0
- package/www/build/index.esm.js.map +1 -1
- package/www/build/menu-Cd2leC2L.js +46 -0
- package/www/build/menu-Cd2leC2L.js.map +1 -0
- package/www/build/utils-CaxAWyZI.js +21 -0
- package/www/build/utils-CaxAWyZI.js.map +1 -0
- package/www/build/zanichelli-it-frontend-kit.css +993 -1
- package/www/build/zanichelli-it-frontend-kit.esm.js +49 -1
- package/www/build/zanichelli-it-frontend-kit.esm.js.map +1 -1
- package/www/build/zanit-menubar.entry.esm.js.map +1 -0
- package/{dist/collection/components/menubar/menubar.js → www/build/zanit-menubar.entry.js} +46 -177
- package/www/build/zanit-menubar.entry.js.map +1 -0
- package/www/build/zanit-mobile-menubar.entry.esm.js.map +1 -0
- package/www/build/zanit-mobile-menubar.entry.js +159 -0
- package/www/build/zanit-mobile-menubar.entry.js.map +1 -0
- package/www/build/zanit-search-form.entry.esm.js.map +1 -0
- package/{dist/collection/components/menubar/search-form/search-form.js → www/build/zanit-search-form.entry.js} +23 -101
- package/www/build/zanit-search-form.entry.js.map +1 -0
- package/www/index.html +185 -37
- package/dist/cjs/index-C45Wd3rZ.js +0 -1535
- package/dist/cjs/index-C45Wd3rZ.js.map +0 -1
- package/dist/cjs/index.cjs.js +0 -5
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js +0 -15
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/zanichelli-it-frontend-kit.cjs.js +0 -27
- package/dist/cjs/zanichelli-it-frontend-kit.cjs.js.map +0 -1
- package/dist/cjs/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.cjs.js.map +0 -1
- package/dist/cjs/zanit-menubar_3.cjs.entry.js +0 -648
- package/dist/cjs/zanit-menubar_3.cjs.entry.js.map +0 -1
- package/dist/collection/collection-manifest.json +0 -14
- package/dist/collection/components/menubar/menu/menu.css +0 -98
- package/dist/collection/components/menubar/menu/menu.js +0 -34
- package/dist/collection/components/menubar/menu/menu.js.map +0 -1
- package/dist/collection/components/menubar/menubar.css +0 -171
- package/dist/collection/components/menubar/menubar.js.map +0 -1
- package/dist/collection/components/menubar/mobile-menubar/mobile-menubar.css +0 -114
- package/dist/collection/components/menubar/mobile-menubar/mobile-menubar.js +0 -280
- package/dist/collection/components/menubar/mobile-menubar/mobile-menubar.js.map +0 -1
- package/dist/collection/components/menubar/search-form/search-form.css +0 -147
- package/dist/collection/components/menubar/search-form/search-form.js.map +0 -1
- package/dist/collection/index.js +0 -11
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/utils/types.js +0 -2
- package/dist/collection/utils/types.js.map +0 -1
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/components/index.js +0 -1293
- package/dist/components/index.js.map +0 -1
- package/dist/components/p-CWNmI_TK.js.map +0 -1
- package/dist/components/p-Cphl7FvH.js.map +0 -1
- package/dist/components/zanit-menubar.js.map +0 -1
- package/dist/components/zanit-mobile-menubar.js +0 -9
- package/dist/components/zanit-mobile-menubar.js.map +0 -1
- package/dist/components/zanit-search-form.js +0 -9
- package/dist/components/zanit-search-form.js.map +0 -1
- package/dist/esm/index-BGwuI2U_.js +0 -1507
- package/dist/esm/index-BGwuI2U_.js.map +0 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js +0 -13
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/zanichelli-it-frontend-kit.js +0 -23
- package/dist/esm/zanichelli-it-frontend-kit.js.map +0 -1
- package/dist/esm/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.js.map +0 -1
- package/dist/esm/zanit-menubar_3.entry.js +0 -644
- package/dist/esm/zanit-menubar_3.entry.js.map +0 -1
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/zanichelli-it-frontend-kit/p-BGwuI2U_.js +0 -3
- package/dist/zanichelli-it-frontend-kit/p-BGwuI2U_.js.map +0 -1
- package/dist/zanichelli-it-frontend-kit/p-b064a657.entry.js +0 -2
- package/dist/zanichelli-it-frontend-kit/p-b064a657.entry.js.map +0 -1
- package/dist/zanichelli-it-frontend-kit/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.esm.js.map +0 -1
- package/www/build/p-984b8fa6.css +0 -1
- package/www/build/p-BGwuI2U_.js +0 -3
- package/www/build/p-BGwuI2U_.js.map +0 -1
- package/www/build/p-b064a657.entry.js +0 -2
- package/www/build/p-b064a657.entry.js.map +0 -1
- package/www/build/p-ff7fd122.js +0 -2
- package/www/build/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.esm.js.map +0 -1
|
@@ -1,114 +0,0 @@
|
|
|
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,280 +0,0 @@
|
|
|
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;
|
|
7
|
-
/** ID of the current active item. */
|
|
8
|
-
current = undefined;
|
|
9
|
-
/** Menubar items. */
|
|
10
|
-
items = [];
|
|
11
|
-
/** Initial search query. */
|
|
12
|
-
searchQuery = undefined;
|
|
13
|
-
/** Whether the menubar is loading the data. */
|
|
14
|
-
loading = false;
|
|
15
|
-
parentItem = undefined;
|
|
16
|
-
menuItems = undefined;
|
|
17
|
-
/** Whether the items to render come from a menubar or a menu. */
|
|
18
|
-
menuType = undefined;
|
|
19
|
-
open;
|
|
20
|
-
onItemsChange() {
|
|
21
|
-
this.setupData(this.items);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Find the current item and take its parent, `menuItems` or the `navbarItems`.
|
|
25
|
-
* @returns True if an item matches the `current` prop, false otherwise.
|
|
26
|
-
*/
|
|
27
|
-
setupData(items, parent) {
|
|
28
|
-
for (const item of items) {
|
|
29
|
-
if (item.id === this.current) {
|
|
30
|
-
const type = item.menuItems?.length ? 'menu' : 'menubar';
|
|
31
|
-
this.parentItem = parent;
|
|
32
|
-
this.menuType = type;
|
|
33
|
-
this.menuItems = item.menuItems || item.navbarItems;
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
if (item.menuItems?.some(({ id }) => id === this.current)) {
|
|
37
|
-
this.parentItem = parent;
|
|
38
|
-
this.menuType = 'menu';
|
|
39
|
-
this.menuItems = item.menuItems;
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
if (item.navbarItems?.length) {
|
|
43
|
-
return this.setupData(item.navbarItems, item);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
get menuItemsElement() {
|
|
49
|
-
return Array.from(this.host.shadowRoot.querySelectorAll('[role="menuitem"]'));
|
|
50
|
-
}
|
|
51
|
-
/** Initialize tabindex on menuitems, setting -1 to all but the first one. */
|
|
52
|
-
initTabindex() {
|
|
53
|
-
this.menuItemsElement.forEach((item, index) => item.setAttribute('tabindex', index === 0 ? '0' : '-1'));
|
|
54
|
-
}
|
|
55
|
-
toggleMenu() {
|
|
56
|
-
if (this.open) {
|
|
57
|
-
this.open = false;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
this.open = true;
|
|
61
|
-
setTimeout(() => {
|
|
62
|
-
this.initTabindex();
|
|
63
|
-
this.menuItemsElement[0]?.focus();
|
|
64
|
-
}, 200);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/** Handles keyboard navigation on mobile menu. */
|
|
68
|
-
handleItemKeydown(event) {
|
|
69
|
-
switch (event.key) {
|
|
70
|
-
case 'ArrowUp': {
|
|
71
|
-
event.preventDefault();
|
|
72
|
-
event.stopPropagation();
|
|
73
|
-
const items = this.menuItemsElement;
|
|
74
|
-
const currentIndex = items.indexOf(event.target);
|
|
75
|
-
const prevItem = items[(currentIndex - 1 + items.length) % items.length];
|
|
76
|
-
moveFocus(items[currentIndex], prevItem);
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
case 'ArrowDown': {
|
|
80
|
-
event.preventDefault();
|
|
81
|
-
event.stopPropagation();
|
|
82
|
-
const items = this.menuItemsElement;
|
|
83
|
-
const currentIndex = items.indexOf(event.target);
|
|
84
|
-
const nextItem = items[(currentIndex + 1) % items.length];
|
|
85
|
-
moveFocus(items[currentIndex], nextItem);
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
case 'Home': {
|
|
89
|
-
event.preventDefault();
|
|
90
|
-
event.stopPropagation();
|
|
91
|
-
moveFocus(event.target, this.menuItemsElement[0]);
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
case 'End': {
|
|
95
|
-
event.preventDefault();
|
|
96
|
-
event.stopPropagation();
|
|
97
|
-
moveFocus(event.target, this.menuItemsElement.pop());
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
connectedCallback() {
|
|
103
|
-
this.setupData(this.items);
|
|
104
|
-
}
|
|
105
|
-
/** Close the menu when clicking outside. */
|
|
106
|
-
handleOutsideClick(event) {
|
|
107
|
-
if (containsTarget(this.host, event)) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
this.open = false;
|
|
111
|
-
}
|
|
112
|
-
/** Close the menu when pressing Escape or Tab. */
|
|
113
|
-
handleKeydown(event) {
|
|
114
|
-
switch (event.key) {
|
|
115
|
-
case 'Escape':
|
|
116
|
-
this.open = false;
|
|
117
|
-
break;
|
|
118
|
-
case 'Tab':
|
|
119
|
-
if (containsTarget(this.host, event)) {
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
this.open = false;
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/** Close the menu when the focus goes out. */
|
|
127
|
-
handleFocusout(event) {
|
|
128
|
-
if (containsTarget(this.host, event)) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
this.open = false;
|
|
132
|
-
}
|
|
133
|
-
render() {
|
|
134
|
-
return (h("nav", { key: 'df6d04c4bb8343ec62fe69df3f01f6f47b4367cf', "aria-label": "Zanichelli.it" }, h("z-logo", { key: '3403d6548e16d131c4ce81c624e761e523b65562', imageAlt: "Logo Zanichelli", link: "/", height: 32, width: 126 }), h("button", { key: '198db21866d9a2b86e9094ae0d6d84c48953f3a6', 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: '549b5327194978ee9b23fb8a2839d73d06bfd6f8', name: this.open ? 'multiply' : 'burger-menu', width: "1.5rem", height: "1.5rem" })), this.open && (h("ul", { key: '27933ec0651b98039598a5e1d26d144ea7c3c73a', class: "mobile-menu", role: "menubar" }, h("li", { key: '09f8dbe1534e0f97df17e34a6f9b075f8dce10dd', role: "none" }, h("zanit-search-form", { key: '64e5fa4b8d9217646da95204583da333ec0f8f6d', searchQuery: this.searchQuery, onResetSearch: () => (this.searchQuery = undefined) })), !this.loading && this.current && (h("li", { key: 'b5dcca1a67de785caa2f5247c850437abb20e5e2', role: "none" }, h("a", { key: '14d386b83ef96ae92070e9e738fdf70e6e0e6ef2', class: "parent", href: this.parentItem?.href ?? '/', id: this.parentItem?.id ?? undefined, role: "menuitem", tabIndex: -1, onKeyDown: (event) => this.handleItemKeydown(event) }, h("z-icon", { key: '7851e7a47f5723029d9ce0bf85e4010025509caf', name: "arrow-left", width: "0.5rem", height: "0.5rem" }), h("span", { key: 'ab158b0c1350eedbb4c4270b2d9d111ae732af95' }, this.parentItem?.label ?? 'Home')))), this.loading && (h("div", { key: '9d4a6b292cbf067a3f5b743daff5a26bfcfaf403', 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, current: this.current, onItemKeyDown: (event) => this.handleItemKeydown(event) })) : (this.menuItems?.length && (h("div", { class: "items-container", role: "none" }, this.menuItems.map((item) => (h("li", { role: "none" }, h("a", { class: {
|
|
135
|
-
'menu-item': this.menuType === 'menu',
|
|
136
|
-
'menubar-item': this.menuType === 'menubar',
|
|
137
|
-
}, href: item.href, id: item.id, role: "menuitem", "aria-current": this.current === item.id ? 'page' : 'false', tabIndex: -1, onKeyDown: (event) => this.handleItemKeydown(event) }, h("span", { "data-text": item.label }, item.label))))))))))));
|
|
138
|
-
}
|
|
139
|
-
static get is() { return "zanit-mobile-menubar"; }
|
|
140
|
-
static get encapsulation() { return "shadow"; }
|
|
141
|
-
static get originalStyleUrls() {
|
|
142
|
-
return {
|
|
143
|
-
"$": ["mobile-menubar.css", "../menu/menu.css"]
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
static get styleUrls() {
|
|
147
|
-
return {
|
|
148
|
-
"$": ["mobile-menubar.css", "../menu/menu.css"]
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
static get properties() {
|
|
152
|
-
return {
|
|
153
|
-
"current": {
|
|
154
|
-
"type": "string",
|
|
155
|
-
"attribute": "current",
|
|
156
|
-
"mutable": false,
|
|
157
|
-
"complexType": {
|
|
158
|
-
"original": "string | undefined",
|
|
159
|
-
"resolved": "string",
|
|
160
|
-
"references": {}
|
|
161
|
-
},
|
|
162
|
-
"required": false,
|
|
163
|
-
"optional": false,
|
|
164
|
-
"docs": {
|
|
165
|
-
"tags": [],
|
|
166
|
-
"text": "ID of the current active item."
|
|
167
|
-
},
|
|
168
|
-
"getter": false,
|
|
169
|
-
"setter": false,
|
|
170
|
-
"reflect": false,
|
|
171
|
-
"defaultValue": "undefined"
|
|
172
|
-
},
|
|
173
|
-
"items": {
|
|
174
|
-
"type": "unknown",
|
|
175
|
-
"attribute": "items",
|
|
176
|
-
"mutable": false,
|
|
177
|
-
"complexType": {
|
|
178
|
-
"original": "MenubarItem[]",
|
|
179
|
-
"resolved": "MenubarItem[]",
|
|
180
|
-
"references": {
|
|
181
|
-
"MenubarItem": {
|
|
182
|
-
"location": "import",
|
|
183
|
-
"path": "../../../utils/types",
|
|
184
|
-
"id": "src/utils/types.ts::MenubarItem"
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
"required": false,
|
|
189
|
-
"optional": false,
|
|
190
|
-
"docs": {
|
|
191
|
-
"tags": [],
|
|
192
|
-
"text": "Menubar items."
|
|
193
|
-
},
|
|
194
|
-
"getter": false,
|
|
195
|
-
"setter": false,
|
|
196
|
-
"defaultValue": "[]"
|
|
197
|
-
},
|
|
198
|
-
"searchQuery": {
|
|
199
|
-
"type": "string",
|
|
200
|
-
"attribute": "search-query",
|
|
201
|
-
"mutable": true,
|
|
202
|
-
"complexType": {
|
|
203
|
-
"original": "string | undefined",
|
|
204
|
-
"resolved": "string",
|
|
205
|
-
"references": {}
|
|
206
|
-
},
|
|
207
|
-
"required": false,
|
|
208
|
-
"optional": false,
|
|
209
|
-
"docs": {
|
|
210
|
-
"tags": [],
|
|
211
|
-
"text": "Initial search query."
|
|
212
|
-
},
|
|
213
|
-
"getter": false,
|
|
214
|
-
"setter": false,
|
|
215
|
-
"reflect": false,
|
|
216
|
-
"defaultValue": "undefined"
|
|
217
|
-
},
|
|
218
|
-
"loading": {
|
|
219
|
-
"type": "boolean",
|
|
220
|
-
"attribute": "loading",
|
|
221
|
-
"mutable": false,
|
|
222
|
-
"complexType": {
|
|
223
|
-
"original": "boolean",
|
|
224
|
-
"resolved": "boolean",
|
|
225
|
-
"references": {}
|
|
226
|
-
},
|
|
227
|
-
"required": false,
|
|
228
|
-
"optional": false,
|
|
229
|
-
"docs": {
|
|
230
|
-
"tags": [],
|
|
231
|
-
"text": "Whether the menubar is loading the data."
|
|
232
|
-
},
|
|
233
|
-
"getter": false,
|
|
234
|
-
"setter": false,
|
|
235
|
-
"reflect": false,
|
|
236
|
-
"defaultValue": "false"
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
static get states() {
|
|
241
|
-
return {
|
|
242
|
-
"parentItem": {},
|
|
243
|
-
"menuItems": {},
|
|
244
|
-
"menuType": {},
|
|
245
|
-
"open": {}
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
static get elementRef() { return "host"; }
|
|
249
|
-
static get watchers() {
|
|
250
|
-
return [{
|
|
251
|
-
"propName": "items",
|
|
252
|
-
"methodName": "onItemsChange"
|
|
253
|
-
}, {
|
|
254
|
-
"propName": "current",
|
|
255
|
-
"methodName": "onItemsChange"
|
|
256
|
-
}];
|
|
257
|
-
}
|
|
258
|
-
static get listeners() {
|
|
259
|
-
return [{
|
|
260
|
-
"name": "click",
|
|
261
|
-
"method": "handleOutsideClick",
|
|
262
|
-
"target": "document",
|
|
263
|
-
"capture": false,
|
|
264
|
-
"passive": true
|
|
265
|
-
}, {
|
|
266
|
-
"name": "keydown",
|
|
267
|
-
"method": "handleKeydown",
|
|
268
|
-
"target": undefined,
|
|
269
|
-
"capture": false,
|
|
270
|
-
"passive": true
|
|
271
|
-
}, {
|
|
272
|
-
"name": "focusin",
|
|
273
|
-
"method": "handleFocusout",
|
|
274
|
-
"target": "document",
|
|
275
|
-
"capture": false,
|
|
276
|
-
"passive": true
|
|
277
|
-
}];
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
//# sourceMappingURL=mobile-menubar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;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AC,CAAC,CAC1B,EAAC,IAAI,IACH,KAAK,EAAE,IAAI,CAAC,SAAS,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,GACvD,CACH,CAAC,CAAC,CAAC,CACF,IAAI,CAAC,SAAS,EAAE,MAAM,IAAI,CACxB,WACE,KAAK,EAAC,iBAAiB,EACvB,IAAI,EAAC,MAAM,IAEV,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC5B,UAAI,IAAI,EAAC,MAAM;oBACb,SACE,KAAK,EAAE;4BACL,WAAW,EAAE,IAAI,CAAC,QAAQ,KAAK,MAAM;4BACrC,cAAc,EAAE,IAAI,CAAC,QAAQ,KAAK,SAAS;yBAC5C,EACD,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,IAAI,EAAC,UAAU,kBACD,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EACzD,QAAQ,EAAE,CAAC,CAAC,EACZ,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC;wBAEnD,yBAAiB,IAAI,CAAC,KAAK,IAAG,IAAI,CAAC,KAAK,CAAQ,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 /** ID of the current active item. */\n @Prop() current: string | undefined = undefined;\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 @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('current')\n onItemsChange() {\n this.setupData(this.items);\n }\n\n /**\n * Find the current item and take its parent, `menuItems` or the `navbarItems`.\n * @returns True if an item matches the `current` prop, false otherwise.\n */\n private setupData(items: MenubarItem[], parent?: MenubarItem): boolean {\n for (const item of items) {\n if (item.id === this.current) {\n const type = item.menuItems?.length ? 'menu' : 'menubar';\n this.parentItem = parent;\n this.menuType = type;\n this.menuItems = item.menuItems || item.navbarItems;\n return true;\n }\n\n if (item.menuItems?.some(({ id }) => id === this.current)) {\n this.parentItem = parent;\n this.menuType = 'menu';\n this.menuItems = item.menuItems;\n return true;\n }\n\n if (item.navbarItems?.length) {\n return this.setupData(item.navbarItems, item);\n }\n }\n\n return false;\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.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.current && (\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 >\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 )}\n\n {this.menuType === 'menu' ? (\n <Menu\n items={this.menuItems}\n current={this.current}\n onItemKeyDown={(event) => this.handleItemKeydown(event)}\n />\n ) : (\n this.menuItems?.length && (\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.current === item.id ? 'page' : 'false'}\n tabIndex={-1}\n onKeyDown={(event) => this.handleItemKeydown(event)}\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"]}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
:host,
|
|
2
|
-
*,
|
|
3
|
-
::before,
|
|
4
|
-
::after {
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
*:focus:focus-visible {
|
|
9
|
-
box-shadow: var(--shadow-focus-primary);
|
|
10
|
-
outline: none;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
button {
|
|
14
|
-
all: unset;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@media (width < 768px) {
|
|
19
|
-
.searchbar {
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
border: 1px solid #000;
|
|
23
|
-
border-radius: 4px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.searchbar > *:first-child {
|
|
27
|
-
/* To have a seamless appearance of the border radius of an internal child element nested within a parent element with rounded borders, we need to subtract the parent's border thickness from the child's border radius. Inner Radius = Outer Radius - Border Thickness */
|
|
28
|
-
border-bottom-left-radius: 3px;
|
|
29
|
-
border-top-left-radius: 3px;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.searchbar button[type='reset'] {
|
|
33
|
-
display: flex;
|
|
34
|
-
padding: 0 0 0 8px;
|
|
35
|
-
cursor: pointer;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.searchbar input {
|
|
39
|
-
width: 100%;
|
|
40
|
-
height: 100%;
|
|
41
|
-
padding: 4px 8px;
|
|
42
|
-
border: none;
|
|
43
|
-
background-color: #fff;
|
|
44
|
-
font-family: var(--font-family-sans);
|
|
45
|
-
font-size: 1rem;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.searchbar input[type='search']::-webkit-search-cancel-button,
|
|
49
|
-
.searchbar input[type='search']::-webkit-search-decoration {
|
|
50
|
-
appearance: none;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.searchbar input::placeholder {
|
|
54
|
-
color: var(--gray500);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.searchbar .searchbar-button {
|
|
58
|
-
padding: 4px 8px;
|
|
59
|
-
border-left: 1px solid #000;
|
|
60
|
-
background: var(--zanit-accent-color);
|
|
61
|
-
border-bottom-right-radius: 3px;
|
|
62
|
-
border-top-right-radius: 3px;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.searchbar input:focus:focus-visible,
|
|
66
|
-
.searchbar .searchbar-button:focus:focus-visible {
|
|
67
|
-
z-index: 1;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@media (width >= 768px) {
|
|
72
|
-
.searchbar {
|
|
73
|
-
display: flex;
|
|
74
|
-
font-size: 1.5rem;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.searchbar.searchbar-open {
|
|
78
|
-
position: absolute;
|
|
79
|
-
width: 100%;
|
|
80
|
-
height: 100%;
|
|
81
|
-
inset: 0;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.searchbar .input-wrapper {
|
|
85
|
-
display: none;
|
|
86
|
-
width: 100%;
|
|
87
|
-
align-items: center;
|
|
88
|
-
padding: 0 0 0 var(--grid-margin);
|
|
89
|
-
background-color: #fff;
|
|
90
|
-
gap: 14px;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.searchbar .input-wrapper:not(.hide) {
|
|
94
|
-
display: flex;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.searchbar button[type='reset'] {
|
|
98
|
-
display: flex;
|
|
99
|
-
align-items: center;
|
|
100
|
-
border-radius: 4px;
|
|
101
|
-
cursor: pointer;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.searchbar input {
|
|
105
|
-
z-index: 1;
|
|
106
|
-
width: 100%;
|
|
107
|
-
height: 100%;
|
|
108
|
-
padding: 8px 14px 8px 0;
|
|
109
|
-
border: none;
|
|
110
|
-
background-color: #fff;
|
|
111
|
-
font-family: var(--font-family-sans);
|
|
112
|
-
font-size: inherit;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.searchbar input[type='search']::-webkit-search-cancel-button,
|
|
116
|
-
.searchbar input[type='search']::-webkit-search-decoration {
|
|
117
|
-
appearance: none;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.searchbar input::placeholder {
|
|
121
|
-
color: var(--gray500);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.searchbar .searchbar-button {
|
|
125
|
-
display: flex;
|
|
126
|
-
align-items: center;
|
|
127
|
-
padding: 8px 16px;
|
|
128
|
-
border-right: 1px solid #000;
|
|
129
|
-
border-left: 1px solid #000;
|
|
130
|
-
background: var(--zanit-accent-color);
|
|
131
|
-
font-family: inherit;
|
|
132
|
-
font-size: inherit;
|
|
133
|
-
gap: 64px;
|
|
134
|
-
line-height: 1;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.searchbar input:focus:focus-visible,
|
|
138
|
-
.searchbar .searchbar-button:focus:focus-visible {
|
|
139
|
-
z-index: 1;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
@media (width >= 768px) and (width < 1152px) {
|
|
144
|
-
.searchbar .searchbar-button > .searchbar-button-label {
|
|
145
|
-
display: none;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-form.js","sourceRoot":"","sources":["../../../../src/components/menubar/search-form/search-form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAOtD,MAAM,OAAO,eAAe;IAClB,WAAW,CAAkB;IAE1B,IAAI,CAA6B;IAG5C,QAAQ,GAAY,KAAK,CAA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EAAC,MAAM;gBAEV,IAAI,CAAC,WAAW,IAAI,CACnB,cACE,IAAI,EAAC,OAAO,gBACD,yBAAyB;oBAEpC,cACE,IAAI,EAAC,kBAAkB,EACvB,KAAK,EAAC,QAAQ,EACd,MAAM,EAAC,QAAQ,GACf,CACK,CACV;gBACD,aACE,EAAE,EAAC,iBAAiB,EACpB,IAAI,EAAC,GAAG,EACR,IAAI,EAAC,QAAQ,EACb,WAAW,EAAC,gCAAgC,EAC5C,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,EACjD,KAAK,EAAE,IAAI,CAAC,WAAW,EACvB,QAAQ,SACD,CACL;YAEN,cACE,KAAK,EAAC,kBAAkB,gBACb,OAAO,mBACJ,iBAAiB,EAC/B,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAC9C,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;gBAEzC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAM,KAAK,EAAC,wBAAwB,YAAa;gBAC9E,cACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,GACL,CACH,CACJ,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Listen, Prop, State, Watch } from '@stencil/core';\nimport { containsTarget } from '../../../utils/utils';\n\n@Component({\n tag: 'zanit-search-form',\n styleUrl: 'search-form.css',\n shadow: true,\n})\nexport class ZanitSearchForm {\n private formElement: HTMLFormElement;\n\n @Element() host: HTMLZanitSearchFormElement;\n\n @State()\n isMobile: boolean = false;\n\n /** Indicates whether the searchbar is visible and usable. */\n @State()\n showSearchbar: boolean = false;\n\n /** Search query to apply. */\n @State()\n _searchQuery: string | undefined = undefined;\n\n /** Initial search query */\n @Prop({ mutable: true })\n searchQuery: string | undefined = undefined;\n\n @Watch('searchQuery')\n onSearchQueryChange() {\n this._searchQuery = this.searchQuery;\n if (this.searchQuery) {\n this.showSearchbar = true;\n }\n }\n\n /** Focus searchbar input when it becomes visible. */\n @Watch('showSearchbar')\n onShowSearchbar() {\n if (!this.showSearchbar) {\n return;\n }\n\n setTimeout(() => {\n const searchbarInput = this.host.shadowRoot.querySelector('#searchbar-input') as HTMLInputElement;\n if (this.showSearchbar && !this.searchQuery) {\n searchbarInput.focus();\n }\n }, 100);\n }\n\n /** Emitted on search form submission. */\n @Event({ cancelable: true }) search: EventEmitter<{ query: string }>;\n\n @Event() resetSearch: EventEmitter<void>;\n\n async connectedCallback() {\n this.showSearchbar = !!this.searchQuery;\n const mobileMediaQuery = window.matchMedia('(width < 768px)');\n this.isMobile = mobileMediaQuery.matches;\n mobileMediaQuery.onchange = (mql) => {\n this.isMobile = mql.matches;\n };\n }\n\n /** Close open searchbar when clicking outside. */\n @Listen('click', { target: 'document', passive: true })\n handleOutsideClick(event: MouseEvent) {\n if (this.showSearchbar && this.formElement && !containsTarget(this.formElement, event)) {\n this.showSearchbar = false;\n }\n }\n\n private resetSearchQuery() {\n this.searchQuery = undefined;\n this.resetSearch.emit();\n }\n\n private handleInputChange(event: Event) {\n this._searchQuery = (event.target as HTMLInputElement).value;\n if (!this._searchQuery) {\n this.searchQuery = undefined;\n }\n }\n\n private onSearchSubmit(event: Event) {\n event.preventDefault();\n if (!this._searchQuery) {\n return;\n }\n\n this.showSearchbar = false;\n const searchEv = this.search.emit({ query: this._searchQuery });\n // do not submit the form if the event default behavior was prevented\n if (searchEv.defaultPrevented) {\n return;\n }\n\n this.formElement.submit();\n }\n\n render() {\n if (this.isMobile) {\n return (\n <form\n class=\"searchbar\"\n ref={(el) => (this.formElement = el)}\n role=\"search\"\n aria-label=\"Cerca\"\n method=\"get\"\n action=\"/ricerca\"\n onSubmit={(event) => this.onSearchSubmit(event)}\n onReset={() => this.resetSearchQuery()}\n >\n {this.searchQuery && (\n <button\n type=\"reset\"\n aria-label=\"Svuota campo di ricerca\"\n >\n <z-icon\n name=\"multiply-circled\"\n width=\"1rem\"\n height=\"1rem\"\n />\n </button>\n )}\n <input\n id=\"searchbar-input\"\n name=\"q\"\n type=\"search\"\n placeholder=\"Cerca per parola chiave o ISBN\"\n onInput={(event) => this.handleInputChange(event)}\n value={this.searchQuery}\n required\n ></input>\n <button\n class=\"searchbar-button\"\n aria-controls=\"searchbar-input\"\n aria-label=\"Cerca\"\n type=\"submit\"\n >\n <z-icon\n name=\"search\"\n width=\"1.25rem\"\n height=\"1.25rem\"\n ></z-icon>\n </button>\n </form>\n );\n }\n\n return (\n <form\n class={{ 'searchbar': true, 'searchbar-open': this.showSearchbar }}\n ref={(el) => (this.formElement = el)}\n role=\"search\"\n aria-label=\"Cerca\"\n method=\"get\"\n action=\"/ricerca\"\n onSubmit={(event) => this.onSearchSubmit(event)}\n onReset={() => this.resetSearchQuery()}\n >\n <div\n class={{ 'hide': !this.showSearchbar, 'input-wrapper': true }}\n role=\"none\"\n >\n {this.searchQuery && (\n <button\n type=\"reset\"\n aria-label=\"Svuota campo di ricerca\"\n >\n <z-icon\n name=\"multiply-circled\"\n width=\"1.5rem\"\n height=\"1.5rem\"\n />\n </button>\n )}\n <input\n id=\"searchbar-input\"\n name=\"q\"\n type=\"search\"\n placeholder=\"Cerca per parola chiave o ISBN\"\n onInput={(event) => this.handleInputChange(event)}\n value={this.searchQuery}\n required\n ></input>\n </div>\n\n <button\n class=\"searchbar-button\"\n aria-label=\"Cerca\"\n aria-controls=\"searchbar-input\"\n type={this.showSearchbar ? 'submit' : 'button'}\n onClick={() => (this.showSearchbar = true)}\n >\n {this.showSearchbar ? null : <span class=\"searchbar-button-label\">Cerca</span>}\n <z-icon\n name=\"search\"\n width=\"2rem\"\n height=\"2rem\"\n ></z-icon>\n </button>\n </form>\n );\n }\n}\n"]}
|
package/dist/collection/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview entry point for your component library
|
|
3
|
-
*
|
|
4
|
-
* This is the entry point for your component library. Use this file to export utilities,
|
|
5
|
-
* constants or data structure that accompany your components.
|
|
6
|
-
*
|
|
7
|
-
* DO NOT use this file to export your components. Instead, use the recommended approaches
|
|
8
|
-
* to consume components of this package as outlined in the `README.md`.
|
|
9
|
-
*/
|
|
10
|
-
export * from './utils/types';
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,cAAc,eAAe,CAAC","sourcesContent":["/**\n * @fileoverview entry point for your component library\n *\n * This is the entry point for your component library. Use this file to export utilities,\n * constants or data structure that accompany your components.\n *\n * DO NOT use this file to export your components. Instead, use the recommended approaches\n * to consume components of this package as outlined in the `README.md`.\n */\n\nexport type * from './components.d.ts';\nexport * from './utils/types';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"","sourcesContent":["export type MenuItem = {\n label: string;\n href?: string;\n highlight?: boolean;\n id?: string;\n group?: { id: string; label: string };\n};\n\nexport type MenubarItem = Omit<MenuItem, 'group' | 'highlight'> & {\n navbarItems?: MenubarItem[];\n menuItems?: MenuItem[];\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAqB,EAAE,KAAY,EAAE,EAAE;IACpE,OAAO,KAAK;SACT,YAAY,EAAE;SACd,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,MAAM,CAAC,MAAM,CAAC;SACvD,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAiB,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,0FAA0F;AAC1F,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAoB,EAAE,IAAiB,EAAE,EAAE;IACnE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAClB,IAAI,CAAC,KAAK,EAAE,CAAC;AACf,CAAC,CAAC","sourcesContent":["/**\n * Check if an element contains an event target by checking its composedPath.\n * Useful when an event target may come from a component's shadow DOM.\n */\nexport const containsTarget = (ancestor: HTMLElement, event: Event) => {\n return event\n .composedPath()\n .filter((el) => el !== document && el !== window.window)\n .some((el) => ancestor.contains(el as HTMLElement));\n};\n\n/** Move the focus to `next` element, set tabindex to 0 for `next` and -1 to `current`. */\nexport const moveFocus = (current: HTMLElement, next: HTMLElement) => {\n current.tabIndex = -1;\n next.tabIndex = 0;\n next.focus();\n};\n"]}
|