@@ -19,6 +19,12 @@ import { InputState } from '../types/inputTheme';
19
19
export const InformationAssociatedStandAlone = (
20
20
props : IInformationAssociated
21
21
) : JSX . Element | null => {
22
+ const isInformationAssociatedVisible =
23
+ ! ! props . informationAssociatedValue &&
24
+ ( props . state === InputState . FILLED ||
25
+ props . state === InputState . ERROR_FILLED_WITH_INFO ||
26
+ props . state === InputState . DISABLED_FILLED_WITH_INFO ) ;
27
+
22
28
const InfoAssociatedDecoration = (
23
29
props : IInformationAssociatedDecoration
24
30
) : JSX . Element | null => {
@@ -49,55 +55,54 @@ export const InformationAssociatedStandAlone = (
49
55
) ;
50
56
} ;
51
57
52
- if (
53
- ! props . informationAssociatedValue ||
54
- ( props . state !== InputState . FILLED &&
55
- props . state !== InputState . DISABLED_FILLED_WITH_INFO &&
56
- props . state !== InputState . ERROR_FILLED_WITH_INFO )
57
- ) {
58
- return null ;
59
- }
60
-
61
58
return (
62
- < InformationAssociatedWrapperStyled
63
- aria-live = { AriaLiveOptionType . POLITE }
64
- data-testid = { `${ props . dataTestId } InfoAssociated` }
65
- iconPosition = {
66
- props . informationAssociatedIcon ?. position ||
67
- props . highlightedInformationAssociatedIcon ?. position
68
- }
69
- styles = { props . styles }
70
- >
71
- < InfoAssociatedTextAndDecorativeStyled styles = { props . styles } >
72
- < InfoAssociatedDecoration
73
- highlightedInformationAssociatedIcon = { props . highlightedInformationAssociatedIcon }
74
- informationAssociatedIcon = { props . informationAssociatedIcon }
59
+ < >
60
+ { props . informationAssociatedValue && (
61
+ < InformationAssociatedWrapperStyled
62
+ aria-live = { AriaLiveOptionType . POLITE }
63
+ data-testid = { `${ props . dataTestId } InfoAssociated` }
64
+ iconPosition = {
65
+ props . informationAssociatedIcon ?. position ||
66
+ props . highlightedInformationAssociatedIcon ?. position
67
+ }
75
68
styles = { props . styles }
76
- />
77
- < Text
78
- component = { TextComponentType . SPAN }
79
- customTypography = { props . styles ?. informationAssociated }
80
- { ...props . informationAssociatedValue }
81
69
>
82
- { props . informationAssociatedValue . content }
83
- </ Text >
84
- </ InfoAssociatedTextAndDecorativeStyled >
85
- { props . informationAssociatedButton &&
86
- ( props . styles ?. informationAssociatedButton ?. size ||
87
- props . informationAssociatedButton ?. size ) &&
88
- ( props . styles ?. informationAssociatedButton ?. variant ||
89
- props . informationAssociatedButton ?. variant ) &&
90
- props . state === InputState . ERROR_FILLED_WITH_INFO && (
91
- < InfoAssociatedButtonStyled styles = { props . styles } >
92
- < Button
93
- size = { props . styles ?. informationAssociatedButton ?. size }
94
- variant = { props . styles ?. informationAssociatedButton ?. variant }
95
- { ...props . informationAssociatedButton }
96
- >
97
- { props . informationAssociatedButton . content }
98
- </ Button >
99
- </ InfoAssociatedButtonStyled >
100
- ) }
101
- </ InformationAssociatedWrapperStyled >
70
+ { isInformationAssociatedVisible && (
71
+ < >
72
+ < InfoAssociatedTextAndDecorativeStyled styles = { props . styles } >
73
+ < InfoAssociatedDecoration
74
+ highlightedInformationAssociatedIcon = { props . highlightedInformationAssociatedIcon }
75
+ informationAssociatedIcon = { props . informationAssociatedIcon }
76
+ styles = { props . styles }
77
+ />
78
+ < Text
79
+ component = { TextComponentType . SPAN }
80
+ customTypography = { props . styles ?. informationAssociated }
81
+ { ...props . informationAssociatedValue }
82
+ >
83
+ { props . informationAssociatedValue ?. content }
84
+ </ Text >
85
+ </ InfoAssociatedTextAndDecorativeStyled >
86
+ { props . informationAssociatedButton &&
87
+ ( props . styles ?. informationAssociatedButton ?. size ||
88
+ props . informationAssociatedButton ?. size ) &&
89
+ ( props . styles ?. informationAssociatedButton ?. variant ||
90
+ props . informationAssociatedButton ?. variant ) &&
91
+ props . state === InputState . ERROR_FILLED_WITH_INFO && (
92
+ < InfoAssociatedButtonStyled styles = { props . styles } >
93
+ < Button
94
+ size = { props . styles ?. informationAssociatedButton ?. size }
95
+ variant = { props . styles ?. informationAssociatedButton ?. variant }
96
+ { ...props . informationAssociatedButton }
97
+ >
98
+ { props . informationAssociatedButton . content }
99
+ </ Button >
100
+ </ InfoAssociatedButtonStyled >
101
+ ) }
102
+ </ >
103
+ ) }
104
+ </ InformationAssociatedWrapperStyled >
105
+ ) }
106
+ </ >
102
107
) ;
103
108
} ;
0 commit comments