Skip to content

Commit 5709e31

Browse files
authored
refactor(ui5-tab): rename iconColor to semanticColor (#518)
1 parent 08e0569 commit 5709e31

File tree

3 files changed

+35
-27
lines changed

3 files changed

+35
-27
lines changed

packages/main/src/Tab.js

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Bootstrap from "@ui5/webcomponents-base/src/Bootstrap.js";
22
import TabBase from "./TabBase.js";
3-
import IconColor from "./types/IconColor.js";
3+
import SemanticColor from "./types/SemanticColor.js";
44
import Icon from "./Icon.js";
55
import TabRenderer from "./build/compiled/TabRenderer.lit.js";
66

@@ -31,7 +31,7 @@ const metadata = {
3131
/**
3232
* The text to be displayed for the item.
3333
* @type {string}
34-
* @defaultvalue: ""
34+
* @defaultvalue ""
3535
* @public
3636
*/
3737
text: {
@@ -51,37 +51,45 @@ const metadata = {
5151
/**
5252
* Represents the "additionalText" text, which is displayed in the tab filter.
5353
* @type {string}
54-
* @defaultvalue: ""
54+
* @defaultvalue ""
5555
* @public
5656
*/
5757
additionalText: {
5858
type: String,
5959
},
6060

6161
/**
62-
* Specifies the icon to be displayed for the tab filter.
62+
* Defines the icon source URI to be displayed as graphical element within the <code>ui5-tab</code>.
63+
* The SAP-icons font provides numerous built-in icons.
64+
* See all the available icons in the <ui5-link target="_blank" href="https://openui5.hana.ondemand.com/test-resources/sap/m/demokit/iconExplorer/webapp/index.html" class="api-table-content-cell-link">Icon Explorer</ui5-link>.
65+
*
6366
* @type {string}
67+
* @defaultvalue ""
6468
* @public
6569
*/
6670
icon: {
6771
type: String,
6872
},
6973

7074
/**
71-
* Specifies the icon color.
72-
*
73-
* If an icon font is used, the color can be chosen from the icon colors
74-
* (sap.ui.core.IconColor).
75-
* Possible semantic colors are: Neutral, Positive, Critical, Negative.
76-
* Instead of the semantic icon color the brand color can be used, this is named Default.
77-
* Semantic colors and brand colors should not be mixed up inside one IconTabBar.
78-
* @type {IconColor}
75+
* Defines the <code>ui5-tab</code> semantic color.
76+
* The color is applied to:
77+
* <ul>
78+
* <li>the <code>ui5-tab</code> icon</li>
79+
* <li>the <code>text</code> when <code>ui5-tab</code> overflows</li>
80+
* <li>the tab selection line</li>
81+
* </ul>
82+
* <br>
83+
* Available semantic colors are: <code>"Default"</code>, <code>"Neutral", <code>"Positive"</code>, <code>"Critical"</code> and <code>"Negative"</code>.
84+
* <br><br>
85+
* <b>Note:</b> The color value depends on the current theme.
86+
* @type {string}
7987
* @defaultvalue "Default"
8088
* @public
8189
*/
82-
iconColor: {
83-
type: IconColor,
84-
defaultValue: IconColor.Default,
90+
semanticColor: {
91+
type: SemanticColor,
92+
defaultValue: SemanticColor.Default,
8593
},
8694

8795
/**

packages/main/src/TabContainer.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Icon from "./Icon.js";
1111
import List from "./List.js";
1212
import Popover from "./Popover.js";
1313
import TabBase from "./TabBase.js";
14-
import IconColor from "./types/IconColor.js";
14+
import SemanticColor from "./types/SemanticColor.js";
1515

1616
// Styles
1717
import tabContainerCss from "./themes/TabContainer.css.js";
@@ -504,8 +504,8 @@ const calculateHeaderItemClasses = (item, mixedMode) => {
504504
classes.push("ui5-tc__headerItem--mixedMode");
505505
}
506506

507-
if (item.iconColor !== IconColor.Default) {
508-
classes.push(`ui5-tc__headerItem--${item.iconColor.toLowerCase()}`);
507+
if (item.semanticColor !== SemanticColor.Default) {
508+
classes.push(`ui5-tc__headerItem--${item.semanticColor.toLowerCase()}`);
509509
}
510510

511511
return classes.join(" ");
@@ -526,8 +526,8 @@ const calculateHeaderItemIconClasses = item => {
526526
const calculateHeaderItemSemanticIconClasses = item => {
527527
const classes = ["ui5-tc-headerItemSemanticIcon"];
528528

529-
if (item.iconColor !== IconColor.Default) {
530-
classes.push(`ui5-tc-headerItemSemanticIcon--${item.iconColor.toLowerCase()}`);
529+
if (item.semanticColor !== SemanticColor.Default) {
530+
classes.push(`ui5-tc-headerItemSemanticIcon--${item.semanticColor.toLowerCase()}`);
531531
}
532532

533533
return classes.join(" ");
@@ -548,8 +548,8 @@ const calculateHeaderItemAdditionalTextClasses = item => {
548548
const calculateOverflowItemClasses = item => {
549549
const classes = ["ui5-tc__overflowItem"];
550550

551-
if (item.iconColor !== IconColor.Default) {
552-
classes.push(`ui5-tc__overflowItem--${item.iconColor.toLowerCase()}`);
551+
if (item.semanticColor !== SemanticColor.Default) {
552+
classes.push(`ui5-tc__overflowItem--${item.semanticColor.toLowerCase()}`);
553553
}
554554

555555
if (item.disabled) {
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import DataType from "@ui5/webcomponents-base/src/types/DataType.js";
22

3-
const IconColors = {
3+
const SemanticColors = {
44
/**
55
* Default color (brand color)
66
* @public
@@ -33,12 +33,12 @@ const IconColors = {
3333
};
3434

3535

36-
class IconColor extends DataType {
36+
class SemanticColor extends DataType {
3737
static isValid(value) {
38-
return !!IconColors[value];
38+
return !!SemanticColors[value];
3939
}
4040
}
4141

42-
IconColor.generataTypeAcessors(IconColors);
42+
SemanticColor.generataTypeAcessors(SemanticColors);
4343

44-
export default IconColor;
44+
export default SemanticColor;

0 commit comments

Comments
 (0)