@madie/madie-design-system 1.2.47 → 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/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
- package/test/components/TextArea.test.js +24 -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;
|