Skip to content

Commit e3365b2

Browse files
authored
feat(design)!: update DaffStatus danger value to critical and add an info value (#3293)
BREAKING CHANGE: the `danger` value in `DaffStatus` has been changed to `critical`.
1 parent 3a7443a commit e3365b2

20 files changed

+55
-42
lines changed

apps/design-land/src/app/button/button.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ <h3>Theming</h3>
4747
<h3>Status Indicators</h3>
4848
<p>Buttons with status indicators can be used to distinguish what type of action it performs and its importance compared to other buttons in the same context.</p>
4949

50-
<p>Supported statuses: <code>warn | danger | success</code></p>
50+
<p>Supported statuses: <code>warn | critical | success</code></p>
5151

5252
<design-land-example-viewer-container example="statusable-button"></design-land-example-viewer-container>
5353

apps/design-land/src/app/foundations/variables/variables.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ <h2>CSS Custom Properties</h2>
5858
<td>#00852E</td>
5959
</tr>
6060
<tr>
61-
<td>--daff-theme-danger</td>
61+
<td>--daff-theme-critical</td>
6262
<td>#EC0019</td>
6363
<td>#EC0019</td>
6464
</tr>

apps/design-land/src/app/notification/notification.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ <h2>Properties</h2>
2828
<h3>Statuses</h3>
2929
<p>The status color of a notification can be updated by using the <code>status</code> property.</p>
3030

31-
<p>Supported statuses: <code>warn | danger | success</code></p>
31+
<p>Supported statuses: <code>warn | critical | success</code></p>
3232

3333
<h4>Notification with statuses</h4>
3434
<design-land-example-viewer-container example="notification-status"></design-land-example-viewer-container>
@@ -46,4 +46,4 @@ <h3>Dismissing a notification</h3>
4646
<design-land-example-viewer-container example="dismissible-notification"></design-land-example-viewer-container>
4747

4848
<h2>Accessibility</h2>
49-
<p>Notifications with a <code>danger</code> or <code>warn</code> status have a <code>role="alert"</code> so that it can be announced by assistive technologies. All other notifications have a <code>role="status"</code>. See <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#4._live_region_roles" target="_blank">live region roles</a> for more information. Notifications have a <code>tabindex="0"</code> so users can discover them while tabbing through a page.</p>
49+
<p>Notifications with a <code>critical</code> or <code>warn</code> status have a <code>role="alert"</code> so that it can be announced by assistive technologies. All other notifications have a <code>role="status"</code>. See <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#4._live_region_roles" target="_blank">live region roles</a> for more information. Notifications have a <code>tabindex="0"</code> so users can discover them while tabbing through a page.</p>

apps/design-land/src/app/toast/toast.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ <h3>Stacking</h3>
113113
<h3>Statuses</h3>
114114
<p>The status color of a toast can be updated by using the <code>status</code> property.</p>
115115

116-
<p>Supported statuses: <code>warn | danger | success</code></p>
116+
<p>Supported statuses: <code>warn | critical | success</code></p>
117117

118118
<h4>Toast with statuses</h4>
119119
<design-land-article-encapsulated>

libs/design/button/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Supported colors: `primary | secondary | tertiary | black | white | theme | them
8989
## Status Indicators
9090
Buttons with status indicators can be used to distinguish what type of action it performs and its importance compared to other buttons in the same context.
9191

92-
Supported statuses: `warn | danger | success`
92+
Supported statuses: `warn | critical | success`
9393

9494
<design-land-example-viewer-container example="statusable-button"></design-land-example-viewer-container>
9595

Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
<h4>Basic Status Buttons</h4>
22
<div class="statusable-button__group">
33
<button daff-button status="warn">Warn</button>
4-
<button daff-button status="danger">Danger</button>
4+
<button daff-button status="critical">Critical</button>
55
<button daff-button status="success">Success</button>
66
</div>
77

88
<h4>Stroked Status Buttons</h4>
99
<div class="statusable-button__group">
1010
<button daff-stroked-button status="warn">Warn</button>
11-
<button daff-stroked-button status="danger">Danger</button>
11+
<button daff-stroked-button status="critical">Critical</button>
1212
<button daff-stroked-button status="success">Success</button>
1313
</div>
1414

1515
<h4>Raised Status Buttons</h4>
1616
<div class="statusable-button__group">
1717
<button daff-raised-button status="warn">Warn</button>
18-
<button daff-raised-button status="danger">Danger</button>
18+
<button daff-raised-button status="critical">Critical</button>
1919
<button daff-raised-button status="success">Success</button>
2020
</div>
2121

2222
<h4>Underline Status Buttons</h4>
2323
<div class="statusable-button__group">
2424
<button daff-underline-button status="warn">Warn</button>
25-
<button daff-underline-button status="danger">Danger</button>
25+
<button daff-underline-button status="critical">Critical</button>
2626
<button daff-underline-button status="success">Success</button>
2727
</div>
2828

2929
<h4>Icon Status Buttons</h4>
3030
<div class="statusable-button__group">
3131
<button daff-icon-button status="warn"><fa-icon [icon]="faExclamation"></fa-icon></button>
32-
<button daff-icon-button status="danger"><fa-icon [icon]="faExclamationTriangle"></fa-icon></button>
32+
<button daff-icon-button status="critical"><fa-icon [icon]="faExclamationTriangle"></fa-icon></button>
3333
<button daff-icon-button status="success"><fa-icon [icon]="faCheckCircle"></fa-icon></button>
3434
</div>

libs/design/button/src/button-theme.scss

+6-6
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
);
112112
}
113113

114-
&.daff-danger {
114+
&.daff-critical {
115115
@include button.daff-button-theme-variant(
116116
theming.daff-color(theming.$daff-red, 60),
117117
theming.daff-color(theming.$daff-red, 70),
@@ -177,7 +177,7 @@
177177
);
178178
}
179179

180-
&.daff-danger {
180+
&.daff-critical {
181181
@include raised.daff-raised-button-theme-variant(
182182
theming.daff-color(theming.$daff-red, 60)
183183
);
@@ -274,7 +274,7 @@
274274
);
275275
}
276276

277-
&.daff-danger {
277+
&.daff-critical {
278278
@include icon.daff-icon-button-theme-variant(
279279
theming.daff-color(theming.$daff-red, 60),
280280
theming.daff-color(theming.$daff-red, 70),
@@ -390,7 +390,7 @@
390390
);
391391
}
392392

393-
&.daff-danger {
393+
&.daff-critical {
394394
@include stroked.daff-stroked-button-theme-variant(
395395
theming.daff-color(theming.$daff-red, 60),
396396
theming.daff-color(theming.$daff-red, 70)
@@ -492,7 +492,7 @@
492492
);
493493
}
494494

495-
&.daff-danger {
495+
&.daff-critical {
496496
@include flat.daff-flat-button-theme-variant(
497497
theming.daff-color(theming.$daff-red, 60),
498498
theming.daff-color(theming.$daff-red, 70)
@@ -559,7 +559,7 @@
559559
);
560560
}
561561

562-
&.daff-danger {
562+
&.daff-critical {
563563
@include underline.daff-underline-button-theme-variant(
564564
theming.daff-color(theming.$daff-red, 60)
565565
);

libs/design/notification/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Buttons can be included in notifications to resolve the notification or navigate
6969
### Statuses
7070
The status color of a notification can be updated by using the `status` property.
7171

72-
Supported statuses: `warn | danger | success`
72+
Supported statuses: `warn | critical | success`
7373

7474
#### Notification with statuses
7575
<design-land-example-viewer-container example="notification-status"></design-land-example-viewer-container>
@@ -87,4 +87,4 @@ The close button is hidden by default but can be visible by setting the `dismiss
8787
<design-land-example-viewer-container example="dismissible-notification"></design-land-example-viewer-container>
8888

8989
## Accessibility
90-
Notifications with a `danger` or `warn` status have a `role="alert"` so that it can be announced by assistive technologies. See (live region roles)[https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#4._live_region_roles] for more information. All other notifications have a `role="status"`. Notifications have a `tabindex="0"` so users can discover them while tabbing through a page.
90+
Notifications with a `critical` or `warn` status have a `role="alert"` so that it can be announced by assistive technologies. See (live region roles)[https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#4._live_region_roles] for more information. All other notifications have a `role="status"`. Notifications have a `tabindex="0"` so users can discover them while tabbing through a page.
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<daff-notification [status]="statusControl.value">
22
<fa-icon *ngIf="statusControl.value === 'success'" daffPrefix [icon]="faCheck" [fixedWidth]="true"></fa-icon>
33
<fa-icon *ngIf="statusControl.value === 'warn'" daffPrefix [icon]="faExclamation" [fixedWidth]="true"></fa-icon>
4-
<fa-icon *ngIf="statusControl.value === 'danger'" daffPrefix [icon]="faExclamation" [fixedWidth]="true"></fa-icon>
4+
<fa-icon *ngIf="statusControl.value === 'critical'" daffPrefix [icon]="faExclamation" [fixedWidth]="true"></fa-icon>
55
<div daffNotificationTitle>Title</div>
66
<div daffNotificationSubtitle>This is the subtitle with information</div>
77
</daff-notification>
88

99
<select [formControl]="statusControl">
1010
<option value="success">Success</option>
1111
<option value="warn">Warn</option>
12-
<option value="danger">Danger</option>
12+
<option value="critical">Critical</option>
1313
</select>

libs/design/notification/src/notification-theme.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
}
3838
}
3939

40-
&.daff-danger {
40+
&.daff-critical {
4141
background: theming.daff-color(theming.$daff-red, 10);
4242
border: 1px solid theming.daff-color(theming.$daff-red, 20);
4343
color: theming.daff-text-contrast(theming.daff-color(theming.$daff-red, 10));

libs/design/notification/src/notification/notification.component.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ describe('@daffodil/design/notification | DaffNotificationComponent', () => {
124124
expect(component.role).toBe('alert');
125125
});
126126

127-
it('should set role to alert if status is danger', () => {
128-
wrapper.status = 'danger';
127+
it('should set role to alert if status is critical', () => {
128+
wrapper.status = 'critical';
129129
fixture.detectChanges();
130130

131131
expect(component.role).toBe('alert');

libs/design/notification/src/notification/notification.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ export class DaffNotificationComponent implements DaffPrefixable {
6868
@HostBinding('attr.tabindex') tabindex = '0';
6969

7070
/**
71-
* Sets role to alert when `status="warn"` or `status="danger"`.
71+
* Sets role to alert when `status="warn"` or `status="critical"`.
7272
* Sets role to status on all other instances.
7373
*/
7474
@HostBinding('attr.role') get role() {
75-
return this.statusDirective.status === DaffStatusEnum.Warn || this.statusDirective.status === DaffStatusEnum.Danger ? 'alert' : 'status';
75+
return this.statusDirective.status === DaffStatusEnum.Warn || this.statusDirective.status === DaffStatusEnum.Critical ? 'alert' : 'status';
7676
};
7777

7878
@HostBinding('class.vertical') get verticalOrientation() {

libs/design/scss/theming/_theme-css-variables.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
--daff-theme-tertiary: #{theming.daff-color($tertiary)};
2626
--daff-theme-warn: #{theming.daff-color(theming.$daff-bronze, 60)};
2727
--daff-theme-success: #{theming.daff-color(theming.$daff-green, 60)};
28-
--daff-theme-danger: #{theming.daff-color(theming.$daff-red, 60)};
28+
--daff-theme-critical: #{theming.daff-color(theming.$daff-red, 60)};
2929
--daff-theme-white: #{$white};
3030
--daff-theme-black: #{$black};
3131
--daff-theme-gray: #{theming.daff-color($neutral)};

libs/design/src/core/statusable/statusable.directive.spec.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ describe('@daffodil/design | DaffStatusableDirective', () => {
5757
expect(directive.status).toEqual(wrapper.status);
5858
});
5959

60+
it('should add a class of .daff-info to the host element if status is set to info', () => {
61+
wrapper.status = 'info';
62+
fixture.detectChanges();
63+
64+
expect(directive.class).toEqual(jasmine.objectContaining({
65+
'daff-info': true,
66+
}));
67+
});
68+
6069
it('should add a class of .daff-warn to the host element if status is set to warn', () => {
6170
wrapper.status = 'warn';
6271
fixture.detectChanges();
@@ -66,12 +75,12 @@ describe('@daffodil/design | DaffStatusableDirective', () => {
6675
}));
6776
});
6877

69-
it('should add a class of .daff-danger to the host element if status is set to danger', () => {
70-
wrapper.status = 'danger';
78+
it('should add a class of .daff-critical to the host element if status is set to critical', () => {
79+
wrapper.status = 'critical';
7180
fixture.detectChanges();
7281

7382
expect(directive.class).toEqual(jasmine.objectContaining({
74-
'daff-danger': true,
83+
'daff-critical': true,
7584
}));
7685
});
7786

libs/design/src/core/statusable/statusable.directive.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
/**
1414
* `DaffStatusableDirective` allows a component to conditionally apply status-specific
1515
* styles by setting CSS classes based on the specified status. This directive is useful
16-
* for indicating different statuses such as warning, danger, or success states.
16+
* for indicating different statuses such as info, warning, critical, or success states.
1717
*
1818
* ## Usage
1919
*
@@ -42,7 +42,7 @@ import {
4242
* ```scss
4343
* .custom-component {
4444
*
45-
* &.daff-danger {
45+
* &.daff-critical {
4646
* background: daff-color($red, 10);
4747
* color: daff-color($red, 90);
4848
* }
@@ -52,8 +52,9 @@ import {
5252
*
5353
* The directive applies the following CSS classes based on the status:
5454
*
55+
* - `daff-info`: Applied when the status is `info`.
5556
* - `daff-warn`: Applied when the status is `warn`.
56-
* - `daff-danger`: Applied when the status is `danger`.
57+
* - `daff-critical`: Applied when the status is `critical`.
5758
* - `daff-success`: Applied when the status is `success`.
5859
*/
5960
@Directive({
@@ -68,8 +69,9 @@ export class DaffStatusableDirective implements DaffStatusable {
6869
*/
6970
@HostBinding('class') get class() {
7071
return {
72+
'daff-info': this.status === DaffStatusEnum.Info,
7173
'daff-warn': this.status === DaffStatusEnum.Warn,
72-
'daff-danger': this.status === DaffStatusEnum.Danger,
74+
'daff-critical': this.status === DaffStatusEnum.Critical,
7375
'daff-success': this.status === DaffStatusEnum.Success,
7476
};
7577
}

libs/design/src/core/statusable/statusable.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ export interface DaffStatusable {
1111

1212
/**
1313
* The `DaffStatus` type defines the possible status values that a component can have.
14+
* - 'info': Indicatea an informational status.
1415
* - 'warn': Indicates a warning status.
15-
* - 'danger': Indicates a danger or error status.
16+
* - 'critical': Indicates a critical or error status.
1617
* - 'success': Indicates a success status.
1718
*/
18-
export type DaffStatus = 'warn' | 'danger' | 'success';
19+
export type DaffStatus = 'info' | 'warn' | 'critical' | 'success';
1920

2021
/**
2122
* The `DaffStatusEnum` enumerates the possible status values for a component.
2223
*/
2324
export enum DaffStatusEnum {
25+
Info = 'info',
2426
Warn = 'warn',
25-
Danger = 'danger',
27+
Critical = 'critical',
2628
Success = 'success'
2729
}

libs/design/toast/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ A maximum of three toasts can be shown at a time. Toasts are stacked vertically,
153153
## Statuses
154154
The status color of a toast can be updated by using the `status` property.
155155
156-
Supported statuses: `warn | danger | success`
156+
Supported statuses: `warn | critical | success`
157157
158158
### Toast with statuses
159159
<design-land-example-viewer-container example="toast-status"></design-land-example-viewer-container>

libs/design/toast/examples/src/toast-status/toast-status.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
<select [formControl]="statusControl">
44
<option value="success">Success</option>
55
<option value="warn">Warn</option>
6-
<option value="danger">Danger</option>
6+
<option value="critical">Critical</option>
77
</select>

libs/design/toast/examples/src/toast-status/toast-status.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
} from '@daffodil/design/toast';
2020

2121
const status: Record<string, DaffToastData> = {
22-
danger: {
22+
critical: {
2323
title: 'Server error',
2424
message: 'There is a server error.',
2525
},
@@ -60,7 +60,7 @@ export class ToastStatusComponent {
6060
...status[this.statusControl.value],
6161
},
6262
{
63-
duration: this.statusControl.value === 'danger' ? undefined : 5000,
63+
duration: this.statusControl.value === 'critical' ? undefined : 5000,
6464
},
6565
);
6666
}

libs/design/toast/src/toast-theme.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
}
4848
}
4949

50-
&.daff-danger {
50+
&.daff-critical {
5151
background: theming.daff-color(theming.$daff-red, 10);
5252
color: $black;
5353

0 commit comments

Comments
 (0)