@@ -4,10 +4,13 @@ import { isSpace, isEnter } from "@ui5/webcomponents-base/dist/events/PseudoEven
4
4
import { getCompactSize } from "@ui5/webcomponents-base/dist/config/CompactSize.js" ;
5
5
import { getRTL } from "@ui5/webcomponents-base/dist/config/RTL.js" ;
6
6
import { getFeature } from "@ui5/webcomponents-base/dist/FeaturesRegistry.js" ;
7
+ import { fetchResourceBundle , getResourceBundle } from "@ui5/webcomponents-base/dist/ResourceBundle.js" ;
7
8
import ButtonDesign from "./types/ButtonDesign.js" ;
8
9
import ButtonTemplate from "./generated/templates/ButtonTemplate.lit.js" ;
9
10
import Icon from "./Icon.js" ;
10
11
12
+ import { BUTTON_ARIA_TYPE_ACCEPT , BUTTON_ARIA_TYPE_REJECT , BUTTON_ARIA_TYPE_EMPHASIZED } from "./i18n/defaults.js" ;
13
+
11
14
// Styles
12
15
import buttonCss from "./generated/themes/Button.css.js" ;
13
16
@@ -190,6 +193,8 @@ class Button extends UI5Element {
190
193
this . _active = false ;
191
194
}
192
195
} ;
196
+
197
+ this . resourceBundle = getResourceBundle ( "@ui5/webcomponents" ) ;
193
198
}
194
199
195
200
onBeforeRendering ( ) {
@@ -266,8 +271,27 @@ class Button extends UI5Element {
266
271
return getRTL ( ) ? "rtl" : undefined ;
267
272
}
268
273
274
+ get hasButtonType ( ) {
275
+ return this . design !== ButtonDesign . Default && this . design !== ButtonDesign . Transparent ;
276
+ }
277
+
278
+ static typeTextMappings ( ) {
279
+ return {
280
+ "Positive" : BUTTON_ARIA_TYPE_ACCEPT ,
281
+ "Negative" : BUTTON_ARIA_TYPE_REJECT ,
282
+ "Emphasized" : BUTTON_ARIA_TYPE_EMPHASIZED ,
283
+ } ;
284
+ }
285
+
286
+ get buttonTypeText ( ) {
287
+ return this . resourceBundle . getText ( Button . typeTextMappings ( ) [ this . design ] ) ;
288
+ }
289
+
269
290
static async define ( ...params ) {
270
- await Icon . define ( ) ;
291
+ await Promise . all ( [
292
+ Icon . define ( ) ,
293
+ fetchResourceBundle ( "@ui5/webcomponents" ) ,
294
+ ] ) ;
271
295
272
296
super . define ( ...params ) ;
273
297
}
0 commit comments