@sapudex/web-components 2.0.0 → 2.1.1
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/cypress/fixtures/footer-links.ts +221 -0
- package/cypress/specs/Checkbox.cy.tsx +92 -0
- package/cypress/specs/CountrySelector.cy.tsx +215 -0
- package/cypress/specs/Footer.cy.tsx +313 -0
- package/cypress/specs/PhoneNumberField.cy.tsx +2 -2
- package/cypress/specs/Table.cy.tsx +361 -0
- package/cypress/specs/TextField.cy.tsx +4 -0
- package/cypress/specs/Tooltip.cy.tsx +26 -0
- package/cypress/specs/Upload.cy.tsx +20 -3
- package/dist/AssetsVariables.js +1 -1
- package/dist/AssetsVariables.js.map +1 -1
- package/dist/Checkbox.d.ts +17 -0
- package/dist/Checkbox.js +36 -1
- package/dist/Checkbox.js.map +1 -1
- package/dist/FilterMenu.d.ts +7 -0
- package/dist/FilterMenu.js +3 -0
- package/dist/FilterMenu.js.map +1 -1
- package/dist/Link.d.ts +3 -4
- package/dist/Link.js +4 -5
- package/dist/Link.js.map +1 -1
- package/dist/MastheadItem.d.ts +21 -2
- package/dist/MastheadItem.js +95 -13
- package/dist/MastheadItem.js.map +1 -1
- package/dist/MastheadMenu.d.ts +1 -0
- package/dist/MastheadMenu.js +11 -5
- package/dist/MastheadMenu.js.map +1 -1
- package/dist/MastheadMobileMenu.d.ts +8 -2
- package/dist/MastheadMobileMenu.js +8 -2
- package/dist/MastheadMobileMenu.js.map +1 -1
- package/dist/MastheadShell.d.ts +24 -12
- package/dist/MastheadShell.js +75 -26
- package/dist/MastheadShell.js.map +1 -1
- package/dist/PasswordField.d.ts +10 -0
- package/dist/PasswordField.js +14 -0
- package/dist/PasswordField.js.map +1 -1
- package/dist/PhoneNumberField.d.ts +1 -0
- package/dist/PhoneNumberField.js +15 -1
- package/dist/PhoneNumberField.js.map +1 -1
- package/dist/RadioButton.d.ts +1 -0
- package/dist/RadioButton.js +1 -0
- package/dist/RadioButton.js.map +1 -1
- package/dist/SecondaryNavigation.d.ts +6 -5
- package/dist/SecondaryNavigation.js +8 -6
- package/dist/SecondaryNavigation.js.map +1 -1
- package/dist/SecondaryNavigationItem.d.ts +9 -6
- package/dist/SecondaryNavigationItem.js +19 -13
- package/dist/SecondaryNavigationItem.js.map +1 -1
- package/dist/SecondaryNavigationSubItem.d.ts +8 -4
- package/dist/SecondaryNavigationSubItem.js +6 -5
- package/dist/SecondaryNavigationSubItem.js.map +1 -1
- package/dist/Table.d.ts +1 -1
- package/dist/Table.js +1 -1
- package/dist/Table.js.map +1 -1
- package/dist/TextField.d.ts +8 -0
- package/dist/TextField.js +15 -0
- package/dist/TextField.js.map +1 -1
- package/dist/Tooltip.d.ts +5 -0
- package/dist/Tooltip.js +11 -1
- package/dist/Tooltip.js.map +1 -1
- package/dist/Upload.d.ts +12 -2
- package/dist/Upload.js +25 -1
- package/dist/Upload.js.map +1 -1
- package/dist/assets/{InputSuggestions-pMcXiozG.js → InputSuggestions-CP3cBQsh.js} +1 -1
- package/dist/assets/{ListItemStandardExpandableTextTemplate-BoB9C9hl.js → ListItemStandardExpandableTextTemplate-CLBtdbBK.js} +1 -1
- package/dist/assets/bundle-C9ZlnwwH.css +1 -0
- package/dist/assets/{bundle.esm-4ejJpC9l.js → bundle.esm-jHcdiVfj.js} +224 -224
- package/dist/assets/messagebundle_en-CVKgy_9L.js +1 -0
- package/dist/css/themes/Button.css +1 -1
- package/dist/css/themes/Checkbox.css +1 -1
- package/dist/css/themes/MastheadItem.css +1 -1
- package/dist/css/themes/RadioButton.css +1 -1
- package/dist/css/themes/RatingIndicator.css +1 -1
- package/dist/css/themes/Search.css +1 -1
- package/dist/css/themes/Slider.css +1 -1
- package/dist/css/themes/Tooltip.css +1 -1
- package/dist/css/themes/Upload.css +1 -1
- package/dist/css/themes/WizardTab.css +1 -1
- package/dist/custom-elements-internal.json +204 -12
- package/dist/custom-elements.json +165 -8
- package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
- package/dist/generated/i18n/i18n-defaults.d.ts +4 -1
- package/dist/generated/i18n/i18n-defaults.js +4 -1
- package/dist/generated/i18n/i18n-defaults.js.map +1 -1
- package/dist/generated/templates/FilterMenuTemplate.lit.js +1 -1
- package/dist/generated/templates/FilterMenuTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadItemTemplate.lit.js +2 -2
- package/dist/generated/templates/MastheadItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadMenuTemplate.lit.js +1 -1
- package/dist/generated/templates/MastheadMenuTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadMobileMenuTemplate.lit.js +2 -2
- package/dist/generated/templates/MastheadMobileMenuTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadShellTemplate.lit.js +6 -5
- package/dist/generated/templates/MastheadShellTemplate.lit.js.map +1 -1
- package/dist/generated/templates/PasswordFieldTemplate.lit.js +1 -1
- package/dist/generated/templates/PasswordFieldTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SecondaryNavigationItemTemplate.lit.js +1 -1
- package/dist/generated/templates/SecondaryNavigationItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/TextFieldTemplate.lit.js +1 -1
- package/dist/generated/templates/TextFieldTemplate.lit.js.map +1 -1
- package/dist/generated/templates/UploadTemplate.lit.js +2 -2
- package/dist/generated/templates/UploadTemplate.lit.js.map +1 -1
- package/dist/generated/themes/Button.css.d.ts +1 -1
- package/dist/generated/themes/Button.css.js +1 -1
- package/dist/generated/themes/Button.css.js.map +1 -1
- package/dist/generated/themes/Checkbox.css.d.ts +1 -1
- package/dist/generated/themes/Checkbox.css.js +1 -1
- package/dist/generated/themes/Checkbox.css.js.map +1 -1
- package/dist/generated/themes/MastheadItem.css.d.ts +1 -1
- package/dist/generated/themes/MastheadItem.css.js +1 -1
- package/dist/generated/themes/MastheadItem.css.js.map +1 -1
- package/dist/generated/themes/RadioButton.css.d.ts +1 -1
- package/dist/generated/themes/RadioButton.css.js +1 -1
- package/dist/generated/themes/RadioButton.css.js.map +1 -1
- package/dist/generated/themes/RatingIndicator.css.d.ts +1 -1
- package/dist/generated/themes/RatingIndicator.css.js +1 -1
- package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
- package/dist/generated/themes/Search.css.d.ts +1 -1
- package/dist/generated/themes/Search.css.js +1 -1
- package/dist/generated/themes/Search.css.js.map +1 -1
- package/dist/generated/themes/Slider.css.d.ts +1 -1
- package/dist/generated/themes/Slider.css.js +1 -1
- package/dist/generated/themes/Slider.css.js.map +1 -1
- package/dist/generated/themes/Tooltip.css.d.ts +1 -1
- package/dist/generated/themes/Tooltip.css.js +1 -1
- package/dist/generated/themes/Tooltip.css.js.map +1 -1
- package/dist/generated/themes/Upload.css.d.ts +1 -1
- package/dist/generated/themes/Upload.css.js +1 -1
- package/dist/generated/themes/Upload.css.js.map +1 -1
- package/dist/generated/themes/WizardTab.css.d.ts +1 -1
- package/dist/generated/themes/WizardTab.css.js +1 -1
- package/dist/generated/themes/WizardTab.css.js.map +1 -1
- package/dist/messagebundle.properties +9 -1
- package/dist/messagebundle_en.properties +4 -1
- package/dist/vscode.html-custom-data.json +29 -4
- package/dist/web-types.json +113 -11
- package/package.json +1 -1
- package/src/AssetsVariables.ts +1 -1
- package/src/Checkbox.ts +47 -0
- package/src/FilterMenu.hbs +2 -0
- package/src/FilterMenu.ts +8 -0
- package/src/Link.ts +4 -5
- package/src/MastheadItem.hbs +2 -2
- package/src/MastheadItem.ts +119 -15
- package/src/MastheadMenu.hbs +4 -1
- package/src/MastheadMenu.ts +12 -5
- package/src/MastheadMobileMenu.hbs +2 -2
- package/src/MastheadMobileMenu.ts +16 -3
- package/src/MastheadShell.hbs +14 -3
- package/src/MastheadShell.ts +98 -36
- package/src/PasswordField.hbs +1 -0
- package/src/PasswordField.ts +14 -0
- package/src/PhoneNumberField.ts +19 -1
- package/src/RadioButton.ts +1 -0
- package/src/SecondaryNavigation.ts +14 -10
- package/src/SecondaryNavigationItem.hbs +1 -1
- package/src/SecondaryNavigationItem.ts +25 -16
- package/src/SecondaryNavigationSubItem.ts +13 -7
- package/src/Table.ts +2 -2
- package/src/TextField.hbs +2 -0
- package/src/TextField.ts +16 -0
- package/src/Tooltip.ts +19 -0
- package/src/Upload.hbs +4 -4
- package/src/Upload.ts +24 -3
- package/src/generated/i18n/i18n-defaults.ts +2 -2
- package/src/generated/templates/FilterMenuTemplate.lit.ts +1 -1
- package/src/generated/templates/MastheadItemTemplate.lit.ts +2 -2
- package/src/generated/templates/MastheadMenuTemplate.lit.ts +1 -1
- package/src/generated/templates/MastheadMobileMenuTemplate.lit.ts +2 -2
- package/src/generated/templates/MastheadShellTemplate.lit.ts +6 -5
- package/src/generated/templates/PasswordFieldTemplate.lit.ts +1 -1
- package/src/generated/templates/SecondaryNavigationItemTemplate.lit.ts +1 -1
- package/src/generated/templates/TextFieldTemplate.lit.ts +1 -1
- package/src/generated/templates/UploadTemplate.lit.ts +2 -2
- package/src/generated/themes/Button.css.ts +1 -1
- package/src/generated/themes/Checkbox.css.ts +1 -1
- package/src/generated/themes/MastheadItem.css.ts +1 -1
- package/src/generated/themes/RadioButton.css.ts +1 -1
- package/src/generated/themes/RatingIndicator.css.ts +1 -1
- package/src/generated/themes/Search.css.ts +1 -1
- package/src/generated/themes/Slider.css.ts +1 -1
- package/src/generated/themes/Tooltip.css.ts +1 -1
- package/src/generated/themes/Upload.css.ts +1 -1
- package/src/generated/themes/WizardTab.css.ts +1 -1
- package/src/i18n/messagebundle.properties +9 -1
- package/src/i18n/messagebundle_en.properties +4 -1
- package/src/themes/Button.css +9 -5
- package/src/themes/Checkbox.css +15 -1
- package/src/themes/MastheadItem.css +9 -3
- package/src/themes/RadioButton.css +2 -0
- package/src/themes/Search.css +1 -0
- package/src/themes/Tooltip.css +1 -1
- package/src/themes/Upload.css +10 -2
- package/src/themes/WizardTab.css +5 -0
- package/dist/assets/bundle-7XIcgsQH.css +0 -1
- package/dist/assets/messagebundle_en-BYIX4tmE.js +0 -1
package/src/MastheadItem.ts
CHANGED
|
@@ -10,7 +10,9 @@ import "@ui5/webcomponents-icons/dist/search.js";
|
|
|
10
10
|
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
|
|
11
11
|
import { isEscape } from "@ui5/webcomponents-base/dist/Keys.js";
|
|
12
12
|
import { isDesktop } from "@ui5/webcomponents-base/dist/Device.js";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
OPENS_IN_A_NEW_WINDOW, PROFILE, CART, COUNTRY_SELECTOR, SUPPORT,
|
|
15
|
+
} from "./generated/i18n/i18n-defaults.js";
|
|
14
16
|
import UDExMastheadMenu from "./MastheadMenu.js";
|
|
15
17
|
import type UDExAvatar from "./Avatar.js";
|
|
16
18
|
import "@ui5/webcomponents-icons/dist/slim-arrow-down.js";
|
|
@@ -22,6 +24,12 @@ import { BreakpointUtils } from "./utils/Breakpoints.js";
|
|
|
22
24
|
// Styles
|
|
23
25
|
import MastheadItemCss from "./generated/themes/MastheadItem.css.js";
|
|
24
26
|
|
|
27
|
+
export enum UDExMastheadDropdownItemAction {
|
|
28
|
+
Open = "Open",
|
|
29
|
+
Close = "Close",
|
|
30
|
+
ClickOutside = "Click Outside",
|
|
31
|
+
}
|
|
32
|
+
|
|
25
33
|
export interface IMastheadItem {
|
|
26
34
|
text?: string;
|
|
27
35
|
selected?: boolean;
|
|
@@ -52,6 +60,11 @@ type UDExMastheadItemItemClickEventDetail = {
|
|
|
52
60
|
item: UDExMastheadItem,
|
|
53
61
|
}
|
|
54
62
|
|
|
63
|
+
export type UDExMastheadDropdownEventDetail = {
|
|
64
|
+
title: string,
|
|
65
|
+
action: UDExMastheadDropdownItemAction,
|
|
66
|
+
}
|
|
67
|
+
|
|
55
68
|
/**
|
|
56
69
|
* @class
|
|
57
70
|
*
|
|
@@ -89,9 +102,27 @@ type UDExMastheadItemItemClickEventDetail = {
|
|
|
89
102
|
*/
|
|
90
103
|
@event("item-click", { bubbles: true })
|
|
91
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Fires when dropdown is closed
|
|
107
|
+
*
|
|
108
|
+
* @allowPreventDefault
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
@event("dropdown-closed", { bubbles: true })
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Fires when dropdown is opened
|
|
115
|
+
*
|
|
116
|
+
* @allowPreventDefault
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
@event("dropdown-opened", { bubbles: true })
|
|
120
|
+
|
|
92
121
|
class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
93
122
|
eventDetails!: {
|
|
94
123
|
"item-click": UDExMastheadItemItemClickEventDetail,
|
|
124
|
+
"dropdown-closed": UDExMastheadDropdownEventDetail,
|
|
125
|
+
"dropdown-opened": UDExMastheadDropdownEventDetail,
|
|
95
126
|
};
|
|
96
127
|
/**
|
|
97
128
|
* Defines sub items for item
|
|
@@ -256,6 +287,7 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
256
287
|
|
|
257
288
|
_profileAvatar!: UDExAvatar;
|
|
258
289
|
_mastheadShell!: UDExMastheadShell;
|
|
290
|
+
_isEscPress!: boolean;
|
|
259
291
|
|
|
260
292
|
onEnterDOM(): void {
|
|
261
293
|
if (isDesktop()) {
|
|
@@ -270,10 +302,27 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
270
302
|
if (this.selected && this.hasDropdownSlot && !this.isMobile && !this.isExploreBtn) {
|
|
271
303
|
this.setDropdownInsetStart();
|
|
272
304
|
}
|
|
305
|
+
|
|
306
|
+
this.handleOutsideClick();
|
|
307
|
+
this._isEscPress = false;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
handleOutsideClick(): void {
|
|
311
|
+
document.addEventListener("click", (e: Event) => {
|
|
312
|
+
const target = e.target as HTMLElement;
|
|
313
|
+
const item = target.closest("[udex-masthead-item]");
|
|
314
|
+
if (item !== this && !this.isMobile) {
|
|
315
|
+
if (this.isDropdownOpened) {
|
|
316
|
+
this.fireDropdownCloseEvent(this.eventItemTitle, UDExMastheadDropdownItemAction.ClickOutside);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
this.selected = false;
|
|
320
|
+
}
|
|
321
|
+
});
|
|
273
322
|
}
|
|
274
323
|
|
|
275
324
|
handleFocusout(e: FocusEvent): void {
|
|
276
|
-
if (e.relatedTarget === null) {
|
|
325
|
+
if (e.relatedTarget === null || this._isEscPress) {
|
|
277
326
|
return;
|
|
278
327
|
}
|
|
279
328
|
|
|
@@ -294,6 +343,7 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
294
343
|
}
|
|
295
344
|
|
|
296
345
|
handleKeyEscape(): void {
|
|
346
|
+
this._isEscPress = true;
|
|
297
347
|
this.closeDropdown();
|
|
298
348
|
if (this.isProfileBtn) {
|
|
299
349
|
this._profileAvatar.focus();
|
|
@@ -303,32 +353,56 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
303
353
|
}
|
|
304
354
|
|
|
305
355
|
handleKeyEscapeMobile(): void {
|
|
356
|
+
this.fireDropdownCloseEvent(this.eventItemTitle, UDExMastheadDropdownItemAction.Close);
|
|
306
357
|
this._mastheadShell.closeMobileMenu();
|
|
307
358
|
this._mastheadShell.mobileBtn?.focus();
|
|
308
359
|
}
|
|
309
360
|
|
|
310
361
|
handleItemClick(e: PointerEvent): void {
|
|
311
362
|
this.handleSelectedChange();
|
|
363
|
+
this.fireItemClickEvent(e);
|
|
364
|
+
this.fireDropdownEvents();
|
|
365
|
+
}
|
|
312
366
|
|
|
367
|
+
handleSelectedChange(): void {
|
|
368
|
+
this.selected = this.isMobile ? true : !this.selected;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
fireDropdownEvents(): void {
|
|
372
|
+
if (this.hasDropdownSlot) {
|
|
373
|
+
const { Open, Close } = UDExMastheadDropdownItemAction;
|
|
374
|
+
const action = this.selected ? Open : Close;
|
|
375
|
+
if (this.selected) {
|
|
376
|
+
this.fireDropdownOpenEvent(this.eventItemTitle, action);
|
|
377
|
+
} else {
|
|
378
|
+
this.fireDropdownCloseEvent(this.eventItemTitle, action);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
fireDropdownCloseEvent(title: string, action: UDExMastheadDropdownItemAction): void {
|
|
384
|
+
this.fireDecoratorEvent("dropdown-closed", { title, action });
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
fireDropdownOpenEvent(title: string, action: UDExMastheadDropdownItemAction): void {
|
|
388
|
+
this.fireDecoratorEvent("dropdown-opened", { title, action });
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
fireItemClickEvent(e: PointerEvent): void {
|
|
313
392
|
this.fireDecoratorEvent("item-click", {
|
|
314
393
|
item: this,
|
|
315
394
|
originalEvent: e,
|
|
316
395
|
});
|
|
317
396
|
}
|
|
318
397
|
|
|
319
|
-
handleSelectedChange(): void {
|
|
320
|
-
this.selected = this.isMobile ? true : !this.selected;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
398
|
setDropdownInsetStart(): void {
|
|
324
399
|
const dropdown = this.getDomElement(".udex-masthead-item__dropdown");
|
|
325
400
|
if (dropdown) {
|
|
326
401
|
const rect = dropdown.getBoundingClientRect();
|
|
327
|
-
const dropdownHolder = this.getDomElement(".udex-masthead-item__dropdown-holder");
|
|
328
402
|
const marginInlineStart = this.calculateMarginInlineStart(rect);
|
|
329
403
|
|
|
330
|
-
if (marginInlineStart !== null
|
|
331
|
-
|
|
404
|
+
if (marginInlineStart !== null) {
|
|
405
|
+
dropdown.style.marginInlineStart = `${marginInlineStart - 3}px`;
|
|
332
406
|
}
|
|
333
407
|
}
|
|
334
408
|
}
|
|
@@ -368,6 +442,7 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
368
442
|
|
|
369
443
|
closeDropdown(): void {
|
|
370
444
|
this.selected = false;
|
|
445
|
+
this.fireDropdownCloseEvent(this.eventItemTitle, UDExMastheadDropdownItemAction.Close);
|
|
371
446
|
}
|
|
372
447
|
|
|
373
448
|
getDomElement(selector: string): HTMLElement | undefined | null {
|
|
@@ -390,8 +465,9 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
390
465
|
const iconClass = (this.icon || this.image) ? "udex-masthead-item__button--icon" : "";
|
|
391
466
|
const profileClass = this.isProfileBtn ? "udex-masthead-item__button--profile" : "";
|
|
392
467
|
const exploreClass = this.isExploreBtn ? "udex-masthead-item__button--explore" : "";
|
|
468
|
+
const supportClass = this.isSupportBtn ? "udex-masthead-item__button--support" : "";
|
|
393
469
|
const countrySelectorClass = this.isCountrySelectorBtn ? "udex-masthead-item__button--country-selector" : "";
|
|
394
|
-
return `udex-masthead-item ${iconClass} ${profileClass} ${exploreClass} ${countrySelectorClass}`.trim();
|
|
470
|
+
return `udex-masthead-item ${iconClass} ${profileClass} ${exploreClass} ${countrySelectorClass} ${supportClass}`.trim();
|
|
395
471
|
}
|
|
396
472
|
|
|
397
473
|
get profileAvatar(): UDExAvatar {
|
|
@@ -436,7 +512,7 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
436
512
|
return labels.join(" ").trim();
|
|
437
513
|
}
|
|
438
514
|
|
|
439
|
-
get
|
|
515
|
+
get isDropdownOpened(): boolean {
|
|
440
516
|
return this.hasDropdownSlot && this.selected;
|
|
441
517
|
}
|
|
442
518
|
|
|
@@ -460,12 +536,16 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
460
536
|
return this.getAttribute("slot") === "countrySelector";
|
|
461
537
|
}
|
|
462
538
|
|
|
463
|
-
get
|
|
464
|
-
return this.
|
|
539
|
+
get isCartBtn(): boolean {
|
|
540
|
+
return this.getAttribute("slot") === "cart";
|
|
465
541
|
}
|
|
466
542
|
|
|
467
|
-
get
|
|
468
|
-
return
|
|
543
|
+
get isSupportBtn(): boolean {
|
|
544
|
+
return this.getAttribute("slot") === "support";
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
get accessibleLabel(): string {
|
|
548
|
+
return this.accessibleName || this.innerText || (this.isProfileBtn ? UDExMastheadItem.i18nBundle.getText(PROFILE) : "");
|
|
469
549
|
}
|
|
470
550
|
|
|
471
551
|
get isMobile(): boolean {
|
|
@@ -479,6 +559,30 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
|
|
|
479
559
|
get openInNewWindowText(): string {
|
|
480
560
|
return UDExMastheadItem.i18nBundle.getText(OPENS_IN_A_NEW_WINDOW);
|
|
481
561
|
}
|
|
562
|
+
|
|
563
|
+
get eventItemTitle(): string {
|
|
564
|
+
if (this.accessibleName) {
|
|
565
|
+
return this.accessibleName.trim();
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if (this.isCartBtn) {
|
|
569
|
+
return UDExMastheadItem.i18nBundle.getText(CART);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
if (this.isProfileBtn) {
|
|
573
|
+
return UDExMastheadItem.i18nBundle.getText(PROFILE);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
if (this.isCountrySelectorBtn) {
|
|
577
|
+
return UDExMastheadItem.i18nBundle.getText(COUNTRY_SELECTOR);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
if (this.isSupportBtn) {
|
|
581
|
+
return UDExMastheadItem.i18nBundle.getText(SUPPORT);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
return this.firstChild?.nodeValue?.trim() || "";
|
|
585
|
+
}
|
|
482
586
|
}
|
|
483
587
|
|
|
484
588
|
UDExMastheadItem.define();
|
package/src/MastheadMenu.hbs
CHANGED
|
@@ -34,7 +34,10 @@
|
|
|
34
34
|
{{/inline}}
|
|
35
35
|
|
|
36
36
|
{{#*inline "list"}}
|
|
37
|
-
<ul
|
|
37
|
+
<ul
|
|
38
|
+
class="udex-masthead-menu__list"
|
|
39
|
+
aria-labelledby="category-{{categoryId}}"
|
|
40
|
+
category="{{this.category}}">
|
|
38
41
|
{{#each this.items}}
|
|
39
42
|
<li>
|
|
40
43
|
{{#if this.url}}
|
package/src/MastheadMenu.ts
CHANGED
|
@@ -8,7 +8,7 @@ import "@ui5/webcomponents-icons/dist/slim-arrow-right.js";
|
|
|
8
8
|
import "@ui5/webcomponents-icons/dist/action.js";
|
|
9
9
|
import { isUp, isDown } from "@ui5/webcomponents-base/dist/Keys.js";
|
|
10
10
|
import UDExBadge from "./Badge.js";
|
|
11
|
-
import UDExMastheadMenuItem from "./MastheadMenuItem.js";
|
|
11
|
+
import UDExMastheadMenuItem, { UDExItemType } from "./MastheadMenuItem.js";
|
|
12
12
|
import UDExDivider from "./Divider.js";
|
|
13
13
|
import MastheadMenuTemplate from "./generated/templates/MastheadMenuTemplate.lit.js";
|
|
14
14
|
|
|
@@ -35,6 +35,7 @@ export type MenuItem = {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
type UDExMastheadMenuMenuItemClickEventDetail = {
|
|
38
|
+
category?: string,
|
|
38
39
|
originalEvent: PointerEvent,
|
|
39
40
|
item: UDExMastheadMenuItem,
|
|
40
41
|
}
|
|
@@ -124,10 +125,16 @@ class UDExMastheadMenu extends UI5Element {
|
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
handleMenuItemClick(e: PointerEvent): void {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
const item = e.target as UDExMastheadMenuItem;
|
|
129
|
+
const { url, type } = item;
|
|
130
|
+
if (url?.length) {
|
|
131
|
+
const list = item.closest(".udex-masthead-menu__list") as HTMLElement;
|
|
132
|
+
this.fireDecoratorEvent("menu-item-click", {
|
|
133
|
+
item,
|
|
134
|
+
originalEvent: e,
|
|
135
|
+
...(type !== UDExItemType.Heading && { category: list?.getAttribute("category") || "" }),
|
|
136
|
+
});
|
|
137
|
+
}
|
|
131
138
|
}
|
|
132
139
|
|
|
133
140
|
focusPreviousItem(item: UDExMastheadMenuItem): void {
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
{{#if _category.url}}
|
|
149
149
|
<li class="udex-masthead-mobile-menu__list-item" role="menuitem">
|
|
150
150
|
<udex-masthead-menu-item
|
|
151
|
-
@click="{{../
|
|
151
|
+
@click="{{../handleMobileCategoryItemEvent}}"
|
|
152
152
|
url="{{this._category.url}}"
|
|
153
153
|
label="{{overviewLinkText}}"
|
|
154
154
|
has-border>
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
{{#if this.url}}
|
|
160
160
|
<li class="udex-masthead-mobile-menu__list-item" role="menuitem">
|
|
161
161
|
<udex-masthead-menu-item
|
|
162
|
-
@click="{{../
|
|
162
|
+
@click="{{../handleMobileCategoryItemEvent}}"
|
|
163
163
|
label="{{this.title}}"
|
|
164
164
|
url="{{this.url}}"
|
|
165
165
|
has-border>
|
|
@@ -22,6 +22,12 @@ import MastheadMobileMenuCss from "./generated/themes/MastheadMobileMenu.css.js"
|
|
|
22
22
|
type UDExMastheadMobileMenuItemClickEventDetail = {
|
|
23
23
|
originalEvent: PointerEvent | KeyboardEvent,
|
|
24
24
|
item: UDExMastheadMenuItem,
|
|
25
|
+
category?: string,
|
|
26
|
+
isMobile: boolean,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type UDExMastheadMobileMenuExploreClickEventDetail = {
|
|
30
|
+
originalEvent: PointerEvent | KeyboardEvent,
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
/**
|
|
@@ -68,7 +74,7 @@ type UDExMastheadMobileMenuItemClickEventDetail = {
|
|
|
68
74
|
class UDExMastheadMobileMenu extends UI5Element {
|
|
69
75
|
eventDetails!: {
|
|
70
76
|
"item-click": UDExMastheadMobileMenuItemClickEventDetail,
|
|
71
|
-
"explorer-menu-click":
|
|
77
|
+
"explorer-menu-click": UDExMastheadMobileMenuExploreClickEventDetail,
|
|
72
78
|
};
|
|
73
79
|
/**
|
|
74
80
|
* Slot for search
|
|
@@ -145,7 +151,7 @@ class UDExMastheadMobileMenu extends UI5Element {
|
|
|
145
151
|
e.preventDefault();
|
|
146
152
|
this.openExploreSapMenu(e);
|
|
147
153
|
this.setFocusItemByIndex(0);
|
|
148
|
-
this.fireDecoratorEvent("explorer-menu-click");
|
|
154
|
+
this.fireDecoratorEvent("explorer-menu-click", { originalEvent: e });
|
|
149
155
|
}
|
|
150
156
|
|
|
151
157
|
handleBackToMenuItems(e: PointerEvent) {
|
|
@@ -232,6 +238,11 @@ class UDExMastheadMobileMenu extends UI5Element {
|
|
|
232
238
|
this.fireMobileItemEvent(e);
|
|
233
239
|
}
|
|
234
240
|
|
|
241
|
+
handleMobileCategoryItemEvent(e: PointerEvent) {
|
|
242
|
+
e.stopPropagation();
|
|
243
|
+
this.fireMobileItemEvent(e, this._category.category);
|
|
244
|
+
}
|
|
245
|
+
|
|
235
246
|
handleMenuMode() {
|
|
236
247
|
if (this.isNoMenuItemsMode && this.hasExploreBtnSlot) {
|
|
237
248
|
this.openCategories(this.exploreItem);
|
|
@@ -399,10 +410,12 @@ class UDExMastheadMobileMenu extends UI5Element {
|
|
|
399
410
|
this._showCategoryItems = false;
|
|
400
411
|
}
|
|
401
412
|
|
|
402
|
-
fireMobileItemEvent(e: PointerEvent | KeyboardEvent) {
|
|
413
|
+
fireMobileItemEvent(e: PointerEvent | KeyboardEvent, category?: string) {
|
|
403
414
|
this.fireDecoratorEvent("item-click", {
|
|
415
|
+
isMobile: true,
|
|
404
416
|
item: e.target as UDExMastheadMenuItem,
|
|
405
417
|
originalEvent: e,
|
|
418
|
+
...(category && { category }),
|
|
406
419
|
});
|
|
407
420
|
}
|
|
408
421
|
|
package/src/MastheadShell.hbs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<header
|
|
1
|
+
<header
|
|
2
|
+
class="udex-masthead-shell"
|
|
3
|
+
@keydown="{{handleKeyDown}}">
|
|
2
4
|
<div class="udex-masthead-shell__main-content">
|
|
3
5
|
<div class="udex-masthead-shell__landing-wrap">
|
|
4
6
|
{{#if logoUrl}}
|
|
@@ -26,7 +28,9 @@
|
|
|
26
28
|
</div>
|
|
27
29
|
|
|
28
30
|
{{#if isSearchVisible}}
|
|
29
|
-
<div
|
|
31
|
+
<div
|
|
32
|
+
class="udex-masthead-shell__search-container"
|
|
33
|
+
@ui5-search-keydown="{{handleSearchKeyDown}}">
|
|
30
34
|
<slot name="search"></slot>
|
|
31
35
|
</div>
|
|
32
36
|
{{#if _isSearchOpened}}
|
|
@@ -80,6 +84,14 @@
|
|
|
80
84
|
<slot name="cart"></slot>
|
|
81
85
|
</div>
|
|
82
86
|
{{/if}}
|
|
87
|
+
{{#if hasSupport}}
|
|
88
|
+
<div
|
|
89
|
+
class="udex-masthead-shell__support udex-masthead-shell__item_icon"
|
|
90
|
+
@ui5-item-click="{{setSelectedItem}}"
|
|
91
|
+
@click="{{handleSupportClick}}">
|
|
92
|
+
<slot name="support"></slot>
|
|
93
|
+
</div>
|
|
94
|
+
{{/if}}
|
|
83
95
|
{{#if hasProfile}}
|
|
84
96
|
<div
|
|
85
97
|
class="udex-masthead-shell__profile udex-masthead-shell__item_icon"
|
|
@@ -96,7 +108,6 @@
|
|
|
96
108
|
<slot name="countrySelector"></slot>
|
|
97
109
|
</div>
|
|
98
110
|
{{/if}}
|
|
99
|
-
|
|
100
111
|
{{#if hasMobileMenuButtons}}
|
|
101
112
|
<udex-masthead-item
|
|
102
113
|
@keydown="{{handleEnterAndSpaceOnCloseBtn}}"
|