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