@@ -9,7 +9,11 @@ import { getFilePreview, isFileIncluded } from "./utils";
99import HelperText from "../styles/forms/HelperText" ;
1010import Label from "../styles/forms/Label" ;
1111
12- const FileInputContainer = styled . div < { margin : FileInputPropsType [ "margin" ] } > `
12+ const FileInputContainer = styled . div < {
13+ margin : FileInputPropsType [ "margin" ] ;
14+ mode : FileInputPropsType [ "mode" ] ;
15+ size : FileInputPropsType [ "size" ] ;
16+ } > `
1317 display: flex;
1418 flex-direction: column;
1519 margin: ${ ( props ) => ( props . margin && typeof props . margin !== "object" ? spaces [ props . margin ] : "0px" ) } ;
@@ -21,7 +25,7 @@ const FileInputContainer = styled.div<{ margin: FileInputPropsType["margin"] }>`
2125 props . margin && typeof props . margin === "object" && props . margin . bottom ? spaces [ props . margin . bottom ] : "" } ;
2226 margin-left: ${ ( props ) =>
2327 props . margin && typeof props . margin === "object" && props . margin . left ? spaces [ props . margin . left ] : "" } ;
24- width: fit-content;
28+ width: ${ ( props ) => ( props . mode !== "file" && props . size === "fillParent" ? "100%" : " fit-content" ) } ;
2529` ;
2630
2731const FileContainer = styled . div < { singleFileMode : boolean } > `
@@ -41,6 +45,7 @@ const FileItemListContainer = styled.div`
4145 display: flex;
4246 flex-direction: column;
4347 row-gap: var(--spacing-gap-xs);
48+ width: 100%;
4449` ;
4550
4651const Container = styled . div `
@@ -54,6 +59,7 @@ const DragDropArea = styled.div<{
5459 mode : FileInputPropsType [ "mode" ] ;
5560 disabled : FileInputPropsType [ "disabled" ] ;
5661 isDragging : boolean ;
62+ size : FileInputPropsType [ "size" ] ;
5763} > `
5864 box-sizing: border-box;
5965 display: flex;
@@ -62,7 +68,7 @@ const DragDropArea = styled.div<{
6268 ? "flex-direction: row; column-gap: var(--spacing-gap-s);"
6369 : "justify-content: center; flex-direction: column; row-gap: var(--spacing-gap-s); height: 160px;" }
6470 align-items: center;
65- width: 320px;
71+ width: ${ ( props ) => ( props . size === "fillParent" ? "100%" : " 320px" ) } ;
6672 padding: ${ ( props ) => ( props . mode === "filedrop" ? `var(--spacing-padding-xxs)` : "var(--spacing-padding-m)" ) } ;
6773 overflow: hidden;
6874 border-radius: var(--border-radius-m);
@@ -116,6 +122,7 @@ const DxcFileInput = forwardRef<RefType, FileInputPropsType>(
116122 multiple = true ,
117123 disabled = false ,
118124 callbackFile,
125+ size = "medium" ,
119126 value,
120127 margin,
121128 tabIndex = 0 ,
@@ -230,7 +237,7 @@ const DxcFileInput = forwardRef<RefType, FileInputPropsType>(
230237 } , [ value ] ) ;
231238
232239 return (
233- < FileInputContainer margin = { margin } ref = { ref } >
240+ < FileInputContainer margin = { margin } ref = { ref } mode = { mode } size = { size } >
234241 { label && (
235242 < Label disabled = { disabled } hasMargin = { ! helperText } htmlFor = { fileInputId } >
236243 { label } { optional && < span > { translatedLabels . formFields . optionalLabel } </ span > }
@@ -275,6 +282,7 @@ const DxcFileInput = forwardRef<RefType, FileInputPropsType>(
275282 onDelete = { onDelete }
276283 tabIndex = { tabIndex }
277284 key = { `file-${ index } ` }
285+ size = { size }
278286 />
279287 ) ) }
280288 </ FileItemListContainer >
@@ -295,6 +303,7 @@ const DxcFileInput = forwardRef<RefType, FileInputPropsType>(
295303 < DragDropArea
296304 isDragging = { isDragging }
297305 disabled = { disabled }
306+ size = { size }
298307 mode = { mode }
299308 onDrop = { handleDrop }
300309 onDragEnter = { handleDragIn }
@@ -337,6 +346,7 @@ const DxcFileInput = forwardRef<RefType, FileInputPropsType>(
337346 onDelete = { onDelete }
338347 tabIndex = { tabIndex }
339348 key = { `file-${ index } ` }
349+ size = { size }
340350 />
341351 ) ) }
342352 </ FileItemListContainer >
0 commit comments