mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-29 03:45:15 +00:00
40 lines
1.5 KiB
JavaScript
40 lines
1.5 KiB
JavaScript
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
||
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||
|
var _excluded = ["id", "bsPrefix", "bsCustomPrefix", "className", "isValid", "isInvalid", "lang", "as"];
|
||
|
import classNames from 'classnames';
|
||
|
import React, { useContext } from 'react';
|
||
|
import FormContext from './FormContext';
|
||
|
import { useBootstrapPrefix } from './ThemeProvider';
|
||
|
var FormFileInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
||
|
var id = _ref.id,
|
||
|
bsPrefix = _ref.bsPrefix,
|
||
|
bsCustomPrefix = _ref.bsCustomPrefix,
|
||
|
className = _ref.className,
|
||
|
isValid = _ref.isValid,
|
||
|
isInvalid = _ref.isInvalid,
|
||
|
lang = _ref.lang,
|
||
|
_ref$as = _ref.as,
|
||
|
Component = _ref$as === void 0 ? 'input' : _ref$as,
|
||
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
||
|
|
||
|
var _useContext = useContext(FormContext),
|
||
|
controlId = _useContext.controlId,
|
||
|
custom = _useContext.custom;
|
||
|
|
||
|
var type = 'file';
|
||
|
|
||
|
var _ref2 = custom ? [bsCustomPrefix, 'custom-file-input'] : [bsPrefix, 'form-control-file'],
|
||
|
prefix = _ref2[0],
|
||
|
defaultPrefix = _ref2[1];
|
||
|
|
||
|
bsPrefix = useBootstrapPrefix(prefix, defaultPrefix);
|
||
|
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
||
|
ref: ref,
|
||
|
id: id || controlId,
|
||
|
type: type,
|
||
|
lang: lang,
|
||
|
className: classNames(className, bsPrefix, isValid && 'is-valid', isInvalid && 'is-invalid')
|
||
|
}));
|
||
|
});
|
||
|
FormFileInput.displayName = 'FormFileInput';
|
||
|
export default FormFileInput;
|