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