@@ -28,14 +28,18 @@ export namespace InputProps {
2828 disabled ?: boolean ;
2929 iconId ?: FrIconClassName | RiIconClassName ;
3030 classes ?: Partial <
31- Record < "root" | "label" | "description" | "nativeInputOrTextArea" | "message" , string >
31+ Record <
32+ "root" | "label" | "description" | "nativeInputOrTextArea" | "message" | "wrap" ,
33+ string
34+ >
3235 > ;
3336 style ?: CSSProperties ;
3437 /** Default: "default" */
3538 state ?: "success" | "error" | "info" | "default" ;
3639 /** The message won't be displayed if state is "default" */
3740 stateRelatedMessage ?: ReactNode ;
3841 addon ?: ReactNode ;
42+ action ?: ReactNode ;
3943 } ;
4044
4145 export type RegularInput = Common & {
@@ -84,6 +88,7 @@ export const Input = memo(
8488 nativeTextAreaProps,
8589 nativeInputProps,
8690 addon,
91+ action,
8792 ...rest
8893 } = props ;
8994
@@ -154,7 +159,6 @@ export const Input = memo(
154159 case "default" :
155160 return undefined ;
156161 }
157- assert < Equals < typeof state , never > > ( ) ;
158162 } ) ( )
159163 ) ,
160164 classes . nativeInputOrTextArea
@@ -168,16 +172,22 @@ export const Input = memo(
168172
169173 const hasIcon = iconId !== undefined ;
170174 const hasAddon = addon !== undefined ;
171- return hasIcon || hasAddon ? (
175+ const hasAction = action !== undefined ;
176+ return hasIcon || hasAddon || hasAction ? (
172177 < div
173- className = { fr . cx (
174- "fr-input-wrap" ,
175- hasIcon && iconId ,
176- hasAddon && "fr-input-wrap--addon"
178+ className = { cx (
179+ fr . cx (
180+ "fr-input-wrap" ,
181+ hasIcon && iconId ,
182+ hasAddon && "fr-input-wrap--addon" ,
183+ hasAction && "fr-input-wrap--action"
184+ ) ,
185+ classes . wrap
177186 ) }
178187 >
179188 { nativeInputOrTextArea }
180189 { hasAddon && addon }
190+ { hasAction && action }
181191 </ div >
182192 ) : (
183193 nativeInputOrTextArea
@@ -198,7 +208,6 @@ export const Input = memo(
198208 case "info" :
199209 return "fr-info-text" ;
200210 }
201- assert < Equals < typeof state , never > > ( ) ;
202211 } ) ( )
203212 ) ,
204213 classes . message
0 commit comments