Skip to content

Commit eb079b6

Browse files
committed
refactor(widget): update to v5
1 parent 1291f90 commit eb079b6

File tree

7 files changed

+24
-25
lines changed

7 files changed

+24
-25
lines changed

projects/coreui-angular/src/lib/widget/widget-stat-a/widget-stat-a.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class WidgetStatAComponent implements AfterContentInit {
3838
return {
3939
'card': true,
4040
[`bg-${this.color}`]: !!this.color,
41-
'text-high-emphasis-inverse': !!this.color
41+
'text-white': !!this.color
4242
};
4343
}
4444

projects/coreui-angular/src/lib/widget/widget-stat-b/widget-stat-b.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}
88
<ng-content />
99
@if (text) {
10-
<small [ngClass]="inverse ? 'text-medium-emphasis-inverse' : 'text-medium-emphasis'">
10+
<small [ngClass]="inverse ? 'text-white text-opacity-75' : 'text-body-secondary'">
1111
{{ text }}
1212
</small>
1313
}

projects/coreui-angular/src/lib/widget/widget-stat-b/widget-stat-b.component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { booleanAttribute, Component, HostBinding, Input } from '@angular/core';
22
import { NgClass } from '@angular/common';
33

4-
import { Colors } from '../../coreui.types';
4+
import { Colors, TextColors } from '../../coreui.types';
55
import { CardBodyComponent, CardComponent } from '../../card';
66

77
@Component({
@@ -26,7 +26,7 @@ export class WidgetStatBComponent extends CardComponent {
2626
* Sets the text-color context of the component to one of CoreUI’s themed colors.
2727
* @type Colors
2828
*/
29-
@Input() override textColor?: Colors | 'white' | 'muted';
29+
@Input() override textColor?: TextColors;
3030
/**
3131
* Title of the widget to display
3232
* @type string
@@ -55,7 +55,7 @@ export class WidgetStatBComponent extends CardComponent {
5555
'card': true,
5656
[`bg-${this.color}`]: !!this.color,
5757
[`text-${this.textColor}`]: !!this.textColor,
58-
'text-high-emphasis-inverse': !!this.color
58+
'text-white': !!this.inverse
5959
};
6060
}
6161

projects/coreui-angular/src/lib/widget/widget-stat-c/widget-stat-c.component.ts

+15-17
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,23 @@ export class WidgetStatCComponent extends CardComponent implements AfterContentI
4545
* Invert colors from their default dark shade.
4646
* @type boolean
4747
*/
48-
@Input({ transform: booleanAttribute }) inverse: string | boolean = false;
48+
@Input({ transform: booleanAttribute }) inverse: boolean = false;
4949

5050
templates: any = {};
5151
@ContentChildren(TemplateIdDirective, { descendants: true }) contentTemplates!: QueryList<TemplateIdDirective>;
5252

5353
@HostBinding('class')
5454
get hostExtendedClass() {
5555
return {
56-
'high-emphasis-inverse': this.inverse
57-
};
58-
}
59-
60-
get iconClasses() {
61-
return {
62-
'mb-4': !this.textColor,
63-
'text-end': true,
64-
'text-medium-emphasis': !this.inverse,
65-
'text-medium-emphasis-inverse': this.inverse,
66-
[`text-${this.textColor}`]: !!this.textColor
56+
'text-white': this.inverse
6757
};
6858
}
6959

7060
get titleClasses() {
7161
return {
72-
'text-medium-emphasis': !this.inverse,
73-
'text-medium-emphasis-inverse': this.inverse,
62+
'text-body-secondary': !this.inverse,
63+
'text-white': this.inverse,
64+
'text-opacity-75': this.inverse,
7465
[`text-${this.textColor}`]: !!this.textColor
7566
};
7667
}
@@ -79,9 +70,16 @@ export class WidgetStatCComponent extends CardComponent implements AfterContentI
7970
return {
8071
'fs-4': !this.textColor,
8172
'fw-semibold': true,
82-
'text-high-emphasis': !this.inverse,
83-
'text-high-emphasis-inverse': this.inverse,
84-
[`text-${this.textColor}`]: !!this.textColor
73+
...this.titleClasses,
74+
'text-opacity-75': false
75+
};
76+
}
77+
78+
get iconClasses() {
79+
return {
80+
'mb-4': !this.textColor,
81+
'text-end': true,
82+
...this.titleClasses
8583
};
8684
}
8785

projects/coreui-angular/src/lib/widget/widget-stat-d/widget-stat-d.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
<c-col>
1010
<div class="fs-5 fw-semibold">{{ item.value }}</div>
11-
<div class="text-uppercase text-medium-emphasis small">{{ item.title }}</div>
11+
<div class="text-uppercase text-body-secondary small">{{ item.title }}</div>
1212
</c-col>
1313
}
1414
</c-card-body>

projects/coreui-angular/src/lib/widget/widget-stat-e/widget-stat-e.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class WidgetStatEComponent extends CardComponent {
2020
* @type string
2121
*/
2222
@Input() title?: string;
23+
2324
/**
2425
* Value for your widget to display
2526
* @type string | number
@@ -28,7 +29,7 @@ export class WidgetStatEComponent extends CardComponent {
2829

2930
get titleClasses() {
3031
return {
31-
'text-medium-emphasis': !this.textColor,
32+
'text-body-secondary': !this.textColor,
3233
'small': true,
3334
'text-uppercase': true,
3435
'fw-semibold': true,

projects/coreui-angular/src/lib/widget/widget-stat-f/widget-stat-f.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class WidgetStatFComponent implements AfterContentInit {
9494

9595
get titleClasses() {
9696
return {
97-
'text-medium-emphasis': !this.textColor,
97+
'text-body-secondary': !this.textColor,
9898
'small': true,
9999
'text-uppercase': true,
100100
'fw-semibold': true,

0 commit comments

Comments
 (0)