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