UNPKG

2.22 kBJavaScriptView Raw
1import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
3import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
4import classNames from 'classnames';
5import React from 'react';
6import PropTypes from 'prop-types';
7import { bsClass, bsSizes, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
8import { Size } from './utils/StyleConfig';
9var propTypes = {
10 /**
11 * A css class to apply to the Modal dialog DOM node.
12 */
13 dialogClassName: PropTypes.string
14};
15
16var ModalDialog =
17/*#__PURE__*/
18function (_React$Component) {
19 _inheritsLoose(ModalDialog, _React$Component);
20
21 function ModalDialog() {
22 return _React$Component.apply(this, arguments) || this;
23 }
24
25 var _proto = ModalDialog.prototype;
26
27 _proto.render = function render() {
28 var _extends2;
29
30 var _this$props = this.props,
31 dialogClassName = _this$props.dialogClassName,
32 className = _this$props.className,
33 style = _this$props.style,
34 children = _this$props.children,
35 props = _objectWithoutPropertiesLoose(_this$props, ["dialogClassName", "className", "style", "children"]);
36
37 var _splitBsProps = splitBsProps(props),
38 bsProps = _splitBsProps[0],
39 elementProps = _splitBsProps[1];
40
41 var bsClassName = prefix(bsProps);
42
43 var modalStyle = _extends({
44 display: 'block'
45 }, style);
46
47 var dialogClasses = _extends({}, getClassSet(bsProps), (_extends2 = {}, _extends2[bsClassName] = false, _extends2[prefix(bsProps, 'dialog')] = true, _extends2));
48
49 return React.createElement("div", _extends({}, elementProps, {
50 tabIndex: "-1",
51 role: "dialog",
52 style: modalStyle,
53 className: classNames(className, bsClassName)
54 }), React.createElement("div", {
55 className: classNames(dialogClassName, dialogClasses)
56 }, React.createElement("div", {
57 className: prefix(bsProps, 'content'),
58 role: "document"
59 }, children)));
60 };
61
62 return ModalDialog;
63}(React.Component);
64
65ModalDialog.propTypes = propTypes;
66export default bsClass('modal', bsSizes([Size.LARGE, Size.SMALL], ModalDialog));
\No newline at end of file