@comicrelief/component-library 8.25.1 → 8.25.2
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.
|
@@ -28,23 +28,28 @@ const InputWrapper = _styledComponents.default.div.withConfig({
|
|
|
28
28
|
const InputFieldContainer = _styledComponents.default.div.withConfig({
|
|
29
29
|
displayName: "Input__InputFieldContainer",
|
|
30
30
|
componentId: "sc-bcqy1o-1"
|
|
31
|
-
})(["position:relative;width:100%;display:flex;justify-content:flex-end;align-items:center;", ""], _ref2 => {
|
|
31
|
+
})(["position:relative;width:100%;display:flex;", ";justify-content:flex-end;align-items:center;", ""], _ref2 => {
|
|
32
|
+
let {
|
|
33
|
+
error
|
|
34
|
+
} = _ref2;
|
|
35
|
+
return error && 'flex-direction: row;';
|
|
36
|
+
}, _ref3 => {
|
|
32
37
|
let {
|
|
33
38
|
maxPxWidthMediumBreakpoint,
|
|
34
39
|
maxPxWidthLargeBreakpoint,
|
|
35
40
|
theme
|
|
36
|
-
} =
|
|
41
|
+
} = _ref3;
|
|
37
42
|
return (0, _styledComponents.css)(["@media ", "{", "}@media ", "{", "}"], theme.allBreakpoints('M'), maxPxWidthMediumBreakpoint && "max-width: ".concat(maxPxWidthMediumBreakpoint, "px;"), theme.allBreakpoints('L'), maxPxWidthLargeBreakpoint && "max-width: ".concat(maxPxWidthLargeBreakpoint, "px;"));
|
|
38
43
|
});
|
|
39
44
|
const InputField = _styledComponents.default.input.withConfig({
|
|
40
45
|
displayName: "Input__InputField",
|
|
41
46
|
componentId: "sc-bcqy1o-2"
|
|
42
|
-
})(["", ""],
|
|
47
|
+
})(["", ""], _ref4 => {
|
|
43
48
|
let {
|
|
44
49
|
theme,
|
|
45
50
|
error,
|
|
46
51
|
prefixLength
|
|
47
|
-
} =
|
|
52
|
+
} = _ref4;
|
|
48
53
|
return (0, _styledComponents.css)(["position:relative;box-sizing:border-box;width:100%;height:48px;padding:1rem 2.4rem 1rem 1.5rem;", " background-color:", ";border:1px solid;border-color:", ";box-shadow:none;appearance:none;color:", ";border-radius:0.5rem;font-size:inherit;z-index:2;font-family:", ";:focus{border:1px solid ", ";}"], prefixLength > 0 ? "padding-left: ".concat(getPrefixWidth(prefixLength), ";") : '', theme.color('grey_light'), error ? theme.color('red') : theme.color('grey_medium'), theme.color('black'), theme.fontFamilies(theme.font.regular), theme.color('grey_for_forms'));
|
|
49
54
|
});
|
|
50
55
|
const ErrorIconWrapper = _styledComponents.default.div.withConfig({
|
|
@@ -54,18 +59,18 @@ const ErrorIconWrapper = _styledComponents.default.div.withConfig({
|
|
|
54
59
|
const Prefix = _styledComponents.default.div.withConfig({
|
|
55
60
|
displayName: "Input__Prefix",
|
|
56
61
|
componentId: "sc-bcqy1o-4"
|
|
57
|
-
})(["position:absolute;left:0;top:0;", " display:flex;height:100%;width:", ";justify-content:center;align-items:center;color:", ";font-weight:700;font-size:inherit;margin-left:2px;"], (0, _zIndex.default)('high'),
|
|
62
|
+
})(["position:absolute;left:0;top:0;", " display:flex;height:100%;width:", ";justify-content:center;align-items:center;color:", ";font-weight:700;font-size:inherit;margin-left:2px;"], (0, _zIndex.default)('high'), _ref5 => {
|
|
58
63
|
let {
|
|
59
64
|
length
|
|
60
|
-
} =
|
|
65
|
+
} = _ref5;
|
|
61
66
|
return getPrefixWidth(length);
|
|
62
|
-
},
|
|
67
|
+
}, _ref6 => {
|
|
63
68
|
let {
|
|
64
69
|
theme
|
|
65
|
-
} =
|
|
70
|
+
} = _ref6;
|
|
66
71
|
return theme.color('grey_dark');
|
|
67
72
|
});
|
|
68
|
-
const Input = /*#__PURE__*/_react.default.forwardRef((
|
|
73
|
+
const Input = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
69
74
|
let {
|
|
70
75
|
errorMsg = '',
|
|
71
76
|
id,
|
|
@@ -81,7 +86,7 @@ const Input = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) => {
|
|
|
81
86
|
maxPxWidthMediumBreakpoint,
|
|
82
87
|
maxPxWidthLargeBreakpoint,
|
|
83
88
|
...rest
|
|
84
|
-
} =
|
|
89
|
+
} = _ref7;
|
|
85
90
|
return /*#__PURE__*/_react.default.createElement(_Label.default, Object.assign({
|
|
86
91
|
className: className,
|
|
87
92
|
htmlFor: id,
|
|
@@ -95,7 +100,8 @@ const Input = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) => {
|
|
|
95
100
|
length: prefix.length
|
|
96
101
|
}, prefix), /*#__PURE__*/_react.default.createElement(InputFieldContainer, {
|
|
97
102
|
maxPxWidthMediumBreakpoint: maxPxWidthMediumBreakpoint,
|
|
98
|
-
maxPxWidthLargeBreakpoint: maxPxWidthLargeBreakpoint
|
|
103
|
+
maxPxWidthLargeBreakpoint: maxPxWidthLargeBreakpoint,
|
|
104
|
+
error: Boolean(errorMsg)
|
|
99
105
|
}, /*#__PURE__*/_react.default.createElement(InputField, Object.assign({
|
|
100
106
|
id: id,
|
|
101
107
|
type: type,
|
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@ const InputFieldContainer = styled.div`
|
|
|
20
20
|
position: relative;
|
|
21
21
|
width: 100%;
|
|
22
22
|
display: flex;
|
|
23
|
+
${({ error }) => error && 'flex-direction: row;'};
|
|
23
24
|
justify-content: flex-end;
|
|
24
25
|
align-items: center;
|
|
25
26
|
${({ maxPxWidthMediumBreakpoint, maxPxWidthLargeBreakpoint, theme }) => css`
|
|
@@ -115,6 +116,7 @@ const Input = React.forwardRef(
|
|
|
115
116
|
<InputFieldContainer
|
|
116
117
|
maxPxWidthMediumBreakpoint={maxPxWidthMediumBreakpoint}
|
|
117
118
|
maxPxWidthLargeBreakpoint={maxPxWidthLargeBreakpoint}
|
|
119
|
+
error={Boolean(errorMsg)}
|
|
118
120
|
>
|
|
119
121
|
<InputField
|
|
120
122
|
id={id}
|