@emmveqz/react-components
Version:
Diverse Components for React
32 lines (31 loc) • 2.03 kB
JavaScript
;
//
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const TextField_1 = __importDefault(require("@mui/material/TextField"));
//
const TextField = (_a) => {
var _b;
var { autoComplete, endAdornment, inputComponent, InputLabelProps, InputProps, inputRef, startAdornment,
// Note: Buggy typescript compiling, so we need to destruct it to declare.
variant } = _a, props = __rest(_a, ["autoComplete", "endAdornment", "inputComponent", "InputLabelProps", "InputProps", "inputRef", "startAdornment", "variant"]);
const shrinkLabel = (InputLabelProps === null || InputLabelProps === void 0 ? void 0 : InputLabelProps.shrink) || !!((_b = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _b === void 0 ? void 0 : _b.value);
return (react_1.default.createElement(TextField_1.default, Object.assign({}, props, { autoComplete: autoComplete !== null && autoComplete !== void 0 ? autoComplete : 'off', InputLabelProps: !shrinkLabel ? InputLabelProps : Object.assign(Object.assign({}, InputLabelProps), { shrink: true }), InputProps: Object.assign(Object.assign({}, InputProps), { endAdornment,
inputComponent,
startAdornment }), inputRef: inputRef, variant: variant !== null && variant !== void 0 ? variant : 'outlined' })));
};
exports.default = TextField;