Skip to content

Commit e5c7faf

Browse files
authored
refactor(ui5-card-header): rename status to additionalText (#8507)
Renames the `status` property to `additionalText` and its shadow part. BREAKING CHANGE: The `status` property and its shadow part have been renamed. If you previously used them: ```html <style> .cardHeader::part(status) { ... } </style> <ui5-card-header status="3 of 10"></ui5-popover> ``` Now use `additionalText` instead: ```html <style> .cardHeader::part(additional-text) { ... } </style> <ui5-card-header class="cardHeader" additional-text="3 of 10"></ui5-card-header> ``` Related to #8461
1 parent e44547c commit e5c7faf

File tree

10 files changed

+33
-32
lines changed

10 files changed

+33
-32
lines changed

packages/main/src/CardHeader.hbs

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
>{{titleText}}</div>
3434
{{/if}}
3535

36-
{{#if status}}
37-
<div class="ui5-card-header-status">
38-
<span id="{{_id}}-status" part="status" dir="auto">{{status}}</span>
36+
{{#if additionalText}}
37+
<div class="ui5-card-header-additionalText">
38+
<span id="{{_id}}-additionalText" part="additional-text" dir="auto">{{additionalText}}</span>
3939
</div>
4040
{{/if}}
4141

packages/main/src/CardHeader.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import cardHeaderCss from "./generated/themes/CardHeader.css.js";
2525
* ### Overview
2626
*
2727
* The `ui5-card-header` is a component, meant to be used as a header of the `ui5-card` component.
28-
* It displays valuable information, that can be defined with several properties, such as: `titleText`, `subtitleText`, `status`
28+
* It displays valuable information, that can be defined with several properties, such as: `titleText`, `subtitleText`, `additionalText`
2929
* and two slots: `avatar` and `action`.
3030
*
3131
* ### Keyboard handling
@@ -41,7 +41,7 @@ import cardHeaderCss from "./generated/themes/CardHeader.css.js";
4141
* @csspart root - Used to style the root DOM element of the CardHeader
4242
* @csspart title - Used to style the title of the CardHeader
4343
* @csspart subtitle - Used to style the subtitle of the CardHeader
44-
* @csspart status - Used to style the status of the CardHeader
44+
* @csspart additional-text - Used to style the additional text of the CardHeader
4545
*/
4646
@customElement({
4747
tag: "ui5-card-header",
@@ -75,12 +75,12 @@ class CardHeader extends UI5Element {
7575
subtitleText!: string;
7676

7777
/**
78-
* Defines the status text.
78+
* Defines the additional text.
7979
* @default ""
8080
* @public
8181
*/
8282
@property()
83-
status!: string;
83+
additionalText!: string;
8484

8585
/**
8686
* Defines if the component would be interactive,
@@ -158,8 +158,8 @@ class CardHeader extends UI5Element {
158158
labels.push(`${this._id}-subtitle`);
159159
}
160160

161-
if (this.status) {
162-
labels.push(`${this._id}-status`);
161+
if (this.additionalText) {
162+
labels.push(`${this._id}-additionalText`);
163163
}
164164

165165
if (this.hasAvatar) {

packages/main/src/themes/CardHeader.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
justify-content: space-between;
7979
}
8080

81-
.ui5-card-header-status {
81+
.ui5-card-header-additionalText {
8282
flex: none;
8383
}
8484

@@ -105,7 +105,7 @@
105105
border-radius: 50%;
106106
}
107107

108-
.ui5-card-header .ui5-card-header-status {
108+
.ui5-card-header .ui5-card-header-additionalText {
109109
display: inline-block;
110110
font-family: "72override", var(--sapFontFamily);
111111
font-size: var(--sapFontSmallSize);

packages/main/test/pages/Card.html

+10-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<ui5-card-header
1717
id="cardHeader"
1818
slot="header"
19-
status="4 of 10"
19+
additional-text="4 of 10"
2020
title-text="Quick Links"
2121
subtitle-text="Quick links sub title"
2222
interactive>
@@ -35,7 +35,7 @@
3535
<ui5-card-header
3636
id="cardHeader2"
3737
slot="header"
38-
status="4 of 10"
38+
additional-text="4 of 10"
3939
title-text="Quick Links"
4040
subtitle-text="Quick Links">
4141
<ui5-icon name="group" slot="avatar"></ui5-icon>
@@ -99,7 +99,7 @@
9999
<ui5-card-header
100100
id="cardHeader2d"
101101
slot="header"
102-
status="4 of 10"
102+
additional-text="4 of 10"
103103
title-text="Quick Links">
104104
<img src="./img/John_Miller.png" alt="John Miller" slot="avatar">
105105
</ui5-card-header>
@@ -114,7 +114,7 @@
114114
<ui5-card-header
115115
id="cardHeader2e"
116116
slot="header"
117-
status="4 of 10"
117+
additional-text="4 of 10"
118118
title-text="Long Long Long Long Long Long Title">
119119
<img src="./img/John_Miller.png" alt="John Miller" slot="avatar">
120120
</ui5-card-header>
@@ -129,7 +129,7 @@
129129
<ui5-card-header
130130
id="cardHeader2f"
131131
slot="header"
132-
status="4 of 10"
132+
additional-text="4 of 10"
133133
title-text="Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Title"
134134
subtitle-text="Long long long long long long long long long long long long long subtitle">
135135
<img src="./img/John_Miller.png" alt="John Miller" slot="avatar">
@@ -145,7 +145,7 @@
145145
<ui5-card-header
146146
id="cardHeader2g"
147147
slot="header"
148-
status="4 of 10"
148+
additional-text="4 of 10"
149149
title-text="Quick Links">
150150
</ui5-card-header>
151151
<div class="myTextContent">
@@ -159,7 +159,7 @@
159159
<ui5-card-header
160160
id="cardHeader2h"
161161
slot="header"
162-
status="4 of 10"
162+
additional-text="4 of 10"
163163
title-text="Quick Links"
164164
subtitle-text="Subtitle">
165165
<ui5-button slot="action" design="Transparent" icon="overflow"></ui5-button>
@@ -192,7 +192,7 @@
192192
id="actionCardHeader"
193193
slot="header"
194194
title-text="Linked Activities (5)"
195-
status="4 of 10">
195+
additional-text="4 of 10">
196196
<ui5-button icon="add" slot="action" design="Transparent">Add activity</ui5-button>
197197
</ui5-card-header>
198198

@@ -235,7 +235,7 @@
235235
id="actionCardHeader2"
236236
slot="header"
237237
title-text="Linked Activities (5)"
238-
status="4 of 10">
238+
additional-text="4 of 10">
239239
<ui5-button icon="add" slot="action" design="Transparent">Add activity</ui5-button>
240240
</ui5-card-header>
241241

@@ -277,7 +277,7 @@
277277
<ui5-card-header
278278
slot="header"
279279
id="header"
280-
status="4 of 10"
280+
additional-text="4 of 10"
281281
title-text="Linked Activities (5)"
282282
subtitle-text="Quick Links">
283283
</ui5-card-header>

packages/main/test/specs/Card.spec.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ describe("Card general interaction", () => {
1111
assert.ok(await card.isExisting(), "The component has shadow root.");
1212
});
1313

14-
it("tests status is rendered, when action is set", async () => {
15-
const status = await browser.$("#actionCardHeader").shadow$(".ui5-card-header-status");
14+
it("tests additionalText is rendered, when action is set", async () => {
15+
const additionalText = await browser.$("#actionCardHeader").shadow$(".ui5-card-header-additionalText");
1616

17-
assert.ok(await status.isExisting(), "The status DOM is rendered.");
17+
assert.ok(await additionalText.isExisting(), "The element is rendered.");
1818
});
1919

2020
it("tests interactive header results in interactive class on the card", async () => {
@@ -108,7 +108,7 @@ describe("CardHeader", () => {
108108
const header2 = await browser.$("#header2").shadow$(".ui5-card-header .ui5-card-header-focusable-element");
109109
const headerId = await browser.$("#header").getProperty("_id");
110110
const headerId2 = await browser.$("#header2").getProperty("_id");
111-
const EXPECTED_ARIA_LABELLEDBY_HEADER = `${headerId}-title ${headerId}-subtitle ${headerId}-status`;
111+
const EXPECTED_ARIA_LABELLEDBY_HEADER = `${headerId}-title ${headerId}-subtitle ${headerId}-additionalText`;
112112
const EXPECTED_ARIA_LABELLEDBY_HEADER2 = `${headerId2}-title ${headerId2}-subtitle`;
113113

114114
assert.strictEqual(await header.getAttribute("aria-labelledby"), EXPECTED_ARIA_LABELLEDBY_HEADER,
@@ -117,6 +117,7 @@ describe("CardHeader", () => {
117117
"The aria-labelledby is correctly set.");
118118
});
119119
});
120+
120121
describe("Card Accessibility", () => {
121122
before(async () => {
122123
await browser.url(`test/pages/Card.html`);

packages/playground/_stories/main/Card/Card.stories.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ const Template: UI5StoryArgs<Card, StoryArgsSlots> = (args) => {
3333
`;
3434
};
3535

36-
const header = (titleText: string, subtitleText: string, status?: string, actions?: string[], avatar?: string, interactive?: boolean) => {
36+
const header = (titleText: string, subtitleText: string, additionalText?: string, actions?: string[], avatar?: string, interactive?: boolean) => {
3737
return `<ui5-card-header
3838
slot="header"
3939
title-text="${titleText}"
4040
subtitle-text="${subtitleText}"
41-
${status ? `status="${status}"` : ""}
41+
${additionalText ? `additional-text="${additionalText}"` : ""}
4242
${interactive ? "interactive" : ""}
4343
>
4444
${avatar ? avatar : ""}

packages/playground/_stories/main/Card/CardHeader/CardHeader.stories.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const Template: UI5StoryArgs<CardHeader, StoryArgsSlots> = (args) => {
2020
slot="header"
2121
title-text="${ifDefined(args.titleText)}"
2222
subtitle-text="${ifDefined(args.subtitleText)}"
23-
status="${ifDefined(args.status)}"
23+
additional-text="${ifDefined(args.additionalText)}"
2424
?interactive="${ifDefined(args.interactive)}"
2525
>
2626
${unsafeHTML(args.avatar)}
@@ -40,7 +40,7 @@ Basic.tags = ["_hidden_"]
4040
Basic.args = {
4141
titleText: "Team Space",
4242
subtitleText: "Direct Reports",
43-
status: "3 of 10",
43+
additionalText: "3 of 10",
4444
action: `<ui5-button design="Transparent" slot="action">View All</ui5-button>`,
4545
avatar: `<ui5-icon name="group" slot="avatar"></ui5-icon>`,
4646
interactive: true,

packages/website/docs/_samples/main/Card/Basic/sample.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<ui5-card>
1616
<ui5-card-header slot="header" title-text="This header is interactive"
17-
subtitle-text="Click, press Enter or Space" status="3 of 6" interactive>
17+
subtitle-text="Click, press Enter or Space" additional-text="3 of 6" interactive>
1818
<ui5-icon name="group" slot="avatar"></ui5-icon>
1919
</ui5-card-header>
2020
<ui5-list separators="None" style="margin-block-end: 0.75rem;">

packages/website/docs/_samples/main/Card/WithList/sample.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<!-- playground-fold-end -->
1414

1515
<ui5-card>
16-
<ui5-card-header slot="header" title-text="Team Space" subtitle-text="Direct Reports" status="3 of 10">
16+
<ui5-card-header slot="header" title-text="Team Space" subtitle-text="Direct Reports" additional-text="3 of 10">
1717
<ui5-icon name="group" slot="avatar"></ui5-icon>
1818
<ui5-button design="Transparent" slot="action">View All</ui5-button>
1919
</ui5-card-header>

packages/website/docs/_samples/main/Card/WithTable/sample.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<!-- playground-fold-end -->
1414

1515
<ui5-card>
16-
<ui5-card-header slot="header" title-text="New Purchase Orders" subtitle-text="Today" status="3 of 15">
16+
<ui5-card-header slot="header" title-text="New Purchase Orders" subtitle-text="Today" additional-text="3 of 15">
1717
</ui5-card-header>
1818

1919
<ui5-table style="margin-block-end: 0.75rem;">

0 commit comments

Comments
 (0)