Skip to content

Commit 88e3367

Browse files
authored
Merge pull request #786 from dxc-technology/radio-types-interface
Added types file in radio component
2 parents e456edc + f23467c commit 88e3367

File tree

2 files changed

+32
-21
lines changed

2 files changed

+32
-21
lines changed

projects/dxc-ngx-cdk/src/lib/dxc-radio/dxc-radio.component.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,7 @@ import { BehaviorSubject } from "rxjs";
1313
import { CssUtils } from "../utils";
1414
import { coerceBooleanProperty } from "@angular/cdk/coercion";
1515
import { BackgroundProviderService } from "../background-provider/service/background-provider.service";
16-
17-
type Space =
18-
| "xxsmall"
19-
| "xsmall"
20-
| "small"
21-
| "medium"
22-
| "large"
23-
| "xlarge"
24-
| "xxlarge";
25-
26-
type Margin = {
27-
top?: Space;
28-
bottom?: Space;
29-
left?: Space;
30-
right?: Space;
31-
};
16+
import { RadioProperties, Space, Spacing } from "./dxc-radio.types";
3217

3318
@Component({
3419
selector: "dxc-radio",
@@ -102,11 +87,11 @@ export class DxcRadioComponent implements OnInit {
10287

10388
/**
10489
* Size of the margin to be applied to the component
105-
* ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
106-
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in
90+
* ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
91+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in
10792
* order to specify different margin sizes.
10893
*/
109-
@Input() margin: Space | Margin;
94+
@Input() margin: Space | Spacing;
11095

11196
/**
11297
* Size of the component.
@@ -120,7 +105,7 @@ export class DxcRadioComponent implements OnInit {
120105

121106
renderedChecked: boolean;
122107

123-
defaultInputs = new BehaviorSubject<any>({
108+
defaultInputs = new BehaviorSubject<RadioProperties>({
124109
checked: false,
125110
value: null,
126111
label: null,
@@ -130,7 +115,6 @@ export class DxcRadioComponent implements OnInit {
130115
required: false,
131116
margin: null,
132117
size: "fitContent",
133-
id: null,
134118
});
135119

136120
sizes = {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export interface RadioProperties {
2+
margin?: Space | Spacing;
3+
checked?: boolean;
4+
value?: string;
5+
label: string;
6+
labelPosition?: "before" | "after";
7+
name?: string;
8+
disabled?: boolean;
9+
required?: boolean;
10+
size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
11+
}
12+
13+
export type Space =
14+
| "xxsmall"
15+
| "xsmall"
16+
| "small"
17+
| "medium"
18+
| "large"
19+
| "xlarge"
20+
| "xxlarge";
21+
22+
export type Spacing = {
23+
top?: Space;
24+
bottom?: Space;
25+
left?: Space;
26+
right?: Space;
27+
};

0 commit comments

Comments
 (0)