@ui5/webcomponents-fiori 2.8.0-rc.1 → 2.8.0-rc.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.
Files changed (202) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/cypress/specs/ShellBar.cy.tsx +102 -44
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/ShellBar.d.ts +45 -52
  5. package/dist/ShellBar.js +215 -256
  6. package/dist/ShellBar.js.map +1 -1
  7. package/dist/ShellBarTemplate.js +34 -16
  8. package/dist/ShellBarTemplate.js.map +1 -1
  9. package/dist/css/themes/DynamicPage.css +1 -1
  10. package/dist/css/themes/DynamicPageHeader.css +1 -1
  11. package/dist/css/themes/DynamicPageHeaderActions.css +1 -1
  12. package/dist/css/themes/DynamicPageTitle.css +1 -1
  13. package/dist/css/themes/FlexibleColumnLayout.css +1 -1
  14. package/dist/css/themes/MediaGallery.css +1 -1
  15. package/dist/css/themes/MediaGalleryItem.css +1 -1
  16. package/dist/css/themes/NavigationMenu.css +1 -1
  17. package/dist/css/themes/NavigationMenuItem.css +1 -1
  18. package/dist/css/themes/NotificationListGroupItem.css +1 -1
  19. package/dist/css/themes/NotificationListItem.css +1 -1
  20. package/dist/css/themes/NotificationListItemBase.css +1 -1
  21. package/dist/css/themes/NotificationStateIcon.css +1 -1
  22. package/dist/css/themes/Page.css +1 -1
  23. package/dist/css/themes/ProductSwitchItem.css +1 -1
  24. package/dist/css/themes/ShellBar.css +1 -1
  25. package/dist/css/themes/ShellBarPopover.css +1 -1
  26. package/dist/css/themes/SideNavigation.css +1 -1
  27. package/dist/css/themes/SideNavigationGroup.css +1 -1
  28. package/dist/css/themes/SideNavigationItem.css +1 -1
  29. package/dist/css/themes/SideNavigationItemBase.css +1 -1
  30. package/dist/css/themes/SideNavigationPopover.css +1 -1
  31. package/dist/css/themes/SideNavigationSubItem.css +1 -1
  32. package/dist/css/themes/Timeline.css +1 -1
  33. package/dist/css/themes/TimelineGroupItem.css +1 -1
  34. package/dist/css/themes/TimelineItem.css +1 -1
  35. package/dist/css/themes/UploadCollection.css +1 -1
  36. package/dist/css/themes/UploadCollectionItem.css +1 -1
  37. package/dist/css/themes/ViewSettingsDialog.css +1 -1
  38. package/dist/css/themes/Wizard.css +1 -1
  39. package/dist/css/themes/WizardTab.css +1 -1
  40. package/dist/css/themes/sap_fiori_3/parameters-bundle.css +1 -1
  41. package/dist/css/themes/sap_fiori_3_dark/parameters-bundle.css +1 -1
  42. package/dist/css/themes/sap_fiori_3_hcb/parameters-bundle.css +1 -1
  43. package/dist/css/themes/sap_fiori_3_hcw/parameters-bundle.css +1 -1
  44. package/dist/css/themes/sap_horizon/parameters-bundle.css +1 -1
  45. package/dist/css/themes/sap_horizon_dark/parameters-bundle.css +1 -1
  46. package/dist/css/themes/sap_horizon_dark_exp/parameters-bundle.css +1 -1
  47. package/dist/css/themes/sap_horizon_exp/parameters-bundle.css +1 -1
  48. package/dist/css/themes/sap_horizon_hcb/parameters-bundle.css +1 -1
  49. package/dist/css/themes/sap_horizon_hcb_exp/parameters-bundle.css +1 -1
  50. package/dist/css/themes/sap_horizon_hcw/parameters-bundle.css +1 -1
  51. package/dist/css/themes/sap_horizon_hcw_exp/parameters-bundle.css +1 -1
  52. package/dist/custom-elements-internal.json +1 -1
  53. package/dist/custom-elements.json +1 -1
  54. package/dist/generated/assets/themes/sap_fiori_3/parameters-bundle.css.json +1 -1
  55. package/dist/generated/assets/themes/sap_fiori_3_dark/parameters-bundle.css.json +1 -1
  56. package/dist/generated/assets/themes/sap_fiori_3_hcb/parameters-bundle.css.json +1 -1
  57. package/dist/generated/assets/themes/sap_fiori_3_hcw/parameters-bundle.css.json +1 -1
  58. package/dist/generated/assets/themes/sap_horizon/parameters-bundle.css.json +1 -1
  59. package/dist/generated/assets/themes/sap_horizon_dark/parameters-bundle.css.json +1 -1
  60. package/dist/generated/assets/themes/sap_horizon_dark_exp/parameters-bundle.css.json +1 -1
  61. package/dist/generated/assets/themes/sap_horizon_exp/parameters-bundle.css.json +1 -1
  62. package/dist/generated/assets/themes/sap_horizon_hcb/parameters-bundle.css.json +1 -1
  63. package/dist/generated/assets/themes/sap_horizon_hcb_exp/parameters-bundle.css.json +1 -1
  64. package/dist/generated/assets/themes/sap_horizon_hcw/parameters-bundle.css.json +1 -1
  65. package/dist/generated/assets/themes/sap_horizon_hcw_exp/parameters-bundle.css.json +1 -1
  66. package/dist/generated/themes/DynamicPage.css.d.ts +1 -1
  67. package/dist/generated/themes/DynamicPage.css.js +1 -1
  68. package/dist/generated/themes/DynamicPage.css.js.map +1 -1
  69. package/dist/generated/themes/DynamicPageHeader.css.d.ts +1 -1
  70. package/dist/generated/themes/DynamicPageHeader.css.js +1 -1
  71. package/dist/generated/themes/DynamicPageHeader.css.js.map +1 -1
  72. package/dist/generated/themes/DynamicPageHeaderActions.css.d.ts +1 -1
  73. package/dist/generated/themes/DynamicPageHeaderActions.css.js +1 -1
  74. package/dist/generated/themes/DynamicPageHeaderActions.css.js.map +1 -1
  75. package/dist/generated/themes/DynamicPageTitle.css.d.ts +1 -1
  76. package/dist/generated/themes/DynamicPageTitle.css.js +1 -1
  77. package/dist/generated/themes/DynamicPageTitle.css.js.map +1 -1
  78. package/dist/generated/themes/FlexibleColumnLayout.css.d.ts +1 -1
  79. package/dist/generated/themes/FlexibleColumnLayout.css.js +1 -1
  80. package/dist/generated/themes/FlexibleColumnLayout.css.js.map +1 -1
  81. package/dist/generated/themes/MediaGallery.css.d.ts +1 -1
  82. package/dist/generated/themes/MediaGallery.css.js +1 -1
  83. package/dist/generated/themes/MediaGallery.css.js.map +1 -1
  84. package/dist/generated/themes/MediaGalleryItem.css.d.ts +1 -1
  85. package/dist/generated/themes/MediaGalleryItem.css.js +1 -1
  86. package/dist/generated/themes/MediaGalleryItem.css.js.map +1 -1
  87. package/dist/generated/themes/NavigationMenu.css.d.ts +1 -1
  88. package/dist/generated/themes/NavigationMenu.css.js +1 -1
  89. package/dist/generated/themes/NavigationMenu.css.js.map +1 -1
  90. package/dist/generated/themes/NavigationMenuItem.css.d.ts +1 -1
  91. package/dist/generated/themes/NavigationMenuItem.css.js +1 -1
  92. package/dist/generated/themes/NavigationMenuItem.css.js.map +1 -1
  93. package/dist/generated/themes/NotificationListGroupItem.css.d.ts +1 -1
  94. package/dist/generated/themes/NotificationListGroupItem.css.js +1 -1
  95. package/dist/generated/themes/NotificationListGroupItem.css.js.map +1 -1
  96. package/dist/generated/themes/NotificationListItem.css.d.ts +1 -1
  97. package/dist/generated/themes/NotificationListItem.css.js +1 -1
  98. package/dist/generated/themes/NotificationListItem.css.js.map +1 -1
  99. package/dist/generated/themes/NotificationListItemBase.css.d.ts +1 -1
  100. package/dist/generated/themes/NotificationListItemBase.css.js +1 -1
  101. package/dist/generated/themes/NotificationListItemBase.css.js.map +1 -1
  102. package/dist/generated/themes/NotificationStateIcon.css.d.ts +1 -1
  103. package/dist/generated/themes/NotificationStateIcon.css.js +1 -1
  104. package/dist/generated/themes/NotificationStateIcon.css.js.map +1 -1
  105. package/dist/generated/themes/Page.css.d.ts +1 -1
  106. package/dist/generated/themes/Page.css.js +1 -1
  107. package/dist/generated/themes/Page.css.js.map +1 -1
  108. package/dist/generated/themes/ProductSwitchItem.css.d.ts +1 -1
  109. package/dist/generated/themes/ProductSwitchItem.css.js +1 -1
  110. package/dist/generated/themes/ProductSwitchItem.css.js.map +1 -1
  111. package/dist/generated/themes/ShellBar.css.d.ts +1 -1
  112. package/dist/generated/themes/ShellBar.css.js +1 -1
  113. package/dist/generated/themes/ShellBar.css.js.map +1 -1
  114. package/dist/generated/themes/ShellBarPopover.css.d.ts +1 -1
  115. package/dist/generated/themes/ShellBarPopover.css.js +1 -1
  116. package/dist/generated/themes/ShellBarPopover.css.js.map +1 -1
  117. package/dist/generated/themes/SideNavigation.css.d.ts +1 -1
  118. package/dist/generated/themes/SideNavigation.css.js +1 -1
  119. package/dist/generated/themes/SideNavigation.css.js.map +1 -1
  120. package/dist/generated/themes/SideNavigationGroup.css.d.ts +1 -1
  121. package/dist/generated/themes/SideNavigationGroup.css.js +1 -1
  122. package/dist/generated/themes/SideNavigationGroup.css.js.map +1 -1
  123. package/dist/generated/themes/SideNavigationItem.css.d.ts +1 -1
  124. package/dist/generated/themes/SideNavigationItem.css.js +1 -1
  125. package/dist/generated/themes/SideNavigationItem.css.js.map +1 -1
  126. package/dist/generated/themes/SideNavigationItemBase.css.d.ts +1 -1
  127. package/dist/generated/themes/SideNavigationItemBase.css.js +1 -1
  128. package/dist/generated/themes/SideNavigationItemBase.css.js.map +1 -1
  129. package/dist/generated/themes/SideNavigationPopover.css.d.ts +1 -1
  130. package/dist/generated/themes/SideNavigationPopover.css.js +1 -1
  131. package/dist/generated/themes/SideNavigationPopover.css.js.map +1 -1
  132. package/dist/generated/themes/SideNavigationSubItem.css.d.ts +1 -1
  133. package/dist/generated/themes/SideNavigationSubItem.css.js +1 -1
  134. package/dist/generated/themes/SideNavigationSubItem.css.js.map +1 -1
  135. package/dist/generated/themes/Timeline.css.d.ts +1 -1
  136. package/dist/generated/themes/Timeline.css.js +1 -1
  137. package/dist/generated/themes/Timeline.css.js.map +1 -1
  138. package/dist/generated/themes/TimelineGroupItem.css.d.ts +1 -1
  139. package/dist/generated/themes/TimelineGroupItem.css.js +1 -1
  140. package/dist/generated/themes/TimelineGroupItem.css.js.map +1 -1
  141. package/dist/generated/themes/TimelineItem.css.d.ts +1 -1
  142. package/dist/generated/themes/TimelineItem.css.js +1 -1
  143. package/dist/generated/themes/TimelineItem.css.js.map +1 -1
  144. package/dist/generated/themes/UploadCollection.css.d.ts +1 -1
  145. package/dist/generated/themes/UploadCollection.css.js +1 -1
  146. package/dist/generated/themes/UploadCollection.css.js.map +1 -1
  147. package/dist/generated/themes/UploadCollectionItem.css.d.ts +1 -1
  148. package/dist/generated/themes/UploadCollectionItem.css.js +1 -1
  149. package/dist/generated/themes/UploadCollectionItem.css.js.map +1 -1
  150. package/dist/generated/themes/ViewSettingsDialog.css.d.ts +1 -1
  151. package/dist/generated/themes/ViewSettingsDialog.css.js +1 -1
  152. package/dist/generated/themes/ViewSettingsDialog.css.js.map +1 -1
  153. package/dist/generated/themes/Wizard.css.d.ts +1 -1
  154. package/dist/generated/themes/Wizard.css.js +1 -1
  155. package/dist/generated/themes/Wizard.css.js.map +1 -1
  156. package/dist/generated/themes/WizardTab.css.d.ts +1 -1
  157. package/dist/generated/themes/WizardTab.css.js +1 -1
  158. package/dist/generated/themes/WizardTab.css.js.map +1 -1
  159. package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.d.ts +1 -1
  160. package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.js +1 -1
  161. package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.js.map +1 -1
  162. package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.d.ts +1 -1
  163. package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.js +1 -1
  164. package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.js.map +1 -1
  165. package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.d.ts +1 -1
  166. package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.js +1 -1
  167. package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.js.map +1 -1
  168. package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.d.ts +1 -1
  169. package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.js +1 -1
  170. package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.js.map +1 -1
  171. package/dist/generated/themes/sap_horizon/parameters-bundle.css.d.ts +1 -1
  172. package/dist/generated/themes/sap_horizon/parameters-bundle.css.js +1 -1
  173. package/dist/generated/themes/sap_horizon/parameters-bundle.css.js.map +1 -1
  174. package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.d.ts +1 -1
  175. package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js +1 -1
  176. package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js.map +1 -1
  177. package/dist/generated/themes/sap_horizon_dark_exp/parameters-bundle.css.d.ts +1 -1
  178. package/dist/generated/themes/sap_horizon_dark_exp/parameters-bundle.css.js +1 -1
  179. package/dist/generated/themes/sap_horizon_dark_exp/parameters-bundle.css.js.map +1 -1
  180. package/dist/generated/themes/sap_horizon_exp/parameters-bundle.css.d.ts +1 -1
  181. package/dist/generated/themes/sap_horizon_exp/parameters-bundle.css.js +1 -1
  182. package/dist/generated/themes/sap_horizon_exp/parameters-bundle.css.js.map +1 -1
  183. package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.d.ts +1 -1
  184. package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js +1 -1
  185. package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js.map +1 -1
  186. package/dist/generated/themes/sap_horizon_hcb_exp/parameters-bundle.css.d.ts +1 -1
  187. package/dist/generated/themes/sap_horizon_hcb_exp/parameters-bundle.css.js +1 -1
  188. package/dist/generated/themes/sap_horizon_hcb_exp/parameters-bundle.css.js.map +1 -1
  189. package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.d.ts +1 -1
  190. package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js +1 -1
  191. package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js.map +1 -1
  192. package/dist/generated/themes/sap_horizon_hcw_exp/parameters-bundle.css.d.ts +1 -1
  193. package/dist/generated/themes/sap_horizon_hcw_exp/parameters-bundle.css.js +1 -1
  194. package/dist/generated/themes/sap_horizon_hcw_exp/parameters-bundle.css.js.map +1 -1
  195. package/dist/vscode.html-custom-data.json +1 -1
  196. package/dist/web-types.json +3 -3
  197. package/package.json +8 -8
  198. package/src/ShellBarTemplate.tsx +145 -117
  199. package/src/themes/FlexibleColumnLayout.css +4 -3
  200. package/src/themes/ShellBar.css +26 -28
  201. package/src/themes/base/FlexibleColumnLayout-parameters.css +0 -1
  202. package/src/themes/base/ShellBar-parameters.css +1 -1
package/dist/ShellBar.js CHANGED
@@ -37,7 +37,7 @@ import ShellBarTemplate from "./ShellBarTemplate.js";
37
37
  import shellBarStyles from "./generated/themes/ShellBar.css.js";
38
38
  import ShellBarPopoverCss from "./generated/themes/ShellBarPopover.css.js";
39
39
  import { SHELLBAR_LABEL, SHELLBAR_LOGO, SHELLBAR_NOTIFICATIONS, SHELLBAR_NOTIFICATIONS_NO_COUNT, SHELLBAR_CANCEL, SHELLBAR_PROFILE, SHELLBAR_PRODUCTS, SHELLBAR_SEARCH, SHELLBAR_SEARCH_FIELD, SHELLBAR_OVERFLOW, SHELLBAR_LOGO_AREA, SHELLBAR_ADDITIONAL_CONTEXT, SHELLBAR_SEARCHFIELD_DESCRIPTION, SHELLBAR_SEARCH_BTN_OPEN, SHELLBAR_PRODUCT_SWITCH_BTN, } from "./generated/i18n/i18n-defaults.js";
40
- const RESIZE_THROTTLE_RATE = 40; // ms
40
+ const RESIZE_THROTTLE_RATE = 200; // ms
41
41
  // actions always visible in lean mode, order is important
42
42
  const PREDEFINED_PLACE_ACTIONS = ["feedback", "sys-help"];
43
43
  /**
@@ -155,24 +155,22 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
155
155
  * @private
156
156
  */
157
157
  this.withLogo = false;
158
+ this._itemsInfo = [];
159
+ this._contentInfo = [];
158
160
  this._menuPopoverExpanded = false;
159
161
  this._overflowPopoverExpanded = false;
160
- this.hasVisibleStartContent = false;
161
- this.hasVisibleEndContent = false;
162
+ this.showFullWidthSearch = false;
162
163
  this._cachedHiddenContent = [];
163
164
  this._lastOffsetWidth = 0;
164
165
  this._observableContent = [];
165
- this._searchBarAutoOpen = false;
166
- this._searchBarAutoClosed = false;
167
- this._searchIconPressed = false;
166
+ this._autoRestoreSearchField = false;
168
167
  this._hiddenIcons = [];
169
- this._itemsInfo = [];
170
168
  this._isInitialRendering = true;
171
169
  this._overflowNotifications = null;
172
170
  // marks if preventDefault() is called in item's press handler
173
171
  this._defaultItemPressPrevented = false;
174
- this.additionalContextObserver = new MutationObserver(() => {
175
- this._updateAdditionalContextItems();
172
+ this.contentItemsObserver = new MutationObserver(() => {
173
+ this._handleActionsOverflow();
176
174
  });
177
175
  this._headerPress = () => {
178
176
  if (this.hasMenuItems) {
@@ -187,30 +185,26 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
187
185
  this.overflowPopover.open = false;
188
186
  if (this._lastOffsetWidth !== this.offsetWidth) {
189
187
  this._overflowActions();
190
- if (this._searchBarAutoOpen) {
191
- this._searchBarInitialState();
188
+ if (this.autoSearchField) {
189
+ this._updateSearchFieldState();
192
190
  }
193
191
  }
194
192
  }, RESIZE_THROTTLE_RATE);
195
193
  }
196
- _searchBarInitialState() {
194
+ _updateSearchFieldState() {
197
195
  const spacerWidth = this.shadowRoot.querySelector(".ui5-shellbar-spacer") ? this.shadowRoot.querySelector(".ui5-shellbar-spacer").getBoundingClientRect().width : 0;
198
196
  const searchFieldWidth = this.domCalculatedValues("--_ui5_shellbar_search_field_width");
199
- if (this._searchIconPressed || document.activeElement === this.searchField[0]) {
200
- return;
201
- }
202
- if (this._showFullWidthSearch) {
197
+ if (this.showFullWidthSearch) {
203
198
  this.showSearchField = false;
204
- this._searchBarAutoClosed = true;
205
199
  return;
206
200
  }
207
- if ((spacerWidth <= 0 || this.additionalContextHidden.length !== 0) && this.showSearchField === true) {
201
+ if ((spacerWidth <= searchFieldWidth && this.contentItemsHidden.length !== 0) && this.showSearchField) {
208
202
  this.showSearchField = false;
209
- this._searchBarAutoClosed = true;
203
+ this._autoRestoreSearchField = true;
210
204
  }
211
- if (spacerWidth > searchFieldWidth && this.additionalContextHidden.length === 0 && this.showSearchField === false) {
205
+ else if (spacerWidth > searchFieldWidth && this._autoRestoreSearchField) {
212
206
  this.showSearchField = true;
213
- this._searchBarAutoClosed = false;
207
+ this._autoRestoreSearchField = false;
214
208
  }
215
209
  }
216
210
  _onKeyDown(e) {
@@ -242,24 +236,23 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
242
236
  const style = getComputedStyle(element);
243
237
  return style.display !== "none" && style.visibility !== "hidden" && element.offsetWidth > 0 && element.offsetHeight > 0;
244
238
  }
245
- _isInteractive(element) {
246
- const component = element;
247
- if (component.isUI5Element) {
248
- const dom = component.getFocusDomRef();
249
- return dom?.tabIndex === 0;
250
- }
251
- return element.tabIndex === 0;
252
- }
253
239
  _getNavigableContent() {
254
- return [
240
+ const elements = [
255
241
  ...this.startButton,
256
242
  ...this.logo,
257
243
  ...this.shadowRoot.querySelectorAll(".ui5-shellbar-logo"),
258
244
  ...this.shadowRoot.querySelectorAll(".ui5-shellbar-logo-area"),
259
245
  ...this.shadowRoot.querySelectorAll(".ui5-shellbar-menu-button"),
260
- ...this.additionalContext,
246
+ ...this.contentItems,
261
247
  ...this._getRightChildItems(),
262
248
  ];
249
+ return elements.map((element) => {
250
+ const component = element;
251
+ if (component.isUI5Element) {
252
+ return component.getFocusDomRef();
253
+ }
254
+ return element;
255
+ }).filter(el => !!el);
263
256
  }
264
257
  _getRightChildItems() {
265
258
  return [
@@ -272,7 +265,7 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
272
265
  _getVisibleAndInteractiveItems() {
273
266
  const items = this._getNavigableContent();
274
267
  const visibleAndInteractiveItems = items.filter(item => {
275
- return this._isVisible(item) && this._isInteractive(item);
268
+ return this._isVisible(item) && item.tabIndex === 0;
276
269
  });
277
270
  return visibleAndInteractiveItems;
278
271
  }
@@ -341,23 +334,21 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
341
334
  const shouldStayOnScreen = isOverflowIcon || (isImageIcon && this.hasProfile);
342
335
  return isHidden && isSet && !shouldStayOnScreen;
343
336
  });
344
- this._observeAdditionalContextItems();
345
- this._updateSeparatorsVisibility();
346
- }
347
- get additionalContextSorted() {
348
- return this.additionalContext.sort((a, b) => {
349
- return parseInt(a.getAttribute("data-hide-order") || "0") - parseInt(b.getAttribute("data-hide-order") || "0");
350
- }).map(item => this.shadowRoot.querySelector(`#${item.slot}`)).filter(item => item !== null);
351
- }
352
- get additionalContextContainer() {
353
- return this.shadowRoot.querySelector(".ui5-shellbar-overflow-container-additional-content");
337
+ this._observeContentItems();
354
338
  }
355
339
  onAfterRendering() {
356
- requestAnimationFrame(() => {
357
- this._lastOffsetWidth = this.offsetWidth;
358
- this._overflowActions();
359
- });
360
- this._searchBarAutoOpen = this._searchBarAutoClosed || (this.showSearchField && !this._searchIconPressed);
340
+ this._lastOffsetWidth = this.offsetWidth;
341
+ this._overflowActions();
342
+ this.onInitialRendering();
343
+ }
344
+ async onInitialRendering() {
345
+ if (this._isInitialRendering) {
346
+ await renderFinished();
347
+ if (this.autoSearchField) {
348
+ this._updateSearchFieldState();
349
+ }
350
+ }
351
+ this._isInitialRendering = false;
361
352
  }
362
353
  /**
363
354
  * Closes the overflow area.
@@ -378,108 +369,54 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
378
369
  this.breakpointSize = mappedSize;
379
370
  }
380
371
  }
381
- _hideOverflowItems(hiddenItems, items) {
382
- for (let i = 0; hiddenItems > 0 && i < items.length; i++) {
383
- // start from last item
384
- const item = items[items.length - 1 - i];
372
+ _hideItems(items) {
373
+ items.forEach(item => {
385
374
  if (item.classes.indexOf("ui5-shellbar-no-overflow-button") === -1) {
386
375
  item.classes = `${item.classes} ui5-shellbar-hidden-button`;
387
- hiddenItems--;
388
376
  }
389
- }
390
- // assistant is a slot, still described in the itemsInfo for the purpose of the overflow
391
- // so if marked as hidden, it should be hidden separately
392
- this._updateAssistantIconVisibility(items);
393
- return hiddenItems;
394
- }
395
- _hideAdditionalContext() {
396
- const container = this.additionalContextContainer;
397
- const totalWidth = container?.offsetWidth || 0;
398
- const additionalContextSorted = this.additionalContextSorted.toReversed();
399
- let usedWidth = 0;
400
- for (let i = 0; i < additionalContextSorted.length; i++) {
401
- const item = additionalContextSorted[i];
377
+ });
378
+ return items;
379
+ }
380
+ _resetItemsVisibility(items) {
381
+ items.forEach(item => {
402
382
  item.classList.remove("ui5-shellbar-hidden-button");
403
- const itemWidth = item.offsetWidth + parseInt(getComputedStyle(item).getPropertyValue("margin-inline-start"));
404
- usedWidth += itemWidth;
405
- if (usedWidth > totalWidth) {
406
- item.classList.add("ui5-shellbar-hidden-button");
407
- }
408
- }
383
+ });
409
384
  }
410
385
  _handleActionsOverflow() {
411
- const itemsToOverflow = this.itemsToOverflow;
412
- const container = this.shadowRoot.querySelector(".ui5-shellbar-overflow-container-right");
413
- const searchFieldWidth = this.searchField[0] ? this.searchField[0].offsetWidth : 0;
414
- const nonDisappearingItems = Array.from(container.querySelectorAll(".ui5-shellbar-no-overflow-button"));
415
- const nonDisappearingItemsWidth = nonDisappearingItems.reduce((acc, el) => acc + el.offsetWidth + this.domCalculatedValues("--_ui5-shellbar-overflow-button-margin"), 0);
416
- let totalWidth = container.offsetWidth - nonDisappearingItemsWidth - this.separatorsWidth;
417
- if (this.additionalContext.length === 0) {
418
- totalWidth -= searchFieldWidth;
419
- }
420
- let usedWidth = 0;
421
- let hiddenItems = 0;
422
- let restoreVisibility = false;
423
- // first check how many items can fit without overflowing
424
- for (let i = 0; i < itemsToOverflow.length; i++) {
425
- // reset item visibility before calculating
426
- const item = itemsToOverflow[i];
427
- const isAdditionalContext = this.additionalContextSorted.includes(item);
428
- if (item.classList.contains("ui5-shellbar-hidden-button")) {
429
- item.classList.remove("ui5-shellbar-hidden-button");
430
- restoreVisibility = true;
431
- }
432
- // exlcude the gap if an item is in the additional context as the wrapped element's width is already including the gap
433
- const gap = isAdditionalContext ? 0 : parseInt(getComputedStyle(item).getPropertyValue("margin-inline-start"));
434
- const itemWidth = item.offsetWidth + gap;
435
- if (restoreVisibility) {
436
- item.classList.add("ui5-shellbar-hidden-button");
437
- restoreVisibility = false;
438
- }
439
- usedWidth += itemWidth;
440
- if (usedWidth > totalWidth) {
441
- // as soon as we find an item that doesn't fit, we stop
442
- // and sum the rest of the items as hidden
443
- hiddenItems = itemsToOverflow.length - i;
386
+ const inner = this.overflowInner;
387
+ const wrapper = this.overflowWrapper;
388
+ const hidableDomElements = this.hidableDomElements;
389
+ const hiddenItems = [];
390
+ let lastHiddenIndex = 0;
391
+ this._resetItemsVisibility(hidableDomElements);
392
+ for (let i = 0; i < hidableDomElements.length; i++) {
393
+ if (inner?.offsetWidth === wrapper?.offsetWidth) {
394
+ lastHiddenIndex = i;
444
395
  break;
445
396
  }
397
+ const item = hidableDomElements[i];
398
+ hiddenItems.push(item.id);
399
+ item.classList.add("ui5-shellbar-hidden-button");
446
400
  }
447
- // never show only one item in the overflow
448
- if (hiddenItems === 1) {
449
- hiddenItems++;
450
- }
451
- const showOverflowButton = hiddenItems > 0;
452
- const items = this._getAllItems(showOverflowButton, hiddenItems === itemsToOverflow.length).filter(item => item.show && item.classes.indexOf("ui5-shellbar-no-overflow-button") === -1);
453
- // start hiding the actions on the right (overflow actions) first
454
- this._hideOverflowItems(hiddenItems, items);
455
- // last, start hiding the items that are in the additional context
456
- this._hideAdditionalContext();
457
- if (JSON.stringify(this.additionalContextHidden) !== JSON.stringify(this._cachedHiddenContent)) {
458
- this.fireDecoratorEvent("content-item-visibility-change", { items: this.additionalContextHidden });
401
+ if (hiddenItems.length === 1 && !this.showSearchField) {
402
+ const nextItemToHide = hidableDomElements[++lastHiddenIndex];
403
+ if (nextItemToHide) {
404
+ hiddenItems.push(nextItemToHide.id);
405
+ }
459
406
  }
460
- this._cachedHiddenContent = this.additionalContextHidden;
461
- return items;
407
+ const itemsInfo = this._getItemsInfo().filter(item => item.show && item.classes.indexOf("ui5-shellbar-no-overflow-button") === -1);
408
+ const contentInfo = this._getContentInfo().sort((a, b) => a.hideOrder - b.hideOrder);
409
+ const itemsToHide = [...itemsInfo, ...contentInfo].filter(item => hiddenItems.includes(item.id));
410
+ this._hideItems(itemsToHide);
411
+ return { itemsInfo, contentInfo };
462
412
  }
463
413
  _overflowActions() {
464
414
  this._handleBarBreakpoints();
465
- const newItems = this._handleActionsOverflow();
466
- this._updateSeparatorsVisibility();
467
- this._updateItemsInfo(newItems);
415
+ const { itemsInfo, contentInfo } = this._handleActionsOverflow();
416
+ this._updateItemsInfo(itemsInfo);
417
+ this._updateContentInfo(contentInfo);
468
418
  this._updateOverflowNotifications();
469
- }
470
- _updateAssistantIconVisibility(items) {
471
- if (this.assistant.length) {
472
- const assistantWrapper = this.shadowRoot.getElementById("assistant");
473
- const assistantInfo = items.find(item => item.text === "Assistant");
474
- assistantWrapper && assistantWrapper.classList.remove("ui5-shellbar-hidden-button");
475
- if (assistantInfo && assistantInfo.classes.indexOf("ui5-shellbar-hidden-button") > 0) {
476
- assistantWrapper && assistantWrapper.classList.add("ui5-shellbar-hidden-button");
477
- }
478
- }
479
- }
480
- _updateSeparatorsVisibility() {
481
- this.hasVisibleStartContent = this._hasVisibleStartContent;
482
- this.hasVisibleEndContent = this._hasVisibleEndContent;
419
+ this.showFullWidthSearch = this.overflowed;
483
420
  }
484
421
  _toggleActionPopover() {
485
422
  const overflowButton = this.shadowRoot.querySelector(".ui5-shellbar-overflow-button");
@@ -492,12 +429,9 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
492
429
  if (isDesktop()) {
493
430
  this.setAttribute("desktop", "");
494
431
  }
495
- if (this._searchBarAutoOpen) {
496
- setTimeout(() => this._searchBarInitialState(), 100);
497
- }
498
432
  }
499
433
  onExitDOM() {
500
- this.additionalContextObserver.disconnect();
434
+ this.contentItemsObserver.disconnect();
501
435
  this._observableContent = [];
502
436
  ResizeHandler.deregister(this, this._handleResize);
503
437
  }
@@ -507,12 +441,10 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
507
441
  targetRef: searchButtonRef,
508
442
  searchFieldVisible: this.showSearchField,
509
443
  });
510
- this._searchIconPressed = true;
511
444
  if (defaultPrevented) {
512
445
  return;
513
446
  }
514
447
  this.showSearchField = !this.showSearchField;
515
- this._searchBarAutoOpen = this.showSearchField;
516
448
  if (!this.showSearchField) {
517
449
  return;
518
450
  }
@@ -616,18 +548,27 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
616
548
  get productSwitchDomRef() {
617
549
  return this.shadowRoot.querySelector(`*[data-ui5-stable="product-switch"]`);
618
550
  }
551
+ _getContentInfo() {
552
+ return [
553
+ ...this.contentItemsSorted.map(item => {
554
+ return {
555
+ hideOrder: parseInt(item.getAttribute("data-hide-order") || "0"),
556
+ id: item.slot,
557
+ classes: "ui5-shellbar-content-item",
558
+ show: false,
559
+ };
560
+ }),
561
+ ];
562
+ }
619
563
  /**
620
564
  * Returns all items that will be placed in the right of the bar as icons / dom elements.
621
- * @param showOverflowButton Determines if overflow button should be visible (not overflowing)
622
565
  */
623
- _getAllItems(showOverflowButton, showSearchButton = true) {
624
- let domOrder = -1;
566
+ _getItemsInfo() {
625
567
  const items = [
626
568
  {
627
569
  icon: search,
628
570
  text: this._searchText,
629
- classes: `${this.searchField.length ? "" : "ui5-shellbar-invisible-button"} ${showSearchButton ? "" : "ui5-shellbar-no-overflow-button"} ui5-shellbar-search-button ui5-shellbar-button`,
630
- domOrder: this.searchField.length ? (++domOrder) : -1,
571
+ classes: `${this.searchField.length ? "" : "ui5-shellbar-invisible-button"} ui5-shellbar-search-button ui5-shellbar-button`,
631
572
  id: `${this._id}-item-${1}`,
632
573
  press: this._handleSearchIconPress.bind(this),
633
574
  show: !!this.searchField.length,
@@ -636,10 +577,9 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
636
577
  {
637
578
  icon: da,
638
579
  text: "Assistant",
639
- classes: `${this.assistant.length ? "" : "ui5-shellbar-invisible-button"} ui5-shellbar-button`,
640
- id: `${this._id}-item-${4}`,
580
+ classes: `${this.assistant.length ? "" : "ui5-shellbar-invisible-button"} ui5-shellbar-assistant-button`,
581
+ id: `${this._id}-assistant`,
641
582
  show: !!this.assistant.length,
642
- domOrder: this.assistant.length ? (++domOrder) : -1,
643
583
  press: () => { },
644
584
  tooltip: this.assistant.length ? (this.assistant[0].getAttribute("text") || this.assistant[0].getAttribute("title") || undefined) : undefined,
645
585
  },
@@ -651,7 +591,6 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
651
591
  classes: `${this.showNotifications ? "" : "ui5-shellbar-invisible-button"} ui5-shellbar-bell-button ui5-shellbar-button`,
652
592
  id: `${this._id}-item-${2}`,
653
593
  show: this.showNotifications,
654
- domOrder: this.showNotifications ? (++domOrder) : -1,
655
594
  press: this._handleNotificationsPress.bind(this),
656
595
  tooltip: this._notificationsText,
657
596
  },
@@ -671,7 +610,6 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
671
610
  refItemid: item._id,
672
611
  text: item.text,
673
612
  classes: "ui5-shellbar-custom-item ui5-shellbar-button",
674
- domOrder: (++domOrder),
675
613
  show,
676
614
  press: this._handleCustomActionPress.bind(this),
677
615
  custom: true,
@@ -683,8 +621,7 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
683
621
  {
684
622
  icon: overflow,
685
623
  text: "Overflow",
686
- classes: `${showOverflowButton ? "" : "ui5-shellbar-hidden-button"} ui5-shellbar-no-overflow-button ui5-shellbar-overflow-button ui5-shellbar-button`,
687
- domOrder: showOverflowButton ? (++domOrder) : -1,
624
+ classes: "ui5-shellbar-hidden-button ui5-shellbar-no-overflow-button ui5-shellbar-overflow-button ui5-shellbar-button",
688
625
  id: `${this.id}-item-${5}`,
689
626
  press: this._handleOverflowPress.bind(this),
690
627
  show: true,
@@ -695,7 +632,6 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
695
632
  classes: `${this.hasProfile ? "" : "ui5-shellbar-invisible-button"} ui5-shellbar-no-overflow-button ui5-shellbar-image-button ui5-shellbar-button`,
696
633
  profile: true,
697
634
  id: `${this._id}-item-${3}`,
698
- domOrder: this.hasProfile ? (++domOrder) : -1,
699
635
  show: this.hasProfile,
700
636
  press: this._handleProfilePress.bind(this),
701
637
  tooltip: this._profileText,
@@ -706,19 +642,33 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
706
642
  classes: `${this.showProductSwitch ? "" : "ui5-shellbar-invisible-button"} ui5-shellbar-no-overflow-button ui5-shellbar-button ui5-shellbar-image-button ui5-shellbar-button-product-switch`,
707
643
  id: `${this._id}-item-${4}`,
708
644
  show: this.showProductSwitch,
709
- domOrder: this.showProductSwitch ? (++domOrder) : -1,
710
645
  press: this._handleProductSwitchPress.bind(this),
711
646
  tooltip: this._productsText,
712
647
  },
713
648
  ];
714
649
  return items;
715
650
  }
716
- _updateItemsInfo(newItems) {
717
- const isDifferent = JSON.stringify(this._itemsInfo) !== JSON.stringify(newItems);
651
+ _updateItemsInfo(newItemsInfo) {
652
+ const isDifferent = JSON.stringify(this._itemsInfo) !== JSON.stringify(newItemsInfo);
653
+ if (isDifferent) {
654
+ this._itemsInfo = newItemsInfo;
655
+ }
656
+ }
657
+ _updateContentInfo(newContentInfo) {
658
+ const isDifferent = JSON.stringify(this._contentInfo) !== JSON.stringify(newContentInfo);
718
659
  if (isDifferent) {
719
- this._itemsInfo = newItems;
660
+ this._contentInfo = newContentInfo;
661
+ this._fireContentItemVisibilityChangeEvent();
720
662
  }
721
663
  }
664
+ _fireContentItemVisibilityChangeEvent() {
665
+ const hiddenByClass = this._contentInfo
666
+ .filter(item => item.classes.indexOf("ui5-shellbar-hidden-button") !== -1)
667
+ .map(item => item.id);
668
+ this.fireDecoratorEvent("content-item-visibility-change", {
669
+ items: this.contentItems.filter(item => hiddenByClass.includes(item.slot)),
670
+ });
671
+ }
722
672
  _updateOverflowNotifications() {
723
673
  const notificationsArr = [];
724
674
  let overflowNotifications = null;
@@ -735,16 +685,13 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
735
685
  }
736
686
  this._overflowNotifications = overflowNotifications;
737
687
  }
738
- _updateAdditionalContextItems() {
739
- this._handleActionsOverflow();
740
- }
741
- _observeAdditionalContextItems() {
742
- if (JSON.stringify(this.additionalContext) === JSON.stringify(this._observableContent)) {
688
+ _observeContentItems() {
689
+ if (JSON.stringify(this.contentItems) === JSON.stringify(this._observableContent)) {
743
690
  return false;
744
691
  }
745
- this.additionalContext.forEach(item => {
692
+ this.contentItems.forEach(item => {
746
693
  if (!this._observableContent.includes(item)) {
747
- this.additionalContextObserver.observe(item, {
694
+ this.contentItemsObserver.observe(item, {
748
695
  characterData: false,
749
696
  childList: false,
750
697
  subtree: false,
@@ -753,7 +700,7 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
753
700
  });
754
701
  }
755
702
  });
756
- this._observableContent = this.additionalContext;
703
+ this._observableContent = this.contentItems;
757
704
  }
758
705
  _getOverflowPopover() {
759
706
  return this.shadowRoot.querySelector(".ui5-shellbar-overflow-popover");
@@ -768,12 +715,48 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
768
715
  }
769
716
  return itemInfo.classes.indexOf("ui5-shellbar-hidden-button") !== -1;
770
717
  }
718
+ get contentItemsSorted() {
719
+ return this.contentItems.toReversed().sort((a, b) => {
720
+ return parseInt(a.getAttribute("data-hide-order") || "0") - parseInt(b.getAttribute("data-hide-order") || "0");
721
+ });
722
+ }
723
+ get contentItemsWrappersSorted() {
724
+ return this.contentItemsSorted.map(item => this.shadowRoot.querySelector(`#${item.slot}`)).filter(item => item !== null);
725
+ }
726
+ get autoSearchField() {
727
+ const onFocus = document.activeElement === this.searchField[0];
728
+ const isEmpty = this.searchField[0]?.value.length === 0;
729
+ return (this.showSearchField || this._autoRestoreSearchField) && !onFocus && isEmpty;
730
+ }
731
+ get showStartSeparatorInWrapper() {
732
+ // show separator at the beginning of content if more than one
733
+ // item is visible, otherwise, the separator is packed with the
734
+ // first visible item to be calculated with the next overflow action
735
+ const starContent = this.startContent;
736
+ const hiddenStartContentItems = this._contentInfo.filter(item => {
737
+ const isHidden = item.classes.indexOf("ui5-shellbar-hidden-button") !== -1;
738
+ const isInContent = starContent.find(contentItem => contentItem.slot === item.id);
739
+ return isHidden && isInContent;
740
+ }).map(item => item.id);
741
+ return (starContent.length - hiddenStartContentItems.length) > 0;
742
+ }
743
+ get showEndSeparatorInWrapper() {
744
+ // show separator at the end of content if more than one
745
+ // item is visible, otherwise, the separator is packed with the
746
+ // last visible item to be calculated with the next overflow
747
+ const endContent = this.endContent;
748
+ const hiddenEndContentItems = this._contentInfo.filter(item => {
749
+ const isHidden = item.classes.indexOf("ui5-shellbar-hidden-button") !== -1;
750
+ const isInContent = endContent.find(contentItem => contentItem.slot === item.id);
751
+ return isHidden && isInContent;
752
+ }).map(item => item.id);
753
+ return (endContent.length - hiddenEndContentItems.length) > 0;
754
+ }
771
755
  get classes() {
772
756
  return {
773
757
  wrapper: {
774
758
  "ui5-shellbar-root": true,
775
759
  "ui5-shellbar-with-searchfield": this.hasSearchField,
776
- "ui5-shellbar-with-full-searchfield": this.hasSearchField && this.showSearchField && this._showFullWidthSearch,
777
760
  },
778
761
  button: {
779
762
  "ui5-shellbar-menu-button--interactive": this.hasMenuItems,
@@ -783,41 +766,23 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
783
766
  },
784
767
  search: {
785
768
  "ui5-shellbar-hidden-button": this.isIconHidden("search"),
786
- "ui5-shellbar-no-overflow-button": this.breakpointSize !== "S",
787
769
  },
788
770
  overflow: {
789
771
  "ui5-shellbar-hidden-button": this._hiddenIcons.length === 0,
790
772
  },
791
773
  assistant: {
792
774
  "ui5-shellbar-hidden-button": this.isIconHidden("assistant"),
775
+ "ui5-shellbar-assistant-button": true,
793
776
  },
794
777
  };
795
778
  }
796
779
  get styles() {
797
780
  return {
798
781
  searchField: {
799
- "display": this.correctSearchFieldStyles,
800
- },
801
- additionalContext: {
802
- start: {
803
- separator: {
804
- "visibility": this.hasVisibleStartContent ? "" : "hidden",
805
- },
806
- },
807
- end: {
808
- separator: {
809
- "visibility": this.hasVisibleEndContent ? "" : "hidden",
810
- },
811
- },
782
+ "display": this.showSearchField ? "flex" : "none",
812
783
  },
813
784
  };
814
785
  }
815
- get correctSearchFieldStyles() {
816
- if (this.showSearchField) {
817
- return "flex";
818
- }
819
- return "none";
820
- }
821
786
  get customItemsInfo() {
822
787
  return this._itemsInfo.filter(itemInfo => !!itemInfo.custom);
823
788
  }
@@ -871,47 +836,30 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
871
836
  const secondaryTitle = this.secondaryTitle ?? "";
872
837
  return ShellBar_1.i18nBundle.getText(SHELLBAR_LOGO_AREA, primaryTitle, secondaryTitle);
873
838
  }
874
- get _additionalContextText() {
839
+ get _contentItemsText() {
875
840
  return ShellBar_1.i18nBundle.getText(SHELLBAR_ADDITIONAL_CONTEXT);
876
841
  }
877
842
  get _searchFieldDescription() {
878
843
  return ShellBar_1.i18nBundle.getText(SHELLBAR_SEARCHFIELD_DESCRIPTION);
879
844
  }
880
- get _additionalContextRole() {
881
- if (this.additionalContext.length === 1) {
845
+ get _contentItemsRole() {
846
+ if (this.contentItems.length === 1) {
882
847
  return;
883
848
  }
884
849
  return "group";
885
850
  }
886
- get additionalContext() {
851
+ get contentItems() {
887
852
  return [...this.startContent, ...this.endContent];
888
853
  }
889
854
  get startContent() {
890
- // return all items before the ui5-shellbar-spacer
891
- const startContent = [];
892
- for (let i = 0; i < this.content.length; i++) {
893
- const child = this.content[i];
894
- if (child.hasAttribute("ui5-shellbar-spacer")) {
895
- break;
896
- }
897
- startContent.push(child);
898
- }
899
- return startContent;
855
+ // all items before the first spacer
856
+ const spacerIndex = this.content.findIndex(child => child.hasAttribute("ui5-shellbar-spacer"));
857
+ return this.content.slice(0, spacerIndex);
900
858
  }
901
859
  get endContent() {
902
- // return all items after the ui5-shellbar-spacer
903
- const endContent = [];
904
- let spacerFound = false;
905
- for (let i = 0; i < this.content.length; i++) {
906
- const child = this.content[i];
907
- if (spacerFound) {
908
- endContent.push(child);
909
- }
910
- if (child.hasAttribute("ui5-shellbar-spacer")) {
911
- spacerFound = true;
912
- }
913
- }
914
- return endContent;
860
+ // all items after the first spacer
861
+ const spacerIndex = this.content.findIndex(child => child.hasAttribute("ui5-shellbar-spacer"));
862
+ return this.content.slice(spacerIndex + 1);
915
863
  }
916
864
  get _rightChildRole() {
917
865
  const items = this._getRightChildItems();
@@ -923,9 +871,6 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
923
871
  }
924
872
  return "toolbar";
925
873
  }
926
- get _searchFieldExpanded() {
927
- return this.showSearchField;
928
- }
929
874
  get _searchFieldText() {
930
875
  return ShellBar_1.i18nBundle.getText(SHELLBAR_SEARCH_FIELD);
931
876
  }
@@ -935,11 +880,6 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
935
880
  get _productSwitchBtnText() {
936
881
  return ShellBar_1.i18nBundle.getText(SHELLBAR_PRODUCT_SWITCH_BTN);
937
882
  }
938
- get _showFullWidthSearch() {
939
- const size = this.breakpointSize;
940
- const searchBtnHidden = !!this.shadowRoot.querySelector(".ui5-shellbar-search-button.ui5-shellbar-hidden-button");
941
- return size === "S" || searchBtnHidden || this._lessSearchSpace;
942
- }
943
883
  get isSearchFieldVisible() {
944
884
  return this.searchField[0]?.offsetWidth || 0;
945
885
  }
@@ -955,40 +895,59 @@ let ShellBar = ShellBar_1 = class ShellBar extends UI5Element {
955
895
  get _overflowText() {
956
896
  return ShellBar_1.i18nBundle.getText(SHELLBAR_OVERFLOW);
957
897
  }
958
- get hasAdditionalContext() {
959
- return this.additionalContext.length > 0;
960
- }
961
- get _hasVisibleStartContent() {
962
- return this.startContent.some(item => this.shadowRoot.getElementById(item.slot) && !this.shadowRoot.getElementById(item.slot).classList.contains("ui5-shellbar-hidden-button"));
963
- }
964
- get _hasVisibleEndContent() {
965
- return this.endContent.some(item => this.shadowRoot.getElementById(item.slot) && !this.shadowRoot.getElementById(item.slot).classList.contains("ui5-shellbar-hidden-button"));
966
- }
967
- get itemsToOverflow() {
968
- const overflowActions = Array.from(this.shadowRoot.querySelectorAll(".ui5-shellbar-button:not(.ui5-shellbar-overflow-button):not(.ui5-shellbar-invisible-button):not(.ui5-shellbar-cancel-button):not(.ui5-shellbar-no-overflow-button)"));
969
- return [...this.additionalContextSorted.toReversed(), this.assistant[0], ...overflowActions.toReversed()].filter(Boolean);
970
- }
971
- get separatorsWidth() {
972
- const separatorsWidth = this.separators.reduce((acc, el) => acc + (el?.offsetWidth + this.domCalculatedValues("--_ui5-shellbar-content-margin-start")) || 0, 0);
973
- return separatorsWidth;
898
+ get hasContentItems() {
899
+ return this.contentItems.length > 0;
900
+ }
901
+ get hidableDomElements() {
902
+ const items = Array.from(this.shadowRoot.querySelectorAll(".ui5-shellbar-button:not(.ui5-shellbar-search-button):not(.ui5-shellbar-overflow-button):not(.ui5-shellbar-cancel-button):not(.ui5-shellbar-no-overflow-button)"));
903
+ const assistant = this.shadowRoot.querySelector(".ui5-shellbar-assistant-button");
904
+ const searchButton = this.shadowRoot.querySelector(".ui5-shellbar-search-button");
905
+ const contentItems = this.contentItemsWrappersSorted;
906
+ const firstContentItem = contentItems.pop();
907
+ const prioritizeContent = this.showSearchField && this.hasSearchField;
908
+ // order here is important for the responsive behavior, the items will be
909
+ // measured and hidden in the order they are returned until no overlap is detected
910
+ let itemsToHide = [];
911
+ if (prioritizeContent) {
912
+ // search field was toggled, the content items should make space for it
913
+ const overflowItems = [...items, assistant];
914
+ const visibleItems = overflowItems.filter(item => item && !item.classList.contains("ui5-shellbar-hidden-button"));
915
+ const hiddenItems = overflowItems.filter(item => item && item.classList.contains("ui5-shellbar-hidden-button"));
916
+ itemsToHide = [
917
+ ...hiddenItems,
918
+ ...contentItems,
919
+ firstContentItem,
920
+ ...visibleItems,
921
+ ];
922
+ }
923
+ else {
924
+ // search field is close, actions should go to the overflow first
925
+ itemsToHide = [
926
+ ...items.toReversed(),
927
+ assistant,
928
+ ...contentItems,
929
+ searchButton,
930
+ firstContentItem,
931
+ ];
932
+ }
933
+ return itemsToHide.filter(Boolean);
974
934
  }
975
- get searchFieldActualWidth() {
976
- return this.shadowRoot.querySelector("[ui5-input]")?.offsetWidth || 0;
935
+ get contentItemsHidden() {
936
+ return this.contentItemsWrappersSorted.filter(item => item.classList.contains("ui5-shellbar-hidden-button"));
977
937
  }
978
- get separators() {
979
- const start = this.shadowRoot.querySelector(".ui5-shellbar-separator-start");
980
- const end = this.shadowRoot.querySelector(".ui5-shellbar-separator-end");
981
- return [start, end];
938
+ get overflowWrapper() {
939
+ return this.shadowRoot.querySelector(".ui5-shellbar-overflow-container-right");
982
940
  }
983
- get additionalContextHidden() {
984
- return [...this.endContent, ...this.startContent].filter(item => this.shadowRoot.getElementById(item.slot) && this.shadowRoot.getElementById(item.slot).classList.contains("ui5-shellbar-hidden-button"));
941
+ get overflowInner() {
942
+ return this.shadowRoot.querySelector(".ui5-shellbar-overflow-container-right-inner");
985
943
  }
986
- get _lessSearchSpace() {
987
- const targetContainer = this.shadowRoot.querySelector(".ui5-shellbar-spacer");
988
- const targetWidth = targetContainer?.offsetWidth || 0;
989
- const searchFieldWidth = this.domCalculatedValues("--_ui5_shellbar_search_field_width");
990
- const isFullSearchOpen = this.classList.contains("ui5-shellbar-with-full-searchfield");
991
- return this.breakpointSize === "M" && ((this.hasAdditionalContext && targetWidth <= 0) || (!isFullSearchOpen && targetWidth <= searchFieldWidth));
944
+ get overflowed() {
945
+ const wrapper = this.overflowWrapper;
946
+ const inner = this.overflowInner;
947
+ if (!wrapper || !inner) {
948
+ return false;
949
+ }
950
+ return inner.offsetWidth > wrapper.offsetWidth;
992
951
  }
993
952
  get accInfo() {
994
953
  const overflowExpanded = this.accessibilityAttributes.overflow?.expanded;
@@ -1066,6 +1025,9 @@ __decorate([
1066
1025
  __decorate([
1067
1026
  property({ type: Object })
1068
1027
  ], ShellBar.prototype, "_itemsInfo", void 0);
1028
+ __decorate([
1029
+ property({ type: Object })
1030
+ ], ShellBar.prototype, "_contentInfo", void 0);
1069
1031
  __decorate([
1070
1032
  property({ type: Boolean, noAttribute: true })
1071
1033
  ], ShellBar.prototype, "_menuPopoverExpanded", void 0);
@@ -1074,10 +1036,7 @@ __decorate([
1074
1036
  ], ShellBar.prototype, "_overflowPopoverExpanded", void 0);
1075
1037
  __decorate([
1076
1038
  property({ type: Boolean, noAttribute: true })
1077
- ], ShellBar.prototype, "hasVisibleStartContent", void 0);
1078
- __decorate([
1079
- property({ type: Boolean, noAttribute: true })
1080
- ], ShellBar.prototype, "hasVisibleEndContent", void 0);
1039
+ ], ShellBar.prototype, "showFullWidthSearch", void 0);
1081
1040
  __decorate([
1082
1041
  slot()
1083
1042
  ], ShellBar.prototype, "assistant", void 0);