Skip to content

Commit 973015b

Browse files
authored
Merge pull request #772 from dxc-technology/jialecl-accordionTypes
Adding type file to accordion
2 parents 5eca244 + ecb6eb1 commit 973015b

File tree

2 files changed

+32
-25
lines changed

2 files changed

+32
-25
lines changed

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

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,8 @@ import {
2121
import { DxcAccordionIconComponent } from "./dxc-accordion-icon/dxc-accordion-icon.component";
2222
import { QueryList, ChangeDetectorRef, ElementRef } from "@angular/core";
2323
import { BackgroundProviderComponent } from "../background-provider/background-provider.component";
24+
import { AccordionProperties, Space, Spacing } from "./dxc-accordion.types";
2425

25-
type Space =
26-
| "xxsmall"
27-
| "xsmall"
28-
| "small"
29-
| "medium"
30-
| "large"
31-
| "xlarge"
32-
| "xxlarge";
33-
34-
type Margin = {
35-
top?: Space;
36-
bottom?: Space;
37-
left?: Space;
38-
right?: Space;
39-
};
40-
41-
type Padding = {
42-
top?: Space;
43-
bottom?: Space;
44-
left?: Space;
45-
right?: Space;
46-
};
4726

4827
@Component({
4928
selector: "dxc-accordion",
@@ -84,12 +63,12 @@ export class DxcAccordionComponent implements OnInit, OnChanges, AfterViewInit {
8463
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
8564
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
8665
*/
87-
@Input() margin: Space | Margin;
66+
@Input() margin: Space | Spacing;
8867
/**
8968
* Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
9069
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
9170
*/
92-
@Input() padding: Space | Padding;
71+
@Input() padding: Space | Spacing;
9372
/**
9473
* Represents the state of the panel. When true, the component will be
9574
* expanded. If undefined, the component will be uncontrolled and its
@@ -126,7 +105,10 @@ export class DxcAccordionComponent implements OnInit, OnChanges, AfterViewInit {
126105
@ContentChildren(DxcAccordionIconComponent)
127106
dxcAccordionIcon: QueryList<DxcAccordionIconComponent>;
128107

129-
defaultInputs = new BehaviorSubject<any>({
108+
defaultInputs = new BehaviorSubject<AccordionProperties>({
109+
label: "",
110+
assistiveText: "",
111+
isExpanded: false,
130112
margin: null,
131113
padding: null,
132114
disabled: false,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export type Space =
2+
| "xxsmall"
3+
| "xsmall"
4+
| "small"
5+
| "medium"
6+
| "large"
7+
| "xlarge"
8+
| "xxlarge";
9+
10+
export type Spacing = {
11+
top?: Space;
12+
bottom?: Space;
13+
left?: Space;
14+
right?: Space;
15+
};
16+
17+
export interface AccordionProperties {
18+
label: string;
19+
assistiveText?: string;
20+
disabled: boolean;
21+
isExpanded: boolean;
22+
margin?: Space | Spacing;
23+
padding?: Space | Spacing;
24+
tabIndexValue?: number;
25+
}

0 commit comments

Comments
 (0)