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

43 lines
1.7 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", "placement", "className", "style", "children", "content", "arrowProps", "popper", "show"];
import classNames from 'classnames';
import React from 'react';
import isRequiredForA11y from 'prop-types-extra/lib/isRequiredForA11y';
import { useBootstrapPrefix } from './ThemeProvider';
import PopoverTitle from './PopoverTitle';
import PopoverContent from './PopoverContent';
var defaultProps = {
placement: 'right'
};
var Popover = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var bsPrefix = _ref.bsPrefix,
placement = _ref.placement,
className = _ref.className,
style = _ref.style,
children = _ref.children,
content = _ref.content,
arrowProps = _ref.arrowProps,
_ = _ref.popper,
_1 = _ref.show,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
var decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'popover');
var _ref2 = (placement == null ? void 0 : placement.split('-')) || [],
primaryPlacement = _ref2[0];
return /*#__PURE__*/React.createElement("div", _extends({
ref: ref,
role: "tooltip",
style: style,
"x-placement": primaryPlacement,
className: classNames(className, decoratedBsPrefix, primaryPlacement && "bs-popover-" + primaryPlacement)
}, props), /*#__PURE__*/React.createElement("div", _extends({
className: "arrow"
}, arrowProps)), content ? /*#__PURE__*/React.createElement(PopoverContent, null, children) : children);
});
Popover.defaultProps = defaultProps;
Popover.Title = PopoverTitle;
Popover.Content = PopoverContent;
export default Popover;