1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 |
|
5 | Object.defineProperty(exports, "__esModule", {
|
6 | value: true
|
7 | });
|
8 | exports.default = exports.styles = void 0;
|
9 |
|
10 | var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
11 |
|
12 | var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
13 |
|
14 | var _react = _interopRequireDefault(require("react"));
|
15 |
|
16 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
17 |
|
18 | var _clsx = _interopRequireDefault(require("clsx"));
|
19 |
|
20 | var _utils = require("@material-ui/utils");
|
21 |
|
22 | var _InputBase = _interopRequireDefault(require("../InputBase"));
|
23 |
|
24 | var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
25 |
|
26 | var styles = function styles(theme) {
|
27 | var light = theme.palette.type === 'light';
|
28 | var bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
|
29 | return {
|
30 |
|
31 | root: {
|
32 | position: 'relative'
|
33 | },
|
34 |
|
35 |
|
36 | formControl: {
|
37 | 'label + &': {
|
38 | marginTop: 16
|
39 | }
|
40 | },
|
41 |
|
42 |
|
43 | focused: {},
|
44 |
|
45 |
|
46 | disabled: {},
|
47 |
|
48 |
|
49 | colorSecondary: {
|
50 | '&$underline:after': {
|
51 | borderBottomColor: theme.palette.secondary.main
|
52 | }
|
53 | },
|
54 |
|
55 |
|
56 | underline: {
|
57 | '&:after': {
|
58 | borderBottom: "2px solid ".concat(theme.palette.primary.main),
|
59 | left: 0,
|
60 | bottom: 0,
|
61 |
|
62 | content: '""',
|
63 | position: 'absolute',
|
64 | right: 0,
|
65 | transform: 'scaleX(0)',
|
66 | transition: theme.transitions.create('transform', {
|
67 | duration: theme.transitions.duration.shorter,
|
68 | easing: theme.transitions.easing.easeOut
|
69 | }),
|
70 | pointerEvents: 'none'
|
71 |
|
72 | },
|
73 | '&$focused:after': {
|
74 | transform: 'scaleX(1)'
|
75 | },
|
76 | '&$error:after': {
|
77 | borderBottomColor: theme.palette.error.main,
|
78 | transform: 'scaleX(1)'
|
79 |
|
80 | },
|
81 | '&:before': {
|
82 | borderBottom: "1px solid ".concat(bottomLineColor),
|
83 | left: 0,
|
84 | bottom: 0,
|
85 |
|
86 | content: '"\\00a0"',
|
87 | position: 'absolute',
|
88 | right: 0,
|
89 | transition: theme.transitions.create('border-bottom-color', {
|
90 | duration: theme.transitions.duration.shorter
|
91 | }),
|
92 | pointerEvents: 'none'
|
93 |
|
94 | },
|
95 | '&:hover:not($disabled):before': {
|
96 | borderBottom: "2px solid ".concat(theme.palette.text.primary),
|
97 |
|
98 | '@media (hover: none)': {
|
99 | borderBottom: "1px solid ".concat(bottomLineColor)
|
100 | }
|
101 | },
|
102 | '&$disabled:before': {
|
103 | borderBottomStyle: 'dotted'
|
104 | }
|
105 | },
|
106 |
|
107 |
|
108 | error: {},
|
109 |
|
110 |
|
111 | multiline: {},
|
112 |
|
113 |
|
114 | fullWidth: {},
|
115 |
|
116 |
|
117 | input: {},
|
118 |
|
119 |
|
120 | inputMarginDense: {},
|
121 |
|
122 |
|
123 | inputMultiline: {},
|
124 |
|
125 |
|
126 | inputTypeSearch: {}
|
127 | };
|
128 | };
|
129 |
|
130 | exports.styles = styles;
|
131 |
|
132 | var Input = _react.default.forwardRef(function Input(props, ref) {
|
133 | var disableUnderline = props.disableUnderline,
|
134 | classes = props.classes,
|
135 | _props$fullWidth = props.fullWidth,
|
136 | fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
|
137 | _props$inputComponent = props.inputComponent,
|
138 | inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,
|
139 | _props$multiline = props.multiline,
|
140 | multiline = _props$multiline === void 0 ? false : _props$multiline,
|
141 | _props$type = props.type,
|
142 | type = _props$type === void 0 ? 'text' : _props$type,
|
143 | other = (0, _objectWithoutProperties2.default)(props, ["disableUnderline", "classes", "fullWidth", "inputComponent", "multiline", "type"]);
|
144 | return _react.default.createElement(_InputBase.default, (0, _extends2.default)({
|
145 | classes: (0, _extends2.default)({}, classes, {
|
146 | root: (0, _clsx.default)(classes.root, !disableUnderline && classes.underline),
|
147 | underline: null
|
148 | }),
|
149 | fullWidth: fullWidth,
|
150 | inputComponent: inputComponent,
|
151 | multiline: multiline,
|
152 | ref: ref,
|
153 | type: type
|
154 | }, other));
|
155 | });
|
156 |
|
157 | process.env.NODE_ENV !== "production" ? Input.propTypes = {
|
158 | |
159 |
|
160 |
|
161 |
|
162 |
|
163 | autoComplete: _propTypes.default.string,
|
164 |
|
165 | |
166 |
|
167 |
|
168 | autoFocus: _propTypes.default.bool,
|
169 |
|
170 | |
171 |
|
172 |
|
173 |
|
174 | classes: _propTypes.default.object.isRequired,
|
175 |
|
176 | |
177 |
|
178 |
|
179 | className: _propTypes.default.string,
|
180 |
|
181 | |
182 |
|
183 |
|
184 | color: _propTypes.default.oneOf(['primary', 'secondary']),
|
185 |
|
186 | |
187 |
|
188 |
|
189 | defaultValue: _propTypes.default.any,
|
190 |
|
191 | |
192 |
|
193 |
|
194 | disabled: _propTypes.default.bool,
|
195 |
|
196 | |
197 |
|
198 |
|
199 | disableUnderline: _propTypes.default.bool,
|
200 |
|
201 | |
202 |
|
203 |
|
204 | endAdornment: _propTypes.default.node,
|
205 |
|
206 | |
207 |
|
208 |
|
209 |
|
210 | error: _propTypes.default.bool,
|
211 |
|
212 | |
213 |
|
214 |
|
215 | fullWidth: _propTypes.default.bool,
|
216 |
|
217 | |
218 |
|
219 |
|
220 | id: _propTypes.default.string,
|
221 |
|
222 | |
223 |
|
224 |
|
225 |
|
226 | inputComponent: _propTypes.default.elementType,
|
227 |
|
228 | |
229 |
|
230 |
|
231 | inputProps: _propTypes.default.object,
|
232 |
|
233 | |
234 |
|
235 |
|
236 | inputRef: _utils.refType,
|
237 |
|
238 | |
239 |
|
240 |
|
241 |
|
242 | margin: _propTypes.default.oneOf(['dense', 'none']),
|
243 |
|
244 | |
245 |
|
246 |
|
247 | multiline: _propTypes.default.bool,
|
248 |
|
249 | |
250 |
|
251 |
|
252 | name: _propTypes.default.string,
|
253 |
|
254 | |
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 | onChange: _propTypes.default.func,
|
261 |
|
262 | |
263 |
|
264 |
|
265 | placeholder: _propTypes.default.string,
|
266 |
|
267 | |
268 |
|
269 |
|
270 |
|
271 | readOnly: _propTypes.default.bool,
|
272 |
|
273 | |
274 |
|
275 |
|
276 | required: _propTypes.default.bool,
|
277 |
|
278 | |
279 |
|
280 |
|
281 | rows: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
282 |
|
283 | |
284 |
|
285 |
|
286 | rowsMax: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
287 |
|
288 | |
289 |
|
290 |
|
291 | startAdornment: _propTypes.default.node,
|
292 |
|
293 | |
294 |
|
295 |
|
296 | type: _propTypes.default.string,
|
297 |
|
298 | |
299 |
|
300 |
|
301 | value: _propTypes.default.any
|
302 | } : void 0;
|
303 | Input.muiName = 'Input';
|
304 |
|
305 | var _default = (0, _withStyles.default)(styles, {
|
306 | name: 'MuiInput'
|
307 | })(Input);
|
308 |
|
309 | exports.default = _default; |
\ | No newline at end of file |