@@ -8,7 +8,7 @@ import getEffectiveRTL from "@ui5/webcomponents-base/src/util/getEffectiveRTL.js
8
8
9
9
// Template
10
10
import SwitchTemplate from "./build/compiled/SwitchTemplate.lit.js" ;
11
- import SwitchType from "./types/SwitchType.js" ;
11
+
12
12
13
13
// Styles
14
14
import switchCss from "./themes/Switch.css.js" ;
@@ -77,18 +77,15 @@ const metadata = {
77
77
/**
78
78
* Defines the <code>ui5-switch</code> type.
79
79
* <br>
80
- * Available options are <code>Textual</code> and <code>Graphical</code>.
81
80
*
82
- * <br><br>
83
- * <b>Note:</b> If <code>Graphical</code> type is set,
81
+ * <b>Note:</b> If <code>graphical</code> type is set,
84
82
* positive and negative icons will replace the <code>textOn</code> and <code>textOff</code>.
85
83
* @type {string }
86
- * @defaultvalue "Textual"
84
+ * @defaultvalue false
87
85
* @public
88
86
*/
89
- type : {
90
- type : String ,
91
- defaultValue : SwitchType . Textual ,
87
+ graphical : {
88
+ type : Boolean ,
92
89
} ,
93
90
} ,
94
91
events : /** @lends sap.ui.webcomponents.main.Switch.prototype */ {
@@ -176,30 +173,27 @@ class Switch extends UI5Element {
176
173
}
177
174
178
175
get textOn ( ) {
179
- const graphical = this . type === SwitchType . Graphical ;
180
- return graphical ? "" : this . textOn ;
176
+ return this . graphical ? "" : this . textOn ;
181
177
}
182
178
183
179
get textOff ( ) {
184
- const graphical = this . type === SwitchType . Graphical ;
185
- return graphical ? "" : this . textOff ;
180
+ return this . graphical ? "" : this . textOff ;
186
181
}
187
182
188
183
get tabIndex ( ) {
189
184
return this . disabled ? undefined : "0" ;
190
185
}
191
186
192
187
get classes ( ) {
193
- const graphical = this . type === SwitchType . Graphical ;
194
- const hasLabel = graphical || this . textOn || this . textOff ;
188
+ const hasLabel = this . graphical || this . textOn || this . textOff ;
195
189
196
190
return {
197
191
main : {
198
192
"ui5-switch-wrapper" : true ,
199
193
"ui5-switch-desktop" : isDesktop ( ) ,
200
194
"ui5-switch--disabled" : this . disabled ,
201
195
"ui5-switch--checked" : this . checked ,
202
- "ui5-switch--semantic" : graphical ,
196
+ "ui5-switch--semantic" : this . graphical ,
203
197
"ui5-switch--no-label" : ! hasLabel ,
204
198
"sapUiSizeCompact" : getCompactSize ( ) ,
205
199
} ,
0 commit comments