| Name |
@@ -6,7 +11,7 @@
Description |
- | shadowDepth: number (0 | 1 | 2) |
+ shadowDepth: 0 | 1 | 2 |
2 |
The size of the shadow to be displayed around the box. |
@@ -15,10 +20,10 @@
'inline-flex'
|
- Changes the display CSS property of the Box div. |
+ Changes the display CSS property of the box div. |
- | margin: any (string | object) |
+ margin: string | object |
|
Size of the margin to be applied to the component ('xxsmall' | 'xsmall' |
@@ -28,7 +33,7 @@
|
- | padding: any (string | object) |
+ padding: string | object |
|
Size of the padding to be applied to the component ('xxsmall' | 'xsmall' |
diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-box/README.md b/projects/dxc-ngx-cdk/src/lib/dxc-box/README.md
index d2c83f19d..1384c5728 100644
--- a/projects/dxc-ngx-cdk/src/lib/dxc-box/README.md
+++ b/projects/dxc-ngx-cdk/src/lib/dxc-box/README.md
@@ -37,7 +37,7 @@ The API properties are the following:
| Description |
- @Input shadowDepth: number (0 | 1 | 2) |
+ @Input shadowDepth: 0 | 1 | 2 |
2 |
The size of the shadow to be displayed around the box. |
@@ -46,10 +46,10 @@ The API properties are the following:
'inline-flex'
|
- Changes the display CSS property of the Box div. |
+ Changes the display CSS property of the box div. |
- @Input margin: any (string | object) |
+ @Input margin: string | object |
|
Size of the margin to be applied to the component ('xxsmall' | 'xsmall' |
@@ -59,7 +59,7 @@ The API properties are the following:
|
- @Input padding: any (string | object) |
+ @Input padding: string | object |
|
Size of the padding to be applied to the component ('xxsmall' | 'xsmall' |
diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-box/dxc-box.component.ts b/projects/dxc-ngx-cdk/src/lib/dxc-box/dxc-box.component.ts
index d4ec53386..aaaef42ff 100644
--- a/projects/dxc-ngx-cdk/src/lib/dxc-box/dxc-box.component.ts
+++ b/projects/dxc-ngx-cdk/src/lib/dxc-box/dxc-box.component.ts
@@ -8,7 +8,30 @@ import {
import { BehaviorSubject } from "rxjs";
import { css } from "emotion";
import { CssUtils } from "../utils";
-import { BackgroundProviderService } from '../background-provider/service/background-provider.service';
+import { BackgroundProviderService } from "../background-provider/service/background-provider.service";
+
+type Size = "small" | "medium" | "large" | "fillParent" | "fitContent";
+type Space =
+ | "xxsmall"
+ | "xsmall"
+ | "small"
+ | "medium"
+ | "large"
+ | "xlarge"
+ | "xxlarge";
+type Margin = {
+ top?: Space;
+ bottom?: Space;
+ left?: Space;
+ right?: Space;
+};
+type Padding = {
+ top?: Space;
+ bottom?: Space;
+ left?: Space;
+ right?: Space;
+};
+
@Component({
selector: "dxc-box",
templateUrl: "./dxc-box.component.html",
@@ -16,11 +39,28 @@ import { BackgroundProviderService } from '../background-provider/service/backgr
})
export class DxcBoxComponent implements OnInit {
@HostBinding("class") className;
- @Input() shadowDepth: number;
- @Input() display: string;
- @Input() margin: any;
- @Input() padding: any;
- @Input() size: string;
+ /**
+ * The size of the shadow to be displayed around the box.
+ */
+ @Input() shadowDepth: 0 | 1 | 2 = 2;
+ /**
+ * Changes the display CSS property of the box div.
+ */
+ @Input() display: string = "inline-flex";
+ /**
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
+ */
+ @Input() margin: Space | Margin;
+ /**
+ * Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
+ */
+ @Input() padding: Space | Padding;
+ /**
+ * Size of the component.
+ */
+ @Input() size: Size = "fitContent";
currentBackgroundColor;
sizes = {
@@ -59,7 +99,9 @@ export class DxcBoxComponent implements OnInit {
result[item] = changes[item].currentValue;
return result;
}, {});
- this.currentBackgroundColor = this.utils.readProperty('--box-backgroundColor');
+ this.currentBackgroundColor = this.utils.readProperty(
+ "--box-backgroundColor"
+ );
this.defaultInputs.next({ ...this.defaultInputs.getValue(), ...inputs });
this.className = `${this.getDynamicStyle(this.defaultInputs.getValue())}`;
}
|