Skip to content

Commit fe84508

Browse files
Merge pull request #757 from dxc-technology/fix-727
[Major] Renamed tokens file input
2 parents 58d70e6 + b172e6b commit fe84508

File tree

6 files changed

+71
-32
lines changed

6 files changed

+71
-32
lines changed

projects/dxc-ngx-cdk-site/src/app/pages/theme-builder/themes/AdvancedTheme.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,21 +328,26 @@
328328
"fileInput": {
329329
"dropBorderColor": "#000000",
330330
"fileItemBorderColor": "#cccccc",
331-
"fileItemIconColor": "#000000",
331+
"deleteFileItemIconColor": "#000000",
332332
"fileNameFontColor": "#000000",
333333
"labelFontColor": "#000000",
334334
"helperTextFontColor": "#000000",
335+
"filePreviewBackgroundColor": "#f2f2f2",
336+
"filePreviewIconColor": "#000000",
337+
"errorFilePreviewBackgroundColor": "#ffccd3",
338+
"errorFilePreviewIconColor": "#d0011b",
335339
"dropLabelFontColor": "#000000",
336340
"disabledLabelFontColor": "#999999",
337341
"disabledHelperTextFontColor": "#999999",
338342
"disabledDropLabelFontColor": "#999999",
339343
"focusDropBorderColor": "#0095ff",
340344
"disabledDropBorderColor": "#999999",
341345
"dragoverDropBackgroundColor": "#f5fbff",
342-
"hoverFileItemIconBackgroundColor": "#f2f2f2",
343-
"activeFileItemIconBackgroundColor": "#cccccc",
346+
"hoverDeleteFileItemBackgroundColor": "#0000000d",
347+
"activeDeleteFileItemBackgroundColor": "#00000033",
348+
"focusDeleteFileItemBackgroundColor": "#0095ff",
344349
"errorFileItemBorderColor": "#d0011b",
345-
"errorFileItemBackgroundColor": "#ffccd3",
350+
"errorFileItemBackgroundColor": "#FFF5F6",
346351
"errorMessageFontColor": "#d0011b",
347352
"labelFontFamily": "Open Sans, sans-serif",
348353
"labelFontSize": "0.875rem",

projects/dxc-ngx-cdk-site/src/app/pages/theme-builder/themes/schemas/Advanced.schema.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,19 +345,24 @@
345345
"fileInput": {
346346
"dropBorderColor": "color",
347347
"fileItemBorderColor": "color",
348-
"fileItemIconColor": "color",
348+
"deleteFileItemIconColor": "color",
349349
"fileNameFontColor": "color",
350350
"labelFontColor": "color",
351351
"helperTextFontColor": "color",
352+
"filePreviewBackgroundColor": "color",
353+
"filePreviewIconColor": "color",
354+
"errorFilePreviewBackgroundColor": "color",
355+
"errorFilePreviewIconColor": "color",
352356
"dropLabelFontColor": "color",
353357
"disabledLabelFontColor": "color",
354358
"disabledHelperTextFontColor": "color",
355359
"disabledDropLabelFontColor": "color",
356360
"focusDropBorderColor": "color",
357361
"disabledDropBorderColor": "color",
358362
"dragoverDropBackgroundColor": "color",
359-
"hoverFileItemIconBackgroundColor": "color",
360-
"activeFileItemIconBackgroundColor": "color",
363+
"hoverDeleteFileItemBackgroundColor": "color",
364+
"activeDeleteFileItemBackgroundColor": "color",
365+
"focusDeleteFileItemBackgroundColor": "color",
361366
"errorFileItemBorderColor": "color",
362367
"errorFileItemBackgroundColor": "color",
363368
"errorMessageFontColor": "color",

projects/dxc-ngx-cdk/src/lib/dxc-file-input/dxc-file-input.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
[showPreview]="showPreview"
4545
[multiple]="!hasSingleFile"
4646
[mode]="mode"
47+
[tabIndexValue]="tabIndexValue"
4748
[updatable]="callbackFile?.observers?.length > 0"
4849
></dxc-file>
4950
</div>

projects/dxc-ngx-cdk/src/lib/dxc-file-input/dxc-file/dxc-file.component.html

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
<div class="previewContainer" [attr.aria-label]="getIconAriaLabel()" *ngIf="hasShowPreview">
1+
<div
2+
class="previewContainer"
3+
[attr.aria-label]="getIconAriaLabel()"
4+
*ngIf="hasShowPreview"
5+
>
26
<svg
37
xmlns="http://www.w3.org/2000/svg"
48
height="24px"
@@ -7,9 +11,8 @@
711
dxcFileFormat
812
[format]="file.data.type"
913
*ngIf="hasShowPreviewIcon"
10-
>
11-
</svg>
12-
<img [src]="file.image" *ngIf="hasShowPreviewImage"/>
14+
></svg>
15+
<img [src]="file.image" *ngIf="hasShowPreviewImage" />
1316
</div>
1417

1518
<div class="infoContainer">
@@ -29,7 +32,13 @@
2932
></path>
3033
</svg>
3134
</span>
32-
<span class="removeIcon" [attr.aria-label]="getRemoveAriaLabel()" (click)="onRemoveHandler($event)" data-testid="removeIcon">
35+
<span
36+
class="removeIcon"
37+
[tabindex]="tabIndexValue"
38+
[attr.aria-label]="getRemoveAriaLabel()"
39+
(click)="onRemoveHandler($event)"
40+
data-testid="removeIcon"
41+
>
3342
<svg
3443
xmlns="http://www.w3.org/2000/svg"
3544
height="18px"
@@ -46,10 +55,6 @@
4655
</div>
4756
</div>
4857
<div class="errorContainer">
49-
<span
50-
*ngIf="hasShowError"
51-
class="errorMessage"
52-
>{{ file.error }}</span
53-
>
58+
<span *ngIf="hasShowError" class="errorMessage">{{ file.error }}</span>
5459
</div>
5560
</div>

projects/dxc-ngx-cdk/src/lib/dxc-file-input/dxc-file/dxc-file.component.ts

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { coerceBooleanProperty } from "@angular/cdk/coercion";
1+
import {
2+
coerceBooleanProperty,
3+
coerceNumberProperty,
4+
} from "@angular/cdk/coercion";
25
import { C } from "@angular/cdk/keycodes";
36
import {
47
Component,
@@ -31,6 +34,14 @@ export class DxcFileComponent implements OnInit {
3134
this._showPreview = coerceBooleanProperty(value);
3235
}
3336
private _showPreview = false;
37+
@Input()
38+
get tabIndexValue(): number {
39+
return this._tabIndexValue;
40+
}
41+
set tabIndexValue(value: number) {
42+
this._tabIndexValue = coerceNumberProperty(value);
43+
}
44+
private _tabIndexValue = 0;
3445

3546
hasError: boolean = false;
3647
hasShowError: boolean = false;
@@ -70,9 +81,9 @@ export class DxcFileComponent implements OnInit {
7081
}
7182

7283
onRemoveHandler(event: any): void {
73-
if(this.updatable){
84+
if (this.updatable) {
7485
this.service.removeFile(this.file);
75-
}
86+
}
7687
}
7788

7889
private isShowPreview() {
@@ -114,11 +125,11 @@ export class DxcFileComponent implements OnInit {
114125
return "image";
115126
}
116127
return "file";
117-
};
128+
}
118129

119130
getRemoveAriaLabel() {
120131
return "Remove " + this.file.data.name;
121-
};
132+
}
122133

123134
getDynamicStyle(inputs) {
124135
return css`
@@ -149,7 +160,9 @@ export class DxcFileComponent implements OnInit {
149160
margin-top: ${inputs.multiple || inputs.mode !== "file" ? "4px" : ""};
150161
margin-left: ${!inputs.multiple && inputs.mode === "file" ? "4px" : ""};
151162
.previewContainer {
152-
background-color: ${this.hasError ? "#ffc9ce" : "#e6e6e6"};
163+
background-color: ${this.hasError
164+
? "var(--fileInput-errorFilePreviewBackgroundColor)"
165+
: "var(--fileInput-filePreviewBackgroundColor)"};
153166
display: flex;
154167
align-items: center;
155168
place-content: center;
@@ -159,7 +172,9 @@ export class DxcFileComponent implements OnInit {
159172
width: 48px;
160173
svg,
161174
img {
162-
fill: ${this.hasError ? "#d0011b" : "#808080"};
175+
fill: ${this.hasError
176+
? "var(--fileInput-errorFilePreviewIconColor)"
177+
: "var(--fileInput-filePreviewIconColor)"};
163178
height: 24px;
164179
width: 24px;
165180
}
@@ -207,6 +222,7 @@ export class DxcFileComponent implements OnInit {
207222
svg {
208223
height: 16px;
209224
width: 16px;
225+
fill: var(--fileInput-deleteFileItemIconColor);
210226
}
211227
&:hover,
212228
&:active {
@@ -215,14 +231,18 @@ export class DxcFileComponent implements OnInit {
215231
}
216232
&:hover {
217233
background-color: var(
218-
--fileInput-hoverFileItemIconBackgroundColor
234+
--fileInput-hoverDeleteFileItemBackgroundColor
219235
);
220236
}
221237
&:active {
222238
background-color: var(
223-
--fileInput-activeFileItemIconBackgroundColor
239+
--fileInput-activeDeleteFileItemBackgroundColor
224240
);
225241
}
242+
&:focus {
243+
outline: var(--fileInput-focusDeleteFileItemBackgroundColor)
244+
auto 1px;
245+
}
226246
}
227247
.errorIcon {
228248
margin-right: 4px;

projects/dxc-ngx-cdk/src/lib/theme/componentTokens.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,24 +498,27 @@ export const componentTokens = {
498498
//FILE INPUT
499499
"--fileInput-dropBorderColor": globalTokens.hal_black,
500500
"--fileInput-fileItemBorderColor": globalTokens.hal_grey_l_80,
501-
"--fileInput-fileItemIconColor": globalTokens.hal_black, //añadir
501+
"--fileInput-deleteFileItemIconColor": globalTokens.hal_black,
502502
"--fileInput-fileNameFontColor": globalTokens.hal_black,
503503
"--fileInput-labelFontColor": globalTokens.hal_black,
504504
"--fileInput-helperTextFontColor": globalTokens.hal_black,
505505
"--fileInput-dropLabelFontColor": globalTokens.hal_black,
506-
506+
"--fileInput-filePreviewBackgroundColor": globalTokens.hal_grey_l_95,
507+
"--fileInput-filePreviewIconColor": globalTokens.hal_black,
508+
"--fileInput-errorFilePreviewBackgroundColor": "#ffccd3",
509+
"--fileInput-errorFilePreviewIconColor": globalTokens.hal_red_s_41,
507510
"--fileInput-disabledLabelFontColor": globalTokens.hal_grey_l_60,
508511
"--fileInput-disabledHelperTextFontColor": globalTokens.hal_grey_l_60,
509512
"--fileInput-disabledDropLabelFontColor": globalTokens.hal_grey_l_60,
510513
"--fileInput-focusDropBorderColor": globalTokens.hal_blue_l_50,
511514
"--fileInput-disabledDropBorderColor": globalTokens.hal_grey_l_60,
512515
"--fileInput-dragoverDropBackgroundColor": "#f5fbff",
513-
"--fileInput-hoverFileItemIconBackgroundColor": globalTokens.hal_grey_l_95,
514-
"--fileInput-activeFileItemIconBackgroundColor": globalTokens.hal_grey_l_80,
516+
"--fileInput-hoverDeleteFileItemBackgroundColor": "#0000000d",
517+
"--fileInput-activeDeleteFileItemBackgroundColor": "#00000033",
518+
"--fileInput-focusDeleteFileItemBackgroundColor": globalTokens.hal_blue_l_50,
515519
"--fileInput-errorFileItemBorderColor": globalTokens.hal_red_s_41,
516-
"--fileInput-errorFileItemBackgroundColor": "#ffccd3",
520+
"--fileInput-errorFileItemBackgroundColor": "#FFF5F6",
517521
"--fileInput-errorMessageFontColor": globalTokens.hal_red_s_41,
518-
//falta token para error icon
519522
"--fileInput-labelFontFamily": globalTokens.type_sans,
520523
"--fileInput-labelFontSize": globalTokens.type_scale_02,
521524
"--fileInput-labelFontWeight": globalTokens.type_semibold,

0 commit comments

Comments
 (0)