Completely updated React, fixed #11, (hopefully)
This commit is contained in:
		
							
								
								
									
										21
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/Backdrop.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/Backdrop.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
import * as React from 'react';
 | 
			
		||||
import { StandardProps } from '..';
 | 
			
		||||
import { FadeProps } from '../transitions/Fade';
 | 
			
		||||
import { TransitionProps } from '../transitions/transition';
 | 
			
		||||
 | 
			
		||||
export interface BackdropProps
 | 
			
		||||
  extends StandardProps<
 | 
			
		||||
      React.HTMLAttributes<HTMLDivElement> & Partial<FadeProps>,
 | 
			
		||||
      BackdropClassKey
 | 
			
		||||
    > {
 | 
			
		||||
  invisible?: boolean;
 | 
			
		||||
  onClick?: React.ReactEventHandler<{}>;
 | 
			
		||||
  open: boolean;
 | 
			
		||||
  transitionDuration?: TransitionProps['timeout'];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type BackdropClassKey = 'root' | 'invisible';
 | 
			
		||||
 | 
			
		||||
declare const Backdrop: React.ComponentType<BackdropProps>;
 | 
			
		||||
 | 
			
		||||
export default Backdrop;
 | 
			
		||||
							
								
								
									
										102
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/Backdrop.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										102
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/Backdrop.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,102 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, "__esModule", {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.styles = undefined;
 | 
			
		||||
 | 
			
		||||
var _extends2 = require('babel-runtime/helpers/extends');
 | 
			
		||||
 | 
			
		||||
var _extends3 = _interopRequireDefault(_extends2);
 | 
			
		||||
 | 
			
		||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
 | 
			
		||||
 | 
			
		||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
 | 
			
		||||
 | 
			
		||||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
 | 
			
		||||
 | 
			
		||||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
 | 
			
		||||
 | 
			
		||||
var _react = require('react');
 | 
			
		||||
 | 
			
		||||
var _react2 = _interopRequireDefault(_react);
 | 
			
		||||
 | 
			
		||||
var _propTypes = require('prop-types');
 | 
			
		||||
 | 
			
		||||
var _propTypes2 = _interopRequireDefault(_propTypes);
 | 
			
		||||
 | 
			
		||||
var _classnames = require('classnames');
 | 
			
		||||
 | 
			
		||||
var _classnames2 = _interopRequireDefault(_classnames);
 | 
			
		||||
 | 
			
		||||
var _withStyles = require('../styles/withStyles');
 | 
			
		||||
 | 
			
		||||
var _withStyles2 = _interopRequireDefault(_withStyles);
 | 
			
		||||
 | 
			
		||||
var _Fade = require('../transitions/Fade');
 | 
			
		||||
 | 
			
		||||
var _Fade2 = _interopRequireDefault(_Fade);
 | 
			
		||||
 | 
			
		||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 | 
			
		||||
 | 
			
		||||
var styles = exports.styles = {
 | 
			
		||||
  root: {
 | 
			
		||||
    zIndex: -1,
 | 
			
		||||
    width: '100%',
 | 
			
		||||
    height: '100%',
 | 
			
		||||
    position: 'fixed',
 | 
			
		||||
    top: 0,
 | 
			
		||||
    left: 0,
 | 
			
		||||
    // Remove grey highlight
 | 
			
		||||
    WebkitTapHighlightColor: 'transparent',
 | 
			
		||||
    willChange: 'opacity',
 | 
			
		||||
    backgroundColor: 'rgba(0, 0, 0, 0.5)'
 | 
			
		||||
  },
 | 
			
		||||
  invisible: {
 | 
			
		||||
    backgroundColor: 'transparent'
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function Backdrop(props) {
 | 
			
		||||
  var classes = props.classes,
 | 
			
		||||
      invisible = props.invisible,
 | 
			
		||||
      open = props.open,
 | 
			
		||||
      transitionDuration = props.transitionDuration,
 | 
			
		||||
      other = (0, _objectWithoutProperties3.default)(props, ['classes', 'invisible', 'open', 'transitionDuration']);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  var className = (0, _classnames2.default)(classes.root, (0, _defineProperty3.default)({}, classes.invisible, invisible));
 | 
			
		||||
 | 
			
		||||
  return _react2.default.createElement(
 | 
			
		||||
    _Fade2.default,
 | 
			
		||||
    (0, _extends3.default)({ appear: true, 'in': open, timeout: transitionDuration }, other),
 | 
			
		||||
    _react2.default.createElement('div', { className: className, 'aria-hidden': 'true' })
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Backdrop.propTypes = process.env.NODE_ENV !== "production" ? {
 | 
			
		||||
  /**
 | 
			
		||||
   * Useful to extend the style applied to components.
 | 
			
		||||
   */
 | 
			
		||||
  classes: _propTypes2.default.object.isRequired,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the backdrop is invisible.
 | 
			
		||||
   * It can be used when rendering a popover or a custom select component.
 | 
			
		||||
   */
 | 
			
		||||
  invisible: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the backdrop is open.
 | 
			
		||||
   */
 | 
			
		||||
  open: _propTypes2.default.bool.isRequired,
 | 
			
		||||
  /**
 | 
			
		||||
   * The duration for the transition, in milliseconds.
 | 
			
		||||
   * You may specify a single timeout for all transitions, or individually with an object.
 | 
			
		||||
   */
 | 
			
		||||
  transitionDuration: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({ enter: _propTypes2.default.number, exit: _propTypes2.default.number })])
 | 
			
		||||
} : {};
 | 
			
		||||
 | 
			
		||||
Backdrop.defaultProps = {
 | 
			
		||||
  invisible: false
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.default = (0, _withStyles2.default)(styles, { name: 'MuiBackdrop' })(Backdrop);
 | 
			
		||||
							
								
								
									
										67
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/Backdrop.js.flow
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/Backdrop.js.flow
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import PropTypes from 'prop-types';
 | 
			
		||||
import classNames from 'classnames';
 | 
			
		||||
import withStyles from '../styles/withStyles';
 | 
			
		||||
import Fade from '../transitions/Fade';
 | 
			
		||||
 | 
			
		||||
export const styles = {
 | 
			
		||||
  root: {
 | 
			
		||||
    zIndex: -1,
 | 
			
		||||
    width: '100%',
 | 
			
		||||
    height: '100%',
 | 
			
		||||
    position: 'fixed',
 | 
			
		||||
    top: 0,
 | 
			
		||||
    left: 0,
 | 
			
		||||
    // Remove grey highlight
 | 
			
		||||
    WebkitTapHighlightColor: 'transparent',
 | 
			
		||||
    willChange: 'opacity',
 | 
			
		||||
    backgroundColor: 'rgba(0, 0, 0, 0.5)',
 | 
			
		||||
  },
 | 
			
		||||
  invisible: {
 | 
			
		||||
    backgroundColor: 'transparent',
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function Backdrop(props) {
 | 
			
		||||
  const { classes, invisible, open, transitionDuration, ...other } = props;
 | 
			
		||||
 | 
			
		||||
  const className = classNames(classes.root, {
 | 
			
		||||
    [classes.invisible]: invisible,
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <Fade appear in={open} timeout={transitionDuration} {...other}>
 | 
			
		||||
      <div data-mui-test="Backdrop" className={className} aria-hidden="true" />
 | 
			
		||||
    </Fade>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Backdrop.propTypes = {
 | 
			
		||||
  /**
 | 
			
		||||
   * Useful to extend the style applied to components.
 | 
			
		||||
   */
 | 
			
		||||
  classes: PropTypes.object.isRequired,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the backdrop is invisible.
 | 
			
		||||
   * It can be used when rendering a popover or a custom select component.
 | 
			
		||||
   */
 | 
			
		||||
  invisible: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the backdrop is open.
 | 
			
		||||
   */
 | 
			
		||||
  open: PropTypes.bool.isRequired,
 | 
			
		||||
  /**
 | 
			
		||||
   * The duration for the transition, in milliseconds.
 | 
			
		||||
   * You may specify a single timeout for all transitions, or individually with an object.
 | 
			
		||||
   */
 | 
			
		||||
  transitionDuration: PropTypes.oneOfType([
 | 
			
		||||
    PropTypes.number,
 | 
			
		||||
    PropTypes.shape({ enter: PropTypes.number, exit: PropTypes.number }),
 | 
			
		||||
  ]),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Backdrop.defaultProps = {
 | 
			
		||||
  invisible: false,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default withStyles(styles, { name: 'MuiBackdrop' })(Backdrop);
 | 
			
		||||
							
								
								
									
										31
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/Modal.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/Modal.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
import * as React from 'react';
 | 
			
		||||
import { StandardProps, ModalManager } from '..';
 | 
			
		||||
import { BackdropProps } from './Backdrop';
 | 
			
		||||
import { PortalProps } from '../Portal';
 | 
			
		||||
 | 
			
		||||
export interface ModalProps
 | 
			
		||||
  extends StandardProps<
 | 
			
		||||
      React.HtmlHTMLAttributes<HTMLDivElement> & Partial<PortalProps>,
 | 
			
		||||
      ModalClassKey
 | 
			
		||||
    > {
 | 
			
		||||
  BackdropComponent?: React.ReactType<BackdropProps>;
 | 
			
		||||
  BackdropProps?: Partial<BackdropProps>;
 | 
			
		||||
  disableAutoFocus?: boolean;
 | 
			
		||||
  disableBackdropClick?: boolean;
 | 
			
		||||
  disableEnforceFocus?: boolean;
 | 
			
		||||
  disableEscapeKeyDown?: boolean;
 | 
			
		||||
  disableRestoreFocus?: boolean;
 | 
			
		||||
  hideBackdrop?: boolean;
 | 
			
		||||
  keepMounted?: boolean;
 | 
			
		||||
  manager?: ModalManager;
 | 
			
		||||
  onBackdropClick?: React.ReactEventHandler<{}>;
 | 
			
		||||
  onClose?: React.ReactEventHandler<{}>;
 | 
			
		||||
  onEscapeKeyDown?: React.ReactEventHandler<{}>;
 | 
			
		||||
  open: boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type ModalClassKey = 'root' | 'hidden';
 | 
			
		||||
 | 
			
		||||
declare const Modal: React.ComponentType<ModalProps>;
 | 
			
		||||
 | 
			
		||||
export default Modal;
 | 
			
		||||
							
								
								
									
										505
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/Modal.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										505
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/Modal.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,505 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, "__esModule", {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.styles = undefined;
 | 
			
		||||
 | 
			
		||||
var _extends2 = require('babel-runtime/helpers/extends');
 | 
			
		||||
 | 
			
		||||
var _extends3 = _interopRequireDefault(_extends2);
 | 
			
		||||
 | 
			
		||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
 | 
			
		||||
 | 
			
		||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
 | 
			
		||||
 | 
			
		||||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
 | 
			
		||||
 | 
			
		||||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
 | 
			
		||||
 | 
			
		||||
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
 | 
			
		||||
 | 
			
		||||
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
 | 
			
		||||
 | 
			
		||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
 | 
			
		||||
 | 
			
		||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
 | 
			
		||||
 | 
			
		||||
var _createClass2 = require('babel-runtime/helpers/createClass');
 | 
			
		||||
 | 
			
		||||
var _createClass3 = _interopRequireDefault(_createClass2);
 | 
			
		||||
 | 
			
		||||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
 | 
			
		||||
 | 
			
		||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
 | 
			
		||||
 | 
			
		||||
var _inherits2 = require('babel-runtime/helpers/inherits');
 | 
			
		||||
 | 
			
		||||
var _inherits3 = _interopRequireDefault(_inherits2);
 | 
			
		||||
 | 
			
		||||
var _react = require('react');
 | 
			
		||||
 | 
			
		||||
var _react2 = _interopRequireDefault(_react);
 | 
			
		||||
 | 
			
		||||
var _reactDom = require('react-dom');
 | 
			
		||||
 | 
			
		||||
var _reactDom2 = _interopRequireDefault(_reactDom);
 | 
			
		||||
 | 
			
		||||
var _propTypes = require('prop-types');
 | 
			
		||||
 | 
			
		||||
var _propTypes2 = _interopRequireDefault(_propTypes);
 | 
			
		||||
 | 
			
		||||
var _classnames = require('classnames');
 | 
			
		||||
 | 
			
		||||
var _classnames2 = _interopRequireDefault(_classnames);
 | 
			
		||||
 | 
			
		||||
var _warning = require('warning');
 | 
			
		||||
 | 
			
		||||
var _warning2 = _interopRequireDefault(_warning);
 | 
			
		||||
 | 
			
		||||
var _keycode = require('keycode');
 | 
			
		||||
 | 
			
		||||
var _keycode2 = _interopRequireDefault(_keycode);
 | 
			
		||||
 | 
			
		||||
var _activeElement = require('dom-helpers/activeElement');
 | 
			
		||||
 | 
			
		||||
var _activeElement2 = _interopRequireDefault(_activeElement);
 | 
			
		||||
 | 
			
		||||
var _contains = require('dom-helpers/query/contains');
 | 
			
		||||
 | 
			
		||||
var _contains2 = _interopRequireDefault(_contains);
 | 
			
		||||
 | 
			
		||||
var _inDOM = require('dom-helpers/util/inDOM');
 | 
			
		||||
 | 
			
		||||
var _inDOM2 = _interopRequireDefault(_inDOM);
 | 
			
		||||
 | 
			
		||||
var _ownerDocument = require('dom-helpers/ownerDocument');
 | 
			
		||||
 | 
			
		||||
var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
 | 
			
		||||
 | 
			
		||||
var _RefHolder = require('../internal/RefHolder');
 | 
			
		||||
 | 
			
		||||
var _RefHolder2 = _interopRequireDefault(_RefHolder);
 | 
			
		||||
 | 
			
		||||
var _Portal = require('../Portal');
 | 
			
		||||
 | 
			
		||||
var _Portal2 = _interopRequireDefault(_Portal);
 | 
			
		||||
 | 
			
		||||
var _addEventListener = require('../utils/addEventListener');
 | 
			
		||||
 | 
			
		||||
var _addEventListener2 = _interopRequireDefault(_addEventListener);
 | 
			
		||||
 | 
			
		||||
var _helpers = require('../utils/helpers');
 | 
			
		||||
 | 
			
		||||
var _withStyles = require('../styles/withStyles');
 | 
			
		||||
 | 
			
		||||
var _withStyles2 = _interopRequireDefault(_withStyles);
 | 
			
		||||
 | 
			
		||||
var _ModalManager = require('./ModalManager');
 | 
			
		||||
 | 
			
		||||
var _ModalManager2 = _interopRequireDefault(_ModalManager);
 | 
			
		||||
 | 
			
		||||
var _Backdrop = require('./Backdrop');
 | 
			
		||||
 | 
			
		||||
var _Backdrop2 = _interopRequireDefault(_Backdrop);
 | 
			
		||||
 | 
			
		||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 | 
			
		||||
 | 
			
		||||
function getContainer(container, defaultContainer) {
 | 
			
		||||
  container = typeof container === 'function' ? container() : container;
 | 
			
		||||
  return _reactDom2.default.findDOMNode(container) || defaultContainer;
 | 
			
		||||
} // @inheritedComponent Portal
 | 
			
		||||
 | 
			
		||||
function getHasTransition(props) {
 | 
			
		||||
  return props.children ? props.children.props.hasOwnProperty('in') : false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var styles = exports.styles = function styles(theme) {
 | 
			
		||||
  return {
 | 
			
		||||
    root: {
 | 
			
		||||
      display: 'flex',
 | 
			
		||||
      width: '100%',
 | 
			
		||||
      height: '100%',
 | 
			
		||||
      position: 'fixed',
 | 
			
		||||
      zIndex: theme.zIndex.modal,
 | 
			
		||||
      top: 0,
 | 
			
		||||
      left: 0
 | 
			
		||||
    },
 | 
			
		||||
    hidden: {
 | 
			
		||||
      visibility: 'hidden'
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
var Modal = function (_React$Component) {
 | 
			
		||||
  (0, _inherits3.default)(Modal, _React$Component);
 | 
			
		||||
 | 
			
		||||
  function Modal(props, context) {
 | 
			
		||||
    (0, _classCallCheck3.default)(this, Modal);
 | 
			
		||||
 | 
			
		||||
    var _this = (0, _possibleConstructorReturn3.default)(this, (Modal.__proto__ || (0, _getPrototypeOf2.default)(Modal)).call(this, props, context));
 | 
			
		||||
 | 
			
		||||
    _this.dialog = null;
 | 
			
		||||
    _this.mounted = false;
 | 
			
		||||
    _this.mountNode = null;
 | 
			
		||||
 | 
			
		||||
    _this.handleRendered = function () {
 | 
			
		||||
      _this.autoFocus();
 | 
			
		||||
 | 
			
		||||
      if (_this.props.onRendered) {
 | 
			
		||||
        _this.props.onRendered();
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    _this.handleOpen = function () {
 | 
			
		||||
      var doc = (0, _ownerDocument2.default)(_this.mountNode);
 | 
			
		||||
      var container = getContainer(_this.props.container, doc.body);
 | 
			
		||||
 | 
			
		||||
      _this.props.manager.add(_this, container);
 | 
			
		||||
      _this.onDocumentKeydownListener = (0, _addEventListener2.default)(doc, 'keydown', _this.handleDocumentKeyDown);
 | 
			
		||||
      _this.onFocusinListener = (0, _addEventListener2.default)(doc, 'focus', _this.enforceFocus, true);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    _this.handleClose = function () {
 | 
			
		||||
      _this.props.manager.remove(_this);
 | 
			
		||||
      _this.onDocumentKeydownListener.remove();
 | 
			
		||||
      _this.onFocusinListener.remove();
 | 
			
		||||
      _this.restoreLastFocus();
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    _this.handleExited = function () {
 | 
			
		||||
      _this.setState({ exited: true });
 | 
			
		||||
      _this.handleClose();
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    _this.handleBackdropClick = function (event) {
 | 
			
		||||
      if (event.target !== event.currentTarget) {
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (_this.props.onBackdropClick) {
 | 
			
		||||
        _this.props.onBackdropClick(event);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (!_this.props.disableBackdropClick && _this.props.onClose) {
 | 
			
		||||
        _this.props.onClose(event, 'backdropClick');
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    _this.handleDocumentKeyDown = function (event) {
 | 
			
		||||
      if (!_this.isTopModal() || (0, _keycode2.default)(event) !== 'esc') {
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (_this.props.onEscapeKeyDown) {
 | 
			
		||||
        _this.props.onEscapeKeyDown(event);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (!_this.props.disableEscapeKeyDown && _this.props.onClose) {
 | 
			
		||||
        _this.props.onClose(event, 'escapeKeyDown');
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    _this.checkForFocus = function () {
 | 
			
		||||
      if (_inDOM2.default) {
 | 
			
		||||
        _this.lastFocus = (0, _activeElement2.default)();
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    _this.enforceFocus = function () {
 | 
			
		||||
      if (_this.props.disableEnforceFocus || !_this.mounted || !_this.isTopModal()) {
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      var dialogElement = _this.getDialogElement();
 | 
			
		||||
      var currentActiveElement = (0, _activeElement2.default)((0, _ownerDocument2.default)(_this.mountNode));
 | 
			
		||||
 | 
			
		||||
      if (dialogElement && !(0, _contains2.default)(dialogElement, currentActiveElement)) {
 | 
			
		||||
        dialogElement.focus();
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    _this.state = {
 | 
			
		||||
      exited: !_this.props.open
 | 
			
		||||
    };
 | 
			
		||||
    return _this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  (0, _createClass3.default)(Modal, [{
 | 
			
		||||
    key: 'componentDidMount',
 | 
			
		||||
    value: function componentDidMount() {
 | 
			
		||||
      this.mounted = true;
 | 
			
		||||
      if (this.props.open) {
 | 
			
		||||
        this.handleOpen();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }, {
 | 
			
		||||
    key: 'componentWillReceiveProps',
 | 
			
		||||
    value: function componentWillReceiveProps(nextProps) {
 | 
			
		||||
      if (nextProps.open) {
 | 
			
		||||
        this.setState({ exited: false });
 | 
			
		||||
      } else if (!getHasTransition(nextProps)) {
 | 
			
		||||
        // Otherwise let handleExited take care of marking exited.
 | 
			
		||||
        this.setState({ exited: true });
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }, {
 | 
			
		||||
    key: 'componentWillUpdate',
 | 
			
		||||
    value: function componentWillUpdate(nextProps) {
 | 
			
		||||
      if (!this.props.open && nextProps.open) {
 | 
			
		||||
        this.checkForFocus();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }, {
 | 
			
		||||
    key: 'componentDidUpdate',
 | 
			
		||||
    value: function componentDidUpdate(prevProps) {
 | 
			
		||||
      if (prevProps.open && !this.props.open && !getHasTransition(this.props)) {
 | 
			
		||||
        // Otherwise handleExited will call this.
 | 
			
		||||
        this.handleClose();
 | 
			
		||||
      } else if (!prevProps.open && this.props.open) {
 | 
			
		||||
        this.handleOpen();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }, {
 | 
			
		||||
    key: 'componentWillUnmount',
 | 
			
		||||
    value: function componentWillUnmount() {
 | 
			
		||||
      this.mounted = false;
 | 
			
		||||
 | 
			
		||||
      if (this.props.open || getHasTransition(this.props) && !this.state.exited) {
 | 
			
		||||
        this.handleClose();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }, {
 | 
			
		||||
    key: 'getDialogElement',
 | 
			
		||||
    value: function getDialogElement() {
 | 
			
		||||
      return _reactDom2.default.findDOMNode(this.dialog);
 | 
			
		||||
    }
 | 
			
		||||
  }, {
 | 
			
		||||
    key: 'autoFocus',
 | 
			
		||||
    value: function autoFocus() {
 | 
			
		||||
      if (this.props.disableAutoFocus) {
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      var dialogElement = this.getDialogElement();
 | 
			
		||||
      var currentActiveElement = (0, _activeElement2.default)((0, _ownerDocument2.default)(this.mountNode));
 | 
			
		||||
 | 
			
		||||
      if (dialogElement && !(0, _contains2.default)(dialogElement, currentActiveElement)) {
 | 
			
		||||
        this.lastFocus = currentActiveElement;
 | 
			
		||||
 | 
			
		||||
        if (!dialogElement.hasAttribute('tabIndex')) {
 | 
			
		||||
          process.env.NODE_ENV !== "production" ? (0, _warning2.default)(false, ['Material-UI: the modal content node does not accept focus.', 'For the benefit of assistive technologies, ' + 'the tabIndex of the node is being set to "-1".'].join('\n')) : void 0;
 | 
			
		||||
          dialogElement.setAttribute('tabIndex', -1);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        dialogElement.focus();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }, {
 | 
			
		||||
    key: 'restoreLastFocus',
 | 
			
		||||
    value: function restoreLastFocus() {
 | 
			
		||||
      if (this.props.disableRestoreFocus) {
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (this.lastFocus) {
 | 
			
		||||
        this.lastFocus.focus();
 | 
			
		||||
        this.lastFocus = null;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }, {
 | 
			
		||||
    key: 'isTopModal',
 | 
			
		||||
    value: function isTopModal() {
 | 
			
		||||
      return this.props.manager.isTopModal(this);
 | 
			
		||||
    }
 | 
			
		||||
  }, {
 | 
			
		||||
    key: 'render',
 | 
			
		||||
    value: function render() {
 | 
			
		||||
      var _this2 = this;
 | 
			
		||||
 | 
			
		||||
      var _props = this.props,
 | 
			
		||||
          BackdropComponent = _props.BackdropComponent,
 | 
			
		||||
          BackdropProps = _props.BackdropProps,
 | 
			
		||||
          children = _props.children,
 | 
			
		||||
          classes = _props.classes,
 | 
			
		||||
          className = _props.className,
 | 
			
		||||
          container = _props.container,
 | 
			
		||||
          disableAutoFocus = _props.disableAutoFocus,
 | 
			
		||||
          disableBackdropClick = _props.disableBackdropClick,
 | 
			
		||||
          disableEnforceFocus = _props.disableEnforceFocus,
 | 
			
		||||
          disableEscapeKeyDown = _props.disableEscapeKeyDown,
 | 
			
		||||
          disableRestoreFocus = _props.disableRestoreFocus,
 | 
			
		||||
          hideBackdrop = _props.hideBackdrop,
 | 
			
		||||
          keepMounted = _props.keepMounted,
 | 
			
		||||
          onBackdropClick = _props.onBackdropClick,
 | 
			
		||||
          onClose = _props.onClose,
 | 
			
		||||
          onEscapeKeyDown = _props.onEscapeKeyDown,
 | 
			
		||||
          onRendered = _props.onRendered,
 | 
			
		||||
          open = _props.open,
 | 
			
		||||
          manager = _props.manager,
 | 
			
		||||
          other = (0, _objectWithoutProperties3.default)(_props, ['BackdropComponent', 'BackdropProps', 'children', 'classes', 'className', 'container', 'disableAutoFocus', 'disableBackdropClick', 'disableEnforceFocus', 'disableEscapeKeyDown', 'disableRestoreFocus', 'hideBackdrop', 'keepMounted', 'onBackdropClick', 'onClose', 'onEscapeKeyDown', 'onRendered', 'open', 'manager']);
 | 
			
		||||
      var exited = this.state.exited;
 | 
			
		||||
 | 
			
		||||
      var hasTransition = getHasTransition(this.props);
 | 
			
		||||
      var childProps = {};
 | 
			
		||||
 | 
			
		||||
      if (!keepMounted && !open && (!hasTransition || exited)) {
 | 
			
		||||
        return null;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // It's a Transition like component
 | 
			
		||||
      if (hasTransition) {
 | 
			
		||||
        childProps.onExited = (0, _helpers.createChainedFunction)(this.handleExited, children.props.onExited);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (children.props.role === undefined) {
 | 
			
		||||
        childProps.role = children.props.role || 'document';
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (children.props.tabIndex === undefined) {
 | 
			
		||||
        childProps.tabIndex = children.props.tabIndex || '-1';
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      return _react2.default.createElement(
 | 
			
		||||
        _Portal2.default,
 | 
			
		||||
        {
 | 
			
		||||
          ref: function ref(node) {
 | 
			
		||||
            _this2.mountNode = node ? node.getMountNode() : node;
 | 
			
		||||
          },
 | 
			
		||||
          container: container,
 | 
			
		||||
          onRendered: this.handleRendered
 | 
			
		||||
        },
 | 
			
		||||
        _react2.default.createElement(
 | 
			
		||||
          'div',
 | 
			
		||||
          (0, _extends3.default)({
 | 
			
		||||
            className: (0, _classnames2.default)(classes.root, className, (0, _defineProperty3.default)({}, classes.hidden, exited))
 | 
			
		||||
          }, other),
 | 
			
		||||
          hideBackdrop ? null : _react2.default.createElement(BackdropComponent, (0, _extends3.default)({ open: open, onClick: this.handleBackdropClick }, BackdropProps)),
 | 
			
		||||
          _react2.default.createElement(
 | 
			
		||||
            _RefHolder2.default,
 | 
			
		||||
            {
 | 
			
		||||
              ref: function ref(node) {
 | 
			
		||||
                _this2.dialog = node;
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            _react2.default.cloneElement(children, childProps)
 | 
			
		||||
          )
 | 
			
		||||
        )
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
  }]);
 | 
			
		||||
  return Modal;
 | 
			
		||||
}(_react2.default.Component);
 | 
			
		||||
 | 
			
		||||
Modal.propTypes = process.env.NODE_ENV !== "production" ? {
 | 
			
		||||
  /**
 | 
			
		||||
   * A backdrop component. Useful for custom backdrop rendering.
 | 
			
		||||
   */
 | 
			
		||||
  BackdropComponent: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]),
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the `Backdrop` element.
 | 
			
		||||
   */
 | 
			
		||||
  BackdropProps: _propTypes2.default.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * A single child content element.
 | 
			
		||||
   */
 | 
			
		||||
  children: _propTypes2.default.element,
 | 
			
		||||
  /**
 | 
			
		||||
   * Useful to extend the style applied to components.
 | 
			
		||||
   */
 | 
			
		||||
  classes: _propTypes2.default.object.isRequired,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  className: _propTypes2.default.string,
 | 
			
		||||
  /**
 | 
			
		||||
   * A node, component instance, or function that returns either.
 | 
			
		||||
   * The `container` will have the portal children appended to it.
 | 
			
		||||
   */
 | 
			
		||||
  container: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.func]),
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the modal will not automatically shift focus to itself when it opens, and
 | 
			
		||||
   * replace it to the last focused element when it closes.
 | 
			
		||||
   * This also works correctly with any modal children that have the `disableAutoFocus` prop.
 | 
			
		||||
   *
 | 
			
		||||
   * Generally this should never be set to `true` as it makes the modal less
 | 
			
		||||
   * accessible to assistive technologies, like screen readers.
 | 
			
		||||
   */
 | 
			
		||||
  disableAutoFocus: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, clicking the backdrop will not fire any callback.
 | 
			
		||||
   */
 | 
			
		||||
  disableBackdropClick: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the modal will not prevent focus from leaving the modal while open.
 | 
			
		||||
   *
 | 
			
		||||
   * Generally this should never be set to `true` as it makes the modal less
 | 
			
		||||
   * accessible to assistive technologies, like screen readers.
 | 
			
		||||
   */
 | 
			
		||||
  disableEnforceFocus: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, hitting escape will not fire any callback.
 | 
			
		||||
   */
 | 
			
		||||
  disableEscapeKeyDown: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the modal will not restore focus to previously focused element once
 | 
			
		||||
   * modal is hidden.
 | 
			
		||||
   */
 | 
			
		||||
  disableRestoreFocus: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the backdrop is not rendered.
 | 
			
		||||
   */
 | 
			
		||||
  hideBackdrop: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * Always keep the children in the DOM.
 | 
			
		||||
   * This property can be useful in SEO situation or
 | 
			
		||||
   * when you want to maximize the responsiveness of the Modal.
 | 
			
		||||
   */
 | 
			
		||||
  keepMounted: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * A modal manager used to track and manage the state of open
 | 
			
		||||
   * Modals. Useful when customizing how modals interact within a container.
 | 
			
		||||
   */
 | 
			
		||||
  manager: _propTypes2.default.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the backdrop is clicked.
 | 
			
		||||
   */
 | 
			
		||||
  onBackdropClick: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the component requests to be closed.
 | 
			
		||||
   * The `reason` parameter can optionally be used to control the response to `onClose`.
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   * @param {string} reason Can be:`"escapeKeyDown"`, `"backdropClick"`
 | 
			
		||||
   */
 | 
			
		||||
  onClose: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the escape key is pressed,
 | 
			
		||||
   * `disableEscapeKeyDown` is false and the modal is in focus.
 | 
			
		||||
   */
 | 
			
		||||
  onEscapeKeyDown: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired once the children has been mounted into the `container`.
 | 
			
		||||
   * It signals that the `open={true}` property took effect.
 | 
			
		||||
   */
 | 
			
		||||
  onRendered: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the modal is open.
 | 
			
		||||
   */
 | 
			
		||||
  open: _propTypes2.default.bool.isRequired
 | 
			
		||||
} : {};
 | 
			
		||||
 | 
			
		||||
Modal.defaultProps = {
 | 
			
		||||
  disableAutoFocus: false,
 | 
			
		||||
  disableBackdropClick: false,
 | 
			
		||||
  disableEnforceFocus: false,
 | 
			
		||||
  disableEscapeKeyDown: false,
 | 
			
		||||
  disableRestoreFocus: false,
 | 
			
		||||
  hideBackdrop: false,
 | 
			
		||||
  keepMounted: false,
 | 
			
		||||
  // Modals don't open on the server so this won't conflict with concurrent requests.
 | 
			
		||||
  manager: new _ModalManager2.default(),
 | 
			
		||||
  BackdropComponent: _Backdrop2.default
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.default = (0, _withStyles2.default)(styles, { flip: false, name: 'MuiModal' })(Modal);
 | 
			
		||||
							
								
								
									
										404
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/Modal.js.flow
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										404
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/Modal.js.flow
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,404 @@
 | 
			
		||||
// @inheritedComponent Portal
 | 
			
		||||
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import ReactDOM from 'react-dom';
 | 
			
		||||
import PropTypes from 'prop-types';
 | 
			
		||||
import classNames from 'classnames';
 | 
			
		||||
import warning from 'warning';
 | 
			
		||||
import keycode from 'keycode';
 | 
			
		||||
import activeElement from 'dom-helpers/activeElement';
 | 
			
		||||
import contains from 'dom-helpers/query/contains';
 | 
			
		||||
import inDOM from 'dom-helpers/util/inDOM';
 | 
			
		||||
import ownerDocument from 'dom-helpers/ownerDocument';
 | 
			
		||||
import RefHolder from '../internal/RefHolder';
 | 
			
		||||
import Portal from '../Portal';
 | 
			
		||||
import addEventListener from '../utils/addEventListener';
 | 
			
		||||
import { createChainedFunction } from '../utils/helpers';
 | 
			
		||||
import withStyles from '../styles/withStyles';
 | 
			
		||||
import ModalManager from './ModalManager';
 | 
			
		||||
import Backdrop from './Backdrop';
 | 
			
		||||
 | 
			
		||||
function getContainer(container, defaultContainer) {
 | 
			
		||||
  container = typeof container === 'function' ? container() : container;
 | 
			
		||||
  return ReactDOM.findDOMNode(container) || defaultContainer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getHasTransition(props) {
 | 
			
		||||
  return props.children ? props.children.props.hasOwnProperty('in') : false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const styles = theme => ({
 | 
			
		||||
  root: {
 | 
			
		||||
    display: 'flex',
 | 
			
		||||
    width: '100%',
 | 
			
		||||
    height: '100%',
 | 
			
		||||
    position: 'fixed',
 | 
			
		||||
    zIndex: theme.zIndex.modal,
 | 
			
		||||
    top: 0,
 | 
			
		||||
    left: 0,
 | 
			
		||||
  },
 | 
			
		||||
  hidden: {
 | 
			
		||||
    visibility: 'hidden',
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
class Modal extends React.Component {
 | 
			
		||||
  constructor(props, context) {
 | 
			
		||||
    super(props, context);
 | 
			
		||||
    this.state = {
 | 
			
		||||
      exited: !this.props.open,
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  componentDidMount() {
 | 
			
		||||
    this.mounted = true;
 | 
			
		||||
    if (this.props.open) {
 | 
			
		||||
      this.handleOpen();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  componentWillReceiveProps(nextProps) {
 | 
			
		||||
    if (nextProps.open) {
 | 
			
		||||
      this.setState({ exited: false });
 | 
			
		||||
    } else if (!getHasTransition(nextProps)) {
 | 
			
		||||
      // Otherwise let handleExited take care of marking exited.
 | 
			
		||||
      this.setState({ exited: true });
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  componentWillUpdate(nextProps) {
 | 
			
		||||
    if (!this.props.open && nextProps.open) {
 | 
			
		||||
      this.checkForFocus();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  componentDidUpdate(prevProps) {
 | 
			
		||||
    if (prevProps.open && !this.props.open && !getHasTransition(this.props)) {
 | 
			
		||||
      // Otherwise handleExited will call this.
 | 
			
		||||
      this.handleClose();
 | 
			
		||||
    } else if (!prevProps.open && this.props.open) {
 | 
			
		||||
      this.handleOpen();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  componentWillUnmount() {
 | 
			
		||||
    this.mounted = false;
 | 
			
		||||
 | 
			
		||||
    if (this.props.open || (getHasTransition(this.props) && !this.state.exited)) {
 | 
			
		||||
      this.handleClose();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getDialogElement() {
 | 
			
		||||
    return ReactDOM.findDOMNode(this.dialog);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  dialog = null;
 | 
			
		||||
  mounted = false;
 | 
			
		||||
  mountNode = null;
 | 
			
		||||
 | 
			
		||||
  handleRendered = () => {
 | 
			
		||||
    this.autoFocus();
 | 
			
		||||
 | 
			
		||||
    if (this.props.onRendered) {
 | 
			
		||||
      this.props.onRendered();
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  handleOpen = () => {
 | 
			
		||||
    const doc = ownerDocument(this.mountNode);
 | 
			
		||||
    const container = getContainer(this.props.container, doc.body);
 | 
			
		||||
 | 
			
		||||
    this.props.manager.add(this, container);
 | 
			
		||||
    this.onDocumentKeydownListener = addEventListener(doc, 'keydown', this.handleDocumentKeyDown);
 | 
			
		||||
    this.onFocusinListener = addEventListener(doc, 'focus', this.enforceFocus, true);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  handleClose = () => {
 | 
			
		||||
    this.props.manager.remove(this);
 | 
			
		||||
    this.onDocumentKeydownListener.remove();
 | 
			
		||||
    this.onFocusinListener.remove();
 | 
			
		||||
    this.restoreLastFocus();
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  handleExited = () => {
 | 
			
		||||
    this.setState({ exited: true });
 | 
			
		||||
    this.handleClose();
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  handleBackdropClick = event => {
 | 
			
		||||
    if (event.target !== event.currentTarget) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (this.props.onBackdropClick) {
 | 
			
		||||
      this.props.onBackdropClick(event);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!this.props.disableBackdropClick && this.props.onClose) {
 | 
			
		||||
      this.props.onClose(event, 'backdropClick');
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  handleDocumentKeyDown = event => {
 | 
			
		||||
    if (!this.isTopModal() || keycode(event) !== 'esc') {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (this.props.onEscapeKeyDown) {
 | 
			
		||||
      this.props.onEscapeKeyDown(event);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!this.props.disableEscapeKeyDown && this.props.onClose) {
 | 
			
		||||
      this.props.onClose(event, 'escapeKeyDown');
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  checkForFocus = () => {
 | 
			
		||||
    if (inDOM) {
 | 
			
		||||
      this.lastFocus = activeElement();
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  autoFocus() {
 | 
			
		||||
    if (this.props.disableAutoFocus) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const dialogElement = this.getDialogElement();
 | 
			
		||||
    const currentActiveElement = activeElement(ownerDocument(this.mountNode));
 | 
			
		||||
 | 
			
		||||
    if (dialogElement && !contains(dialogElement, currentActiveElement)) {
 | 
			
		||||
      this.lastFocus = currentActiveElement;
 | 
			
		||||
 | 
			
		||||
      if (!dialogElement.hasAttribute('tabIndex')) {
 | 
			
		||||
        warning(
 | 
			
		||||
          false,
 | 
			
		||||
          [
 | 
			
		||||
            'Material-UI: the modal content node does not accept focus.',
 | 
			
		||||
            'For the benefit of assistive technologies, ' +
 | 
			
		||||
              'the tabIndex of the node is being set to "-1".',
 | 
			
		||||
          ].join('\n'),
 | 
			
		||||
        );
 | 
			
		||||
        dialogElement.setAttribute('tabIndex', -1);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      dialogElement.focus();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  restoreLastFocus() {
 | 
			
		||||
    if (this.props.disableRestoreFocus) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (this.lastFocus) {
 | 
			
		||||
      this.lastFocus.focus();
 | 
			
		||||
      this.lastFocus = null;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  enforceFocus = () => {
 | 
			
		||||
    if (this.props.disableEnforceFocus || !this.mounted || !this.isTopModal()) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const dialogElement = this.getDialogElement();
 | 
			
		||||
    const currentActiveElement = activeElement(ownerDocument(this.mountNode));
 | 
			
		||||
 | 
			
		||||
    if (dialogElement && !contains(dialogElement, currentActiveElement)) {
 | 
			
		||||
      dialogElement.focus();
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  isTopModal() {
 | 
			
		||||
    return this.props.manager.isTopModal(this);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  render() {
 | 
			
		||||
    const {
 | 
			
		||||
      BackdropComponent,
 | 
			
		||||
      BackdropProps,
 | 
			
		||||
      children,
 | 
			
		||||
      classes,
 | 
			
		||||
      className,
 | 
			
		||||
      container,
 | 
			
		||||
      disableAutoFocus,
 | 
			
		||||
      disableBackdropClick,
 | 
			
		||||
      disableEnforceFocus,
 | 
			
		||||
      disableEscapeKeyDown,
 | 
			
		||||
      disableRestoreFocus,
 | 
			
		||||
      hideBackdrop,
 | 
			
		||||
      keepMounted,
 | 
			
		||||
      onBackdropClick,
 | 
			
		||||
      onClose,
 | 
			
		||||
      onEscapeKeyDown,
 | 
			
		||||
      onRendered,
 | 
			
		||||
      open,
 | 
			
		||||
      manager,
 | 
			
		||||
      ...other
 | 
			
		||||
    } = this.props;
 | 
			
		||||
    const { exited } = this.state;
 | 
			
		||||
    const hasTransition = getHasTransition(this.props);
 | 
			
		||||
    const childProps = {};
 | 
			
		||||
 | 
			
		||||
    if (!keepMounted && !open && (!hasTransition || exited)) {
 | 
			
		||||
      return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // It's a Transition like component
 | 
			
		||||
    if (hasTransition) {
 | 
			
		||||
      childProps.onExited = createChainedFunction(this.handleExited, children.props.onExited);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (children.props.role === undefined) {
 | 
			
		||||
      childProps.role = children.props.role || 'document';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (children.props.tabIndex === undefined) {
 | 
			
		||||
      childProps.tabIndex = children.props.tabIndex || '-1';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return (
 | 
			
		||||
      <Portal
 | 
			
		||||
        ref={node => {
 | 
			
		||||
          this.mountNode = node ? node.getMountNode() : node;
 | 
			
		||||
        }}
 | 
			
		||||
        container={container}
 | 
			
		||||
        onRendered={this.handleRendered}
 | 
			
		||||
      >
 | 
			
		||||
        <div
 | 
			
		||||
          data-mui-test="Modal"
 | 
			
		||||
          className={classNames(classes.root, className, {
 | 
			
		||||
            [classes.hidden]: exited,
 | 
			
		||||
          })}
 | 
			
		||||
          {...other}
 | 
			
		||||
        >
 | 
			
		||||
          {hideBackdrop ? null : (
 | 
			
		||||
            <BackdropComponent open={open} onClick={this.handleBackdropClick} {...BackdropProps} />
 | 
			
		||||
          )}
 | 
			
		||||
          <RefHolder
 | 
			
		||||
            ref={node => {
 | 
			
		||||
              this.dialog = node;
 | 
			
		||||
            }}
 | 
			
		||||
          >
 | 
			
		||||
            {React.cloneElement(children, childProps)}
 | 
			
		||||
          </RefHolder>
 | 
			
		||||
        </div>
 | 
			
		||||
      </Portal>
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Modal.propTypes = {
 | 
			
		||||
  /**
 | 
			
		||||
   * A backdrop component. Useful for custom backdrop rendering.
 | 
			
		||||
   */
 | 
			
		||||
  BackdropComponent: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the `Backdrop` element.
 | 
			
		||||
   */
 | 
			
		||||
  BackdropProps: PropTypes.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * A single child content element.
 | 
			
		||||
   */
 | 
			
		||||
  children: PropTypes.element,
 | 
			
		||||
  /**
 | 
			
		||||
   * Useful to extend the style applied to components.
 | 
			
		||||
   */
 | 
			
		||||
  classes: PropTypes.object.isRequired,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  className: PropTypes.string,
 | 
			
		||||
  /**
 | 
			
		||||
   * A node, component instance, or function that returns either.
 | 
			
		||||
   * The `container` will have the portal children appended to it.
 | 
			
		||||
   */
 | 
			
		||||
  container: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the modal will not automatically shift focus to itself when it opens, and
 | 
			
		||||
   * replace it to the last focused element when it closes.
 | 
			
		||||
   * This also works correctly with any modal children that have the `disableAutoFocus` prop.
 | 
			
		||||
   *
 | 
			
		||||
   * Generally this should never be set to `true` as it makes the modal less
 | 
			
		||||
   * accessible to assistive technologies, like screen readers.
 | 
			
		||||
   */
 | 
			
		||||
  disableAutoFocus: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, clicking the backdrop will not fire any callback.
 | 
			
		||||
   */
 | 
			
		||||
  disableBackdropClick: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the modal will not prevent focus from leaving the modal while open.
 | 
			
		||||
   *
 | 
			
		||||
   * Generally this should never be set to `true` as it makes the modal less
 | 
			
		||||
   * accessible to assistive technologies, like screen readers.
 | 
			
		||||
   */
 | 
			
		||||
  disableEnforceFocus: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, hitting escape will not fire any callback.
 | 
			
		||||
   */
 | 
			
		||||
  disableEscapeKeyDown: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the modal will not restore focus to previously focused element once
 | 
			
		||||
   * modal is hidden.
 | 
			
		||||
   */
 | 
			
		||||
  disableRestoreFocus: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the backdrop is not rendered.
 | 
			
		||||
   */
 | 
			
		||||
  hideBackdrop: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * Always keep the children in the DOM.
 | 
			
		||||
   * This property can be useful in SEO situation or
 | 
			
		||||
   * when you want to maximize the responsiveness of the Modal.
 | 
			
		||||
   */
 | 
			
		||||
  keepMounted: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * A modal manager used to track and manage the state of open
 | 
			
		||||
   * Modals. Useful when customizing how modals interact within a container.
 | 
			
		||||
   */
 | 
			
		||||
  manager: PropTypes.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the backdrop is clicked.
 | 
			
		||||
   */
 | 
			
		||||
  onBackdropClick: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the component requests to be closed.
 | 
			
		||||
   * The `reason` parameter can optionally be used to control the response to `onClose`.
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   * @param {string} reason Can be:`"escapeKeyDown"`, `"backdropClick"`
 | 
			
		||||
   */
 | 
			
		||||
  onClose: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the escape key is pressed,
 | 
			
		||||
   * `disableEscapeKeyDown` is false and the modal is in focus.
 | 
			
		||||
   */
 | 
			
		||||
  onEscapeKeyDown: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired once the children has been mounted into the `container`.
 | 
			
		||||
   * It signals that the `open={true}` property took effect.
 | 
			
		||||
   */
 | 
			
		||||
  onRendered: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the modal is open.
 | 
			
		||||
   */
 | 
			
		||||
  open: PropTypes.bool.isRequired,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Modal.defaultProps = {
 | 
			
		||||
  disableAutoFocus: false,
 | 
			
		||||
  disableBackdropClick: false,
 | 
			
		||||
  disableEnforceFocus: false,
 | 
			
		||||
  disableEscapeKeyDown: false,
 | 
			
		||||
  disableRestoreFocus: false,
 | 
			
		||||
  hideBackdrop: false,
 | 
			
		||||
  keepMounted: false,
 | 
			
		||||
  // Modals don't open on the server so this won't conflict with concurrent requests.
 | 
			
		||||
  manager: new ModalManager(),
 | 
			
		||||
  BackdropComponent: Backdrop,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default withStyles(styles, { flip: false, name: 'MuiModal' })(Modal);
 | 
			
		||||
							
								
								
									
										8
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/ModalManager.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/ModalManager.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
declare class ModalManager {
 | 
			
		||||
  constructor(opts?: { hideSiblingNodes?: boolean; handleContainerOverflow?: boolean });
 | 
			
		||||
  add(modal: any, container: any): number;
 | 
			
		||||
  remove(modal: any): void;
 | 
			
		||||
  isTopModal(modal: any): boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default ModalManager;
 | 
			
		||||
							
								
								
									
										200
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/ModalManager.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										200
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/ModalManager.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,200 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, "__esModule", {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
 | 
			
		||||
 | 
			
		||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
 | 
			
		||||
 | 
			
		||||
var _keys = require('babel-runtime/core-js/object/keys');
 | 
			
		||||
 | 
			
		||||
var _keys2 = _interopRequireDefault(_keys);
 | 
			
		||||
 | 
			
		||||
var _style = require('dom-helpers/style');
 | 
			
		||||
 | 
			
		||||
var _style2 = _interopRequireDefault(_style);
 | 
			
		||||
 | 
			
		||||
var _ownerDocument = require('dom-helpers/ownerDocument');
 | 
			
		||||
 | 
			
		||||
var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
 | 
			
		||||
 | 
			
		||||
var _scrollbarSize = require('dom-helpers/util/scrollbarSize');
 | 
			
		||||
 | 
			
		||||
var _scrollbarSize2 = _interopRequireDefault(_scrollbarSize);
 | 
			
		||||
 | 
			
		||||
var _isOverflowing = require('./isOverflowing');
 | 
			
		||||
 | 
			
		||||
var _isOverflowing2 = _interopRequireDefault(_isOverflowing);
 | 
			
		||||
 | 
			
		||||
var _manageAriaHidden = require('./manageAriaHidden');
 | 
			
		||||
 | 
			
		||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 | 
			
		||||
 | 
			
		||||
function findIndexOf(data, callback) {
 | 
			
		||||
  var idx = -1;
 | 
			
		||||
  data.some(function (item, index) {
 | 
			
		||||
    if (callback(item)) {
 | 
			
		||||
      idx = index;
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
  });
 | 
			
		||||
  return idx;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function findContainer(data, modal) {
 | 
			
		||||
  return findIndexOf(data, function (item) {
 | 
			
		||||
    return item.modals.indexOf(modal) !== -1;
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getPaddingRight(node) {
 | 
			
		||||
  return parseInt((0, _style2.default)(node, 'paddingRight') || 0, 10);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setContainerStyle(data, container) {
 | 
			
		||||
  var style = { overflow: 'hidden' };
 | 
			
		||||
 | 
			
		||||
  // We are only interested in the actual `style` here because we will override it.
 | 
			
		||||
  data.style = {
 | 
			
		||||
    overflow: container.style.overflow,
 | 
			
		||||
    paddingRight: container.style.paddingRight
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  if (data.overflowing) {
 | 
			
		||||
    var scrollbarSize = (0, _scrollbarSize2.default)();
 | 
			
		||||
 | 
			
		||||
    // Use computed style, here to get the real padding to add our scrollbar width.
 | 
			
		||||
    style.paddingRight = getPaddingRight(container) + scrollbarSize + 'px';
 | 
			
		||||
 | 
			
		||||
    // .mui-fixed is a global helper.
 | 
			
		||||
    var fixedNodes = (0, _ownerDocument2.default)(container).querySelectorAll('.mui-fixed');
 | 
			
		||||
    for (var i = 0; i < fixedNodes.length; i += 1) {
 | 
			
		||||
      var paddingRight = getPaddingRight(fixedNodes[i]);
 | 
			
		||||
      data.prevPaddings.push(paddingRight);
 | 
			
		||||
      fixedNodes[i].style.paddingRight = paddingRight + scrollbarSize + 'px';
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  (0, _keys2.default)(style).forEach(function (key) {
 | 
			
		||||
    container.style[key] = style[key];
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function removeContainerStyle(data, container) {
 | 
			
		||||
  (0, _keys2.default)(data.style).forEach(function (key) {
 | 
			
		||||
    container.style[key] = data.style[key];
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  var fixedNodes = (0, _ownerDocument2.default)(container).querySelectorAll('.mui-fixed');
 | 
			
		||||
  for (var i = 0; i < fixedNodes.length; i += 1) {
 | 
			
		||||
    fixedNodes[i].style.paddingRight = data.prevPaddings[i] + 'px';
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @ignore - do not document.
 | 
			
		||||
 *
 | 
			
		||||
 * Proper state managment for containers and the modals in those containers.
 | 
			
		||||
 * Simplified, but inspired by react-overlay's ModalManager class
 | 
			
		||||
 * Used by the Modal to ensure proper styling of containers.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
var ModalManager = function ModalManager() {
 | 
			
		||||
  var _this = this;
 | 
			
		||||
 | 
			
		||||
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
 | 
			
		||||
      _ref$hideSiblingNodes = _ref.hideSiblingNodes,
 | 
			
		||||
      hideSiblingNodes = _ref$hideSiblingNodes === undefined ? true : _ref$hideSiblingNodes,
 | 
			
		||||
      _ref$handleContainerO = _ref.handleContainerOverflow,
 | 
			
		||||
      handleContainerOverflow = _ref$handleContainerO === undefined ? true : _ref$handleContainerO;
 | 
			
		||||
 | 
			
		||||
  (0, _classCallCheck3.default)(this, ModalManager);
 | 
			
		||||
 | 
			
		||||
  this.add = function (modal, container) {
 | 
			
		||||
    var modalIdx = _this.modals.indexOf(modal);
 | 
			
		||||
    var containerIdx = _this.containers.indexOf(container);
 | 
			
		||||
 | 
			
		||||
    if (modalIdx !== -1) {
 | 
			
		||||
      return modalIdx;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    modalIdx = _this.modals.length;
 | 
			
		||||
    _this.modals.push(modal);
 | 
			
		||||
 | 
			
		||||
    if (_this.hideSiblingNodes) {
 | 
			
		||||
      (0, _manageAriaHidden.hideSiblings)(container, modal.mountNode);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (containerIdx !== -1) {
 | 
			
		||||
      _this.data[containerIdx].modals.push(modal);
 | 
			
		||||
      return modalIdx;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var data = {
 | 
			
		||||
      modals: [modal],
 | 
			
		||||
      overflowing: (0, _isOverflowing2.default)(container),
 | 
			
		||||
      prevPaddings: []
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    if (_this.handleContainerOverflow) {
 | 
			
		||||
      setContainerStyle(data, container);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _this.containers.push(container);
 | 
			
		||||
    _this.data.push(data);
 | 
			
		||||
 | 
			
		||||
    return modalIdx;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  this.remove = function (modal) {
 | 
			
		||||
    var modalIdx = _this.modals.indexOf(modal);
 | 
			
		||||
 | 
			
		||||
    if (modalIdx === -1) {
 | 
			
		||||
      return modalIdx;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var containerIdx = findContainer(_this.data, modal);
 | 
			
		||||
    var data = _this.data[containerIdx];
 | 
			
		||||
    var container = _this.containers[containerIdx];
 | 
			
		||||
 | 
			
		||||
    data.modals.splice(data.modals.indexOf(modal), 1);
 | 
			
		||||
    _this.modals.splice(modalIdx, 1);
 | 
			
		||||
 | 
			
		||||
    // If that was the last modal in a container, clean up the container.
 | 
			
		||||
    if (data.modals.length === 0) {
 | 
			
		||||
      if (_this.handleContainerOverflow) {
 | 
			
		||||
        removeContainerStyle(data, container);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (_this.hideSiblingNodes) {
 | 
			
		||||
        (0, _manageAriaHidden.showSiblings)(container, modal.mountNode);
 | 
			
		||||
      }
 | 
			
		||||
      _this.containers.splice(containerIdx, 1);
 | 
			
		||||
      _this.data.splice(containerIdx, 1);
 | 
			
		||||
    } else if (_this.hideSiblingNodes) {
 | 
			
		||||
      // Otherwise make sure the next top modal is visible to a SR.
 | 
			
		||||
      (0, _manageAriaHidden.ariaHidden)(false, data.modals[data.modals.length - 1].mountNode);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return modalIdx;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  this.isTopModal = function (modal) {
 | 
			
		||||
    return !!_this.modals.length && _this.modals[_this.modals.length - 1] === modal;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  this.hideSiblingNodes = hideSiblingNodes;
 | 
			
		||||
  this.handleContainerOverflow = handleContainerOverflow;
 | 
			
		||||
  // this.modals[modalIdx] = modal
 | 
			
		||||
  this.modals = [];
 | 
			
		||||
  // this.containers[containerIdx] = container
 | 
			
		||||
  this.containers = [];
 | 
			
		||||
  // this.data[containerIdx] = {
 | 
			
		||||
  //   modals: [],
 | 
			
		||||
  // }
 | 
			
		||||
  this.data = [];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.default = ModalManager;
 | 
			
		||||
							
								
								
									
										161
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/ModalManager.js.flow
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										161
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/ModalManager.js.flow
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,161 @@
 | 
			
		||||
import css from 'dom-helpers/style';
 | 
			
		||||
import ownerDocument from 'dom-helpers/ownerDocument';
 | 
			
		||||
import getScrollbarSize from 'dom-helpers/util/scrollbarSize';
 | 
			
		||||
import isOverflowing from './isOverflowing';
 | 
			
		||||
import { ariaHidden, hideSiblings, showSiblings } from './manageAriaHidden';
 | 
			
		||||
 | 
			
		||||
function findIndexOf(data, callback) {
 | 
			
		||||
  let idx = -1;
 | 
			
		||||
  data.some((item, index) => {
 | 
			
		||||
    if (callback(item)) {
 | 
			
		||||
      idx = index;
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
  });
 | 
			
		||||
  return idx;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function findContainer(data, modal) {
 | 
			
		||||
  return findIndexOf(data, item => item.modals.indexOf(modal) !== -1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getPaddingRight(node) {
 | 
			
		||||
  return parseInt(css(node, 'paddingRight') || 0, 10);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setContainerStyle(data, container) {
 | 
			
		||||
  const style = { overflow: 'hidden' };
 | 
			
		||||
 | 
			
		||||
  // We are only interested in the actual `style` here because we will override it.
 | 
			
		||||
  data.style = {
 | 
			
		||||
    overflow: container.style.overflow,
 | 
			
		||||
    paddingRight: container.style.paddingRight,
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  if (data.overflowing) {
 | 
			
		||||
    const scrollbarSize = getScrollbarSize();
 | 
			
		||||
 | 
			
		||||
    // Use computed style, here to get the real padding to add our scrollbar width.
 | 
			
		||||
    style.paddingRight = `${getPaddingRight(container) + scrollbarSize}px`;
 | 
			
		||||
 | 
			
		||||
    // .mui-fixed is a global helper.
 | 
			
		||||
    const fixedNodes = ownerDocument(container).querySelectorAll('.mui-fixed');
 | 
			
		||||
    for (let i = 0; i < fixedNodes.length; i += 1) {
 | 
			
		||||
      const paddingRight = getPaddingRight(fixedNodes[i]);
 | 
			
		||||
      data.prevPaddings.push(paddingRight);
 | 
			
		||||
      fixedNodes[i].style.paddingRight = `${paddingRight + scrollbarSize}px`;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Object.keys(style).forEach(key => {
 | 
			
		||||
    container.style[key] = style[key];
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function removeContainerStyle(data, container) {
 | 
			
		||||
  Object.keys(data.style).forEach(key => {
 | 
			
		||||
    container.style[key] = data.style[key];
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  const fixedNodes = ownerDocument(container).querySelectorAll('.mui-fixed');
 | 
			
		||||
  for (let i = 0; i < fixedNodes.length; i += 1) {
 | 
			
		||||
    fixedNodes[i].style.paddingRight = `${data.prevPaddings[i]}px`;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @ignore - do not document.
 | 
			
		||||
 *
 | 
			
		||||
 * Proper state managment for containers and the modals in those containers.
 | 
			
		||||
 * Simplified, but inspired by react-overlay's ModalManager class
 | 
			
		||||
 * Used by the Modal to ensure proper styling of containers.
 | 
			
		||||
 */
 | 
			
		||||
class ModalManager {
 | 
			
		||||
  constructor({ hideSiblingNodes = true, handleContainerOverflow = true } = {}) {
 | 
			
		||||
    this.hideSiblingNodes = hideSiblingNodes;
 | 
			
		||||
    this.handleContainerOverflow = handleContainerOverflow;
 | 
			
		||||
    // this.modals[modalIdx] = modal
 | 
			
		||||
    this.modals = [];
 | 
			
		||||
    // this.containers[containerIdx] = container
 | 
			
		||||
    this.containers = [];
 | 
			
		||||
    // this.data[containerIdx] = {
 | 
			
		||||
    //   modals: [],
 | 
			
		||||
    // }
 | 
			
		||||
    this.data = [];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  add = (modal, container) => {
 | 
			
		||||
    let modalIdx = this.modals.indexOf(modal);
 | 
			
		||||
    const containerIdx = this.containers.indexOf(container);
 | 
			
		||||
 | 
			
		||||
    if (modalIdx !== -1) {
 | 
			
		||||
      return modalIdx;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    modalIdx = this.modals.length;
 | 
			
		||||
    this.modals.push(modal);
 | 
			
		||||
 | 
			
		||||
    if (this.hideSiblingNodes) {
 | 
			
		||||
      hideSiblings(container, modal.mountNode);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (containerIdx !== -1) {
 | 
			
		||||
      this.data[containerIdx].modals.push(modal);
 | 
			
		||||
      return modalIdx;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const data = {
 | 
			
		||||
      modals: [modal],
 | 
			
		||||
      overflowing: isOverflowing(container),
 | 
			
		||||
      prevPaddings: [],
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    if (this.handleContainerOverflow) {
 | 
			
		||||
      setContainerStyle(data, container);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.containers.push(container);
 | 
			
		||||
    this.data.push(data);
 | 
			
		||||
 | 
			
		||||
    return modalIdx;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  remove = modal => {
 | 
			
		||||
    const modalIdx = this.modals.indexOf(modal);
 | 
			
		||||
 | 
			
		||||
    if (modalIdx === -1) {
 | 
			
		||||
      return modalIdx;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const containerIdx = findContainer(this.data, modal);
 | 
			
		||||
    const data = this.data[containerIdx];
 | 
			
		||||
    const container = this.containers[containerIdx];
 | 
			
		||||
 | 
			
		||||
    data.modals.splice(data.modals.indexOf(modal), 1);
 | 
			
		||||
    this.modals.splice(modalIdx, 1);
 | 
			
		||||
 | 
			
		||||
    // If that was the last modal in a container, clean up the container.
 | 
			
		||||
    if (data.modals.length === 0) {
 | 
			
		||||
      if (this.handleContainerOverflow) {
 | 
			
		||||
        removeContainerStyle(data, container);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (this.hideSiblingNodes) {
 | 
			
		||||
        showSiblings(container, modal.mountNode);
 | 
			
		||||
      }
 | 
			
		||||
      this.containers.splice(containerIdx, 1);
 | 
			
		||||
      this.data.splice(containerIdx, 1);
 | 
			
		||||
    } else if (this.hideSiblingNodes) {
 | 
			
		||||
      // Otherwise make sure the next top modal is visible to a SR.
 | 
			
		||||
      ariaHidden(false, data.modals[data.modals.length - 1].mountNode);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return modalIdx;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  isTopModal = modal => {
 | 
			
		||||
    return !!this.modals.length && this.modals[this.modals.length - 1] === modal;
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default ModalManager;
 | 
			
		||||
							
								
								
									
										6
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
export { default } from './Modal';
 | 
			
		||||
export * from './Modal';
 | 
			
		||||
export { default as Backdrop } from './Backdrop';
 | 
			
		||||
export * from './Backdrop';
 | 
			
		||||
export { default as ModalManager } from './ModalManager';
 | 
			
		||||
export * from './ModalManager';
 | 
			
		||||
							
								
								
									
										34
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, "__esModule", {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
var _Modal = require('./Modal');
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, 'default', {
 | 
			
		||||
  enumerable: true,
 | 
			
		||||
  get: function get() {
 | 
			
		||||
    return _interopRequireDefault(_Modal).default;
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
var _Backdrop = require('./Backdrop');
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, 'Backdrop', {
 | 
			
		||||
  enumerable: true,
 | 
			
		||||
  get: function get() {
 | 
			
		||||
    return _interopRequireDefault(_Backdrop).default;
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
var _ModalManager = require('./ModalManager');
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, 'ModalManager', {
 | 
			
		||||
  enumerable: true,
 | 
			
		||||
  get: function get() {
 | 
			
		||||
    return _interopRequireDefault(_ModalManager).default;
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 | 
			
		||||
							
								
								
									
										3
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/index.js.flow
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/index.js.flow
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
export { default } from './Modal';
 | 
			
		||||
export { default as Backdrop } from './Backdrop';
 | 
			
		||||
export { default as ModalManager } from './ModalManager';
 | 
			
		||||
							
								
								
									
										43
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/isOverflowing.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/isOverflowing.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, "__esModule", {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.isBody = isBody;
 | 
			
		||||
exports.default = isOverflowing;
 | 
			
		||||
 | 
			
		||||
var _isWindow = require('dom-helpers/query/isWindow');
 | 
			
		||||
 | 
			
		||||
var _isWindow2 = _interopRequireDefault(_isWindow);
 | 
			
		||||
 | 
			
		||||
var _ownerDocument = require('dom-helpers/ownerDocument');
 | 
			
		||||
 | 
			
		||||
var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
 | 
			
		||||
 | 
			
		||||
var _ownerWindow = require('dom-helpers/ownerWindow');
 | 
			
		||||
 | 
			
		||||
var _ownerWindow2 = _interopRequireDefault(_ownerWindow);
 | 
			
		||||
 | 
			
		||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 | 
			
		||||
 | 
			
		||||
function isBody(node) {
 | 
			
		||||
  return node && node.tagName.toLowerCase() === 'body';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Do we have a scroll bar?
 | 
			
		||||
function isOverflowing(container) {
 | 
			
		||||
  var doc = (0, _ownerDocument2.default)(container);
 | 
			
		||||
  var win = (0, _ownerWindow2.default)(doc);
 | 
			
		||||
 | 
			
		||||
  /* istanbul ignore next */
 | 
			
		||||
  if (!(0, _isWindow2.default)(doc) && !isBody(container)) {
 | 
			
		||||
    return container.scrollHeight > container.clientHeight;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Takes in account potential non zero margin on the body.
 | 
			
		||||
  var style = win.getComputedStyle(doc.body);
 | 
			
		||||
  var marginLeft = parseInt(style.getPropertyValue('margin-left'), 10);
 | 
			
		||||
  var marginRight = parseInt(style.getPropertyValue('margin-right'), 10);
 | 
			
		||||
 | 
			
		||||
  return marginLeft + doc.body.clientWidth + marginRight < win.innerWidth;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/isOverflowing.js.flow
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/isOverflowing.js.flow
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
import isWindow from 'dom-helpers/query/isWindow';
 | 
			
		||||
import ownerDocument from 'dom-helpers/ownerDocument';
 | 
			
		||||
import ownerWindow from 'dom-helpers/ownerWindow';
 | 
			
		||||
 | 
			
		||||
export function isBody(node) {
 | 
			
		||||
  return node && node.tagName.toLowerCase() === 'body';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Do we have a scroll bar?
 | 
			
		||||
export default function isOverflowing(container) {
 | 
			
		||||
  const doc = ownerDocument(container);
 | 
			
		||||
  const win = ownerWindow(doc);
 | 
			
		||||
 | 
			
		||||
  /* istanbul ignore next */
 | 
			
		||||
  if (!isWindow(doc) && !isBody(container)) {
 | 
			
		||||
    return container.scrollHeight > container.clientHeight;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Takes in account potential non zero margin on the body.
 | 
			
		||||
  const style = win.getComputedStyle(doc.body);
 | 
			
		||||
  const marginLeft = parseInt(style.getPropertyValue('margin-left'), 10);
 | 
			
		||||
  const marginRight = parseInt(style.getPropertyValue('margin-right'), 10);
 | 
			
		||||
 | 
			
		||||
  return marginLeft + doc.body.clientWidth + marginRight < win.innerWidth;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										3
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/manageAriaHidden.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/manageAriaHidden.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
export function ariaHidden(show: boolean, node: Node): never;
 | 
			
		||||
export function hideSiblings(container: Element, mountNode: Node): never;
 | 
			
		||||
export function showSiblings(container: Element, mountNode: Node): never;
 | 
			
		||||
							
								
								
									
										45
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/manageAriaHidden.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/manageAriaHidden.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, "__esModule", {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.ariaHidden = ariaHidden;
 | 
			
		||||
exports.hideSiblings = hideSiblings;
 | 
			
		||||
exports.showSiblings = showSiblings;
 | 
			
		||||
var BLACKLIST = ['template', 'script', 'style'];
 | 
			
		||||
 | 
			
		||||
function isHidable(node) {
 | 
			
		||||
  return node.nodeType === 1 && BLACKLIST.indexOf(node.tagName.toLowerCase()) === -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function siblings(container, mount, callback) {
 | 
			
		||||
  mount = [].concat(mount); // eslint-disable-line no-param-reassign
 | 
			
		||||
  [].forEach.call(container.children, function (node) {
 | 
			
		||||
    if (mount.indexOf(node) === -1 && isHidable(node)) {
 | 
			
		||||
      callback(node);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function ariaHidden(show, node) {
 | 
			
		||||
  if (!node) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if (show) {
 | 
			
		||||
    node.setAttribute('aria-hidden', 'true');
 | 
			
		||||
  } else {
 | 
			
		||||
    node.removeAttribute('aria-hidden');
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function hideSiblings(container, mountNode) {
 | 
			
		||||
  siblings(container, mountNode, function (node) {
 | 
			
		||||
    return ariaHidden(true, node);
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function showSiblings(container, mountNode) {
 | 
			
		||||
  siblings(container, mountNode, function (node) {
 | 
			
		||||
    return ariaHidden(false, node);
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										33
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/manageAriaHidden.js.flow
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								goTorrentWebUI/node_modules/material-ui/Modal/manageAriaHidden.js.flow
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
const BLACKLIST = ['template', 'script', 'style'];
 | 
			
		||||
 | 
			
		||||
function isHidable(node) {
 | 
			
		||||
  return node.nodeType === 1 && BLACKLIST.indexOf(node.tagName.toLowerCase()) === -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function siblings(container, mount, callback) {
 | 
			
		||||
  mount = [].concat(mount); // eslint-disable-line no-param-reassign
 | 
			
		||||
  [].forEach.call(container.children, node => {
 | 
			
		||||
    if (mount.indexOf(node) === -1 && isHidable(node)) {
 | 
			
		||||
      callback(node);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function ariaHidden(show, node) {
 | 
			
		||||
  if (!node) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if (show) {
 | 
			
		||||
    node.setAttribute('aria-hidden', 'true');
 | 
			
		||||
  } else {
 | 
			
		||||
    node.removeAttribute('aria-hidden');
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function hideSiblings(container, mountNode) {
 | 
			
		||||
  siblings(container, mountNode, node => ariaHidden(true, node));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function showSiblings(container, mountNode) {
 | 
			
		||||
  siblings(container, mountNode, node => ariaHidden(false, node));
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user