@@ -1,122 +0,0 @@
1−import React from 'react';
2−import PropTypes from 'prop-types';
3−
4−const TextArea = ({
5− // DOM props
6− name,
7− placeholder,
8− value,
9− className,
10− row,
11− col,
12− disabled,
13− autoFocus,
14− maxLength,
15− readOnly,
16− // events
17− onChange,
18− onFocus,
19− onBlur,
20− format,
21− size,
22− children,
23− // validated component props (if wrapped)
24− isValidated,
25− validationClassnames,
26− focussed,
27− beenFocussed,
28− hasSubmitted,
29− displayPass,
30− displayFailure,
31− error,
32−}) => {
33− const _disabled = disabled === true ? 'br-gray-30' : '';
34−
35− const s = getStyles(styleManifest, format, size);
36−
37− // This enables all children of this component to share the state of this
38− // component.
39− const childrenWithProps = React.Children.map(children, child =>
40− React.cloneElement(child, { displayPass, displayFailure, focussed })
41− );
42−
43− return (
44− <div className={'rel'}>
45− <textarea
46− className={`bw-2 flex bs-solid ${s} ${validationClassnames} ${_disabled} ${className}`}
47− onChange={e => onChange(e)}
48− onFocus={e => onFocus(e)}
49− onBlur={e => onBlur(e)}
50− placeholder={placeholder}
51− name={name}
52− value={value}
53− // row={row}
54− // col={col}
55− disabled={disabled}
56− autoFocus={autoFocus}
57− maxLength={maxLength}
58− readOnly={readOnly}
59− />
60− {childrenWithProps}
61− {displayFailure === true && isValidated === true ? (
62− <div className={'yellow text-600 h-6 mt-1'}>{error}</div>
63− ) : (
64− <div />
65− )}
66− </div>
67− );
68−};
69−
70−const getStyles = (m, t, s) => `${m[t][s] || ''}`;
71−
72−const styleManifest = {
73− normal: {
74− l: 'h-80 fs-7 ph-4',
75− m: 'h-40 fs-35 ph-4',
76− s: 'h-24 fs-35 ph-1',
77− },
78−};
79−
80−TextArea.propTypes = {
81− disabled: PropTypes.bool,
82− onChange: PropTypes.func,
83− onBlur: PropTypes.func,
84− onFocus: PropTypes.func,
85− className: PropTypes.string,
86− children: PropTypes.node,
87− autoFocus: PropTypes.bool,
88− maxLength: PropTypes.number,
89− readOnly: PropTypes.bool,
90− name: PropTypes.string,
91− value: PropTypes.string,
92− row: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
93− col: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
94− isSelected: PropTypes.bool,
95− hasBeenSelected: PropTypes.bool,
96− hasSubmitted: PropTypes.bool,
97− displayPass: PropTypes.bool,
98− displayFailure: PropTypes.bool,
99− error: PropTypes.string,
100− validationClassnames: PropTypes.string,
101−};
102−
103−TextArea.defaultProps = {
104− disabled: false,
105− onChange: () => {},
106− onBlur: () => {},
107− onFocus: () => {},
108− value: '',
109− name: '',
110− className: '',
111− isSelected: false,
112− hasBeenSelected: false,
113− hasSubmitted: false,
114− displayPass: false,
115− displayFailure: false,
116− error: '',
117− size: 'm',
118− format: 'normal',
119− validationClassnames: 'br-gray-50 f-br-blue outline-blue',
120−};
121−
122−export default TextArea;