@sapudex/web-components 0.224.0 → 0.226.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/FilterMenu.d.ts +7 -0
  2. package/dist/FilterMenu.js +3 -0
  3. package/dist/FilterMenu.js.map +1 -1
  4. package/dist/HeroBanner.js.map +1 -1
  5. package/dist/MastheadItem.d.ts +49 -2
  6. package/dist/MastheadItem.js +112 -23
  7. package/dist/MastheadItem.js.map +1 -1
  8. package/dist/MastheadMenu.d.ts +1 -0
  9. package/dist/MastheadMenu.js +14 -5
  10. package/dist/MastheadMenu.js.map +1 -1
  11. package/dist/MastheadMobileMenu.d.ts +4 -1
  12. package/dist/MastheadMobileMenu.js +15 -3
  13. package/dist/MastheadMobileMenu.js.map +1 -1
  14. package/dist/MastheadShell.d.ts +26 -4
  15. package/dist/MastheadShell.js +86 -43
  16. package/dist/MastheadShell.js.map +1 -1
  17. package/dist/PasswordField.d.ts +12 -0
  18. package/dist/PasswordField.js +13 -0
  19. package/dist/PasswordField.js.map +1 -1
  20. package/dist/SecondaryNavigation.d.ts +1 -1
  21. package/dist/SecondaryNavigation.js +8 -6
  22. package/dist/SecondaryNavigation.js.map +1 -1
  23. package/dist/SecondaryNavigationItem.d.ts +4 -3
  24. package/dist/SecondaryNavigationItem.js +15 -9
  25. package/dist/SecondaryNavigationItem.js.map +1 -1
  26. package/dist/SecondaryNavigationSubItem.d.ts +2 -2
  27. package/dist/SecondaryNavigationSubItem.js +5 -4
  28. package/dist/SecondaryNavigationSubItem.js.map +1 -1
  29. package/dist/Table.d.ts +5 -0
  30. package/dist/Table.js +4 -1
  31. package/dist/Table.js.map +1 -1
  32. package/dist/TextField.d.ts +8 -0
  33. package/dist/TextField.js +9 -0
  34. package/dist/TextField.js.map +1 -1
  35. package/dist/assets/{bundle.esm-fe0b0d94.js → bundle.esm-740278cc.js} +194 -193
  36. package/dist/assets/messagebundle_en-f0b5e0d9.js +1 -0
  37. package/dist/css/themes/MastheadItem.css +1 -1
  38. package/dist/css/themes/PasswordField.css +1 -0
  39. package/dist/css/themes/RatingIndicator.css +1 -1
  40. package/dist/css/themes/Slider.css +1 -1
  41. package/dist/custom-elements-internal.json +148 -0
  42. package/dist/custom-elements.json +125 -0
  43. package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
  44. package/dist/generated/i18n/i18n-defaults.d.ts +4 -1
  45. package/dist/generated/i18n/i18n-defaults.js +4 -1
  46. package/dist/generated/i18n/i18n-defaults.js.map +1 -1
  47. package/dist/generated/templates/FilterMenuTemplate.lit.js +1 -1
  48. package/dist/generated/templates/FilterMenuTemplate.lit.js.map +1 -1
  49. package/dist/generated/templates/MastheadItemTemplate.lit.js +2 -2
  50. package/dist/generated/templates/MastheadItemTemplate.lit.js.map +1 -1
  51. package/dist/generated/templates/MastheadMenuTemplate.lit.js +1 -1
  52. package/dist/generated/templates/MastheadMenuTemplate.lit.js.map +1 -1
  53. package/dist/generated/templates/MastheadMobileMenuTemplate.lit.js +2 -2
  54. package/dist/generated/templates/MastheadMobileMenuTemplate.lit.js.map +1 -1
  55. package/dist/generated/templates/MastheadShellTemplate.lit.js +6 -5
  56. package/dist/generated/templates/MastheadShellTemplate.lit.js.map +1 -1
  57. package/dist/generated/templates/PasswordFieldTemplate.lit.js +1 -1
  58. package/dist/generated/templates/PasswordFieldTemplate.lit.js.map +1 -1
  59. package/dist/generated/templates/TextFieldTemplate.lit.js +1 -1
  60. package/dist/generated/templates/TextFieldTemplate.lit.js.map +1 -1
  61. package/dist/generated/themes/MastheadItem.css.js +1 -1
  62. package/dist/generated/themes/MastheadItem.css.js.map +1 -1
  63. package/dist/generated/themes/PasswordField.css.d.ts +3 -0
  64. package/dist/generated/themes/PasswordField.css.js +9 -0
  65. package/dist/generated/themes/PasswordField.css.js.map +1 -0
  66. package/dist/generated/themes/RatingIndicator.css.js +1 -1
  67. package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
  68. package/dist/generated/themes/Slider.css.js +1 -1
  69. package/dist/generated/themes/Slider.css.js.map +1 -1
  70. package/dist/i18n/messagebundle.properties +10 -2
  71. package/dist/i18n/messagebundle_en.properties +4 -1
  72. package/dist/vscode.html-custom-data.json +22 -2
  73. package/dist/web-types.json +93 -4
  74. package/package.json +1 -1
  75. package/src/FilterMenu.hbs +1 -0
  76. package/src/FilterMenu.ts +9 -0
  77. package/src/HeroBanner.ts +1 -1
  78. package/src/MastheadItem.hbs +2 -2
  79. package/src/MastheadItem.ts +136 -25
  80. package/src/MastheadMenu.hbs +4 -1
  81. package/src/MastheadMenu.ts +16 -5
  82. package/src/MastheadMobileMenu.hbs +2 -2
  83. package/src/MastheadMobileMenu.ts +18 -3
  84. package/src/MastheadShell.hbs +14 -3
  85. package/src/MastheadShell.ts +98 -45
  86. package/src/PasswordField.hbs +1 -0
  87. package/src/PasswordField.ts +19 -1
  88. package/src/SecondaryNavigation.ts +9 -6
  89. package/src/SecondaryNavigationItem.ts +17 -10
  90. package/src/SecondaryNavigationSubItem.ts +5 -4
  91. package/src/Table.ts +8 -1
  92. package/src/TextField.hbs +2 -0
  93. package/src/TextField.ts +16 -0
  94. package/src/generated/i18n/i18n-defaults.ts +2 -2
  95. package/src/generated/templates/FilterMenuTemplate.lit.ts +1 -1
  96. package/src/generated/templates/MastheadItemTemplate.lit.ts +2 -2
  97. package/src/generated/templates/MastheadMenuTemplate.lit.ts +1 -1
  98. package/src/generated/templates/MastheadMobileMenuTemplate.lit.ts +2 -2
  99. package/src/generated/templates/MastheadShellTemplate.lit.ts +6 -5
  100. package/src/generated/templates/PasswordFieldTemplate.lit.ts +1 -1
  101. package/src/generated/templates/TextFieldTemplate.lit.ts +1 -1
  102. package/src/generated/themes/MastheadItem.css.ts +1 -1
  103. package/src/generated/themes/PasswordField.css.ts +13 -0
  104. package/src/generated/themes/RatingIndicator.css.ts +1 -1
  105. package/src/generated/themes/Slider.css.ts +1 -1
  106. package/src/i18n/messagebundle.properties +10 -2
  107. package/src/i18n/messagebundle_en.properties +4 -1
  108. package/src/themes/MastheadItem.css +9 -3
  109. package/src/themes/PasswordField.css +3 -0
  110. package/dist/assets/messagebundle_en-d1666c5e.js +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@sapudex/web-components",
4
- "version": "0.224.0",
4
+ "version": "0.226.0",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1276,6 +1276,11 @@
1276
1276
  "description": "Defines the accessible ARIA name of the component.",
1277
1277
  "value": { "type": "string", "default": "\"\"" }
1278
1278
  },
1279
+ {
1280
+ "name": "accessible-name-ref",
1281
+ "description": "Defines id (or many ids) of the elements that contain the ARIA name of the component.",
1282
+ "value": { "type": "string", "default": "\"\"" }
1283
+ },
1279
1284
  {
1280
1285
  "name": "accessible-role",
1281
1286
  "description": "Allows setting a custom role.",
@@ -1446,6 +1451,11 @@
1446
1451
  "description": "Defines the accessible ARIA name of the component.",
1447
1452
  "value": { "type": "string" }
1448
1453
  },
1454
+ {
1455
+ "name": "accessible-name-ref",
1456
+ "description": "Defines id (or many ids) of the elements that contain the ARIA name of the component.",
1457
+ "value": { "type": "string" }
1458
+ },
1449
1459
  {
1450
1460
  "name": "accessible-role",
1451
1461
  "description": "Allows setting a custom role.",
@@ -3167,7 +3177,7 @@
3167
3177
  },
3168
3178
  {
3169
3179
  "name": "udex-masthead-item",
3170
- "description": "<h3 class=\"comment-api-title\">Overview</h3>\n\n\n<h3>Usage</h3>\n\nFor the <code>udex-masthead-item</code>\n<h3>ES6 Module Import</h3>\n\n<code>import \"@sapudex/web-components/dist/MastheadItem.js\";</code>\n---\n\n\n### **Events:**\n - **item-click** - Fires when item is clicked\n\n### **Slots:**\n - **dropdown** - Slot for the dropdown\n- **default** - Slot for any content",
3180
+ "description": "<h3 class=\"comment-api-title\">Overview</h3>\n\n\n<h3>Usage</h3>\n\nFor the <code>udex-masthead-item</code>\n<h3>ES6 Module Import</h3>\n\n<code>import \"@sapudex/web-components/dist/MastheadItem.js\";</code>\n---\n\n\n### **Events:**\n - **item-click** - Fires when item is clicked\n- **dropdown-closed** - Fires when item is clicked\n- **dropdown-opened** - Fires when item is clicked\n\n### **Slots:**\n - **dropdown** - Slot for the dropdown\n- **default** - Slot for any content",
3171
3181
  "doc-url": "",
3172
3182
  "attributes": [
3173
3183
  {
@@ -3249,6 +3259,14 @@
3249
3259
  {
3250
3260
  "name": "item-click",
3251
3261
  "description": "Fires when item is clicked"
3262
+ },
3263
+ {
3264
+ "name": "dropdown-closed",
3265
+ "description": "Fires when item is clicked"
3266
+ },
3267
+ {
3268
+ "name": "dropdown-opened",
3269
+ "description": "Fires when item is clicked"
3252
3270
  }
3253
3271
  ],
3254
3272
  "js": {
@@ -3328,6 +3346,14 @@
3328
3346
  {
3329
3347
  "name": "item-click",
3330
3348
  "description": "Fires when item is clicked"
3349
+ },
3350
+ {
3351
+ "name": "dropdown-closed",
3352
+ "description": "Fires when item is clicked"
3353
+ },
3354
+ {
3355
+ "name": "dropdown-opened",
3356
+ "description": "Fires when item is clicked"
3331
3357
  }
3332
3358
  ]
3333
3359
  }
@@ -3481,7 +3507,7 @@
3481
3507
  },
3482
3508
  {
3483
3509
  "name": "udex-masthead-shell",
3484
- "description": "<h3 class=\"comment-api-title\">Overview</h3>\n\n\n<h3>Usage</h3>\n\nFor the <code>udex-masthead-shell</code>\n<h3>ES6 Module Import</h3>\n\n<code>import \"@sapudex/web-components/dist/MastheadShell.js\";</code>\n---\n\n\n### **Events:**\n - **mobile-menu-open** - Fired event when the user clicks the mobile menu button opener.\n- **mobile-menu-close** - Fired event when the user clicks the mobile menu button closer.\n- **search-click** - Fired event when the user clicks the search button trigger.\n- **cart-click** - Fired event when the user clicks the cart button trigger.\n- **profile-click** - Fired event when the user clicks the profile button trigger.\n- **country-selector-click** - Fired event when the user clicks the country selector button trigger.\n- **logo-click** - Fired event when the user clicks the logo.\n- **site-label-click** - Fired event when the user clicks the site label.\n\n### **Methods:**\n - **closeSearch(): _void_** - Close the search panel.\n- **openSearch(): _void_** - Open the search panel.\n- **openMobileMenu(): _void_** - Open the mobile menu panel.\n- **closeMobileMenu(): _void_** - Close the mobile menu panel.\n\n### **Slots:**\n - **countrySelector** - Slot for country selector item.\n- **mobileMenu** - Slot for mobile menu\n- **default** - Slot for main menu items.\n- **search** - Slot for search component - will be visible on search icon click.\nNote: search component should be hidden by default.\nNote: search icon won't be visible if this slot would be empty\n- **exploreSAP** - Slot for 'Explore SAP' menu\n- **cart** - Slot for cart menu\n- **profile** - Slot for avatar",
3510
+ "description": "<h3 class=\"comment-api-title\">Overview</h3>\n\n\n<h3>Usage</h3>\n\nFor the <code>udex-masthead-shell</code>\n<h3>ES6 Module Import</h3>\n\n<code>import \"@sapudex/web-components/dist/MastheadShell.js\";</code>\n---\n\n\n### **Events:**\n - **mobile-menu-open** - Fired event when the user clicks the mobile menu button opener.\n- **mobile-menu-close** - Fired event when the user clicks the mobile menu button closer.\n- **search-click** - Fired event when the user clicks the search button trigger.\n- **search-close-click** - Fired event when the user clicks the search close button.\n- **search-opened** - Fired event when the search panel is opened.\n- **search-closed** - Fired event when the search panel is closed.\n- **cart-click** - Fired event when the user clicks the cart button trigger.\n- **support-click** - Fired event when the user clicks the support button trigger.\n- **profile-click** - Fired event when the user clicks the profile button trigger.\n- **country-selector-click** - Fired event when the user clicks the country selector button trigger.\n- **logo-click** - Fired event when the user clicks the logo.\n- **site-label-click** - Fired event when the user clicks the site label.\n\n### **Methods:**\n - **closeSearch(): _void_** - Close the search panel.\n- **openSearch(): _void_** - Open the search panel.\n- **openMobileMenu(): _void_** - Open the mobile menu panel.\n- **closeMobileMenu(): _void_** - Close the mobile menu panel.\n\n### **Slots:**\n - **countrySelector** - Slot for country selector item.\n- **mobileMenu** - Slot for mobile menu\n- **default** - Slot for main menu items.\n- **search** - Slot for search component - will be visible on search icon click.\nNote: search component should be hidden by default.\nNote: search icon won't be visible if this slot would be empty\n- **exploreSAP** - Slot for 'Explore SAP' menu\n- **cart** - Slot for cart menu\n- **profile** - Slot for avatar\n- **support** - Slot for support",
3485
3511
  "doc-url": "",
3486
3512
  "attributes": [
3487
3513
  {
@@ -3561,7 +3587,8 @@
3561
3587
  "description": "Slot for 'Explore SAP' menu"
3562
3588
  },
3563
3589
  { "name": "cart", "description": "Slot for cart menu" },
3564
- { "name": "profile", "description": "Slot for avatar" }
3590
+ { "name": "profile", "description": "Slot for avatar" },
3591
+ { "name": "support", "description": "Slot for support" }
3565
3592
  ],
3566
3593
  "events": [
3567
3594
  {
@@ -3576,10 +3603,26 @@
3576
3603
  "name": "search-click",
3577
3604
  "description": "Fired event when the user clicks the search button trigger."
3578
3605
  },
3606
+ {
3607
+ "name": "search-close-click",
3608
+ "description": "Fired event when the user clicks the search close button."
3609
+ },
3610
+ {
3611
+ "name": "search-opened",
3612
+ "description": "Fired event when the search panel is opened."
3613
+ },
3614
+ {
3615
+ "name": "search-closed",
3616
+ "description": "Fired event when the search panel is closed."
3617
+ },
3579
3618
  {
3580
3619
  "name": "cart-click",
3581
3620
  "description": "Fired event when the user clicks the cart button trigger."
3582
3621
  },
3622
+ {
3623
+ "name": "support-click",
3624
+ "description": "Fired event when the user clicks the support button trigger."
3625
+ },
3583
3626
  {
3584
3627
  "name": "profile-click",
3585
3628
  "description": "Fired event when the user clicks the profile button trigger."
@@ -3673,10 +3716,26 @@
3673
3716
  "name": "search-click",
3674
3717
  "description": "Fired event when the user clicks the search button trigger."
3675
3718
  },
3719
+ {
3720
+ "name": "search-close-click",
3721
+ "description": "Fired event when the user clicks the search close button."
3722
+ },
3723
+ {
3724
+ "name": "search-opened",
3725
+ "description": "Fired event when the search panel is opened."
3726
+ },
3727
+ {
3728
+ "name": "search-closed",
3729
+ "description": "Fired event when the search panel is closed."
3730
+ },
3676
3731
  {
3677
3732
  "name": "cart-click",
3678
3733
  "description": "Fired event when the user clicks the cart button trigger."
3679
3734
  },
3735
+ {
3736
+ "name": "support-click",
3737
+ "description": "Fired event when the user clicks the support button trigger."
3738
+ },
3680
3739
  {
3681
3740
  "name": "profile-click",
3682
3741
  "description": "Fired event when the user clicks the profile button trigger."
@@ -4252,6 +4311,11 @@
4252
4311
  "description": "<h3 class=\"comment-api-title\">Overview</h3>\n\n\n<h3>Usage</h3>\n\nFor the <code>udex-password-field</code>\n<h3>ES6 Module Import</h3>\n\n<code>import \"@sapudex/web-components/dist/UDExPasswordField.js\";</code>\n---\n",
4253
4312
  "doc-url": "",
4254
4313
  "attributes": [
4314
+ {
4315
+ "name": "autocomplete",
4316
+ "description": "Defines the behaviour of autocomplete.",
4317
+ "value": { "type": "\"on\" | \"off\"" }
4318
+ },
4255
4319
  {
4256
4320
  "name": "disabled",
4257
4321
  "description": "Defines whether the component is in disabled state.\n<br><br>\n<b>Note:</b> A disabled component is completely noninteractive.",
@@ -4321,6 +4385,11 @@
4321
4385
  "events": [],
4322
4386
  "js": {
4323
4387
  "properties": [
4388
+ {
4389
+ "name": "autocomplete",
4390
+ "description": "Defines the behaviour of autocomplete.",
4391
+ "value": { "type": "\"on\" | \"off\"" }
4392
+ },
4324
4393
  {
4325
4394
  "name": "disabled",
4326
4395
  "description": "Defines whether the component is in disabled state.\n<br><br>\n<b>Note:</b> A disabled component is completely noninteractive.",
@@ -6660,6 +6729,11 @@
6660
6729
  "name": "sticky-column",
6661
6730
  "description": "Sticks the first column to the left of the table.",
6662
6731
  "value": { "type": "boolean", "default": "false" }
6732
+ },
6733
+ {
6734
+ "name": "custom-columns",
6735
+ "description": "Defines the rows of the table.",
6736
+ "value": { "type": "string" }
6663
6737
  }
6664
6738
  ],
6665
6739
  "slots": [
@@ -6726,6 +6800,11 @@
6726
6800
  "name": "sticky-column",
6727
6801
  "description": "Sticks the first column to the left of the table.",
6728
6802
  "value": { "type": "boolean" }
6803
+ },
6804
+ {
6805
+ "name": "custom-columns",
6806
+ "description": "Defines the rows of the table.",
6807
+ "value": { "type": "string" }
6729
6808
  }
6730
6809
  ],
6731
6810
  "events": []
@@ -7396,6 +7475,11 @@
7396
7475
  "description": "Defines if the text-field is active",
7397
7476
  "value": { "type": "boolean", "default": "false" }
7398
7477
  },
7478
+ {
7479
+ "name": "autocomplete",
7480
+ "description": "Defines the behaviour of autocomplete.",
7481
+ "value": { "type": "string", "default": "\"off\"" }
7482
+ },
7399
7483
  {
7400
7484
  "name": "direction",
7401
7485
  "description": "Defines direction of the input.",
@@ -7491,6 +7575,11 @@
7491
7575
  "description": "Defines if the text-field is active",
7492
7576
  "value": { "type": "boolean" }
7493
7577
  },
7578
+ {
7579
+ "name": "autocomplete",
7580
+ "description": "Defines the behaviour of autocomplete.",
7581
+ "value": { "type": "string" }
7582
+ },
7494
7583
  {
7495
7584
  "name": "direction",
7496
7585
  "description": "Defines direction of the input.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapudex/web-components",
3
- "version": "0.224.0",
3
+ "version": "0.226.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/"
6
6
  },
@@ -4,6 +4,7 @@
4
4
  @click="{{handleTriggerClick}}"
5
5
  @keydown="{{handleTriggerKeydown}}"
6
6
  aria-label="{{triggerButtonAccessibleName}}"
7
+ aria-labelledby="{{accessibleNameRef}}"
7
8
  aria-expanded="{{_open}}"
8
9
  aria-haspopup="true"
9
10
  role="{{triggerAccessibleRole}}"
package/src/FilterMenu.ts CHANGED
@@ -278,6 +278,15 @@ class UDExFilterMenu extends UDExSearchableListBase {
278
278
  @property()
279
279
  accessibleName!: string;
280
280
 
281
+ /**
282
+ * Defines id (or many ids) of the elements that contain the ARIA name of the component.
283
+ *
284
+ * @default ""
285
+ * @public
286
+ */
287
+ @property()
288
+ accessibleNameRef!: string;
289
+
281
290
  /**
282
291
  * Allows setting a custom role.
283
292
  * @default "None"
package/src/HeroBanner.ts CHANGED
@@ -89,7 +89,7 @@ class UDExHeroBanner extends UI5Element {
89
89
  * @public
90
90
  */
91
91
  @property({ type: String })
92
- backgroundColor?: string;
92
+ backgroundColor?: string;
93
93
 
94
94
  /**
95
95
  * Allows control over the background-image to set css gradient.
@@ -32,7 +32,7 @@
32
32
  @click="{{handleItemClick}}">
33
33
  {{> content}}
34
34
  </span>
35
- {{#if showDropdown}}
35
+ {{#if isDropdownOpened}}
36
36
  {{> dropdown}}
37
37
  {{/if}}
38
38
  {{else}}
@@ -48,7 +48,7 @@
48
48
  @click="{{handleItemClick}}">
49
49
  {{> content}}
50
50
  </button>
51
- {{#if showDropdown}}
51
+ {{#if isDropdownOpened}}
52
52
  {{> dropdown}}
53
53
  {{/if}}
54
54
  {{/if}}
@@ -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 { OPENS_IN_A_NEW_WINDOW, PROFILE } from "./generated/i18n/i18n-defaults.js";
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 UDExAvatar from "./Avatar.js";
16
18
  import "@ui5/webcomponents-icons/dist/slim-arrow-down.js";
@@ -21,6 +23,12 @@ import { BreakpointUtils } from "./utils/Breakpoints.js";
21
23
  // Styles
22
24
  import MastheadItemCss from "./generated/themes/MastheadItem.css.js";
23
25
 
26
+ export enum DropdownItemAction {
27
+ Open = "Open",
28
+ Close = "Close",
29
+ ClickOutside = "Click Outside",
30
+ }
31
+
24
32
  export interface IMastheadItem {
25
33
  text?: string;
26
34
  selected?: boolean;
@@ -51,6 +59,29 @@ export type ItemClickEventDetail = {
51
59
  item: UDExMastheadItem,
52
60
  }
53
61
 
62
+ export type DropdownEventDetail = {
63
+ title: string,
64
+ action: DropdownItemAction,
65
+ }
66
+
67
+ export const DropdownBaseEventDetail = {
68
+ detail: {
69
+ title: { type: String },
70
+ action: { type: DropdownItemAction },
71
+ },
72
+ };
73
+
74
+ export const ItemBaseEvent = {
75
+ detail: {
76
+ item: {
77
+ type: HTMLElement,
78
+ },
79
+ originalEvent: {
80
+ type: Event,
81
+ },
82
+ },
83
+ };
84
+
54
85
  /**
55
86
  * @class
56
87
  *
@@ -86,16 +117,23 @@ export type ItemClickEventDetail = {
86
117
  * @allowPreventDefault
87
118
  * @public
88
119
  */
89
- @event("item-click", {
90
- detail: {
91
- item: {
92
- type: HTMLElement,
93
- },
94
- originalEvent: {
95
- type: Event,
96
- },
97
- },
98
- })
120
+ @event("item-click", ItemBaseEvent)
121
+
122
+ /**
123
+ * Fires when item is clicked
124
+ *
125
+ * @allowPreventDefault
126
+ * @public
127
+ */
128
+ @event("dropdown-closed", DropdownBaseEventDetail)
129
+
130
+ /**
131
+ * Fires when item is clicked
132
+ *
133
+ * @allowPreventDefault
134
+ * @public
135
+ */
136
+ @event("dropdown-opened", DropdownBaseEventDetail)
99
137
 
100
138
  class UDExMastheadItem extends UI5Element implements IMastheadItem {
101
139
  /**
@@ -258,6 +296,7 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
258
296
 
259
297
  _profileAvatar!: UDExAvatar;
260
298
  _mastheadShell!: UDExMastheadShell;
299
+ _isEscPress!: boolean;
261
300
 
262
301
  static i18nBundle: I18nBundle;
263
302
 
@@ -278,10 +317,27 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
278
317
  if (this.selected && this.hasDropdownSlot && !this.isMobile && !this.isExploreBtn) {
279
318
  this.setDropdownInsetStart();
280
319
  }
320
+
321
+ this.handleOutsideClick();
322
+ this._isEscPress = false;
323
+ }
324
+
325
+ handleOutsideClick(): void {
326
+ document.addEventListener("click", (e: Event) => {
327
+ const target = e.target as HTMLElement;
328
+ const item = target.closest("[udex-masthead-item]");
329
+ if (item !== this && !this.isMobile) {
330
+ if (this.isDropdownOpened) {
331
+ this.fireDropdownCloseEvent(this.eventItemTitle, DropdownItemAction.ClickOutside);
332
+ }
333
+
334
+ this.selected = false;
335
+ }
336
+ });
281
337
  }
282
338
 
283
339
  handleFocusout(e: FocusEvent): void {
284
- if (e.relatedTarget === null) {
340
+ if (e.relatedTarget === null || this._isEscPress) {
285
341
  return;
286
342
  }
287
343
 
@@ -302,6 +358,7 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
302
358
  }
303
359
 
304
360
  handleKeyEscape(): void {
361
+ this._isEscPress = true;
305
362
  this.closeDropdown();
306
363
  if (this.isProfileBtn) {
307
364
  this._profileAvatar.focus();
@@ -311,32 +368,56 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
311
368
  }
312
369
 
313
370
  handleKeyEscapeMobile(): void {
371
+ this.fireDropdownCloseEvent(this.eventItemTitle, DropdownItemAction.Close);
314
372
  this._mastheadShell.closeMobileMenu();
315
373
  this._mastheadShell.mobileBtn?.focus();
316
374
  }
317
375
 
318
376
  handleItemClick(e: Event): void {
377
+ this.fireItemClickEvent(e);
319
378
  this.handleSelectedChange();
379
+ this.fireDropdownEvents();
380
+ }
320
381
 
382
+ handleSelectedChange(): void {
383
+ this.selected = this.isMobile ? true : !this.selected;
384
+ }
385
+
386
+ fireDropdownEvents(): void {
387
+ if (this.hasDropdownSlot) {
388
+ const { Open, Close } = DropdownItemAction;
389
+ const action = this.selected ? Open : Close;
390
+ if (this.selected) {
391
+ this.fireDropdownOpenEvent(this.eventItemTitle, action);
392
+ } else {
393
+ this.fireDropdownCloseEvent(this.eventItemTitle, action);
394
+ }
395
+ }
396
+ }
397
+
398
+ fireDropdownCloseEvent(title: string, action: DropdownItemAction): void {
399
+ this.fireEvent<DropdownEventDetail>("dropdown-closed", { title, action });
400
+ }
401
+
402
+ fireDropdownOpenEvent(title: string, action: DropdownItemAction): void {
403
+ this.fireEvent<DropdownEventDetail>("dropdown-opened", { title, action });
404
+ }
405
+
406
+ fireItemClickEvent(e: Event): void {
321
407
  this.fireEvent<ItemClickEventDetail>("item-click", {
322
408
  item: this,
323
409
  originalEvent: e,
324
410
  });
325
411
  }
326
412
 
327
- handleSelectedChange(): void {
328
- this.selected = this.isMobile ? true : !this.selected;
329
- }
330
-
331
413
  setDropdownInsetStart(): void {
332
414
  const dropdown = this.getDomElement(".udex-masthead-item__dropdown");
333
415
  if (dropdown) {
334
416
  const rect = dropdown.getBoundingClientRect();
335
- const dropdownHolder = this.getDomElement(".udex-masthead-item__dropdown-holder");
336
417
  const marginInlineStart = this.calculateMarginInlineStart(rect);
337
418
 
338
- if (marginInlineStart !== null && dropdownHolder) {
339
- dropdownHolder.style.marginInlineStart = `${marginInlineStart - 3}px`;
419
+ if (marginInlineStart !== null) {
420
+ dropdown.style.marginInlineStart = `${marginInlineStart - 3}px`;
340
421
  }
341
422
  }
342
423
  }
@@ -376,6 +457,7 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
376
457
 
377
458
  closeDropdown(): void {
378
459
  this.selected = false;
460
+ this.fireDropdownCloseEvent(this.eventItemTitle, DropdownItemAction.Close);
379
461
  }
380
462
 
381
463
  getDomElement(selector: string): HTMLElement | undefined | null {
@@ -398,8 +480,9 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
398
480
  const iconClass = (this.icon || this.image) ? "udex-masthead-item__button--icon" : "";
399
481
  const profileClass = this.isProfileBtn ? "udex-masthead-item__button--profile" : "";
400
482
  const exploreClass = this.isExploreBtn ? "udex-masthead-item__button--explore" : "";
483
+ const supportClass = this.isSupportBtn ? "udex-masthead-item__button--support" : "";
401
484
  const countrySelectorClass = this.isCountrySelectorBtn ? "udex-masthead-item__button--country-selector" : "";
402
- return `udex-masthead-item ${iconClass} ${profileClass} ${exploreClass} ${countrySelectorClass}`.trim();
485
+ return `udex-masthead-item ${iconClass} ${profileClass} ${exploreClass} ${countrySelectorClass} ${supportClass}`.trim();
403
486
  }
404
487
 
405
488
  get profileAvatar(): UDExAvatar {
@@ -444,7 +527,7 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
444
527
  return labels.join(" ").trim();
445
528
  }
446
529
 
447
- get showDropdown(): boolean {
530
+ get isDropdownOpened(): boolean {
448
531
  return this.hasDropdownSlot && this.selected;
449
532
  }
450
533
 
@@ -468,12 +551,16 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
468
551
  return this.getAttribute("slot") === "countrySelector";
469
552
  }
470
553
 
471
- get accessibleLabel(): string {
472
- return this.accessibleName || this.innerText || (this.isProfileBtn ? UDExMastheadItem.i18nBundle.getText(PROFILE) : "");
554
+ get isCartBtn(): boolean {
555
+ return this.getAttribute("slot") === "cart";
473
556
  }
474
557
 
475
- get isMenuItem(): boolean {
476
- return true;
558
+ get isSupportBtn(): boolean {
559
+ return this.getAttribute("slot") === "support";
560
+ }
561
+
562
+ get accessibleLabel(): string {
563
+ return this.accessibleName || this.innerText || (this.isProfileBtn ? UDExMastheadItem.i18nBundle.getText(PROFILE) : "");
477
564
  }
478
565
 
479
566
  get isMobile(): boolean {
@@ -487,6 +574,30 @@ class UDExMastheadItem extends UI5Element implements IMastheadItem {
487
574
  get openInNewWindowText(): string {
488
575
  return UDExMastheadItem.i18nBundle.getText(OPENS_IN_A_NEW_WINDOW);
489
576
  }
577
+
578
+ get eventItemTitle(): string {
579
+ if (this.accessibleName) {
580
+ return this.accessibleName.trim();
581
+ }
582
+
583
+ if (this.isCartBtn) {
584
+ return UDExMastheadItem.i18nBundle.getText(CART);
585
+ }
586
+
587
+ if (this.isProfileBtn) {
588
+ return UDExMastheadItem.i18nBundle.getText(PROFILE);
589
+ }
590
+
591
+ if (this.isCountrySelectorBtn) {
592
+ return UDExMastheadItem.i18nBundle.getText(COUNTRY_SELECTOR);
593
+ }
594
+
595
+ if (this.isSupportBtn) {
596
+ return UDExMastheadItem.i18nBundle.getText(SUPPORT);
597
+ }
598
+
599
+ return this.firstChild?.nodeValue?.trim() || "";
600
+ }
490
601
  }
491
602
 
492
603
  UDExMastheadItem.define();
@@ -34,7 +34,10 @@
34
34
  {{/inline}}
35
35
 
36
36
  {{#*inline "list"}}
37
- <ul class="udex-masthead-menu__list" aria-labelledby="category-{{categoryId}}">
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}}
@@ -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, { ItemType } 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
  export type MenuItemClickEventDetail = {
38
+ category?: string,
38
39
  originalEvent: Event,
39
40
  item: UDExMastheadMenuItem,
40
41
  }
@@ -72,6 +73,9 @@ export type MenuItemClickEventDetail = {
72
73
  */
73
74
  @event("menu-item-click", {
74
75
  detail: {
76
+ category: {
77
+ type: String,
78
+ },
75
79
  item: {
76
80
  type: HTMLElement,
77
81
  },
@@ -130,10 +134,17 @@ class UDExMastheadMenu extends UI5Element {
130
134
  }
131
135
 
132
136
  handleMenuItemClick(e: Event): void {
133
- this.fireEvent<MenuItemClickEventDetail>("menu-item-click", {
134
- item: e.target as UDExMastheadMenuItem,
135
- originalEvent: e,
136
- });
137
+ const item = e.target as UDExMastheadMenuItem;
138
+ const { url, type } = item;
139
+
140
+ if (url?.length) {
141
+ const list = item.closest(".udex-masthead-menu__list") as HTMLElement;
142
+ this.fireEvent<MenuItemClickEventDetail>("menu-item-click", {
143
+ item,
144
+ originalEvent: e,
145
+ ...(type !== ItemType.Heading && { category: list?.getAttribute("category") || "" }),
146
+ });
147
+ }
137
148
  }
138
149
 
139
150
  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="{{../handleMobileItemEvent}}"
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="{{../handleMobileItemEvent}}"
162
+ @click="{{../handleMobileCategoryItemEvent}}"
163
163
  label="{{this.title}}"
164
164
  url="{{this.url}}"
165
165
  has-border>