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

60 lines
2.1 KiB
JavaScript

import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import _extends from "@babel/runtime/helpers/esm/extends";
var _excluded = ["bsPrefix", "size", "hasValidation", "className", "as"];
import classNames from 'classnames';
import React from 'react';
import createWithBsPrefix from './createWithBsPrefix';
import { useBootstrapPrefix } from './ThemeProvider';
var InputGroupAppend = createWithBsPrefix('input-group-append');
var InputGroupPrepend = createWithBsPrefix('input-group-prepend');
var InputGroupText = createWithBsPrefix('input-group-text', {
Component: 'span'
});
var InputGroupCheckbox = function InputGroupCheckbox(props) {
return /*#__PURE__*/React.createElement(InputGroupText, null, /*#__PURE__*/React.createElement("input", _extends({
type: "checkbox"
}, props)));
};
var InputGroupRadio = function InputGroupRadio(props) {
return /*#__PURE__*/React.createElement(InputGroupText, null, /*#__PURE__*/React.createElement("input", _extends({
type: "radio"
}, props)));
};
/**
*
* @property {InputGroupAppend} Append
* @property {InputGroupPrepend} Prepend
* @property {InputGroupText} Text
* @property {InputGroupRadio} Radio
* @property {InputGroupCheckbox} Checkbox
*/
var InputGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var bsPrefix = _ref.bsPrefix,
size = _ref.size,
hasValidation = _ref.hasValidation,
className = _ref.className,
_ref$as = _ref.as,
Component = _ref$as === void 0 ? 'div' : _ref$as,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
bsPrefix = useBootstrapPrefix(bsPrefix, 'input-group');
return /*#__PURE__*/React.createElement(Component, _extends({
ref: ref
}, props, {
className: classNames(className, bsPrefix, size && bsPrefix + "-" + size, hasValidation && 'has-validation')
}));
});
InputGroup.displayName = 'InputGroup';
var InputGroupWithExtras = _extends({}, InputGroup, {
Text: InputGroupText,
Radio: InputGroupRadio,
Checkbox: InputGroupCheckbox,
Append: InputGroupAppend,
Prepend: InputGroupPrepend
});
export default InputGroupWithExtras;