@@ -10,11 +10,23 @@ import StandardListItem from "@ui5/webcomponents/dist/StandardListItem.js";
10
10
import List from "@ui5/webcomponents/dist/List.js" ;
11
11
import Popover from "@ui5/webcomponents/dist/Popover.js" ;
12
12
import Button from "@ui5/webcomponents/dist/Button.js" ;
13
+ import { fetchI18nBundle , getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js" ;
13
14
import "@ui5/webcomponents-icons/dist/icons/search.js" ;
14
15
import "@ui5/webcomponents-icons/dist/icons/bell.js" ;
15
16
import "@ui5/webcomponents-icons/dist/icons/overflow.js" ;
16
17
import "@ui5/webcomponents-icons/dist/icons/grid.js" ;
17
18
19
+ import {
20
+ SHELLBAR_LABEL ,
21
+ SHELLBAR_LOGO ,
22
+ SHELLBAR_COPILOT ,
23
+ SHELLBAR_NOTIFICATIONS ,
24
+ SHELLBAR_PROFILE ,
25
+ SHELLBAR_PRODUCTS ,
26
+ SHELLBAR_SEARCH ,
27
+ SHELLBAR_OVERFLOW ,
28
+ } from "./generated/i18n/i18n-defaults.js" ;
29
+
18
30
// Templates
19
31
import ShellBarTemplate from "./generated/templates/ShellBarTemplate.lit.js" ;
20
32
import ShellBarPopoverTemplate from "./generated/templates/ShellBarPopoverTemplate.lit.js" ;
@@ -144,6 +156,14 @@ const metadata = {
144
156
type : String ,
145
157
multiple : true ,
146
158
} ,
159
+ _menuPopoverExpanded : {
160
+ type : Boolean ,
161
+ noAttribute : true ,
162
+ } ,
163
+ _overflowPopoverExpanded : {
164
+ type : Boolean ,
165
+ noAttribute : true ,
166
+ } ,
147
167
} ,
148
168
managedSlots : true ,
149
169
slots : /** @lends sap.ui.webcomponents.fiori.ShellBar.prototype */ {
@@ -389,7 +409,7 @@ class ShellBar extends UI5Element {
389
409
press : async ( ) => {
390
410
this . _updateClonedMenuItems ( ) ;
391
411
392
- if ( this . menuItems . length ) {
412
+ if ( this . hasMenuItems ) {
393
413
this . updateStaticAreaItemContentDensity ( ) ;
394
414
const menuPopover = await this . _getMenuPopover ( ) ;
395
415
menuPopover . openBy ( this . shadowRoot . querySelector ( ".ui5-shellbar-menu-button" ) ) ;
@@ -406,6 +426,8 @@ class ShellBar extends UI5Element {
406
426
this . overflowPopover . close ( ) ;
407
427
this . _overflowActions ( ) ;
408
428
} ;
429
+
430
+ this . i18nBundle = getI18nBundle ( "@ui5/webcomponents-fiori" ) ;
409
431
}
410
432
411
433
_menuItemPress ( event ) {
@@ -414,12 +436,45 @@ class ShellBar extends UI5Element {
414
436
} , true ) ;
415
437
}
416
438
417
- _logoPress ( event ) {
439
+ _logoPress ( ) {
418
440
this . fireEvent ( "logoClick" , {
419
441
targetRef : this . shadowRoot . querySelector ( ".ui5-shellbar-logo" ) ,
420
442
} ) ;
421
443
}
422
444
445
+ _menuPopoverBeforeOpen ( ) {
446
+ this . _menuPopoverExpanded = true ;
447
+ }
448
+
449
+ _menuPopoverAfterClose ( ) {
450
+ this . _menuPopoverExpanded = false ;
451
+ }
452
+
453
+ _overflowPopoverBeforeOpen ( ) {
454
+ this . _overflowPopoverExpanded = true ;
455
+ }
456
+
457
+ _overflowPopoverAfterClose ( ) {
458
+ this . _overflowPopoverExpanded = false ;
459
+ }
460
+
461
+ _logoKeyup ( event ) {
462
+ if ( isSpace ( event ) ) {
463
+ this . _logoPress ( ) ;
464
+ }
465
+ }
466
+
467
+ _logoKeydown ( event ) {
468
+ if ( isSpace ( event ) ) {
469
+ event . preventDefault ( ) ;
470
+ return ;
471
+ }
472
+
473
+ if ( isEnter ( event ) ) {
474
+ this . _logoPress ( ) ;
475
+ }
476
+ }
477
+
423
478
_fireCoPilotClick ( ) {
424
479
this . fireEvent ( "coPilotClick" , {
425
480
targetRef : this . shadowRoot . querySelector ( ".ui5-shellbar-coPilot" ) ,
@@ -792,7 +847,7 @@ class ShellBar extends UI5Element {
792
847
"ui5-shellbar-with-searchfield" : this . searchField . length ,
793
848
} ,
794
849
button : {
795
- "ui5-shellbar-menu-button--interactive" : ! ! this . menuItems . length ,
850
+ "ui5-shellbar-menu-button--interactive" : this . hasMenuItems ,
796
851
"ui5-shellbar-menu-button" : true ,
797
852
} ,
798
853
items : {
@@ -839,12 +894,20 @@ class ShellBar extends UI5Element {
839
894
return this . _itemsInfo . filter ( itemInfo => ! ! itemInfo . custom ) ;
840
895
}
841
896
842
- get interactiveLogo ( ) {
843
- return this . breakpointSize === "S" ;
897
+ get nonFocusableLogo ( ) {
898
+ return this . breakpointSize === "S" && this . hasMenuItems ;
899
+ }
900
+
901
+ get hasFocusableLogo ( ) {
902
+ return this . logo && ! this . nonFocusableLogo ;
903
+ }
904
+
905
+ get hasNonFocusableLogo ( ) {
906
+ return this . logo && this . nonFocusableLogo ;
844
907
}
845
908
846
909
get showArrowDown ( ) {
847
- return this . primaryTitle || ( this . logo && this . interactiveLogo ) ;
910
+ return this . primaryTitle || this . hasInteractvieLogo ;
848
911
}
849
912
850
913
get popoverHorizontalAlign ( ) {
@@ -863,12 +926,80 @@ class ShellBar extends UI5Element {
863
926
return ! ! this . profile . length ;
864
927
}
865
928
929
+ get hasMenuItems ( ) {
930
+ return this . menuItems . length > 0 ;
931
+ }
932
+
933
+ get menuBtnHasPopup ( ) {
934
+ return this . hasMenuItems ? true : undefined ;
935
+ }
936
+
866
937
get menuBtnTabindex ( ) {
867
- return this . menuItems . length > 0 ? "0" : "-1" ;
938
+ return this . hasMenuItems ? "0" : "-1" ;
939
+ }
940
+
941
+ get menuPopoverExpanded ( ) {
942
+ return this . hasMenuItems ? this . _menuPopoverExpanded : undefined ;
943
+ }
944
+
945
+ get _shellbarText ( ) {
946
+ return this . i18nBundle . getText ( SHELLBAR_LABEL ) ;
947
+ }
948
+
949
+ get _logoText ( ) {
950
+ return this . i18nBundle . getText ( SHELLBAR_LOGO ) ;
951
+ }
952
+
953
+ get _copilotText ( ) {
954
+ return this . i18nBundle . getText ( SHELLBAR_COPILOT ) ;
955
+ }
956
+
957
+ get _notificationsText ( ) {
958
+ return this . i18nBundle . getText ( SHELLBAR_NOTIFICATIONS , this . notificationCount ) ;
959
+ }
960
+
961
+ get _profileText ( ) {
962
+ return this . i18nBundle . getText ( SHELLBAR_PROFILE ) ;
963
+ }
964
+
965
+ get _productsText ( ) {
966
+ return this . i18nBundle . getText ( SHELLBAR_PRODUCTS ) ;
967
+ }
968
+
969
+ get _searchText ( ) {
970
+ return this . i18nBundle . getText ( SHELLBAR_SEARCH ) ;
971
+ }
972
+
973
+ get _overflowText ( ) {
974
+ return this . i18nBundle . getText ( SHELLBAR_OVERFLOW ) ;
975
+ }
976
+
977
+ get accInfo ( ) {
978
+ return {
979
+ notifications : {
980
+ "title" : this . _notificationsText ,
981
+ } ,
982
+ profile : {
983
+ "title" : this . _profileText ,
984
+ } ,
985
+ products : {
986
+ "title" : this . _productsText ,
987
+ } ,
988
+ search : {
989
+ "ariaExpanded" : this . showSearchField ,
990
+ "title" : this . _searchText ,
991
+ } ,
992
+ overflow : {
993
+ "title" : this . _overflowText ,
994
+ "ariaHaspopup" : true ,
995
+ "ariaExpanded" : this . _overflowPopoverExpanded ,
996
+ } ,
997
+ } ;
868
998
}
869
999
870
1000
static async onDefine ( ) {
871
1001
await Promise . all ( [
1002
+ fetchI18nBundle ( "@ui5/webcomponents-fiori" ) ,
872
1003
Button . define ( ) ,
873
1004
List . define ( ) ,
874
1005
Popover . define ( ) ,
0 commit comments