GoScrobble/web/node_modules/react-bootstrap/esm/FormFileLabel.js

32 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
var _excluded = ["bsPrefix", "bsCustomPrefix", "className", "htmlFor"];
import classNames from 'classnames';
import React, { useContext } from 'react';
import FormContext from './FormContext';
import { useBootstrapPrefix } from './ThemeProvider';
var FormFileLabel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var bsPrefix = _ref.bsPrefix,
bsCustomPrefix = _ref.bsCustomPrefix,
className = _ref.className,
htmlFor = _ref.htmlFor,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
var _useContext = useContext(FormContext),
controlId = _useContext.controlId,
custom = _useContext.custom;
var _ref2 = custom ? [bsCustomPrefix, 'custom-file-label'] : [bsPrefix, 'form-file-label'],
prefix = _ref2[0],
defaultPrefix = _ref2[1];
bsPrefix = useBootstrapPrefix(prefix, defaultPrefix);
return /*#__PURE__*/React.createElement("label", _extends({}, props, {
ref: ref,
htmlFor: htmlFor || controlId,
className: classNames(className, bsPrefix),
"data-browse": props['data-browse']
}));
});
FormFileLabel.displayName = 'FormFileLabel';
export default FormFileLabel;