UNPKG

@krowdy-ui/views

Version:

React components that implement Google's Material Design.

74 lines (71 loc) 2.14 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; var _excluded = ["filled", "unPadding", "classes"]; import React from 'react'; import { TextField as MuiTextField, withStyles } from '@material-ui/core'; import clsx from 'clsx'; import PropTypes from 'prop-types'; export var styles = function styles(theme) { return { filled: { backgroundColor: theme.palette.secondary[10] }, input: { '&::placeholder': { color: theme.palette.grey[600], opacity: 1 }, padding: theme.spacing(.5, 0) }, inputSelect: { backgroundColor: 'red' }, root: { borderRadius: theme.shape.borderRadius, color: 'inherit', fontSize: 10, padding: theme.spacing(.5, .75) }, unPadding: { padding: 0 }, unPaddingInput: { '&::placeholder': { color: theme.palette.grey[600], opacity: 1 }, padding: theme.spacing(.25, .5) } }; }; var ReferentInput = function ReferentInput(_ref) { var filled = _ref.filled, unPadding = _ref.unPadding, classes = _ref.classes, props = _objectWithoutProperties(_ref, _excluded); return /*#__PURE__*/React.createElement(MuiTextField, _extends({ inputProps: { autoComplete: "new-".concat(props.name) }, InputProps: _extends({}, props.InputProps, { className: clsx(filled && classes.filled), classes: { input: clsx(classes.input, unPadding && classes.unPaddingInput), root: clsx(classes.root, unPadding && classes.unPadding) }, disableUnderline: true }) }, props)); }; process.env.NODE_ENV !== "production" ? ReferentInput.propTypes = _extends({}, MuiTextField.propTypes, { classes: PropTypes.shape(_extends({}, MuiTextField.propTypes.classes, { filled: PropTypes.string, unPadding: PropTypes.string, unPaddingInput: PropTypes.string })), filled: PropTypes.bool, unPadding: PropTypes.bool }) : void 0; export default withStyles(styles, { name: 'ReferentInput' })(ReferentInput);