Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 176x 176x 6x 6x 1x 5x 176x 176x | import React from 'react'; import { lucidClassNames } from '../../util/style-helpers'; import PropTypes from 'prop-types'; const cx = lucidClassNames.bind('&-TextFieldPlain'); type InputProps = JSX.IntrinsicElements['input']; type TextareaProps = JSX.IntrinsicElements['textarea']; interface TextFieldInputPlain extends InputProps { isDisabled?: boolean; isMultiLine?: boolean; rows?: number; } interface TextFieldTextareaPlain extends TextareaProps { isDisabled?: boolean; isMultiLine?: boolean; } const TextFieldPlain = React.forwardRef( ( { isDisabled = false, isMultiLine = false, ...props }: TextFieldInputPlain | TextFieldTextareaPlain, ref: React.Ref<HTMLTextAreaElement | HTMLInputElement> ) => { const className = cx( '&', { '&-is-disabled': isDisabled, '&-is-multi-line': isMultiLine, '&-is-single-line': !isMultiLine, }, props.className ); if (isMultiLine) { return ( <textarea ref={ref as React.Ref<HTMLTextAreaElement>} {...(props as TextFieldTextareaPlain)} className={className} /> ); } else { return ( <input ref={ref as React.Ref<HTMLInputElement>} {...(props as TextFieldInputPlain)} className={className} /> ); } } ); // @ts-ignore TextFieldPlain.propTypes = { isDisabled: PropTypes.bool, isMultiLine: PropTypes.bool, className: PropTypes.string, }; TextFieldPlain.displayName = 'TextFieldPlain'; export default TextFieldPlain; |