@dtdot/lego 1.6.0 → 1.7.0
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.
|
@@ -21,6 +21,16 @@ const InputLabel = styled.label `
|
|
|
21
21
|
font-family: ${(props) => props.theme.fonts.default.family};
|
|
22
22
|
font-size: ${(props) => props.theme.fonts.default.size};
|
|
23
23
|
`;
|
|
24
|
+
const InputDescription = styled.div `
|
|
25
|
+
color: ${(props) => props.theme.colours.controlDescriptionColour};
|
|
26
|
+
font-family: ${(props) => props.theme.fonts.emphasis.family};
|
|
27
|
+
font-size: ${(props) => props.theme.fonts.emphasis.size};
|
|
28
|
+
font-weight: ${(props) => props.theme.fonts.emphasis.weight};
|
|
29
|
+
|
|
30
|
+
padding-top: 4px;
|
|
31
|
+
padding-bottom: 6px;
|
|
32
|
+
font-style: italic;
|
|
33
|
+
`;
|
|
24
34
|
export const InputStyles = css `
|
|
25
35
|
outline: none;
|
|
26
36
|
box-shadow: none;
|
|
@@ -107,7 +117,7 @@ const messageVariants = {
|
|
|
107
117
|
errorFocus: { opacity: 1, y: -4 },
|
|
108
118
|
};
|
|
109
119
|
const Input = React.forwardRef(function ForwardRefInput(props, ref) {
|
|
110
|
-
const { label, name, placeholder, disabled, type = 'text', autoFocus, value, 'error': propsError, onChange, onFocus, onBlur, 'data-cy': dataCy, } = props;
|
|
120
|
+
const { label, name, description, placeholder, disabled, type = 'text', autoFocus, value, 'error': propsError, onChange, onFocus, onBlur, 'data-cy': dataCy, } = props;
|
|
111
121
|
const [isFocused, setIsFocused] = useState(false);
|
|
112
122
|
const { value: contextValue, error: contextError, onChange: contextOnChange } = useFormNode(name);
|
|
113
123
|
const error = contextError || propsError;
|
|
@@ -139,6 +149,7 @@ const Input = React.forwardRef(function ForwardRefInput(props, ref) {
|
|
|
139
149
|
React.createElement(ErrorContainer, { animate: error ? 'show' : undefined, style: { opacity: 0 }, variants: errorVariants, transition: { type: 'spring', duration: 0.3 }, "data-cy": 'error-indicator' },
|
|
140
150
|
React.createElement(ErrorInner, null,
|
|
141
151
|
React.createElement(FontAwesomeIcon, { icon: faExclamationCircle }))),
|
|
142
|
-
error && (React.createElement(ErrorMessage, { style: { opacity: 0, y: 0 }, animate: animationVariant, variants: messageVariants, transition: { type: 'spring', duration: 0.3 }, "data-cy": 'error-message' }, error)))
|
|
152
|
+
error && (React.createElement(ErrorMessage, { style: { opacity: 0, y: 0 }, animate: animationVariant, variants: messageVariants, transition: { type: 'spring', duration: 0.3 }, "data-cy": 'error-message' }, error))),
|
|
153
|
+
description && React.createElement(InputDescription, null, description)));
|
|
143
154
|
});
|
|
144
155
|
export default Input;
|
|
@@ -29,6 +29,7 @@ const darkTheme = {
|
|
|
29
29
|
controlBorderFocus: '#4289de',
|
|
30
30
|
controlBorderHover: '#4a4949',
|
|
31
31
|
controlPlaceholder: '#949494',
|
|
32
|
+
controlDescriptionColour: '#cbcbcb',
|
|
32
33
|
uploadBackground: '#5e6167',
|
|
33
34
|
uploadIcon: '#e2e2e2',
|
|
34
35
|
cardBackground: '#494b50',
|
|
@@ -55,6 +56,11 @@ const darkTheme = {
|
|
|
55
56
|
},
|
|
56
57
|
},
|
|
57
58
|
fonts: {
|
|
59
|
+
emphasis: {
|
|
60
|
+
family: `'Roboto', sans-serif`,
|
|
61
|
+
size: '14px',
|
|
62
|
+
weight: '400',
|
|
63
|
+
},
|
|
58
64
|
default: {
|
|
59
65
|
family: `'Roboto', sans-serif`,
|
|
60
66
|
size: '16px',
|
|
@@ -30,6 +30,7 @@ const defaultTheme = {
|
|
|
30
30
|
controlBorderFocus: colours.grey50,
|
|
31
31
|
controlBorderHover: colours.grey30,
|
|
32
32
|
controlPlaceholder: colours.grey30,
|
|
33
|
+
controlDescriptionColour: colours.grey90,
|
|
33
34
|
uploadBackground: colours.grey20,
|
|
34
35
|
uploadIcon: colours.grey10,
|
|
35
36
|
cardBackground: colours.white,
|
|
@@ -56,6 +57,11 @@ const defaultTheme = {
|
|
|
56
57
|
},
|
|
57
58
|
},
|
|
58
59
|
fonts: {
|
|
60
|
+
emphasis: {
|
|
61
|
+
family: `'Roboto', sans-serif`,
|
|
62
|
+
size: '14px',
|
|
63
|
+
weight: '400',
|
|
64
|
+
},
|
|
59
65
|
default: {
|
|
60
66
|
family: `'Roboto', sans-serif`,
|
|
61
67
|
size: '16px',
|
|
@@ -34,6 +34,7 @@ export interface LegoTheme {
|
|
|
34
34
|
controlBorderFocus: string;
|
|
35
35
|
controlBorderHover: string;
|
|
36
36
|
controlPlaceholder: string;
|
|
37
|
+
controlDescriptionColour: string;
|
|
37
38
|
uploadBackground: string;
|
|
38
39
|
uploadIcon: string;
|
|
39
40
|
cardBackground: string;
|
|
@@ -44,6 +45,7 @@ export interface LegoTheme {
|
|
|
44
45
|
statusDanger: IStatus;
|
|
45
46
|
};
|
|
46
47
|
fonts: {
|
|
48
|
+
emphasis: IFont;
|
|
47
49
|
default: IFont;
|
|
48
50
|
heading: IFont;
|
|
49
51
|
subHeading: IFont;
|