@@ -20,21 +20,13 @@ import { CssUtils } from "../utils";
2020import { OnDestroy } from "@angular/core" ;
2121import { DxcTextInputComponent } from "../dxc-text-input/dxc-text-input.component" ;
2222import { DxcNumberInputHelper } from "./dxc-number-input.helper" ;
23-
24- type Space =
25- | "xxsmall"
26- | "xsmall"
27- | "small"
28- | "medium"
29- | "large"
30- | "xlarge"
31- | "xxlarge" ;
32- type Margin = {
33- top ?: Space ;
34- bottom ?: Space ;
35- left ?: Space ;
36- right ?: Space ;
37- } ;
23+ import {
24+ Spacing ,
25+ Space ,
26+ OnChangeEvent ,
27+ OnBlurEvent ,
28+ NumberInputProperties ,
29+ } from "./dxc-number.types" ;
3830
3931@Component ( {
4032 selector : "dxc-number-input" ,
@@ -146,7 +138,7 @@ export class DxcNumberInputComponent implements OnInit, OnChanges, OnDestroy {
146138 * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
147139 * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
148140 */
149- @Input ( ) margin : Space | Margin ;
141+ @Input ( ) margin : Space | Spacing ;
150142 /**
151143 * Size of the component ('small' | 'medium' | 'large' | 'fillParent').
152144 */
@@ -158,7 +150,7 @@ export class DxcNumberInputComponent implements OnInit, OnChanges, OnDestroy {
158150
159151 private controlled : boolean ;
160152
161- defaultInputs = new BehaviorSubject < any > ( {
153+ defaultInputs = new BehaviorSubject < NumberInputProperties > ( {
162154 placeholder : "" ,
163155 error : "" ,
164156 optional : false ,
@@ -167,7 +159,7 @@ export class DxcNumberInputComponent implements OnInit, OnChanges, OnDestroy {
167159 value : undefined ,
168160 name : "" ,
169161 label : "" ,
170- margin : "" ,
162+ margin : null ,
171163 step : 1 ,
172164 min : null ,
173165 max : null ,
@@ -180,20 +172,14 @@ export class DxcNumberInputComponent implements OnInit, OnChanges, OnDestroy {
180172 * the error (if the value entered is not valid) will be passed to this
181173 * function. If there is no error, error will be null.
182174 */
183- @Output ( ) onChange = new EventEmitter < {
184- value : string ;
185- error : string | null ;
186- } > ( ) ;
175+ @Output ( ) onChange = new EventEmitter < OnChangeEvent > ( ) ;
187176 /**
188177 * This event will emit in case the number loses the focus.
189178 * An object including the input value and the error (if the value
190179 * entered is not valid) will be passed to this function. If there is no error,
191180 * error will be null.
192181 */
193- @Output ( ) onBlur = new EventEmitter < {
194- value : string ;
195- error : string | null ;
196- } > ( ) ;
182+ @Output ( ) onBlur = new EventEmitter < OnBlurEvent > ( ) ;
197183 @ViewChild ( "dxcInputRef" , { static : false } )
198184 dxcInputRef : DxcTextInputComponent ;
199185
0 commit comments