UNPKG

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