@@ -8,19 +8,59 @@ import {
88import { BehaviorSubject } from "rxjs" ;
99import { css } from "emotion" ;
1010import { CssUtils } from "../utils" ;
11- import { BackgroundProviderService } from '../background-provider/service/background-provider.service' ;
11+ import { BackgroundProviderService } from "../background-provider/service/background-provider.service" ;
12+
13+ type Size = "small" | "medium" | "large" | "fillParent" | "fitContent" ;
14+ type Space =
15+ | "xxsmall"
16+ | "xsmall"
17+ | "small"
18+ | "medium"
19+ | "large"
20+ | "xlarge"
21+ | "xxlarge" ;
22+ type Margin = {
23+ top ?: Space ;
24+ bottom ?: Space ;
25+ left ?: Space ;
26+ right ?: Space ;
27+ } ;
28+ type Padding = {
29+ top ?: Space ;
30+ bottom ?: Space ;
31+ left ?: Space ;
32+ right ?: Space ;
33+ } ;
34+
1235@Component ( {
1336 selector : "dxc-box" ,
1437 templateUrl : "./dxc-box.component.html" ,
1538 providers : [ CssUtils , BackgroundProviderService ] ,
1639} )
1740export class DxcBoxComponent implements OnInit {
1841 @HostBinding ( "class" ) className ;
19- @Input ( ) shadowDepth : number ;
20- @Input ( ) display : string ;
21- @Input ( ) margin : any ;
22- @Input ( ) padding : any ;
23- @Input ( ) size : string ;
42+ /**
43+ * The size of the shadow to be displayed around the box.
44+ */
45+ @Input ( ) shadowDepth : 0 | 1 | 2 = 2 ;
46+ /**
47+ * Changes the display CSS property of the box div.
48+ */
49+ @Input ( ) display : string = "inline-flex" ;
50+ /**
51+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
52+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
53+ */
54+ @Input ( ) margin : Space | Margin ;
55+ /**
56+ * Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
57+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
58+ */
59+ @Input ( ) padding : Space | Padding ;
60+ /**
61+ * Size of the component.
62+ */
63+ @Input ( ) size : Size = "fitContent" ;
2464 currentBackgroundColor ;
2565
2666 sizes = {
@@ -59,7 +99,9 @@ export class DxcBoxComponent implements OnInit {
5999 result [ item ] = changes [ item ] . currentValue ;
60100 return result ;
61101 } , { } ) ;
62- this . currentBackgroundColor = this . utils . readProperty ( '--box-backgroundColor' ) ;
102+ this . currentBackgroundColor = this . utils . readProperty (
103+ "--box-backgroundColor"
104+ ) ;
63105 this . defaultInputs . next ( { ...this . defaultInputs . getValue ( ) , ...inputs } ) ;
64106 this . className = `${ this . getDynamicStyle ( this . defaultInputs . getValue ( ) ) } ` ;
65107 }
0 commit comments