@@ -460,6 +460,21 @@ function getStaticBackground(color: string) {
460
460
} as const ;
461
461
}
462
462
463
+
464
+ function replaceAndMergeMultipleStyles ( originalArray : any [ ] , styleToReplace : string , replacingStyles : any [ ] ) : any [ ] {
465
+ let temp = [ ]
466
+ let foundIndex = originalArray . findIndex ( ( element ) => element . name === styleToReplace )
467
+
468
+ if ( foundIndex !== - 1 ) {
469
+ let elementsBeforeFoundIndex = originalArray . filter ( ( item , index ) => index < foundIndex )
470
+ let elementsAfterFoundIndex = originalArray . filter ( ( item , index ) => index > foundIndex )
471
+ temp = [ ...elementsBeforeFoundIndex , ...replacingStyles , ...elementsAfterFoundIndex ]
472
+ } else
473
+ temp = [ ...originalArray ]
474
+
475
+ return temp
476
+ }
477
+
463
478
export const ButtonStyle = [
464
479
...getBgBorderRadiusByBg ( "primary" ) ,
465
480
...STYLING_FIELDS_SEQUENCE
@@ -674,14 +689,6 @@ export const SliderStyle = [
674
689
export const InputLikeStyle = [
675
690
LABEL ,
676
691
getStaticBackground ( SURFACE_COLOR ) ,
677
- // TEXT,
678
- // TEXT_SIZE,
679
- // TEXT_WEIGHT,
680
- // FONT_FAMILY,
681
- // FONT_STYLE,
682
- // MARGIN,
683
- // PADDING,
684
- // BORDER_WIDTH,
685
692
...STYLING_FIELDS_SEQUENCE ,
686
693
...ACCENT_VALIDATE ,
687
694
] as const ;
@@ -1047,8 +1054,7 @@ export const LinkStyle = [
1047
1054
depType : DEP_TYPE . SELF ,
1048
1055
transformer : toSelf ,
1049
1056
} ,
1050
- ...LinkTextStyle ,
1051
- ...STYLING_FIELDS_SEQUENCE . filter ( ( style ) => style . name !== 'text' )
1057
+ ...replaceAndMergeMultipleStyles ( STYLING_FIELDS_SEQUENCE , 'text' , [ ...LinkTextStyle ] )
1052
1058
] as const ;
1053
1059
1054
1060
export const DividerStyle = [
@@ -1070,19 +1076,18 @@ export const DividerStyle = [
1070
1076
} )
1071
1077
] as const ;
1072
1078
1079
+ // Hidden border and borderWidth properties as AntD doesnt allow these properties for progress bar
1073
1080
export const ProgressStyle = [
1074
- {
1081
+ ... replaceAndMergeMultipleStyles ( STYLING_FIELDS_SEQUENCE , 'text' , [ {
1075
1082
name : "text" ,
1076
1083
label : trans ( "text" ) ,
1077
1084
depTheme : "canvas" ,
1078
1085
depType : DEP_TYPE . CONTRAST_TEXT ,
1079
1086
transformer : contrastText ,
1080
- } ,
1087
+ } ] ) . filter ( ( style ) => [ 'border' , 'borderWidth' ] . includes ( style . name ) === false ) ,
1081
1088
TRACK ,
1082
1089
FILL ,
1083
1090
SUCCESS ,
1084
- MARGIN ,
1085
- PADDING ,
1086
1091
] as const ;
1087
1092
1088
1093
export const NavigationStyle = [
0 commit comments