Açıklama Yok

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { _ as _typeof, a as _inherits, b as _classCallCheck, c as _possibleConstructorReturn, d as _getPrototypeOf, e as _createClass } from '../inherits-6cb67931.js';
  2. import React from 'react';
  3. import { createPortal } from 'react-dom';
  4. import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
  5. function isBrowser() {
  6. return !((typeof window === "undefined" ? "undefined" : _typeof(window)) === undefined);
  7. }
  8. var css = ".Modal_wrapper__2hzaC {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n z-index: 1000;\n}\n.Modal_overlay__3iNdm {\n width: 100vw;\n height: 100vh;\n background: #000;\n animation: Modal_overlayer__1zSH9 0.3s forwards;\n}\n.Modal_container__2veos {\n position: absolute;\n top: 20%;\n left: 50%;\n animation: Modal_container__2veos 0.3s forwards;\n}\n@keyframes Modal_overlayer__1zSH9 {\n from {\n opacity: 0;\n }\n to {\n opacity: 0.3;\n }\n}\n@keyframes Modal_container__2veos {\n from {\n transform: translateX(-50%) scale(0, 0);\n }\n to {\n transform: translateX(-50%) scale(1, 1);\n }\n}\n";
  9. var styles = {
  10. "wrapper": "Modal_wrapper__2hzaC",
  11. "overlay": "Modal_overlay__3iNdm",
  12. "overlayer": "Modal_overlayer__1zSH9",
  13. "container": "Modal_container__2veos"
  14. };
  15. styleInject(css);
  16. var Modal =
  17. /*#__PURE__*/
  18. function (_React$PureComponent) {
  19. _inherits(Modal, _React$PureComponent);
  20. function Modal() {
  21. _classCallCheck(this, Modal);
  22. return _possibleConstructorReturn(this, _getPrototypeOf(Modal).apply(this, arguments));
  23. }
  24. _createClass(Modal, [{
  25. key: "render",
  26. value: function render() {
  27. if (!isBrowser()) return null;
  28. var DEFAULT_CONTAINER = document.getElementById('container');
  29. var _this$props = this.props,
  30. children = _this$props.children,
  31. visible = _this$props.visible,
  32. onCancel = _this$props.onCancel,
  33. _this$props$container = _this$props.container,
  34. container = _this$props$container === void 0 ? DEFAULT_CONTAINER : _this$props$container;
  35. var finalMountContainer = document.body;
  36. if (!container) {
  37. if (!DEFAULT_CONTAINER) {
  38. if (!Modal.hasShowWarning) {
  39. Modal.hasShowWarning = true;
  40. }
  41. finalMountContainer = document.body;
  42. } else {
  43. if (!Modal.hasShowWarning) {
  44. Modal.hasShowWarning = true;
  45. }
  46. finalMountContainer = DEFAULT_CONTAINER;
  47. }
  48. }
  49. return visible && createPortal(React.createElement("div", {
  50. className: styles.wrapper
  51. }, React.createElement("div", {
  52. className: styles.overlay,
  53. onClick: onCancel
  54. }), React.createElement("div", {
  55. className: styles.container
  56. }, children)), finalMountContainer);
  57. }
  58. }]);
  59. return Modal;
  60. }(React.PureComponent);
  61. Modal.hasShowWarning = false;
  62. export default Modal;
  63. export { Modal };
  64. //# sourceMappingURL=index.js.map