Skip to content

Commit 2c9393c

Browse files
feat(ui5-button): introducing attention type button (#3481)
fixes: #3446
1 parent 790c02e commit 2c9393c

File tree

6 files changed

+56
-1
lines changed

6 files changed

+56
-1
lines changed

packages/main/src/Button.js

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const metadata = {
3939
* <li><code>Positive</code></li>
4040
* <li><code>Negative</code></li>
4141
* <li><code>Transparent</code></li>
42+
* <li><code>Attention</code></li>
4243
* </ul>
4344
*
4445
* @type {ButtonDesign}

packages/main/src/themes/Button.css

+31
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,37 @@ bdi {
202202
outline-color: var(--sapContent_ContrastFocusColor);
203203
}
204204

205+
:host([design="Attention"]) {
206+
background-color: var(--sapButton_Attention_Background);
207+
border-color: var(--sapButton_Attention_BorderColor);
208+
color: var(--sapButton_Attention_TextColor);
209+
text-shadow: var(--_ui5_button_text_shadow);
210+
}
211+
212+
/*The ui5_hovered class is set by FileUploader to indicate hover state of the control*/
213+
:host([design="Attention"]:not([active]):not([non-interactive]):not([_is-touch]):hover),
214+
:host([design="Attention"]:not([active]):not([non-interactive]):not([_is-touch]).ui5_hovered) {
215+
background-color: var(--sapButton_Attention_Hover_Background);
216+
border-color: var(--sapButton_Attention_Hover_BorderColor);
217+
color: var(--sapButton_Attention_Hover_TextColor);
218+
}
219+
220+
:host([ui5-button][design="Attention"][active]:not([non-interactive])) {
221+
background-color: var(--sapButton_Attention_Active_Background);
222+
border-color: var(--sapButton_Attention_Active_BorderColor);
223+
color: var(--sapButton_Attention_Active_TextColor);
224+
text-shadow: none;
225+
}
226+
227+
:host([design="Attention"][focused]:not([_is-touch])) {
228+
outline-color: var(--_ui5_button_attention_border_focus_hover_color);
229+
border-color: var(--_ui5_button_attention_focus_border_color);
230+
}
231+
232+
:host([design="Attention"][active][focused]) {
233+
outline-color: var(--sapContent_ContrastFocusColor);
234+
}
235+
205236
:host([design="Emphasized"]) {
206237
background-color: var(--sapButton_Emphasized_Background);
207238
border-color: var(--sapButton_Emphasized_BorderColor);

packages/main/src/types/ButtonDesign.js

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ const ButtonTypes = {
3939
* @type {Emphasized}
4040
*/
4141
Emphasized: "Emphasized",
42+
43+
/**
44+
* attention type
45+
* @public
46+
* @type {Attention}
47+
*/
48+
Attention: "Attention",
4249
};
4350

4451
/**

packages/main/test/pages/Button.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@
6767
<ui5-button disabled>Inactive</ui5-button>
6868
<ui5-button design="Positive">Agree</ui5-button>
6969
<ui5-button design="Negative">Decline</ui5-button>
70-
70+
<ui5-button design="Attention">Warning</ui5-button>
71+
<ui5-button design="Attention" icon="message-warning">Warning</ui5-button>
72+
<ui5-button design="Attention" icon="message-warning"></ui5-button>
7173
<br/>
7274
<br/>
7375
<br/>

packages/main/test/samples/Button.sample.html

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ <h3>Basic Button</h3>
1414
<ui5-button class="samples-margin" design="Transparent">Cancel</ui5-button>
1515
<ui5-button class="samples-margin" design="Positive">Approve</ui5-button>
1616
<ui5-button class="samples-margin" design="Negative">Decline</ui5-button>
17+
<ui5-button class="samples-margin" design="Attention">Warning</ui5-button>
1718
<ui5-button class="samples-margin" design="Emphasized">Subscribe</ui5-button>
1819
</div>
1920
<pre class="prettyprint lang-html"><xmp>
@@ -22,6 +23,7 @@ <h3>Basic Button</h3>
2223
<ui5-button design="Transparent">Cancel</ui5-button>
2324
<ui5-button design="Positive">Approve</ui5-button>
2425
<ui5-button design="Negative">Decline</ui5-button>
26+
<ui5-button design="Attention">Warning</ui5-button>
2527
<ui5-button design="Emphasized">Subscribe</ui5-button>
2628
</xmp></pre>
2729
</section>
@@ -33,13 +35,15 @@ <h3>Button with Icon</h3>
3335
<ui5-button class="samples-margin" icon="download" icon-end>Download</ui5-button>
3436
<ui5-button class="samples-margin" design="Positive" icon="add">Add</ui5-button>
3537
<ui5-button class="samples-margin" design="Negative" icon="delete">Remove</ui5-button>
38+
<ui5-button class="samples-margin" design="Attention" icon="message-warning">Warning</ui5-button>
3639
<ui5-button class="samples-margin" design="Transparent" icon="accept">Accept</ui5-button>
3740
</div>
3841
<pre class="prettyprint lang-html"><xmp>
3942
<ui5-button icon="employee">Add</ui5-button>
4043
<ui5-button icon="download" icon-end>Download</ui5-button>
4144
<ui5-button design="Positive" icon="add">Add</ui5-button>
4245
<ui5-button design="Negative" icon="delete">Remove</ui5-button>
46+
<ui5-button design="Attention" icon="message-warning">Warning</ui5-button>
4347
<ui5-button design="Transparent" icon="accept">Transparent</ui5-button>
4448
</xmp></pre>
4549
</section>
@@ -91,13 +95,15 @@ <h3>Button with Design</h3>
9195
<ui5-button class="samples-margin" design="Positive">Agree</ui5-button>
9296
<ui5-button class="samples-margin" design="Negative">Decline</ui5-button>
9397
<ui5-button class="samples-margin" design="Default">Default</ui5-button>
98+
<ui5-button class="samples-margin" design="Attention">Warning</ui5-button>
9499
<ui5-button class="samples-margin" design="Transparent">Transparent</ui5-button>
95100
</div>
96101
<pre class="prettyprint lang-html"><xmp>
97102
<ui5-button design="Emphasized">Submit</ui5-button>
98103
<ui5-button design="Positive">Agree</ui5-button>
99104
<ui5-button design="Negative">Decline</ui5-button>
100105
<ui5-button design="Default">Default</ui5-button>
106+
<ui5-button design="Attention">Warning</ui5-button>
101107
<ui5-button design="Transparent">Transparent</ui5-button>
102108
</xmp></pre>
103109
</section>

packages/theme-base/css-vars-usage.json

+8
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
"--sapButton_Active_Background",
2626
"--sapButton_Active_BorderColor",
2727
"--sapButton_Active_TextColor",
28+
"--sapButton_Attention_Active_Background",
29+
"--sapButton_Attention_Active_BorderColor",
30+
"--sapButton_Attention_Active_TextColor",
31+
"--sapButton_Attention_Background",
32+
"--sapButton_Attention_BorderColor",
33+
"--sapButton_Attention_Hover_Background",
34+
"--sapButton_Attention_Hover_BorderColor",
35+
"--sapButton_Attention_TextColor",
2836
"--sapButton_Background",
2937
"--sapButton_BorderColor",
3038
"--sapButton_BorderCornerRadius",

0 commit comments

Comments
 (0)