@@ -4,24 +4,59 @@ import { BehaviorSubject } from "rxjs";
44import { CssUtils } from "../utils" ;
55import { coerceBooleanProperty } from "@angular/cdk/coercion" ;
66
7+ type Space =
8+ | "xxsmall"
9+ | "xsmall"
10+ | "small"
11+ | "medium"
12+ | "large"
13+ | "xlarge"
14+ | "xxlarge" ;
15+
16+ type Margin = {
17+ top ?: Space ;
18+ bottom ?: Space ;
19+ left ?: Space ;
20+ right ?: Space ;
21+ } ;
22+
723@Component ( {
824 selector : "dxc-progressbar" ,
925 templateUrl : "./dxc-progressbar.component.html" ,
1026 providers : [ CssUtils ] ,
1127} )
1228export class DxcProgressbarComponent {
13- mode : string = "indeterminate" ;
29+
30+ /**
31+ * The value of the progress indicator. If it's received the component is determinate otherwise is indeterminate.
32+ */
1433 @Input ( ) value : number ;
34+
35+ /**
36+ * Text to be placed above the progress bar.
37+ */
1538 @Input ( ) label : string ;
39+
40+ /**
41+ * Helper text to be placed under the progress bar.
42+ */
1643 @Input ( ) helperText : string ;
44+
45+ /**
46+ * If true, the value is displayed above the progress bar.
47+ */
1748 @Input ( )
1849 get showValue ( ) : boolean {
1950 return this . _showValue ;
2051 }
2152 set showValue ( value : boolean ) {
2253 this . _showValue = coerceBooleanProperty ( value ) ;
2354 }
24- private _showValue ;
55+ private _showValue = false ;
56+
57+ /**
58+ * If true, the progress bar will be displayed as a modal.
59+ */
2560 @Input ( )
2661 get overlay ( ) : boolean {
2762 return this . _overlay ;
@@ -30,14 +65,19 @@ export class DxcProgressbarComponent {
3065 this . _overlay = coerceBooleanProperty ( value ) ;
3166 }
3267 private _overlay = false ;
33- @Input ( ) margin : any ;
68+
69+ /**
70+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
71+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
72+ */
73+ @Input ( ) margin : Space | Margin ;
3474
3575 @HostBinding ( "class" ) className ;
3676 @HostBinding ( "class.absolute" ) isAbsolute : boolean = false ;
3777
78+ mode : string = "indeterminate" ;
79+
3880 defaultInputs = new BehaviorSubject < any > ( {
39- showValue : false ,
40- mode : "large" ,
4181 overlay : false ,
4282 } ) ;
4383
@@ -82,6 +122,7 @@ export class DxcProgressbarComponent {
82122 this . mode = "determinate" ;
83123 }
84124 }
125+
85126 getDynamicStyle ( inputs ) {
86127 return css `
87128 ${ this . utils . getMargins ( inputs . margin ) }
@@ -145,7 +186,7 @@ export class DxcProgressbarComponent {
145186 fill : transparent;
146187 }
147188 }
148- .helperText {
189+ .helperText {
149190 font-family : var (--progressBar-helperTextFontFamily );
150191 font-size : var (--progressBar-helperTextFontSize );
151192 font-style : var (--progressBar-helperTextFontStyle );
0 commit comments