@madie/madie-design-system 1.2.46 → 1.2.48
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.
- package/components/TextArea/index.jsx +18 -1
- package/components/TextField/index.jsx +20 -1
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +2 -2
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
- package/test/components/TextArea.test.js +24 -0
- package/test/components/TextField.test.js +26 -0
|
@@ -11,6 +11,7 @@ const TextArea = ({
|
|
|
11
11
|
disabled = false,
|
|
12
12
|
label,
|
|
13
13
|
inputProps,
|
|
14
|
+
maxLength = undefined,
|
|
14
15
|
...rest
|
|
15
16
|
}) => {
|
|
16
17
|
// coerce this to avoid issue passing props to dom.
|
|
@@ -97,9 +98,24 @@ const TextArea = ({
|
|
|
97
98
|
label={null}
|
|
98
99
|
disabled={disabled}
|
|
99
100
|
id={id}
|
|
101
|
+
maxLength={maxLength}
|
|
100
102
|
{...inputProps}
|
|
101
103
|
{...rest}
|
|
102
|
-
/>
|
|
104
|
+
/>
|
|
105
|
+
{maxLength && !disabled && (
|
|
106
|
+
<span
|
|
107
|
+
style={{
|
|
108
|
+
fontFamily: "Rubik",
|
|
109
|
+
fontSize: 12,
|
|
110
|
+
color: "#333",
|
|
111
|
+
position: "absolute",
|
|
112
|
+
bottom: -20,
|
|
113
|
+
right: 0,
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
{rest.value?.length}/{maxLength} Characters
|
|
117
|
+
</span>
|
|
118
|
+
)}
|
|
103
119
|
</FormControl>
|
|
104
120
|
);
|
|
105
121
|
};
|
|
@@ -113,5 +129,6 @@ TextArea.propTypes = {
|
|
|
113
129
|
placeholder: PropTypes.string, // expects placeholder objects of { name: value } and inserts into the render item function.
|
|
114
130
|
label: PropTypes.string,
|
|
115
131
|
inputProps: PropTypes.any,
|
|
132
|
+
maxLength: PropTypes.number,
|
|
116
133
|
};
|
|
117
134
|
export default TextArea;
|
|
@@ -19,6 +19,7 @@ const TextField = ({
|
|
|
19
19
|
inputProps,
|
|
20
20
|
labelColor = undefined,
|
|
21
21
|
textFieldStyles = {},
|
|
22
|
+
maxLength = undefined,
|
|
22
23
|
...rest
|
|
23
24
|
}) => {
|
|
24
25
|
// get a copy of input props
|
|
@@ -167,9 +168,26 @@ const TextField = ({
|
|
|
167
168
|
error={error}
|
|
168
169
|
disabled={disabled}
|
|
169
170
|
id={id}
|
|
170
|
-
inputProps={
|
|
171
|
+
inputProps={{
|
|
172
|
+
...newInputProps,
|
|
173
|
+
maxLength: maxLength,
|
|
174
|
+
}}
|
|
171
175
|
{...rest}
|
|
172
176
|
/>
|
|
177
|
+
{maxLength && !disabled && (
|
|
178
|
+
<span
|
|
179
|
+
style={{
|
|
180
|
+
fontFamily: "Rubik",
|
|
181
|
+
fontSize: 12,
|
|
182
|
+
color: "#333",
|
|
183
|
+
position: "absolute",
|
|
184
|
+
bottom: -20,
|
|
185
|
+
right: 0,
|
|
186
|
+
}}
|
|
187
|
+
>
|
|
188
|
+
{rest.value?.length}/{maxLength} Characters
|
|
189
|
+
</span>
|
|
190
|
+
)}
|
|
173
191
|
</FormControl>
|
|
174
192
|
);
|
|
175
193
|
};
|
|
@@ -186,5 +204,6 @@ TextField.propTypes = {
|
|
|
186
204
|
tooltipText: PropTypes.string,
|
|
187
205
|
inputProps: PropTypes.object,
|
|
188
206
|
labelColor: PropTypes.string,
|
|
207
|
+
maxLength: PropTypes.number,
|
|
189
208
|
};
|
|
190
209
|
export default TextField;
|