-
Notifications
You must be signed in to change notification settings - Fork 91
/
StyledTextarea.js
43 lines (37 loc) · 1.27 KB
/
StyledTextarea.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Copyright Zendesk, Inc.
*
* Use of this source code is governed under the Apache License, Version 2.0
* found at http://www.apache.org/licenses/LICENSE-2.0.
*/
import PropTypes from 'prop-types';
import styled from 'styled-components';
import classNames from 'classnames';
import { retrieveTheme, isRtl } from '@zendeskgarden/react-theming';
import VALIDATION from '../../utils/validation';
import TextStyles from '@zendeskgarden/css-forms/dist/text.css';
import StyledTextInput from './StyledTextInput';
/**
* Accepts all `<textarea>` props
*/
const StyledTextarea = styled(StyledTextInput.withComponent('textarea')).attrs(props => ({
className: classNames(props.className, TextStyles['c-txt__input--area'], {
[TextStyles['is-resizable']]: props.resizable,
// RTL
[TextStyles['is-rtl']]: isRtl(props)
})
}))`
${props => retrieveTheme('forms.text_area', props)};
`;
StyledTextarea.propTypes = {
small: PropTypes.bool,
bare: PropTypes.bool,
disabled: PropTypes.bool,
focused: PropTypes.bool,
/** Applies inset `box-shadow` styling on focus */
focusInset: PropTypes.bool,
hovered: PropTypes.bool,
resizable: PropTypes.bool,
validation: PropTypes.oneOf([VALIDATION.SUCCESS, VALIDATION.WARNING, VALIDATION.ERROR])
};
export default StyledTextarea;