Skip to content

Commit 261944f

Browse files
committed
Merge branch 'master' into release-rc.12
2 parents 0a7043a + 3fb02f3 commit 261944f

File tree

6 files changed

+39
-9
lines changed

6 files changed

+39
-9
lines changed

packages/main/src/ResponsivePopover.hbs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
{{#if header.length}}
1414
<slot slot="header" name="header"></slot>
1515
{{else}}
16-
<header class="ui5-responsive-popover-header">
17-
<ui5-title level="H5" class="ui5-responsive-popover-header-text">{{headerText}}</ui5-title>
16+
<header class="{{dialogClasses.header}}">
17+
{{#if headerText }}
18+
<ui5-title level="H2" class="ui5-popup-header-text ui5-responsive-popover-header-text">{{headerText}}</ui5-title>
19+
{{/if}}
1820
<ui5-button
1921
icon="decline"
2022
design="Transparent"
23+
aria-label="{{_closeDialogAriaLabel}}"
2124
@click="{{close}}"
2225
>
2326
</ui5-button>

packages/main/src/ResponsivePopover.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { isPhone } from "@ui5/webcomponents-base/dist/Device.js";
2+
import { fetchI18nBundle, getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
3+
import { RESPONSIVE_POPOVER_CLOSE_DIALOG_BUTTON } from "./generated/i18n/i18n-defaults.js";
24
import { getNextZIndex } from "./popup-utils/PopupUtils.js";
35
import ResponsivePopoverTemplate from "./generated/templates/ResponsivePopoverTemplate.lit.js";
46
import Popover from "./Popover.js";
@@ -75,18 +77,32 @@ const metadata = {
7577
* @public
7678
*/
7779
class ResponsivePopover extends Popover {
80+
constructor() {
81+
super();
82+
this.i18nBundle = getI18nBundle("@ui5/webcomponents");
83+
}
84+
7885
static get metadata() {
7986
return metadata;
8087
}
8188

8289
static get styles() {
8390
return [Popover.styles, ResponsivePopoverCss];
8491
}
85-
92+
93+
get dialogClasses() {
94+
return {
95+
header: {
96+
"ui5-responsive-popover-header": true,
97+
"ui5-responsive-popover-header-no-title": !this.headerText,
98+
}
99+
}
100+
}
101+
86102
static get template() {
87103
return ResponsivePopoverTemplate;
88104
}
89-
105+
90106
static get dependencies() {
91107
return [
92108
Button,
@@ -170,6 +186,10 @@ class ResponsivePopover extends Popover {
170186
return this._isPhone || !this.contentOnlyOnDesktop;
171187
}
172188

189+
get _closeDialogAriaLabel() {
190+
return this.i18nBundle.getText(RESPONSIVE_POPOVER_CLOSE_DIALOG_BUTTON);
191+
}
192+
173193
_afterDialogOpen(event) {
174194
this.opened = true;
175195
this._propagateDialogEvent(event);
@@ -185,6 +205,10 @@ class ResponsivePopover extends Popover {
185205

186206
this.fireEvent(type, event.detail);
187207
}
208+
209+
static async onDefine() {
210+
await fetchI18nBundle("@ui5/webcomponents");
211+
}
188212
}
189213

190214
ResponsivePopover.define();

packages/main/src/i18n/messagebundle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ RATING_INDICATOR_TOOLTIP_TEXT=Rating
127127
#XBUT: Rating indicator aria-roledescription text
128128
RATING_INDICATOR_TEXT=Rating Indicator
129129

130+
#XFLD: ResponsivePopover's button's text which closes the dialog
131+
RESPONSIVE_POPOVER_CLOSE_DIALOG_BUTTON=Decline
132+
130133
#XACT: ARIA description for the segmented button
131134
SEGMENTEDBUTTON_ARIA_DESCRIPTION=Segmented button
132135

packages/main/src/themes/ResponsivePopover.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
}
2727

2828
.ui5-responsive-popover-header-text {
29-
display: flex;
30-
align-items: center;
3129
width: calc(100% - var(--_ui5_button_base_min_width));
3230
}
31+
32+
.ui5-responsive-popover-header-no-title {
33+
justify-content: flex-end;
34+
}

packages/main/src/themes/ResponsivePopoverCommon.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@
120120
}
121121

122122
.ui5-responsive-popover-header-text {
123-
display: flex;
124-
align-items: center;
125123
width: calc(100% - var(--_ui5_button_base_min_width));
126124
}
127125

packages/main/test/pages/ResponsivePopover.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ <h2> Inputs based component that opens popover/dialog within dialog</h2>
116116
respPopover3.close();
117117
});
118118
btnOpenDialog.addEventListener('click', function (event) {
119-
dialog.open();
119+
dialog.open(btnOpenDialog);
120120
});
121121
</script>
122122
</body>

0 commit comments

Comments
 (0)