Skip to content

Commit 7c0942b

Browse files
authored
fix(ui5-file-uploader): adjust high contrast themes styles (#11927)
- High contrast themes styles adjusted - Missing style overrides from the ui5-input styles added - Explicit icon imports added - Documentation review comments applied - Since tag added to the new APIs
1 parent 9e992ae commit 7c0942b

File tree

10 files changed

+22
-29
lines changed

10 files changed

+22
-29
lines changed

packages/main/src/FileUploader.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ class FileUploader extends UI5Element implements IFormInputElement {
211211
* Defines whether the component is required.
212212
* @default false
213213
* @public
214+
* @since 2.13.0
214215
*/
215216
@property({ type: Boolean })
216217
required = false;
@@ -219,6 +220,7 @@ class FileUploader extends UI5Element implements IFormInputElement {
219220
* Defines the accessible ARIA name of the component.
220221
* @default undefined
221222
* @public
223+
* @since 2.13.0
222224
*/
223225
@property()
224226
accessibleName?: string;
@@ -227,6 +229,7 @@ class FileUploader extends UI5Element implements IFormInputElement {
227229
* Receives id(or many ids) of the elements that label the input.
228230
* @default undefined
229231
* @public
232+
* @since 2.13.0
230233
*/
231234
@property()
232235
accessibleNameRef?: string;
@@ -242,7 +245,7 @@ class FileUploader extends UI5Element implements IFormInputElement {
242245
*
243246
* **Note:** For best accessibility experience, set a `tabindex` of "-1" on your interactive element, or it will be set automatically.
244247
* This slot is intended for use cases where you want a button-only file uploader.
245-
* It is recommended to set the `hideInput` property to "true" when using this slot.
248+
* It is recommended to set `hideInput` property to "true" when using this slot.
246249
* Not setting `hideInput` may negatively impact the screen reader users.
247250
* @public
248251
*/

packages/main/src/FileUploaderTemplate.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import Icon from "./Icon.js";
2+
import valueHelp from "@ui5/webcomponents-icons/dist/value-help.js";
3+
import decline from "@ui5/webcomponents-icons/dist/decline.js";
24
import Tokenizer from "./Tokenizer.js";
35
import Token from "./Token.js";
46
import type FileUploader from "./FileUploader.js";
@@ -64,7 +66,7 @@ export default function FileUploaderTemplate(this: FileUploader) {
6466
))}
6567
</Tokenizer>
6668
<Icon
67-
name="decline"
69+
name={decline}
6870
class="ui5-file-uploader-clear-icon inputIcon"
6971
onClick={this._onClearIconClick}
7072
title={this.clearIconTitle}
@@ -83,7 +85,7 @@ export default function FileUploaderTemplate(this: FileUploader) {
8385
)}
8486

8587
<Icon
86-
name="value-help"
88+
name={valueHelp}
8789
class="ui5-file-uploader-value-help-icon inputIcon"
8890
title={this.valueHelpTitle}
8991
/>

packages/main/src/themes/FileUploader.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,15 @@
5353
flex: 1;
5454
display: flex;
5555
position: relative;
56+
box-sizing: border-box;
5657
}
5758

5859
.ui5-file-uploader-tokenizer,
5960
.ui5-file-uploader-display-input {
6061
position: absolute;
6162
top: 0;
6263
inset-inline-start: 0;
63-
height: inherit;
64+
height: 100%;
6465
border: none;
6566
outline: none;
6667
cursor: pointer;
@@ -91,22 +92,28 @@
9192
/* Input styles overrides */
9293
:host(:not([readonly])),
9394
:host([readonly][disabled]),
95+
:host([focused]:not([opened])),
9496
:host([value-state="None"]:not([readonly]):hover),
97+
:host([value-state="Negative"][focused]:not([opened]):not([readonly])),
9598
:host([value-state="Negative"]:not([readonly]):not([disabled])),
9699
:host([value-state="Negative"]:not([readonly])[focused][opened]:hover),
97100
:host([value-state="Negative"]:not([readonly]):not([focused]):hover),
101+
:host([value-state="Critical"][focused]:not([opened]):not([readonly])),
98102
:host([value-state="Critical"]:not([readonly]):not([disabled])),
99103
:host([value-state="Critical"]:not([readonly])[focused][opened]:hover),
100104
:host([value-state="Critical"]:not([readonly]):not([focused]):hover),
105+
:host([value-state="Positive"][focused]:not([opened]):not([readonly])),
101106
:host([value-state="Positive"]:not([readonly]):not([disabled])),
102107
:host([value-state="Positive"]:not([readonly])[focused][opened]:hover),
103108
:host([value-state="Positive"]:not([readonly]):not([focused]):hover),
109+
:host([value-state="Information"][focused]:not([opened]):not([readonly])),
104110
:host([value-state="Information"]:not([readonly]):not([disabled])),
105111
:host([value-state="Information"]:not([readonly])[focused][opened]:hover),
106112
:host([value-state="Information"]:not([readonly]):not([focused]):hover),
107113
:host(:not([value-state]):not([readonly]):hover) {
108114
box-shadow: none;
109115
background: none;
116+
border: none;
110117
}
111118

112119
:host(:not([readonly])) .ui5-file-uploader-display-elements,
@@ -115,6 +122,7 @@
115122
border: var(--_ui5-input-border);
116123
border-radius: var(--_ui5_input_border_radius);
117124
background: var(--sapField_BackgroundStyle);
125+
background-color: var(--_ui5_input_background_color);
118126
}
119127

120128
/* Value state styles */
@@ -132,6 +140,7 @@
132140
:host(:not([value-state]):not([readonly]):hover) .ui5-file-uploader-display-elements {
133141
box-shadow: var(--sapField_Hover_Shadow);
134142
background: var(--sapField_Hover_BackgroundStyle);
143+
background-color: var(--sapField_Hover_Background);
135144
}
136145

137146
:host([value-state="Negative"]:not([readonly]):not([focused]):hover) .ui5-file-uploader-display-elements,
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
:root {
2-
--_ui5_file_uploader_hover_border: 1px solid var(--sapField_Hover_BorderColor);
3-
--_ui5_file_uploader_value_state_error_hover_background_color: var(--sapField_Hover_Background);
42
--_ui5_file_uploader_display_input_width: calc(100% - var(--_ui5_input_icon_width));
53
--_ui5_file_uploader_tokenizer_width: calc(100% - 2 * var(--_ui5_input_icon_width) - var(--_ui5_input_inner_space_to_tokenizer));
64
}
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
11
@import "../base/FileUploader-parameters.css";
2-
3-
:root {
4-
--_ui5_file_uploader_hover_border: none;
5-
}
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
11
@import "../base/FileUploader-parameters.css";
2-
3-
:root {
4-
--_ui5_file_uploader_hover_border: none;
5-
}
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
@import "../base/FileUploader-parameters.css";
2-
3-
:root {
4-
--_ui5_file_uploader_hover_border: 2px solid var(--sapField_Hover_BorderColor);
5-
--_ui5_file_uploader_value_state_error_hover_background_color: var(--sapField_InvalidBackground);
6-
}
1+
@import "../base/FileUploader-parameters.css";
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
@import "../base/FileUploader-parameters.css";
2-
3-
:root {
4-
--_ui5_file_uploader_hover_border: 2px solid var(--sapField_Hover_BorderColor);
5-
--_ui5_file_uploader_value_state_error_hover_background_color: var(--sapField_InvalidBackground);
6-
}
1+
@import "../base/FileUploader-parameters.css";

packages/main/test/pages/FileUploader.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// delete Document.prototype.adoptedStyleSheets
1414
</script>
1515
</head>
16-
<body>
16+
<body class="fileuploader1auto">
1717

1818
<div>
1919
<div>

packages/main/test/pages/styles/FileUploader.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ body > div {
33
}
44

55
.fileuploader1auto {
6-
border: 1px solid black;
7-
padding: 1rem;
6+
background-color: var(--sapBackgroundColor);
87
}

0 commit comments

Comments
 (0)