on dee2cd5 help sign in
bridge/src/components/old/ProtoTextarea.js
62 lines 1.7 kB history raw
1import React from 'react';
2import PropTypes from 'prop-types';
4import { getDomProps } from '../../lib/base';
6const ProtoTextarea = props => {
7 return (
8 <textarea
9 // getDomProps gets any prop prepended with 'prop-'. Useful here because
10 // one cannot simply pass props like {...props} because the input elem
11 // cannot accept children nodes, which are included in the props arg. It
12 // is doubly useful because it lets the developer control which props are
13 // added to the real DOM.
14 {...getDomProps(props)}
15 className={props.className}
16 onChange={e => props.onChange(e)}
17 onKeyPress={e => props.onKeyPress(e)}
18 onFocus={e => props.onFocus(e)}
19 onBlur={e => props.onBlur(e)}
20 placeholder={props.placeholder}
21 name={props.name}
22 style={props.style}
23 value={props.value}
24 autoFocus={props.autoFocus}
25 readOnly={props.readOnly}
26 maxLength={props.maxLength}
27 autoComplete={props.autoComplete}
28 />
29 );
30};
32ProtoTextarea.propTypes = {
33 disabled: PropTypes.bool,
34 onChange: PropTypes.func,
35 onBlur: PropTypes.func,
36 onFocus: PropTypes.func,
37 onKeyPress: PropTypes.func,
38 className: PropTypes.string,
39 style: PropTypes.object,
40 children: PropTypes.node,
41 autoFocus: PropTypes.bool,
42 readOnly: PropTypes.bool,
43 name: PropTypes.string,
44 value: PropTypes.string,
45 autoComplete: PropTypes.string,
46};
48ProtoTextarea.defaultProps = {
49 disabled: false,
50 autoFocus: false,
51 onChange: () => {},
52 onBlur: () => {},
53 onFocus: () => {},
54 onKeyPress: () => {},
55 style: {},
56 className: '',
57 value: '',
58 name: '',
59 autoComplete: 'off',
60};
62export default ProtoTextarea;