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