@dtdot/lego 0.19.6 → 0.19.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,7 +7,7 @@ import styled, { css } from 'styled-components';
|
|
|
7
7
|
import getThemeControlColours from '../../theme/helpers/getThemeControlColours';
|
|
8
8
|
import useFormNode, { getValue } from '../Form/useFormNode.hook';
|
|
9
9
|
export const INPUT_HEIGHT = 48;
|
|
10
|
-
const InputContainer = styled
|
|
10
|
+
const InputContainer = styled.div `
|
|
11
11
|
position: relative;
|
|
12
12
|
margin: 2px 0;
|
|
13
13
|
|
|
@@ -117,13 +117,14 @@ const Input = React.forwardRef(function ForwardRefInput(props, ref) {
|
|
|
117
117
|
onBlur();
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
+
const animationVariant = error ? (isFocused ? 'errorFocus' : 'error') : undefined;
|
|
120
121
|
return (React.createElement("div", null,
|
|
121
122
|
label && React.createElement(InputLabel, { htmlFor: name }, label),
|
|
122
|
-
React.createElement(InputContainer, {
|
|
123
|
-
React.createElement(StyledInput, { ref: ref, variants: inputVariants, transition: { type: 'spring', duration: 0.3 }, type: type, name: name, placeholder: placeholder, value: getValue(value, contextValue), onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, autoFocus: autoFocus, "data-cy": 'input' }),
|
|
123
|
+
React.createElement(InputContainer, { "data-cy": dataCy },
|
|
124
|
+
React.createElement(StyledInput, { ref: ref, animate: animationVariant, variants: inputVariants, transition: { type: 'spring', duration: 0.3 }, type: type, name: name, placeholder: placeholder, value: getValue(value, contextValue), onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, autoFocus: autoFocus, "data-cy": 'input' }),
|
|
124
125
|
React.createElement(ErrorContainer, { animate: error ? 'show' : undefined, style: { opacity: 0 }, variants: errorVariants, transition: { type: 'spring', duration: 0.3 }, "data-cy": 'error-indicator' },
|
|
125
126
|
React.createElement(ErrorInner, null,
|
|
126
127
|
React.createElement(FontAwesomeIcon, { icon: faExclamationCircle }))),
|
|
127
|
-
error && (React.createElement(ErrorMessage, { style: { opacity: 0, y: 0 }, variants: messageVariants, transition: { type: 'spring', duration: 0.3 }, "data-cy": 'error-message' }, error)))));
|
|
128
|
+
error && (React.createElement(ErrorMessage, { style: { opacity: 0, y: 0 }, animate: animationVariant, variants: messageVariants, transition: { type: 'spring', duration: 0.3 }, "data-cy": 'error-message' }, error)))));
|
|
128
129
|
});
|
|
129
130
|
export default Input;
|