-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(design): rename <daff-progress-indicator> to <daff-progress-bar> (…
…#2510) - feat(demo): update usage to the progress bar component
- Loading branch information
Showing
38 changed files
with
801 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<daff-progress-indicator *ngIf="show" [percentage]="routingPercentage" (finished)="handleFullProgressIndicator()"></daff-progress-indicator> | ||
<daff-progress-bar *ngIf="show" [percentage]="routingPercentage" (finished)="handleFullProgressIndicator()"></daff-progress-bar> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
apps/design-land/src/app/progress-bar/progress-bar-routing.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { | ||
Routes, | ||
RouterModule, | ||
} from '@angular/router'; | ||
|
||
import { DesignLandProgressBarComponent } from './progress-bar.component'; | ||
|
||
export const progressBarRoutes: Routes = [ | ||
{ path: '', component: DesignLandProgressBarComponent }, | ||
]; | ||
|
||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild(progressBarRoutes), | ||
], | ||
exports: [ | ||
RouterModule, | ||
], | ||
}) | ||
export class DesignLandProgressBarRoutingModule {} |
26 changes: 26 additions & 0 deletions
26
apps/design-land/src/app/progress-bar/progress-bar.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<daff-article> | ||
<h1 daffArticleTitle>Progress Bar</h1> | ||
<div daffArticleLead>A progress bar provides visual feedback about the duration or progress of a task or operation.</div> | ||
|
||
<h2>Types</h2> | ||
<p>There are two types of progress bars: <code>determinate</code> and <code>indeterminate</code>. They are <code>determinate</code> by default.</p> | ||
|
||
<h3>Determinate</h3> | ||
<p>Determinate progress bars should be used when the loading percentage of a task or operation is known.</p> | ||
<design-land-example-viewer-container example="progress-bar-default"></design-land-example-viewer-container> | ||
|
||
<h3>Indeterminate</h3> | ||
<p>Indeterminate progress bars should be used when the loading percentage of a task or operation is unknown or cannot be calculated.</p> | ||
<design-land-example-viewer-container example="progress-bar-indeterminate"></design-land-example-viewer-container> | ||
|
||
<h2>Theming</h2> | ||
<p> The progress bar color is defined by using the <code>color</code> property. By default, the color is set to <code>primary</code>. This can be changed to one of the supported colors.</p> | ||
<p>Supported colors: <code>primary | secondary | tertiary | theme | theme-contrast | white | black</code></p> | ||
|
||
<blockquote><code>theme</code>, <code>theme-contrast</code>, <code>white</code>, and <code>black</code> should be used with caution to ensure that there is sufficient contrast.</blockquote> | ||
|
||
<design-land-example-viewer-container example="progress-bar-themes"></design-land-example-viewer-container> | ||
|
||
<h2>Accessibility</h2> | ||
The progress bar component works with the ARIA <code>role="progressbar"</code> to provide an accessible experience. A label should always be provided by using <code>label[daffFormLabel]</code>, <code>aria-label</code>, or <code>aria-labelledby</code>. | ||
</daff-article> |
29 changes: 29 additions & 0 deletions
29
apps/design-land/src/app/progress-bar/progress-bar.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { | ||
waitForAsync, | ||
ComponentFixture, | ||
TestBed, | ||
} from '@angular/core/testing'; | ||
|
||
import { DesignLandProgressBarComponent } from './progress-bar.component'; | ||
|
||
describe('DesignLandProgressBarComponent', () => { | ||
let component: DesignLandProgressBarComponent; | ||
let fixture: ComponentFixture<DesignLandProgressBarComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ DesignLandProgressBarComponent ], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DesignLandProgressBarComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
7 changes: 7 additions & 0 deletions
7
apps/design-land/src/app/progress-bar/progress-bar.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'design-land-progress-bar', | ||
templateUrl: './progress-bar.component.html', | ||
}) | ||
export class DesignLandProgressBarComponent { } |
24 changes: 24 additions & 0 deletions
24
apps/design-land/src/app/progress-bar/progress-bar.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { DaffArticleModule } from '@daffodil/design/article'; | ||
import { DaffProgressBarModule } from '@daffodil/design/progress-bar'; | ||
|
||
import { DesignLandProgressBarRoutingModule } from './progress-bar-routing.module'; | ||
import { DesignLandProgressBarComponent } from './progress-bar.component'; | ||
import { DesignLandExampleViewerModule } from '../core/code-preview/container/example-viewer.module'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
DesignLandProgressBarComponent, | ||
], | ||
imports: [ | ||
CommonModule, | ||
DesignLandProgressBarRoutingModule, | ||
DesignLandExampleViewerModule, | ||
|
||
DaffProgressBarModule, | ||
DaffArticleModule, | ||
], | ||
}) | ||
export class DesignLandProgressBarModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Progress Bar | ||
A progress bar provides visual feedback about the duration or progress of a task or operation. | ||
|
||
## Types | ||
There are two types of progress bars: `determinate` and `indeterminate`. They are `determinate` by default. | ||
|
||
### Determinate | ||
Determinate progress bars should be used when the percentage of a task or operation is known. | ||
|
||
<design-land-example-viewer-container example="progress-bar-default"></design-land-example-viewer-container> | ||
|
||
### Indeterminate | ||
Indeterminate progress bars should be used when the loading percentage of a task or operation is unknown or cannot be calculated. | ||
|
||
<design-land-example-viewer-container example="progress-bar-indeterminate"></design-land-example-viewer-container> | ||
|
||
## Theming | ||
The progress bar color is defined by using the `color` property. By default, the color is set to `primary`. This can be changed to one of the supported colors. | ||
|
||
Supported colors: `primary | secondary | tertiary | theme | theme-contrast | white | black` | ||
|
||
> `theme`, `theme-contrast`, `white`, and `black` should be used with caution to ensure that there is sufficient contrast. | ||
<design-land-example-viewer-container example="progress-bar-themes"></design-land-example-viewer-container> | ||
|
||
## Accessibility | ||
The progress bar component works with the ARIA `role="progressbar"` to provide an accessible experience. A Label should always be provided by using `label[daffFormLabel]`, `aria-label`, or `aria-labelledby`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "../../../../node_modules/ng-packagr/ng-entrypoint.schema.json", | ||
"lib": { | ||
"entryFile": "src/index.ts", | ||
"styleIncludePaths": ["../../scss"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './public_api'; |
3 changes: 3 additions & 0 deletions
3
...design/progress-bar/examples/src/progress-bar-default/progress-bar-default.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<daff-progress-bar percentage="25"> | ||
<label daffProgressBarLabel>Progress bar label</label> | ||
</daff-progress-bar> |
18 changes: 18 additions & 0 deletions
18
libs/design/progress-bar/examples/src/progress-bar-default/progress-bar-default.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
} from '@angular/core'; | ||
|
||
@Component({ | ||
// eslint-disable-next-line @angular-eslint/component-selector | ||
selector: 'progress-bar-default', | ||
templateUrl: './progress-bar-default.component.html', | ||
styles: [` | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
}`], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ProgressBarDefaultComponent {} |
18 changes: 18 additions & 0 deletions
18
libs/design/progress-bar/examples/src/progress-bar-default/progress-bar-default.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { DaffProgressBarModule } from '@daffodil/design/progress-bar'; | ||
|
||
import { ProgressBarDefaultComponent } from './progress-bar-default.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
ProgressBarDefaultComponent, | ||
], | ||
exports: [ | ||
ProgressBarDefaultComponent, | ||
], | ||
imports: [ | ||
DaffProgressBarModule, | ||
], | ||
}) | ||
export class ProgressBarDefaultComponentModule { } |
3 changes: 3 additions & 0 deletions
3
...ess-bar/examples/src/progress-bar-indeterminate/progress-bar-indeterminate.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<daff-progress-bar indeterminate> | ||
<label daffProgressBarLabel>Progress bar label</label> | ||
</daff-progress-bar> |
18 changes: 18 additions & 0 deletions
18
...gress-bar/examples/src/progress-bar-indeterminate/progress-bar-indeterminate.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
} from '@angular/core'; | ||
|
||
@Component({ | ||
// eslint-disable-next-line @angular-eslint/component-selector | ||
selector: 'progress-bar-indeterminate', | ||
templateUrl: './progress-bar-indeterminate.component.html', | ||
styles: [` | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
}`], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ProgressBarIndeterminateComponent {} |
18 changes: 18 additions & 0 deletions
18
...progress-bar/examples/src/progress-bar-indeterminate/progress-bar-indeterminate.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { DaffProgressBarModule } from '@daffodil/design/progress-bar'; | ||
|
||
import { ProgressBarIndeterminateComponent } from './progress-bar-indeterminate.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
ProgressBarIndeterminateComponent, | ||
], | ||
exports: [ | ||
ProgressBarIndeterminateComponent, | ||
], | ||
imports: [ | ||
DaffProgressBarModule, | ||
], | ||
}) | ||
export class ProgressBarIndeterminateComponentModule { } |
14 changes: 14 additions & 0 deletions
14
libs/design/progress-bar/examples/src/progress-bar-themes/progress-bar-themes.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<daff-progress-bar percentage="25" [color]="colorControl.value"> | ||
<label daffProgressBarLabel>Progress bar label</label> | ||
</daff-progress-bar> | ||
|
||
<select [formControl]="colorControl"> | ||
<option value="">Default</option> | ||
<option value="primary">Primary</option> | ||
<option value="secondary">Secondary</option> | ||
<option value="tertiary">Tertiary</option> | ||
<option value="theme">Theme</option> | ||
<option value="theme-contrast">Theme Contrast</option> | ||
<option value="white">White</option> | ||
<option value="black">Black</option> | ||
</select> |
26 changes: 26 additions & 0 deletions
26
libs/design/progress-bar/examples/src/progress-bar-themes/progress-bar-themes.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
} from '@angular/core'; | ||
import { FormControl } from '@angular/forms'; | ||
|
||
import { DaffPalette } from '@daffodil/design'; | ||
|
||
@Component({ | ||
// eslint-disable-next-line @angular-eslint/component-selector | ||
selector: 'progress-bar-themes', | ||
templateUrl: './progress-bar-themes.component.html', | ||
styles: [` | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
gap: 16px; | ||
}`], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ProgressBarThemesComponent { | ||
color: DaffPalette = 'primary'; | ||
|
||
colorControl: FormControl = new FormControl(''); | ||
} |
20 changes: 20 additions & 0 deletions
20
libs/design/progress-bar/examples/src/progress-bar-themes/progress-bar-themes.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { ReactiveFormsModule } from '@angular/forms'; | ||
|
||
import { DaffProgressBarModule } from '@daffodil/design/progress-bar'; | ||
|
||
import { ProgressBarThemesComponent } from './progress-bar-themes.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
ProgressBarThemesComponent, | ||
], | ||
exports: [ | ||
ProgressBarThemesComponent, | ||
], | ||
imports: [ | ||
DaffProgressBarModule, | ||
ReactiveFormsModule, | ||
], | ||
}) | ||
export class ProgressBarThemesComponentModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ComponentExample } from '@daffodil/design'; | ||
|
||
import { ProgressBarDefaultComponent } from './progress-bar-default/progress-bar-default.component'; | ||
import { ProgressBarDefaultComponentModule } from './progress-bar-default/progress-bar-default.module'; | ||
import { ProgressBarIndeterminateComponent } from './progress-bar-indeterminate/progress-bar-indeterminate.component'; | ||
import { ProgressBarIndeterminateComponentModule } from './progress-bar-indeterminate/progress-bar-indeterminate.module'; | ||
import { ProgressBarThemesComponent } from './progress-bar-themes/progress-bar-themes.component'; | ||
import { ProgressBarThemesComponentModule } from './progress-bar-themes/progress-bar-themes.module'; | ||
|
||
export const PROGRESS_BAR_EXAMPLES: ComponentExample[] = [ | ||
{ component: ProgressBarThemesComponent, module: ProgressBarThemesComponentModule }, | ||
{ component: ProgressBarIndeterminateComponent, module: ProgressBarIndeterminateComponentModule }, | ||
{ component: ProgressBarDefaultComponent, module: ProgressBarDefaultComponentModule }, | ||
]; |
Oops, something went wrong.