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