Skip to content

Commit 2f044f6

Browse files
authored
Merge pull request #794 from dxc-technology/dropdown-types-interface
Added types file in dropdwon
2 parents 587be1e + ffa958a commit 2f044f6

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed

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

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,7 @@ import {
2020
coerceNumberProperty,
2121
} from "@angular/cdk/coercion";
2222
import { DropdownService } from "./services/dropdown.service";
23-
24-
type Space =
25-
| "xxsmall"
26-
| "xsmall"
27-
| "small"
28-
| "medium"
29-
| "large"
30-
| "xlarge"
31-
| "xxlarge";
32-
33-
type Margin = {
34-
top?: Space;
35-
bottom?: Space;
36-
left?: Space;
37-
right?: Space;
38-
};
23+
import { DropdownProperties, Space, Spacing } from "./dxc-dropdown.types";
3924

4025
@Component({
4126
selector: "dxc-dropdown",
@@ -79,11 +64,11 @@ export class DxcDropdownComponent implements OnChanges {
7964

8065
/**
8166
* Size of the margin to be applied to the component
82-
* ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
83-
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties
67+
* ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
68+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties
8469
* in order to specify different margin sizes.
8570
*/
86-
@Input() margin: Space | Margin;
71+
@Input() margin: Space | Spacing;
8772

8873
/**
8974
* Size of the component.
@@ -151,9 +136,8 @@ export class DxcDropdownComponent implements OnChanges {
151136
menuOptions: string;
152137
triggerStyles: string;
153138

154-
defaultInputs = new BehaviorSubject<any>({
139+
defaultInputs = new BehaviorSubject<DropdownProperties>({
155140
optionsIconPosition: "before",
156-
iconSrc: null,
157141
iconPosition: "before",
158142
label: null,
159143
name: null,
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export interface DropdownProperties {
2+
margin?: Space | Spacing;
3+
optionsIconPosition?: "before" | "after";
4+
iconPosition?: "before" | "after";
5+
label?: string;
6+
name?: string;
7+
caretHidden?: boolean;
8+
size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
9+
tabIndexValue?: number;
10+
expandOnHover?: boolean;
11+
disabled?: boolean;
12+
}
13+
14+
export type Space =
15+
| "xxsmall"
16+
| "xsmall"
17+
| "small"
18+
| "medium"
19+
| "large"
20+
| "xlarge"
21+
| "xxlarge";
22+
23+
export type Spacing = {
24+
top?: Space;
25+
bottom?: Space;
26+
left?: Space;
27+
right?: Space;
28+
};

0 commit comments

Comments
 (0)