@zanichelli/albe-web-components 16.3.1 → 16.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/web-components-library.cjs.js +1 -1
- package/dist/cjs/z-app-header_12.cjs.entry.js +67 -17
- package/dist/cjs/z-app-header_12.cjs.entry.js.map +1 -1
- package/dist/cjs/z-menu-section.cjs.entry.js +28 -13
- package/dist/cjs/z-menu-section.cjs.entry.js.map +1 -1
- package/dist/cjs/z-menu.cjs.entry.js +89 -43
- package/dist/cjs/z-menu.cjs.entry.js.map +1 -1
- package/dist/collection/components/z-app-header/index.js +55 -13
- package/dist/collection/components/z-app-header/index.js.map +1 -1
- package/dist/collection/components/z-app-header/index.stories.js +50 -116
- package/dist/collection/components/z-app-header/index.stories.js.map +1 -1
- package/dist/collection/components/z-app-header/styles.css +34 -25
- package/dist/collection/components/z-menu/index.js +93 -42
- package/dist/collection/components/z-menu/index.js.map +1 -1
- package/dist/collection/components/z-menu/styles.css +40 -52
- package/dist/collection/components/z-menu-section/index.js +31 -16
- package/dist/collection/components/z-menu-section/index.js.map +1 -1
- package/dist/collection/components/z-menu-section/styles.css +8 -0
- package/dist/collection/components/z-searchbar/index.js +14 -5
- package/dist/collection/components/z-searchbar/index.js.map +1 -1
- package/dist/components/index23.js +14 -5
- package/dist/components/index23.js.map +1 -1
- package/dist/components/z-app-header.js +56 -14
- package/dist/components/z-app-header.js.map +1 -1
- package/dist/components/z-menu-section.js +30 -15
- package/dist/components/z-menu-section.js.map +1 -1
- package/dist/components/z-menu.js +89 -44
- package/dist/components/z-menu.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/web-components-library.js +1 -1
- package/dist/esm/z-app-header_12.entry.js +67 -17
- package/dist/esm/z-app-header_12.entry.js.map +1 -1
- package/dist/esm/z-menu-section.entry.js +28 -13
- package/dist/esm/z-menu-section.entry.js.map +1 -1
- package/dist/esm/z-menu.entry.js +89 -43
- package/dist/esm/z-menu.entry.js.map +1 -1
- package/dist/types/components/z-app-header/index.d.ts +4 -3
- package/dist/types/components/z-menu/index.d.ts +9 -1
- package/dist/types/components/z-menu-section/index.d.ts +4 -2
- package/dist/types/components/z-searchbar/index.d.ts +1 -0
- package/dist/web-components-library/p-8e5f1ae0.entry.js +2 -0
- package/dist/web-components-library/p-8e5f1ae0.entry.js.map +1 -0
- package/dist/web-components-library/p-b6e7866f.entry.js +2 -0
- package/dist/web-components-library/p-b6e7866f.entry.js.map +1 -0
- package/dist/web-components-library/p-fb0b11cd.entry.js +2 -0
- package/dist/web-components-library/p-fb0b11cd.entry.js.map +1 -0
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/dist/web-components-library/web-components-library.esm.js.map +1 -1
- package/package.json +1 -1
- package/www/build/p-38bf2bfc.js +2 -0
- package/www/build/p-8e5f1ae0.entry.js +2 -0
- package/www/build/p-8e5f1ae0.entry.js.map +1 -0
- package/www/build/p-b6e7866f.entry.js +2 -0
- package/www/build/p-b6e7866f.entry.js.map +1 -0
- package/www/build/p-fb0b11cd.entry.js +2 -0
- package/www/build/p-fb0b11cd.entry.js.map +1 -0
- package/www/build/web-components-library.esm.js +1 -1
- package/www/build/web-components-library.esm.js.map +1 -1
- package/www/index.html +1 -1
- package/dist/web-components-library/p-04c39e8a.entry.js +0 -2
- package/dist/web-components-library/p-04c39e8a.entry.js.map +0 -1
- package/dist/web-components-library/p-0542a3c9.entry.js +0 -2
- package/dist/web-components-library/p-0542a3c9.entry.js.map +0 -1
- package/dist/web-components-library/p-16d625b3.entry.js +0 -2
- package/dist/web-components-library/p-16d625b3.entry.js.map +0 -1
- package/www/build/p-04c39e8a.entry.js +0 -2
- package/www/build/p-04c39e8a.entry.js.map +0 -1
- package/www/build/p-0542a3c9.entry.js +0 -2
- package/www/build/p-0542a3c9.entry.js.map +0 -1
- package/www/build/p-16d625b3.entry.js +0 -2
- package/www/build/p-16d625b3.entry.js.map +0 -1
- package/www/build/p-ae5cec65.js +0 -2
|
@@ -62,7 +62,7 @@ export class ZAppHeader {
|
|
|
62
62
|
openDrawer() {
|
|
63
63
|
this.drawerOpen = true;
|
|
64
64
|
this.menuElements.forEach((element, index) => (element.htmlTabindex = index === 0 ? 0 : -1));
|
|
65
|
-
setTimeout(() => this.
|
|
65
|
+
setTimeout(() => this.menuElements[0].setFocus(), 400); /* wait for the 400ms offcanvas transition */
|
|
66
66
|
}
|
|
67
67
|
closeDrawer() {
|
|
68
68
|
this.drawerOpen = false;
|
|
@@ -109,17 +109,58 @@ export class ZAppHeader {
|
|
|
109
109
|
current.htmlTabindex = -1;
|
|
110
110
|
receiver.setFocus();
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
this.
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
onOffcanvasKeydown(ev) {
|
|
113
|
+
var _a, _b;
|
|
114
|
+
if (ev.key !== KeyboardCode.TAB || !this.drawerOpen) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const closestMenu = ev.target.closest("z-menu");
|
|
118
|
+
if (closestMenu) {
|
|
119
|
+
ev.preventDefault();
|
|
120
|
+
ev.stopPropagation();
|
|
121
|
+
// restore tabindex to the zmenu containing the focused element
|
|
122
|
+
closestMenu.htmlTabindex = 0;
|
|
123
|
+
this.closeDrawerButton.focus();
|
|
124
|
+
}
|
|
125
|
+
else if (ev.target === this.closeDrawerButton) {
|
|
126
|
+
ev.preventDefault();
|
|
127
|
+
ev.stopPropagation();
|
|
128
|
+
if (ev.shiftKey) {
|
|
129
|
+
// give focus to the last open menu if any or the last menu otherwhise
|
|
130
|
+
((_a = this.menuElements.filter((menu) => menu.open).pop()) !== null && _a !== void 0 ? _a : this.menuElements[this.menuLength - 1]).setFocus();
|
|
117
131
|
}
|
|
118
|
-
|
|
119
|
-
|
|
132
|
+
else {
|
|
133
|
+
// give focus to the first open menu if any or the first menu otherwhise
|
|
134
|
+
((_b = this.menuElements.find((menu) => menu.open)) !== null && _b !== void 0 ? _b : this.menuElements[0]).setFocus();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
120
137
|
}
|
|
121
|
-
|
|
138
|
+
/** Close each menu except the one receiving focus/click, if any */
|
|
139
|
+
manageMenus(ev) {
|
|
140
|
+
const targetMenu = this.menuElements.find((menu) => containsElement(menu, ev.target));
|
|
141
|
+
if (targetMenu) {
|
|
142
|
+
this.menuElements.forEach((menu) => {
|
|
143
|
+
if (menu === targetMenu) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
menu.htmlTabindex = -1;
|
|
147
|
+
if (!this.drawerOpen) {
|
|
148
|
+
menu.open = false;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
else if (!this.drawerOpen) {
|
|
153
|
+
this.menuElements.forEach((menu) => {
|
|
154
|
+
menu.open = false;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
handleKeydown(ev) {
|
|
122
159
|
var _a, _b;
|
|
160
|
+
if (ev.key === KeyboardCode.ESC && this.drawerOpen) {
|
|
161
|
+
this.closeDrawer();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
123
164
|
if (!this.menuElements.some((elem) => elem.contains(ev.target))) {
|
|
124
165
|
return;
|
|
125
166
|
}
|
|
@@ -160,10 +201,10 @@ export class ZAppHeader {
|
|
|
160
201
|
}
|
|
161
202
|
renderMenuButton() {
|
|
162
203
|
return (this.menuLength > 0 &&
|
|
163
|
-
(this.enableOffcanvas || this._stuck || this.isMobile) && (h("button", { ref: (el) => (this.burgerButton = el), "aria-label": "Apri menu", "aria-haspopup": "menu", "aria-expanded": `${this.drawerOpen}`, "aria-controls": "offcanvas-menu",
|
|
204
|
+
(this.enableOffcanvas || this._stuck || this.isMobile) && (h("button", { ref: (el) => (this.burgerButton = el), class: "drawer-trigger", "aria-label": "Apri menu", "aria-haspopup": "menu", "aria-expanded": `${this.drawerOpen}`, "aria-controls": "offcanvas-menu", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))));
|
|
164
205
|
}
|
|
165
206
|
renderOffcanvas() {
|
|
166
|
-
return (h("z-offcanvas", { id: "offcanvas-menu", variant: OffCanvasVariant.OVERLAY, transitiondirection: TransitionDirection.RIGHT, open: this.drawerOpen, onCanvasOpenStatusChanged: (ev) => (this.drawerOpen = ev.detail) }, h("div", { slot: "canvasContent" }, h("button", { ref: (el) => (this.
|
|
207
|
+
return (h("z-offcanvas", { id: "offcanvas-menu", variant: OffCanvasVariant.OVERLAY, transitiondirection: TransitionDirection.RIGHT, open: this.drawerOpen, onCanvasOpenStatusChanged: (ev) => (this.drawerOpen = ev.detail), onKeyDown: this.onOffcanvasKeydown }, h("div", { slot: "canvasContent" }, h("button", { ref: (el) => (this.closeDrawerButton = el), class: "drawer-close", "aria-label": "Chiudi menu", onClick: this.closeDrawer, "aria-hidden": `${!this.drawerOpen}`, disabled: !this.drawerOpen }, h("z-icon", { name: "close" })), h("div", { class: "drawer-content", "aria-hidden": `${!this.drawerOpen}` }, h("slot", { name: "menu", onSlotchange: this.collectMenuElements })))));
|
|
167
208
|
}
|
|
168
209
|
renderStuck() {
|
|
169
210
|
return (h("div", { class: "heading-stuck" }, h("div", { class: "heading-stuck-content" }, this.renderMenuButton(), h("div", { class: "heading-title" }, this.renderProductLogos(), h("div", { class: "stucked-title" }, h("slot", { name: "stucked-title" }, this.title))), this.enableSearch && this.renderSeachbar())));
|
|
@@ -190,6 +231,7 @@ export class ZAppHeader {
|
|
|
190
231
|
this.openDrawer = this.openDrawer.bind(this);
|
|
191
232
|
this.closeDrawer = this.closeDrawer.bind(this);
|
|
192
233
|
this.collectMenuElements = this.collectMenuElements.bind(this);
|
|
234
|
+
this.onOffcanvasKeydown = this.onOffcanvasKeydown.bind(this);
|
|
193
235
|
}
|
|
194
236
|
componentWillLoad() {
|
|
195
237
|
this.collectMenuElements();
|
|
@@ -211,7 +253,7 @@ export class ZAppHeader {
|
|
|
211
253
|
}
|
|
212
254
|
render() {
|
|
213
255
|
const hasTopSubtitle = this.hasSlot("top-subtitle");
|
|
214
|
-
return (h(Host, { key: '
|
|
256
|
+
return (h(Host, { key: 'f75168a2f0382aa913d97f584d3633a5bdfbfa9c', "menu-length": this.menuLength }, h("div", { key: '124e4e42c49b555e9e0a7fbf74fbed58a34eff26', class: { "heading-panel": true, "has-menubar": this.menuLength > 0 && !this.enableOffcanvas }, ref: (el) => (this.container = el) }, h("div", { key: '59a0f19801d6667ba0bb2ab532e8fef017b7a1f4', class: "heading-container" }, ((!this.enableSearch && this.isMobile) || !this.isMobile) && (h("div", { key: '90477c97647ac20836742a0f66cf33f4a314b096', class: "top-subtitle" }, h("slot", { key: '79635b43939be93a2c8453760325e438a88ac7a6', name: "top-subtitle" }))), h("div", { key: '886bc226038945a58945f76e327c700bf046c573', class: "heading-title" }, this.renderMenuButton(), !hasTopSubtitle && !this._stuck && this.renderProductLogos(), h("slot", { key: 'eec8098326dfc1c57dacfbd1b7c048b0cda46163', name: "title" }), this.enableSearch && !this.isMobile && this.renderSeachbar()), this.enableSearch && this.isMobile && this.renderSeachbar()), h("nav", { key: '4fab027ebeb20cb1be744961c86566328535cc39', class: "menu-container", "aria-label": this.title || undefined }, this.canShowMenu && (h("div", { key: 'e7b8a2c2131e550144a5203c07cc09a77af7f977', role: "menubar", "aria-label": this.title || undefined }, h("slot", { key: '4e020acf3f33bb6fef9da32e9dd69a8b6ed40412', name: "menu", onSlotchange: this.collectMenuElements }))))), this.renderOffcanvas(), this._stuck && this.renderStuck()));
|
|
215
257
|
}
|
|
216
258
|
static get is() { return "z-app-header"; }
|
|
217
259
|
static get encapsulation() { return "shadow"; }
|
|
@@ -409,7 +451,7 @@ export class ZAppHeader {
|
|
|
409
451
|
"passive": true
|
|
410
452
|
}, {
|
|
411
453
|
"name": "keydown",
|
|
412
|
-
"method": "
|
|
454
|
+
"method": "handleKeydown",
|
|
413
455
|
"target": undefined,
|
|
414
456
|
"capture": false,
|
|
415
457
|
"passive": true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/z-app-header/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,MAAM,eAAe,CAAC;AACrH,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAC5G,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,MAAM,6BAA6B,GAAG,OAAO,oBAAoB,KAAK,WAAW,CAAC;AAElF;;;;;;;;;;;GAWG;AAMH,MAAM,OAAO,UAAU;IAoGrB,OAAO;QACL,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACvC,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAGD,mBAAmB;QACjB,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;YACrB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;IAGD,aAAa;;QACX,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,MAAA,IAAI,CAAC,qBAAqB,0CAAE,OAAO,CAAC,IAAI,CAAC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;;;;;;;CACF","sourcesContent":["import {Component, Element, Event, EventEmitter, Fragment, Host, Listen, Prop, State, Watch, h} from \"@stencil/core\";\nimport {ButtonVariant, ControlSize, KeyboardCode, OffCanvasVariant, TransitionDirection} from \"../../beans\";\nimport {Breakpoints} from \"../../constants/breakpoints\";\nimport {containsElement} from \"../../utils/utils\";\n\nconst SUPPORT_INTERSECTION_OBSERVER = typeof IntersectionObserver !== \"undefined\";\n\n/**\n * @slot title - Slot for the main title\n * @slot top-subtitle - Slot for the top subtitle. It will not appear in stuck header.\n * @slot stucked-title - Title for the stuck header. By default it uses the text from the `title` slot.\n * @slot product-logo - To insert the product logo, it should be used with an img tag.\n * @cssprop --app-header-content-max-width - Use it to set header's content max width. Useful when the project use a fixed width layout. Defaults to `100%`.\n * @cssprop --app-header-top-offset - Top offset for the stuck header. Useful when there are other fixed elements above the header. Defaults to `48px` (the height of the main topbar).\n * @cssprop --app-header-bg - Header background color. Defaults to `--color-surface01`.\n * @cssprop --app-header-text-color - Header text color. Defaults to `--color-default-text`.\n * @cssprop --app-header-stucked-bg - Stuck header background color. Defaults to `--color-surface01`.\n * @cssprop --app-header-stucked-text-color - Stuck header text color. Defaults to `--color-default-text`.\n */\n@Component({\n tag: \"z-app-header\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZAppHeader {\n @Element() hostElement: HTMLZAppHeaderElement;\n\n /**\n * Stuck mode for the header.\n * You can programmatically set it using an IntersectionObserver.\n */\n @Prop({reflect: true})\n stuck = false;\n\n /**\n * When enabled, the menu bar is not displayed and a burger icon appears to open the offcanvas menu. Automatically enabled on mobile and when the menu items overflow the container.\n */\n @Prop({reflect: true, mutable: true})\n enableOffcanvas = false;\n\n /**\n * Enable the search bar.\n */\n @Prop({reflect: true})\n enableSearch = false;\n\n /**\n * Placeholder text for the search bar.\n */\n @Prop()\n searchPlaceholder = \"Cerca\";\n\n /**\n * Search string for the search bar.\n */\n @Prop({mutable: true})\n searchString = \"\";\n\n /**\n * Url to the search page.\n * Set this prop and `enableSearch` to show a link-button on mobile and tablet viewports, instead of the normal searchbar.\n * The link will also appear on the sticky header.\n */\n @Prop()\n searchPageUrl: string;\n\n /**\n * Enable laZ logo.\n */\n @Prop({reflect: true})\n enableZLogo = true;\n\n /**\n * Emitted when the `stuck` state of the header changes\n */\n @Event()\n sticking: EventEmitter;\n\n /**\n * The stuck state of the bar.\n */\n @State()\n private _stuck = false;\n\n /**\n * Current count of menu items.\n */\n @State()\n private menuLength: number;\n\n /**\n * The opening state of the drawer.\n */\n @State()\n private drawerOpen = false;\n\n @State()\n private isMobile = true;\n\n @State()\n private isTablet = false;\n\n private container?: HTMLDivElement;\n\n private menuElements: HTMLZMenuElement[] = [];\n\n private menuWidth: number;\n\n private closeMenuButton: HTMLButtonElement;\n\n private burgerButton: HTMLButtonElement;\n\n private menuResizeObserver: ResizeObserver;\n\n private stuckIntersecObserver?: IntersectionObserver = SUPPORT_INTERSECTION_OBSERVER\n ? new IntersectionObserver(\n ([entry]) => {\n this._stuck = !entry.isIntersecting;\n },\n {threshold: 0.5}\n )\n : undefined;\n\n @Watch(\"_stuck\")\n onStuck(): void {\n const scrollParent = this.scrollParent;\n if (!scrollParent) {\n return;\n }\n\n this.sticking.emit(this._stuck);\n }\n\n @Watch(\"drawerOpen\")\n setMenuFloatingMode(): void {\n if (this.menuElements.length === 0) {\n return;\n }\n\n this.menuElements.forEach((element) => {\n element.open = false;\n element.verticalContext = this.drawerOpen;\n });\n }\n\n @Watch(\"stuck\")\n onStuckChange(): void {\n if (this.stuck) {\n this.stuckIntersecObserver?.observe(this.container);\n } else {\n this._stuck = false;\n this.stuckIntersecObserver?.unobserve(this.container);\n }\n }\n\n private get title(): string {\n return this.hostElement.querySelector('[slot=\"title\"]')?.textContent.trim();\n }\n\n private get scrollParent(): Window | Element {\n const parent = this.hostElement.offsetParent;\n if (parent === document.body || parent === document.documentElement) {\n return window;\n }\n\n return parent;\n }\n\n private get canShowMenu(): boolean {\n return !this.enableOffcanvas && this.menuElements.length > 0 && !this.isMobile && !this.drawerOpen;\n }\n\n private get focusableMenu(): HTMLZMenuElement {\n return this.menuElements.find((el) => el.htmlTabindex === 0);\n }\n\n private openDrawer(): void {\n this.drawerOpen = true;\n this.menuElements.forEach((element, index) => (element.htmlTabindex = index === 0 ? 0 : -1));\n setTimeout(() => this.closeMenuButton.focus(), 100);\n }\n\n private closeDrawer(): void {\n this.drawerOpen = false;\n setTimeout(() => this.burgerButton.focus(), 100);\n }\n\n private collectMenuElements(): void {\n this.menuElements = Array.from(this.hostElement.querySelectorAll('[slot=\"menu\"]'));\n this.menuElements.forEach((element, index) => (element.htmlTabindex = index === 0 ? 0 : -1));\n this.menuLength = this.menuElements.length;\n if (!this.enableOffcanvas) {\n this.menuWidth =\n this.menuElements.reduce((acc, el) => acc + el.getBoundingClientRect().width, 0) +\n (this.menuLength - 1) * 32 /* 32px is the gap between each menu item */;\n }\n this.setMenuFloatingMode();\n }\n\n /** Automatically use offcanvas mode when the menubar doesn't fit in the header. */\n private setupMenuResizeObserver(): void {\n if (this.enableOffcanvas) {\n return;\n }\n\n this.menuResizeObserver = new ResizeObserver((entries) => {\n if (this.isMobile) {\n this.enableOffcanvas = true;\n\n return;\n }\n\n const containerWidth = entries[0].contentBoxSize[0].inlineSize;\n if (this.menuWidth === 0) {\n return;\n }\n\n if (this.menuWidth > containerWidth && !this.enableOffcanvas) {\n this.enableOffcanvas = true;\n } else if (this.menuWidth <= containerWidth && this.enableOffcanvas) {\n this.enableOffcanvas = false;\n }\n });\n this.menuResizeObserver.observe(this.container);\n }\n\n private hasSlot(slotName: string): boolean {\n return this.hostElement.querySelector(`[slot=\"${slotName}\"]`) !== null;\n }\n\n private moveFocus(current: HTMLZMenuElement, receiver: HTMLZMenuElement): void {\n current.htmlTabindex = -1;\n receiver.setFocus();\n }\n\n /** Close each menu except the one receiving focus/click */\n @Listen(\"focusin\", {target: \"document\", passive: true})\n @Listen(\"click\", {target: \"document\", passive: true})\n manageMenus(ev: FocusEvent | PointerEvent): void {\n this.menuElements.forEach((menu) => {\n if (!menu.open || !menu.floating || menu.verticalContext || containsElement(menu, ev.target as Element)) {\n return;\n }\n menu.open = false;\n });\n }\n\n @Listen(\"keydown\", {passive: true})\n handleMenubarKeydown(ev: KeyboardEvent): void {\n if (!this.menuElements.some((elem) => elem.contains(ev.target as HTMLElement))) {\n return;\n }\n\n const current = this.focusableMenu;\n const currentIndex = this.menuElements.indexOf(current);\n let receiver: HTMLZMenuElement;\n if (\n (ev.key === KeyboardCode.ARROW_RIGHT && !current.verticalContext) ||\n (ev.key === KeyboardCode.ARROW_DOWN && current.verticalContext)\n ) {\n receiver = this.menuElements[currentIndex + 1] ?? this.menuElements[0];\n } else if (\n (ev.key === KeyboardCode.ARROW_LEFT && !current.verticalContext) ||\n (ev.key === KeyboardCode.ARROW_UP && current.verticalContext)\n ) {\n receiver = this.menuElements[currentIndex - 1] ?? this.menuElements[this.menuLength - 1];\n }\n if (!receiver) {\n return;\n }\n\n if (ev.key === KeyboardCode.ARROW_UP && current.verticalContext) {\n if (receiver.open) {\n current.htmlTabindex = -1;\n receiver.focusLastItem();\n\n return;\n }\n }\n\n this.moveFocus(current, receiver);\n }\n\n private renderSeachbar(): HTMLZButtonElement | HTMLZSearchbarElement | undefined {\n if (this.isMobile && !this.searchPageUrl && this._stuck) {\n return;\n }\n\n if (this.searchPageUrl && (this.isMobile || this.isTablet)) {\n return (\n <z-button\n class=\"search-page-button\"\n variant={ButtonVariant.SECONDARY}\n href={this.searchPageUrl}\n icon=\"search\"\n size={ControlSize.X_SMALL}\n />\n );\n }\n\n return (\n <z-searchbar\n value={this.searchString}\n placeholder={this.searchPlaceholder}\n showSearchButton={true}\n searchButtonIconOnly={this.isMobile || this.isTablet}\n size={ControlSize.X_SMALL}\n variant={ButtonVariant.SECONDARY}\n preventSubmit={this.searchString.length < 3}\n onSearchTyping={(e) => (this.searchString = e.detail)}\n />\n );\n }\n\n private renderProductLogos(): HTMLElement | null {\n return (\n <Fragment>\n {this.enableZLogo && (\n <span class=\"z-logo\">\n <img alt=\"Logo Zanichelli\" />\n </span>\n )}\n {this.hostElement.querySelector(\"[slot='product-logo']\") && (\n <span class=\"product-logo\">\n <slot name=\"product-logo\" />\n </span>\n )}\n </Fragment>\n );\n }\n\n private renderMenuButton(): HTMLButtonElement {\n return (\n this.menuLength > 0 &&\n (this.enableOffcanvas || this._stuck || this.isMobile) && (\n <button\n ref={(el) => (this.burgerButton = el as HTMLButtonElement)}\n aria-label=\"Apri menu\"\n aria-haspopup=\"menu\"\n aria-expanded={`${this.drawerOpen}`}\n aria-controls=\"offcanvas-menu\"\n class=\"drawer-trigger\"\n onClick={this.openDrawer}\n >\n <z-icon name=\"burger-menu\" />\n </button>\n )\n );\n }\n\n private renderOffcanvas(): HTMLZOffcanvasElement {\n return (\n <z-offcanvas\n id=\"offcanvas-menu\"\n variant={OffCanvasVariant.OVERLAY}\n transitiondirection={TransitionDirection.RIGHT}\n open={this.drawerOpen}\n onCanvasOpenStatusChanged={(ev) => (this.drawerOpen = ev.detail)}\n >\n <div slot=\"canvasContent\">\n <button\n ref={(el) => (this.closeMenuButton = el as HTMLButtonElement)}\n class=\"drawer-close\"\n aria-label=\"Chiudi menu\"\n onClick={this.closeDrawer}\n aria-hidden={`${!this.drawerOpen}`}\n disabled={!this.drawerOpen}\n >\n <z-icon name=\"close\" />\n </button>\n\n <div\n class=\"drawer-content\"\n aria-hidden={`${!this.drawerOpen}`}\n >\n <slot\n name=\"menu\"\n onSlotchange={this.collectMenuElements}\n />\n </div>\n </div>\n </z-offcanvas>\n );\n }\n\n private renderStuck(): HTMLElement {\n return (\n <div class=\"heading-stuck\">\n <div class=\"heading-stuck-content\">\n {this.renderMenuButton()}\n <div class=\"heading-title\">\n {this.renderProductLogos()}\n <div class=\"stucked-title\">\n <slot name=\"stucked-title\">{this.title}</slot>\n </div>\n </div>\n {this.enableSearch && this.renderSeachbar()}\n </div>\n </div>\n );\n }\n\n constructor() {\n this.openDrawer = this.openDrawer.bind(this);\n this.closeDrawer = this.closeDrawer.bind(this);\n this.collectMenuElements = this.collectMenuElements.bind(this);\n }\n\n componentWillLoad(): void {\n this.collectMenuElements();\n\n // mobile and tablet media queries listeners\n const mobileMediaQuery = window.matchMedia(`(max-width: ${Breakpoints.MOBILE}px)`);\n this.isMobile = mobileMediaQuery.matches;\n mobileMediaQuery.addEventListener(\"change\", (e) => (this.isMobile = e.matches));\n const tabletMediaQuery = window.matchMedia(\n `(min-width: ${Breakpoints.MOBILE + 1}px) and (max-width: ${Breakpoints.TABLET}px)`\n );\n this.isTablet = tabletMediaQuery.matches;\n tabletMediaQuery.addEventListener(\"change\", (e) => (this.isTablet = e.matches));\n }\n\n componentDidLoad(): void {\n this.onStuckChange();\n this.setupMenuResizeObserver();\n }\n\n disconnectedCallback(): void {\n this.menuResizeObserver?.disconnect();\n }\n\n render(): HTMLZAppHeaderElement {\n const hasTopSubtitle = this.hasSlot(\"top-subtitle\");\n\n return (\n <Host menu-length={this.menuLength}>\n <div\n class={{\"heading-panel\": true, \"has-menubar\": this.menuLength > 0 && !this.enableOffcanvas}}\n ref={(el) => (this.container = el)}\n >\n <div class=\"heading-container\">\n {((!this.enableSearch && this.isMobile) || !this.isMobile) && (\n <div class=\"top-subtitle\">\n <slot name=\"top-subtitle\" />\n </div>\n )}\n <div class=\"heading-title\">\n {this.renderMenuButton()}\n {!hasTopSubtitle && !this._stuck && this.renderProductLogos()}\n <slot name=\"title\" />\n {this.enableSearch && !this.isMobile && this.renderSeachbar()}\n </div>\n {this.enableSearch && this.isMobile && this.renderSeachbar()}\n </div>\n\n <nav\n class=\"menu-container\"\n aria-label={this.title || undefined}\n >\n {this.canShowMenu && (\n <div\n role=\"menubar\"\n aria-label={this.title || undefined}\n >\n <slot\n name=\"menu\"\n onSlotchange={this.collectMenuElements}\n />\n </div>\n )}\n </nav>\n </div>\n {this.renderOffcanvas()}\n {this._stuck && this.renderStuck()}\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+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AAS,IAElC,IAAI,CAAC,WAAW,IAAI,CACnB,4DACE,IAAI,EAAC,SAAS,gBACF,IAAI,CAAC,KAAK,IAAI,SAAS;oBAEnC,6DACE,IAAI,EAAC,MAAM,EACX,YAAY,EAAE,IAAI,CAAC,mBAAmB,GACtC,CACE,CACP,CACG,CACF;YACL,IAAI,CAAC,eAAe,EAAE;YACtB,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE,CAC7B,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, Event, EventEmitter, Fragment, Host, Listen, Prop, State, Watch, h} from \"@stencil/core\";\nimport {ButtonVariant, ControlSize, KeyboardCode, OffCanvasVariant, TransitionDirection} from \"../../beans\";\nimport {Breakpoints} from \"../../constants/breakpoints\";\nimport {containsElement} from \"../../utils/utils\";\n\nconst SUPPORT_INTERSECTION_OBSERVER = typeof IntersectionObserver !== \"undefined\";\n\n/**\n * @slot title - Slot for the main title\n * @slot top-subtitle - Slot for the top subtitle. It will not appear in stuck header.\n * @slot stucked-title - Title for the stuck header. By default it uses the text from the `title` slot.\n * @slot product-logo - To insert the product logo, it should be used with an img tag.\n * @cssprop --app-header-content-max-width - Use it to set header's content max width. Useful when the project use a fixed width layout. Defaults to `100%`.\n * @cssprop --app-header-top-offset - Top offset for the stuck header. Useful when there are other fixed elements above the header. Defaults to `48px` (the height of the main topbar).\n * @cssprop --app-header-bg - Header background color. Defaults to `--color-surface01`.\n * @cssprop --app-header-text-color - Header text color. Defaults to `--color-default-text`.\n * @cssprop --app-header-stucked-bg - Stuck header background color. Defaults to `--color-surface01`.\n * @cssprop --app-header-stucked-text-color - Stuck header text color. Defaults to `--color-default-text`.\n */\n@Component({\n tag: \"z-app-header\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZAppHeader {\n @Element() hostElement: HTMLZAppHeaderElement;\n\n /**\n * Stuck mode for the header.\n * You can programmatically set it using an IntersectionObserver.\n */\n @Prop({reflect: true})\n stuck = false;\n\n /**\n * When enabled, the menu bar is not displayed and a burger icon appears to open the offcanvas menu. Automatically enabled on mobile and when the menu items overflow the container.\n */\n @Prop({reflect: true, mutable: true})\n enableOffcanvas = false;\n\n /**\n * Enable the search bar.\n */\n @Prop({reflect: true})\n enableSearch = false;\n\n /**\n * Placeholder text for the search bar.\n */\n @Prop()\n searchPlaceholder = \"Cerca\";\n\n /**\n * Search string for the search bar.\n */\n @Prop({mutable: true})\n searchString = \"\";\n\n /**\n * Url to the search page.\n * Set this prop and `enableSearch` to show a link-button on mobile and tablet viewports, instead of the normal searchbar.\n * The link will also appear on the sticky header.\n */\n @Prop()\n searchPageUrl: string;\n\n /**\n * Enable laZ logo.\n */\n @Prop({reflect: true})\n enableZLogo = true;\n\n /**\n * Emitted when the `stuck` state of the header changes\n */\n @Event()\n sticking: EventEmitter;\n\n /**\n * The stuck state of the bar.\n */\n @State()\n private _stuck = false;\n\n /**\n * Current count of menu items.\n */\n @State()\n private menuLength: number;\n\n /**\n * The opening state of the drawer.\n */\n @State()\n private drawerOpen = false;\n\n @State()\n private isMobile = true;\n\n @State()\n private isTablet = false;\n\n private container?: HTMLDivElement;\n\n private menuElements: HTMLZMenuElement[] = [];\n\n private menuWidth: number;\n\n private closeDrawerButton: HTMLButtonElement;\n\n private burgerButton: HTMLButtonElement;\n\n private menuResizeObserver: ResizeObserver;\n\n private stuckIntersecObserver?: IntersectionObserver = SUPPORT_INTERSECTION_OBSERVER\n ? new IntersectionObserver(\n ([entry]) => {\n this._stuck = !entry.isIntersecting;\n },\n {threshold: 0.5}\n )\n : undefined;\n\n @Watch(\"_stuck\")\n onStuck(): void {\n const scrollParent = this.scrollParent;\n if (!scrollParent) {\n return;\n }\n\n this.sticking.emit(this._stuck);\n }\n\n @Watch(\"drawerOpen\")\n setMenuFloatingMode(): void {\n if (this.menuElements.length === 0) {\n return;\n }\n\n this.menuElements.forEach((element) => {\n element.open = false;\n element.verticalContext = this.drawerOpen;\n });\n }\n\n @Watch(\"stuck\")\n onStuckChange(): void {\n if (this.stuck) {\n this.stuckIntersecObserver?.observe(this.container);\n } else {\n this._stuck = false;\n this.stuckIntersecObserver?.unobserve(this.container);\n }\n }\n\n private get title(): string {\n return this.hostElement.querySelector('[slot=\"title\"]')?.textContent.trim();\n }\n\n private get scrollParent(): Window | Element {\n const parent = this.hostElement.offsetParent;\n if (parent === document.body || parent === document.documentElement) {\n return window;\n }\n\n return parent;\n }\n\n private get canShowMenu(): boolean {\n return !this.enableOffcanvas && this.menuElements.length > 0 && !this.isMobile && !this.drawerOpen;\n }\n\n private get focusableMenu(): HTMLZMenuElement {\n return this.menuElements.find((el) => el.htmlTabindex === 0);\n }\n\n private openDrawer(): void {\n this.drawerOpen = true;\n this.menuElements.forEach((element, index) => (element.htmlTabindex = index === 0 ? 0 : -1));\n setTimeout(() => this.menuElements[0].setFocus(), 400); /* wait for the 400ms offcanvas transition */\n }\n\n private closeDrawer(): void {\n this.drawerOpen = false;\n setTimeout(() => this.burgerButton.focus(), 100);\n }\n\n private collectMenuElements(): void {\n this.menuElements = Array.from(this.hostElement.querySelectorAll('[slot=\"menu\"]'));\n this.menuElements.forEach((element, index) => (element.htmlTabindex = index === 0 ? 0 : -1));\n this.menuLength = this.menuElements.length;\n if (!this.enableOffcanvas) {\n this.menuWidth =\n this.menuElements.reduce((acc, el) => acc + el.getBoundingClientRect().width, 0) +\n (this.menuLength - 1) * 32 /* 32px is the gap between each menu item */;\n }\n this.setMenuFloatingMode();\n }\n\n /** Automatically use offcanvas mode when the menubar doesn't fit in the header. */\n private setupMenuResizeObserver(): void {\n if (this.enableOffcanvas) {\n return;\n }\n\n this.menuResizeObserver = new ResizeObserver((entries) => {\n if (this.isMobile) {\n this.enableOffcanvas = true;\n\n return;\n }\n\n const containerWidth = entries[0].contentBoxSize[0].inlineSize;\n if (this.menuWidth === 0) {\n return;\n }\n\n if (this.menuWidth > containerWidth && !this.enableOffcanvas) {\n this.enableOffcanvas = true;\n } else if (this.menuWidth <= containerWidth && this.enableOffcanvas) {\n this.enableOffcanvas = false;\n }\n });\n this.menuResizeObserver.observe(this.container);\n }\n\n private hasSlot(slotName: string): boolean {\n return this.hostElement.querySelector(`[slot=\"${slotName}\"]`) !== null;\n }\n\n private moveFocus(current: HTMLZMenuElement, receiver: HTMLZMenuElement): void {\n current.htmlTabindex = -1;\n receiver.setFocus();\n }\n\n private onOffcanvasKeydown(ev: KeyboardEvent): void {\n if (ev.key !== KeyboardCode.TAB || !this.drawerOpen) {\n return;\n }\n\n const closestMenu = (ev.target as HTMLElement).closest(\"z-menu\");\n if (closestMenu) {\n ev.preventDefault();\n ev.stopPropagation();\n // restore tabindex to the zmenu containing the focused element\n closestMenu.htmlTabindex = 0;\n this.closeDrawerButton.focus();\n } else if (ev.target === this.closeDrawerButton) {\n ev.preventDefault();\n ev.stopPropagation();\n if (ev.shiftKey) {\n // give focus to the last open menu if any or the last menu otherwhise\n (this.menuElements.filter((menu) => menu.open).pop() ?? this.menuElements[this.menuLength - 1]).setFocus();\n } else {\n // give focus to the first open menu if any or the first menu otherwhise\n (this.menuElements.find((menu) => menu.open) ?? this.menuElements[0]).setFocus();\n }\n }\n }\n\n /** Close each menu except the one receiving focus/click, if any */\n @Listen(\"focusin\", {target: \"document\", passive: true})\n @Listen(\"click\", {target: \"document\", passive: true})\n manageMenus(ev: FocusEvent | PointerEvent): void {\n const targetMenu = this.menuElements.find((menu) => containsElement(menu, ev.target as Element));\n if (targetMenu) {\n this.menuElements.forEach((menu) => {\n if (menu === targetMenu) {\n return;\n }\n\n menu.htmlTabindex = -1;\n if (!this.drawerOpen) {\n menu.open = false;\n }\n });\n } else if (!this.drawerOpen) {\n this.menuElements.forEach((menu) => {\n menu.open = false;\n });\n }\n }\n\n @Listen(\"keydown\", {passive: true})\n handleKeydown(ev: KeyboardEvent): void {\n if (ev.key === KeyboardCode.ESC && this.drawerOpen) {\n this.closeDrawer();\n\n return;\n }\n\n if (!this.menuElements.some((elem) => elem.contains(ev.target as HTMLElement))) {\n return;\n }\n\n const current = this.focusableMenu;\n const currentIndex = this.menuElements.indexOf(current);\n let receiver: HTMLZMenuElement;\n if (\n (ev.key === KeyboardCode.ARROW_RIGHT && !current.verticalContext) ||\n (ev.key === KeyboardCode.ARROW_DOWN && current.verticalContext)\n ) {\n receiver = this.menuElements[currentIndex + 1] ?? this.menuElements[0];\n } else if (\n (ev.key === KeyboardCode.ARROW_LEFT && !current.verticalContext) ||\n (ev.key === KeyboardCode.ARROW_UP && current.verticalContext)\n ) {\n receiver = this.menuElements[currentIndex - 1] ?? this.menuElements[this.menuLength - 1];\n }\n if (!receiver) {\n return;\n }\n\n if (ev.key === KeyboardCode.ARROW_UP && current.verticalContext) {\n if (receiver.open) {\n current.htmlTabindex = -1;\n receiver.focusLastItem();\n\n return;\n }\n }\n\n this.moveFocus(current, receiver);\n }\n\n private renderSeachbar(): HTMLZButtonElement | HTMLZSearchbarElement | undefined {\n if (this.isMobile && !this.searchPageUrl && this._stuck) {\n return;\n }\n\n if (this.searchPageUrl && (this.isMobile || this.isTablet)) {\n return (\n <z-button\n class=\"search-page-button\"\n variant={ButtonVariant.SECONDARY}\n href={this.searchPageUrl}\n icon=\"search\"\n size={ControlSize.X_SMALL}\n />\n );\n }\n\n return (\n <z-searchbar\n value={this.searchString}\n placeholder={this.searchPlaceholder}\n showSearchButton={true}\n searchButtonIconOnly={this.isMobile || this.isTablet}\n size={ControlSize.X_SMALL}\n variant={ButtonVariant.SECONDARY}\n preventSubmit={this.searchString.length < 3}\n onSearchTyping={(e) => (this.searchString = e.detail)}\n />\n );\n }\n\n private renderProductLogos(): HTMLElement | null {\n return (\n <Fragment>\n {this.enableZLogo && (\n <span class=\"z-logo\">\n <img alt=\"Logo Zanichelli\" />\n </span>\n )}\n {this.hostElement.querySelector(\"[slot='product-logo']\") && (\n <span class=\"product-logo\">\n <slot name=\"product-logo\" />\n </span>\n )}\n </Fragment>\n );\n }\n\n private renderMenuButton(): HTMLButtonElement {\n return (\n this.menuLength > 0 &&\n (this.enableOffcanvas || this._stuck || this.isMobile) && (\n <button\n ref={(el) => (this.burgerButton = el as HTMLButtonElement)}\n class=\"drawer-trigger\"\n aria-label=\"Apri menu\"\n aria-haspopup=\"menu\"\n aria-expanded={`${this.drawerOpen}`}\n aria-controls=\"offcanvas-menu\"\n onClick={this.openDrawer}\n >\n <z-icon name=\"burger-menu\" />\n </button>\n )\n );\n }\n\n private renderOffcanvas(): HTMLZOffcanvasElement {\n return (\n <z-offcanvas\n id=\"offcanvas-menu\"\n variant={OffCanvasVariant.OVERLAY}\n transitiondirection={TransitionDirection.RIGHT}\n open={this.drawerOpen}\n onCanvasOpenStatusChanged={(ev) => (this.drawerOpen = ev.detail)}\n onKeyDown={this.onOffcanvasKeydown}\n >\n <div slot=\"canvasContent\">\n <button\n ref={(el) => (this.closeDrawerButton = el)}\n class=\"drawer-close\"\n aria-label=\"Chiudi menu\"\n onClick={this.closeDrawer}\n aria-hidden={`${!this.drawerOpen}`}\n disabled={!this.drawerOpen}\n >\n <z-icon name=\"close\" />\n </button>\n\n <div\n class=\"drawer-content\"\n aria-hidden={`${!this.drawerOpen}`}\n >\n <slot\n name=\"menu\"\n onSlotchange={this.collectMenuElements}\n />\n </div>\n </div>\n </z-offcanvas>\n );\n }\n\n private renderStuck(): HTMLElement {\n return (\n <div class=\"heading-stuck\">\n <div class=\"heading-stuck-content\">\n {this.renderMenuButton()}\n <div class=\"heading-title\">\n {this.renderProductLogos()}\n <div class=\"stucked-title\">\n <slot name=\"stucked-title\">{this.title}</slot>\n </div>\n </div>\n {this.enableSearch && this.renderSeachbar()}\n </div>\n </div>\n );\n }\n\n constructor() {\n this.openDrawer = this.openDrawer.bind(this);\n this.closeDrawer = this.closeDrawer.bind(this);\n this.collectMenuElements = this.collectMenuElements.bind(this);\n this.onOffcanvasKeydown = this.onOffcanvasKeydown.bind(this);\n }\n\n componentWillLoad(): void {\n this.collectMenuElements();\n\n // mobile and tablet media queries listeners\n const mobileMediaQuery = window.matchMedia(`(max-width: ${Breakpoints.MOBILE}px)`);\n this.isMobile = mobileMediaQuery.matches;\n mobileMediaQuery.addEventListener(\"change\", (e) => (this.isMobile = e.matches));\n const tabletMediaQuery = window.matchMedia(\n `(min-width: ${Breakpoints.MOBILE + 1}px) and (max-width: ${Breakpoints.TABLET}px)`\n );\n this.isTablet = tabletMediaQuery.matches;\n tabletMediaQuery.addEventListener(\"change\", (e) => (this.isTablet = e.matches));\n }\n\n componentDidLoad(): void {\n this.onStuckChange();\n this.setupMenuResizeObserver();\n }\n\n disconnectedCallback(): void {\n this.menuResizeObserver?.disconnect();\n }\n\n render(): HTMLZAppHeaderElement {\n const hasTopSubtitle = this.hasSlot(\"top-subtitle\");\n\n return (\n <Host menu-length={this.menuLength}>\n <div\n class={{\"heading-panel\": true, \"has-menubar\": this.menuLength > 0 && !this.enableOffcanvas}}\n ref={(el) => (this.container = el)}\n >\n <div class=\"heading-container\">\n {((!this.enableSearch && this.isMobile) || !this.isMobile) && (\n <div class=\"top-subtitle\">\n <slot name=\"top-subtitle\" />\n </div>\n )}\n <div class=\"heading-title\">\n {this.renderMenuButton()}\n {!hasTopSubtitle && !this._stuck && this.renderProductLogos()}\n <slot name=\"title\" />\n {this.enableSearch && !this.isMobile && this.renderSeachbar()}\n </div>\n {this.enableSearch && this.isMobile && this.renderSeachbar()}\n </div>\n\n <nav\n class=\"menu-container\"\n aria-label={this.title || undefined}\n >\n {this.canShowMenu && (\n <div\n role=\"menubar\"\n aria-label={this.title || undefined}\n >\n <slot\n name=\"menu\"\n onSlotchange={this.collectMenuElements}\n />\n </div>\n )}\n </nav>\n </div>\n {this.renderOffcanvas()}\n {this._stuck && this.renderStuck()}\n </Host>\n );\n }\n}\n"]}
|
|
@@ -22,142 +22,76 @@ const StoryMeta = {
|
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
24
|
export default StoryMeta;
|
|
25
|
-
const
|
|
26
|
-
return html
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const menuItemsTemplate = () => {
|
|
26
|
+
return html `<a
|
|
27
|
+
href=""
|
|
28
|
+
slot="item"
|
|
29
|
+
>Item 1</a
|
|
30
|
+
>
|
|
31
|
+
<z-menu-section slot="item">
|
|
32
|
+
<h3>Item 2</h3>
|
|
29
33
|
<a
|
|
30
34
|
href=""
|
|
31
|
-
slot="
|
|
32
|
-
>Item 1</a
|
|
35
|
+
slot="section"
|
|
36
|
+
>Item 2.1</a
|
|
33
37
|
>
|
|
34
38
|
<a
|
|
35
39
|
href=""
|
|
36
|
-
slot="
|
|
37
|
-
>Item 2</a
|
|
40
|
+
slot="section"
|
|
41
|
+
>Item 2.2</a
|
|
38
42
|
>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
href=""
|
|
43
|
-
slot="section"
|
|
44
|
-
>Item 3.1</a
|
|
45
|
-
>
|
|
46
|
-
<a
|
|
47
|
-
href=""
|
|
48
|
-
slot="section"
|
|
49
|
-
>Item 3.2</a
|
|
50
|
-
>
|
|
51
|
-
</z-menu-section>
|
|
52
|
-
<z-menu-section slot="item">
|
|
53
|
-
<h3>Item 4</h3>
|
|
54
|
-
<a
|
|
55
|
-
href=""
|
|
56
|
-
slot="section"
|
|
57
|
-
>Item 4.1</a
|
|
58
|
-
>
|
|
59
|
-
<a
|
|
60
|
-
href=""
|
|
61
|
-
slot="section"
|
|
62
|
-
>Item 4.2</a
|
|
63
|
-
>
|
|
64
|
-
</z-menu-section>
|
|
43
|
+
</z-menu-section>
|
|
44
|
+
<z-menu-section slot="item">
|
|
45
|
+
<h3>Item 3</h3>
|
|
65
46
|
<a
|
|
66
47
|
href=""
|
|
67
|
-
slot="
|
|
68
|
-
>Item
|
|
48
|
+
slot="section"
|
|
49
|
+
>Item 3.1</a
|
|
69
50
|
>
|
|
70
|
-
</z-menu>
|
|
71
|
-
<z-menu slot="menu">
|
|
72
|
-
<a href>Menu label 2</a>
|
|
73
|
-
</z-menu>
|
|
74
|
-
<z-menu slot="menu">
|
|
75
|
-
<h3>Menu label 3</h3>
|
|
76
51
|
<a
|
|
77
52
|
href=""
|
|
78
|
-
slot="
|
|
79
|
-
>Item
|
|
53
|
+
slot="section"
|
|
54
|
+
>Item 3.2</a
|
|
80
55
|
>
|
|
56
|
+
</z-menu-section>
|
|
57
|
+
<a
|
|
58
|
+
href=""
|
|
59
|
+
slot="item"
|
|
60
|
+
>Item 4</a
|
|
61
|
+
>
|
|
62
|
+
<z-menu-section slot="item">
|
|
63
|
+
<h3>Item 5</h3>
|
|
81
64
|
<a
|
|
82
65
|
href=""
|
|
83
|
-
slot="
|
|
84
|
-
>Item
|
|
66
|
+
slot="section"
|
|
67
|
+
>Item 5.1</a
|
|
85
68
|
>
|
|
86
|
-
<z-menu-section slot="item">
|
|
87
|
-
<h3>Item 3</h3>
|
|
88
|
-
<a
|
|
89
|
-
href=""
|
|
90
|
-
slot="section"
|
|
91
|
-
>Item 3.1</a
|
|
92
|
-
>
|
|
93
|
-
<a
|
|
94
|
-
href=""
|
|
95
|
-
slot="section"
|
|
96
|
-
>Item 3.2</a
|
|
97
|
-
>
|
|
98
|
-
</z-menu-section>
|
|
99
|
-
<z-menu-section slot="item">
|
|
100
|
-
<h3>Item 4</h3>
|
|
101
|
-
<a
|
|
102
|
-
href=""
|
|
103
|
-
slot="section"
|
|
104
|
-
>Item 4.1</a
|
|
105
|
-
>
|
|
106
|
-
<a
|
|
107
|
-
href=""
|
|
108
|
-
slot="section"
|
|
109
|
-
>Item 4.2</a
|
|
110
|
-
>
|
|
111
|
-
</z-menu-section>
|
|
112
69
|
<a
|
|
113
70
|
href=""
|
|
114
|
-
slot="
|
|
115
|
-
>Item 5</a
|
|
71
|
+
slot="section"
|
|
72
|
+
>Item 5.2</a
|
|
116
73
|
>
|
|
74
|
+
</z-menu-section>`;
|
|
75
|
+
};
|
|
76
|
+
const menuTemplate = () => {
|
|
77
|
+
return html `
|
|
78
|
+
<z-menu slot="menu">
|
|
79
|
+
<h3>Menu label 1</h3>
|
|
80
|
+
${menuItemsTemplate()}
|
|
117
81
|
</z-menu>
|
|
82
|
+
|
|
83
|
+
<z-menu slot="menu">
|
|
84
|
+
<a href>Menu label 2</a>
|
|
85
|
+
</z-menu>
|
|
86
|
+
|
|
87
|
+
<z-menu slot="menu">
|
|
88
|
+
<h3>Menu label 3</h3>
|
|
89
|
+
${menuItemsTemplate()}
|
|
90
|
+
</z-menu>
|
|
91
|
+
|
|
118
92
|
<z-menu slot="menu">
|
|
119
93
|
<h3>Menu label 4</h3>
|
|
120
|
-
|
|
121
|
-
href=""
|
|
122
|
-
slot="item"
|
|
123
|
-
>Item 1</a
|
|
124
|
-
>
|
|
125
|
-
<a
|
|
126
|
-
href=""
|
|
127
|
-
slot="item"
|
|
128
|
-
>Item 2</a
|
|
129
|
-
>
|
|
130
|
-
<z-menu-section slot="item">
|
|
131
|
-
<h3>Item 3</h3>
|
|
132
|
-
<a
|
|
133
|
-
href=""
|
|
134
|
-
slot="section"
|
|
135
|
-
>Item 3.1</a
|
|
136
|
-
>
|
|
137
|
-
<a
|
|
138
|
-
href=""
|
|
139
|
-
slot="section"
|
|
140
|
-
>Item 3.2</a
|
|
141
|
-
>
|
|
142
|
-
</z-menu-section>
|
|
143
|
-
<z-menu-section slot="item">
|
|
144
|
-
<h3>Item 4</h3>
|
|
145
|
-
<a
|
|
146
|
-
href=""
|
|
147
|
-
slot="section"
|
|
148
|
-
>Item 4.1</a
|
|
149
|
-
>
|
|
150
|
-
<a
|
|
151
|
-
href=""
|
|
152
|
-
slot="section"
|
|
153
|
-
>Item 4.2</a
|
|
154
|
-
>
|
|
155
|
-
</z-menu-section>
|
|
156
|
-
<a
|
|
157
|
-
href=""
|
|
158
|
-
slot="item"
|
|
159
|
-
>Item 5</a
|
|
160
|
-
>
|
|
94
|
+
${menuItemsTemplate()}
|
|
161
95
|
</z-menu>
|
|
162
96
|
`;
|
|
163
97
|
};
|
|
@@ -173,7 +107,7 @@ export const Title = {
|
|
|
173
107
|
.enableZLogo=${args.enableZLogo}
|
|
174
108
|
style="--app-header-content-max-width: ${args["--app-header-content-max-width"]}"
|
|
175
109
|
>
|
|
176
|
-
<
|
|
110
|
+
<a href="zanichelli.it" slot="title">Applicazione</h1>
|
|
177
111
|
</z-app-header>`,
|
|
178
112
|
};
|
|
179
113
|
export const ProductLogo = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../src/components/z-app-header/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,IAAI,EAAC,MAAM,KAAK,CAAC;AAGzC,OAAO,yBAAyB,CAAC;AACjC,OAAO,iBAAiB,CAAC;AACzB,OAAO,SAAS,CAAC;AACjB,OAAO,qBAAqB,CAAC;AAI7B,MAAM,SAAS,GAAG;IAChB,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,cAAc;IACzB,UAAU,EAAE;QACV,MAAM,EAAE,YAAY;KACrB;IACD,aAAa,EAAE;QACb,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE,gBAAgB;KAC/B;IACD,IAAI,EAAE;QACJ,gCAAgC,EAAE,MAAM;QACxC,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,EAAE;QACnB,aAAa,EAAE,KAAK;QACpB,iBAAiB,EAAE,KAAK;KACzB;CACoC,CAAC;AAExC,eAAe,SAAS,CAAC;AAEzB,MAAM,YAAY,GAAG,GAAmB,EAAE;IACxC,OAAO,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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E;QACV,QAAQ,EAAE;YACR,OAAO,EAAE,CAAC,eAAe,EAAE,cAAc,EAAE,iBAAiB,CAAC;SAC9D;KACF;IACD,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;;;;QAIX,KAAK,EAAE;KACV;KACF;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CACf,IAAI,CAAA;;qBAEa,IAAI,CAAC,WAAW;;+CAEU,IAAI,CAAC,gCAAgC,CAAC;;;;QAI7E,YAAY,EAAE;oBACF;CACH,CAAC","sourcesContent":["import {Meta} from \"@storybook/web-components\";\nimport {TemplateResult, html} from \"lit\";\nimport {ZAppHeader} from \".\";\nimport {CSSVarsArguments} from \"../../utils/storybook-utils\";\nimport \"../z-menu-section/index\";\nimport \"../z-menu/index\";\nimport \"./index\";\nimport \"./index.stories.css\";\n\ntype ZAppHeaderStoriesArgs = ZAppHeader & CSSVarsArguments<\"app-header-content-max-width\">;\n\nconst StoryMeta = {\n title: \"ZAppHeader\",\n component: \"z-app-header\",\n parameters: {\n layout: \"fullscreen\",\n },\n subcomponents: {\n ZMenu: \"z-menu\",\n ZMenuSection: \"z-menu-section\",\n },\n args: {\n \"--app-header-content-max-width\": \"100%\",\n \"enableSearch\": false,\n \"searchPageUrl\": \"\",\n \"enableZLogo\": false,\n \"enableOffcanvas\": false,\n },\n} satisfies Meta<ZAppHeaderStoriesArgs>;\n\nexport default StoryMeta;\n\nconst menuTemplate = (): TemplateResult => {\n return html`\n <z-menu slot=\"menu\">\n <h3>Menu label 1</h3>\n <a\n href=\"\"\n slot=\"item\"\n >Item 1</a\n >\n <a\n href=\"\"\n slot=\"item\"\n >Item 2</a\n >\n <z-menu-section slot=\"item\">\n <h3>Item 3</h3>\n <a\n href=\"\"\n slot=\"section\"\n >Item 3.1</a\n >\n <a\n href=\"\"\n slot=\"section\"\n >Item 3.2</a\n >\n </z-menu-section>\n <z-menu-section slot=\"item\">\n <h3>Item 4</h3>\n <a\n href=\"\"\n slot=\"section\"\n >Item 4.1</a\n >\n <a\n href=\"\"\n slot=\"section\"\n >Item 4.2</a\n >\n </z-menu-section>\n <a\n href=\"\"\n slot=\"item\"\n >Item 5</a\n >\n </z-menu>\n <z-menu slot=\"menu\">\n <a href>Menu label 2</a>\n </z-menu>\n <z-menu slot=\"menu\">\n <h3>Menu label 3</h3>\n <a\n href=\"\"\n slot=\"item\"\n >Item 1</a\n >\n <a\n href=\"\"\n slot=\"item\"\n >Item 2</a\n >\n <z-menu-section slot=\"item\">\n <h3>Item 3</h3>\n <a\n href=\"\"\n slot=\"section\"\n >Item 3.1</a\n >\n <a\n href=\"\"\n slot=\"section\"\n >Item 3.2</a\n >\n </z-menu-section>\n <z-menu-section slot=\"item\">\n <h3>Item 4</h3>\n <a\n href=\"\"\n slot=\"section\"\n >Item 4.1</a\n >\n <a\n href=\"\"\n slot=\"section\"\n >Item 4.2</a\n >\n </z-menu-section>\n <a\n href=\"\"\n slot=\"item\"\n >Item 5</a\n >\n </z-menu>\n <z-menu slot=\"menu\">\n <h3>Menu label 4</h3>\n <a\n href=\"\"\n slot=\"item\"\n >Item 1</a\n >\n <a\n href=\"\"\n slot=\"item\"\n >Item 2</a\n >\n <z-menu-section slot=\"item\">\n <h3>Item 3</h3>\n <a\n href=\"\"\n slot=\"section\"\n >Item 3.1</a\n >\n <a\n href=\"\"\n slot=\"section\"\n >Item 3.2</a\n >\n </z-menu-section>\n <z-menu-section slot=\"item\">\n <h3>Item 4</h3>\n <a\n href=\"\"\n slot=\"section\"\n >Item 4.1</a\n >\n <a\n href=\"\"\n slot=\"section\"\n >Item 4.2</a\n >\n </z-menu-section>\n <a\n href=\"\"\n slot=\"item\"\n >Item 5</a\n >\n </z-menu>\n `;\n};\n\ntype Story = Meta<ZAppHeaderStoriesArgs>;\n\nexport const Title = {\n parameters: {\n controls: {\n exclude: [\"enableOffcanvas\"],\n },\n },\n render: (args) =>\n html`<z-app-header\n .enableSearch=${args.enableSearch}\n .searchPageUrl=${args.searchPageUrl}\n .enableZLogo=${args.enableZLogo}\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\"\n >\n <h1 slot=\"title\">Applicazione</h1>\n </z-app-header>`,\n} satisfies Story;\n\nexport const ProductLogo = {\n parameters: {\n controls: {\n exclude: [\"enableOffcanvas\"],\n },\n },\n render: (args) =>\n html`<z-app-header\n .enableSearch=${args.enableSearch}\n .searchPageUrl=${args.searchPageUrl}\n .enableZLogo=${args.enableZLogo}\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\"\n >\n <h1 slot=\"title\">Applicazione</h1>\n <div\n class=\"story-product-logo\"\n slot=\"product-logo\"\n ></div>\n </z-app-header>`,\n} satisfies Story;\n\nexport const TopTitle = {\n parameters: {\n controls: {\n exclude: [\"enableOffcanvas\", \"enableZLogo\"],\n },\n },\n render: (args) =>\n html`<z-app-header\n .enableSearch=${args.enableSearch}\n .searchPageUrl=${args.searchPageUrl}\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\"\n >\n <h2 slot=\"top-subtitle\">Payoff dell'applicazione</h2>\n <h1 slot=\"title\">Applicazione</h1>\n </z-app-header>`,\n} satisfies Story;\n\nexport const MenuWithTopTitle = {\n parameters: {\n controls: {\n exclude: [\"enableZLogo\"],\n },\n },\n render: (args) =>\n html`<z-app-header\n .enableOffcanvas=${args.enableOffcanvas}\n .enableSearch=${args.enableSearch}\n .searchPageUrl=${args.searchPageUrl}\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\"\n >\n <h2 slot=\"top-subtitle\">Payoff dell'applicazione</h2>\n <h1 slot=\"title\">Applicazione</h1>\n ${menuTemplate()}\n </z-app-header>`,\n} satisfies Story;\n\nexport const LongTitle = {\n parameters: {\n controls: {\n exclude: [\"enableOffcanvas\", \"enableZLogo\", \"enableSearch\", \"searchPageUrl\"],\n },\n },\n render: (args) =>\n html`<z-app-header style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\">\n <h1 slot=\"title\">Fondamenti di fisica 8e - Meccanica, Onde, Termodinamica, Elettromagnetismo, Ottica</h1>\n <h2 slot=\"top-subtitle\">Jearl Walker, David Halliday, Robert Resnick</h2>\n ${menuTemplate()}\n </z-app-header>`,\n} satisfies Story;\n\nexport const OffcanvasMenu = {\n args: {\n enableOffcanvas: true,\n },\n render: (args) =>\n html`<z-app-header\n .enableOffcanvas=${args.enableOffcanvas}\n .enableSearch=${args.enableSearch}\n .searchPageUrl=${args.searchPageUrl}\n .enableZLogo=${args.enableZLogo}\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\"\n >\n <h1 slot=\"title\">Applicazione</h1>\n ${menuTemplate()}\n </z-app-header>`,\n} satisfies Story;\n\nexport const Stuck = {\n decorators: [\n (Story) => html`\n <div style=\"padding: 16px var(--grid-margin)\">Scroll to see <code>stuck</code> prop in action.</div>\n <div style=\"height: 200vh\">${Story()}</div>\n `,\n ],\n parameters: {\n docs: {\n inlineStories: false,\n iframeHeight: \"400px\",\n },\n controls: {\n exclude: [\"enableOffcanvas\"],\n },\n },\n render: (args) =>\n html`<z-app-header\n stuck\n .enableZLogo=${args.enableZLogo}\n .enableSearch=${args.enableSearch}\n .searchPageUrl=${args.searchPageUrl}\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}; --app-header-top-offset: 0\"\n >\n <h1 slot=\"title\">Fondamenti di fisica 8e - Meccanica, Onde, Termodinamica, Elettromagnetismo, Ottica</h1>\n ${menuTemplate()}\n </z-app-header>`,\n} satisfies Story;\n\nexport const SearchPageButton = {\n parameters: {\n controls: {\n exclude: [\"searchPageUrl\", \"enableSearch\", \"enableOffcanvas\"],\n },\n },\n decorators: [\n (Story) => html`\n <div style=\"padding: 16px var(--grid-margin)\">\n The prop <code>searchPageUrl</code> only affects the component in tablet and mobile viewports.\n </div>\n ${Story()}\n `,\n ],\n render: (args) =>\n html`<z-app-header\n enable-search\n .enableZLogo=${args.enableZLogo}\n search-page-url=\"https://www.zanichelli.it\"\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\"\n >\n <h1 slot=\"title\">Applicazione</h1>\n <h2 slot=\"subtitle\">Payoff dell'applicazione</h2>\n ${menuTemplate()}\n </z-app-header>`,\n} satisfies Story;\n"]}
|
|
1
|
+
{"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../src/components/z-app-header/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,IAAI,EAAC,MAAM,KAAK,CAAC;AAGzC,OAAO,yBAAyB,CAAC;AACjC,OAAO,iBAAiB,CAAC;AACzB,OAAO,SAAS,CAAC;AACjB,OAAO,qBAAqB,CAAC;AAI7B,MAAM,SAAS,GAAG;IAChB,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,cAAc;IACzB,UAAU,EAAE;QACV,MAAM,EAAE,YAAY;KACrB;IACD,aAAa,EAAE;QACb,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE,gBAAgB;KAC/B;IACD,IAAI,EAAE;QACJ,gCAAgC,EAAE,MAAM;QACxC,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,EAAE;QACnB,aAAa,EAAE,KAAK;QACpB,iBAAiB,EAAE,KAAK;KACzB;CACoC,CAAC;AAExC,eAAe,SAAS,CAAC;AAEzB,MAAM,iBAAiB,GAAG,GAAmB,EAAE;IAC7C,OAAO,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAgDS,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,GAAmB,EAAE;IACxC,OAAO,IAAI,CAAA;;;QAGL,iBAAiB,EAAE;;;;;;;;;QASnB,iBAAiB,EAAE;;;;;QAKnB,iBAAiB,EAAE;;GAExB,CAAC;AACJ,CAAC,CAAC;AAIF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,OAAO,EAAE,CAAC,iBAAiB,C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K,EAAE;KACV;KACF;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CACf,IAAI,CAAA;;qBAEa,IAAI,CAAC,WAAW;;+CAEU,IAAI,CAAC,gCAAgC,CAAC;;;;QAI7E,YAAY,EAAE;oBACF;CACH,CAAC","sourcesContent":["import {Meta} from \"@storybook/web-components\";\nimport {TemplateResult, html} from \"lit\";\nimport {ZAppHeader} from \".\";\nimport {CSSVarsArguments} from \"../../utils/storybook-utils\";\nimport \"../z-menu-section/index\";\nimport \"../z-menu/index\";\nimport \"./index\";\nimport \"./index.stories.css\";\n\ntype ZAppHeaderStoriesArgs = ZAppHeader & CSSVarsArguments<\"app-header-content-max-width\">;\n\nconst StoryMeta = {\n title: \"ZAppHeader\",\n component: \"z-app-header\",\n parameters: {\n layout: \"fullscreen\",\n },\n subcomponents: {\n ZMenu: \"z-menu\",\n ZMenuSection: \"z-menu-section\",\n },\n args: {\n \"--app-header-content-max-width\": \"100%\",\n \"enableSearch\": false,\n \"searchPageUrl\": \"\",\n \"enableZLogo\": false,\n \"enableOffcanvas\": false,\n },\n} satisfies Meta<ZAppHeaderStoriesArgs>;\n\nexport default StoryMeta;\n\nconst menuItemsTemplate = (): TemplateResult => {\n return html`<a\n href=\"\"\n slot=\"item\"\n >Item 1</a\n >\n <z-menu-section slot=\"item\">\n <h3>Item 2</h3>\n <a\n href=\"\"\n slot=\"section\"\n >Item 2.1</a\n >\n <a\n href=\"\"\n slot=\"section\"\n >Item 2.2</a\n >\n </z-menu-section>\n <z-menu-section slot=\"item\">\n <h3>Item 3</h3>\n <a\n href=\"\"\n slot=\"section\"\n >Item 3.1</a\n >\n <a\n href=\"\"\n slot=\"section\"\n >Item 3.2</a\n >\n </z-menu-section>\n <a\n href=\"\"\n slot=\"item\"\n >Item 4</a\n >\n <z-menu-section slot=\"item\">\n <h3>Item 5</h3>\n <a\n href=\"\"\n slot=\"section\"\n >Item 5.1</a\n >\n <a\n href=\"\"\n slot=\"section\"\n >Item 5.2</a\n >\n </z-menu-section>`;\n};\n\nconst menuTemplate = (): TemplateResult => {\n return html`\n <z-menu slot=\"menu\">\n <h3>Menu label 1</h3>\n ${menuItemsTemplate()}\n </z-menu>\n\n <z-menu slot=\"menu\">\n <a href>Menu label 2</a>\n </z-menu>\n\n <z-menu slot=\"menu\">\n <h3>Menu label 3</h3>\n ${menuItemsTemplate()}\n </z-menu>\n\n <z-menu slot=\"menu\">\n <h3>Menu label 4</h3>\n ${menuItemsTemplate()}\n </z-menu>\n `;\n};\n\ntype Story = Meta<ZAppHeaderStoriesArgs>;\n\nexport const Title = {\n parameters: {\n controls: {\n exclude: [\"enableOffcanvas\"],\n },\n },\n render: (args) =>\n html`<z-app-header\n .enableSearch=${args.enableSearch}\n .searchPageUrl=${args.searchPageUrl}\n .enableZLogo=${args.enableZLogo}\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\"\n >\n <a href=\"zanichelli.it\" slot=\"title\">Applicazione</h1>\n </z-app-header>`,\n} satisfies Story;\n\nexport const ProductLogo = {\n parameters: {\n controls: {\n exclude: [\"enableOffcanvas\"],\n },\n },\n render: (args) =>\n html`<z-app-header\n .enableSearch=${args.enableSearch}\n .searchPageUrl=${args.searchPageUrl}\n .enableZLogo=${args.enableZLogo}\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\"\n >\n <h1 slot=\"title\">Applicazione</h1>\n <div\n class=\"story-product-logo\"\n slot=\"product-logo\"\n ></div>\n </z-app-header>`,\n} satisfies Story;\n\nexport const TopTitle = {\n parameters: {\n controls: {\n exclude: [\"enableOffcanvas\", \"enableZLogo\"],\n },\n },\n render: (args) =>\n html`<z-app-header\n .enableSearch=${args.enableSearch}\n .searchPageUrl=${args.searchPageUrl}\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\"\n >\n <h2 slot=\"top-subtitle\">Payoff dell'applicazione</h2>\n <h1 slot=\"title\">Applicazione</h1>\n </z-app-header>`,\n} satisfies Story;\n\nexport const MenuWithTopTitle = {\n parameters: {\n controls: {\n exclude: [\"enableZLogo\"],\n },\n },\n render: (args) =>\n html`<z-app-header\n .enableOffcanvas=${args.enableOffcanvas}\n .enableSearch=${args.enableSearch}\n .searchPageUrl=${args.searchPageUrl}\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\"\n >\n <h2 slot=\"top-subtitle\">Payoff dell'applicazione</h2>\n <h1 slot=\"title\">Applicazione</h1>\n ${menuTemplate()}\n </z-app-header>`,\n} satisfies Story;\n\nexport const LongTitle = {\n parameters: {\n controls: {\n exclude: [\"enableOffcanvas\", \"enableZLogo\", \"enableSearch\", \"searchPageUrl\"],\n },\n },\n render: (args) =>\n html`<z-app-header style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\">\n <h1 slot=\"title\">Fondamenti di fisica 8e - Meccanica, Onde, Termodinamica, Elettromagnetismo, Ottica</h1>\n <h2 slot=\"top-subtitle\">Jearl Walker, David Halliday, Robert Resnick</h2>\n ${menuTemplate()}\n </z-app-header>`,\n} satisfies Story;\n\nexport const OffcanvasMenu = {\n args: {\n enableOffcanvas: true,\n },\n render: (args) =>\n html`<z-app-header\n .enableOffcanvas=${args.enableOffcanvas}\n .enableSearch=${args.enableSearch}\n .searchPageUrl=${args.searchPageUrl}\n .enableZLogo=${args.enableZLogo}\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\"\n >\n <h1 slot=\"title\">Applicazione</h1>\n ${menuTemplate()}\n </z-app-header>`,\n} satisfies Story;\n\nexport const Stuck = {\n decorators: [\n (Story) => html`\n <div style=\"padding: 16px var(--grid-margin)\">Scroll to see <code>stuck</code> prop in action.</div>\n <div style=\"height: 200vh\">${Story()}</div>\n `,\n ],\n parameters: {\n docs: {\n inlineStories: false,\n iframeHeight: \"400px\",\n },\n controls: {\n exclude: [\"enableOffcanvas\"],\n },\n },\n render: (args) =>\n html`<z-app-header\n stuck\n .enableZLogo=${args.enableZLogo}\n .enableSearch=${args.enableSearch}\n .searchPageUrl=${args.searchPageUrl}\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}; --app-header-top-offset: 0\"\n >\n <h1 slot=\"title\">Fondamenti di fisica 8e - Meccanica, Onde, Termodinamica, Elettromagnetismo, Ottica</h1>\n ${menuTemplate()}\n </z-app-header>`,\n} satisfies Story;\n\nexport const SearchPageButton = {\n parameters: {\n controls: {\n exclude: [\"searchPageUrl\", \"enableSearch\", \"enableOffcanvas\"],\n },\n },\n decorators: [\n (Story) => html`\n <div style=\"padding: 16px var(--grid-margin)\">\n The prop <code>searchPageUrl</code> only affects the component in tablet and mobile viewports.\n </div>\n ${Story()}\n `,\n ],\n render: (args) =>\n html`<z-app-header\n enable-search\n .enableZLogo=${args.enableZLogo}\n search-page-url=\"https://www.zanichelli.it\"\n style=\"--app-header-content-max-width: ${args[\"--app-header-content-max-width\"]}\"\n >\n <h1 slot=\"title\">Applicazione</h1>\n <h2 slot=\"subtitle\">Payoff dell'applicazione</h2>\n ${menuTemplate()}\n </z-app-header>`,\n} satisfies Story;\n"]}
|