Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,8 @@ import {
import { DxcAccordionIconComponent } from "./dxc-accordion-icon/dxc-accordion-icon.component";
import { QueryList, ChangeDetectorRef, ElementRef } from "@angular/core";
import { BackgroundProviderComponent } from "../background-provider/background-provider.component";
import { AccordionProperties, Space, Spacing } from "./dxc-accordion.types";

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-accordion",
Expand Down Expand Up @@ -84,12 +63,12 @@ export class DxcAccordionComponent implements OnInit, OnChanges, AfterViewInit {
* 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;
@Input() margin: Space | Spacing;
/**
* 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;
@Input() padding: Space | Spacing;
/**
* Represents the state of the panel. When true, the component will be
* expanded. If undefined, the component will be uncontrolled and its
Expand Down Expand Up @@ -126,7 +105,10 @@ export class DxcAccordionComponent implements OnInit, OnChanges, AfterViewInit {
@ContentChildren(DxcAccordionIconComponent)
dxcAccordionIcon: QueryList<DxcAccordionIconComponent>;

defaultInputs = new BehaviorSubject<any>({
defaultInputs = new BehaviorSubject<AccordionProperties>({
label: "",
assistiveText: "",
isExpanded: false,
margin: null,
padding: null,
disabled: false,
Expand Down
25 changes: 25 additions & 0 deletions projects/dxc-ngx-cdk/src/lib/dxc-accordion/dxc-accordion.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export type Space =
| "xxsmall"
| "xsmall"
| "small"
| "medium"
| "large"
| "xlarge"
| "xxlarge";

export type Spacing = {
top?: Space;
bottom?: Space;
left?: Space;
right?: Space;
};

export interface AccordionProperties {
label: string;
assistiveText?: string;
disabled: boolean;
isExpanded: boolean;
margin?: Space | Spacing;
padding?: Space | Spacing;
tabIndexValue?: number;
}