Completely updated React, fixed #11, (hopefully)
This commit is contained in:
		
							
								
								
									
										25
									
								
								goTorrentWebUI/node_modules/material-ui/Select/Select.d.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										25
									
								
								goTorrentWebUI/node_modules/material-ui/Select/Select.d.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,29 +1,24 @@
 | 
			
		||||
import * as React from 'react';
 | 
			
		||||
import { StandardProps } from '..';
 | 
			
		||||
import { InputProps } from '../Input';
 | 
			
		||||
import { InputClassKey } from '../Input/Input';
 | 
			
		||||
import { MenuProps } from '../Menu';
 | 
			
		||||
 | 
			
		||||
export interface SelectProps extends StandardProps<
 | 
			
		||||
  InputProps,
 | 
			
		||||
  SelectClassKey,
 | 
			
		||||
  'value'
 | 
			
		||||
> {
 | 
			
		||||
export interface SelectProps extends StandardProps<InputProps, SelectClassKey, 'value'> {
 | 
			
		||||
  autoWidth?: boolean;
 | 
			
		||||
  displayEmpty?: boolean;
 | 
			
		||||
  input?: React.ReactNode;
 | 
			
		||||
  native?: boolean;
 | 
			
		||||
  MenuProps?: Partial<MenuProps>;
 | 
			
		||||
  multiple?: boolean;
 | 
			
		||||
  MenuProps?: Object;
 | 
			
		||||
  renderValue?: Function;
 | 
			
		||||
  native?: boolean;
 | 
			
		||||
  onClose?: (event: React.ChangeEvent<{}>) => void;
 | 
			
		||||
  onOpen?: (event: React.ChangeEvent<{}>) => void;
 | 
			
		||||
  open?: boolean;
 | 
			
		||||
  renderValue?: (value: SelectProps['value']) => React.ReactNode;
 | 
			
		||||
  SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
 | 
			
		||||
  value?: Array<string | number> | string | number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type SelectClassKey =
 | 
			
		||||
  | InputClassKey
 | 
			
		||||
  | 'select'
 | 
			
		||||
  | 'selectMenu'
 | 
			
		||||
  | 'icon'
 | 
			
		||||
  ;
 | 
			
		||||
export type SelectClassKey = 'root' | 'select' | 'selectMenu' | 'disabled' | 'icon';
 | 
			
		||||
 | 
			
		||||
declare const Select: React.ComponentType<SelectProps>;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										218
									
								
								goTorrentWebUI/node_modules/material-ui/Select/Select.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										218
									
								
								goTorrentWebUI/node_modules/material-ui/Select/Select.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -17,9 +17,9 @@ var _react = require('react');
 | 
			
		||||
 | 
			
		||||
var _react2 = _interopRequireDefault(_react);
 | 
			
		||||
 | 
			
		||||
var _warning = require('warning');
 | 
			
		||||
var _propTypes = require('prop-types');
 | 
			
		||||
 | 
			
		||||
var _warning2 = _interopRequireDefault(_warning);
 | 
			
		||||
var _propTypes2 = _interopRequireDefault(_propTypes);
 | 
			
		||||
 | 
			
		||||
var _SelectInput = require('./SelectInput');
 | 
			
		||||
 | 
			
		||||
@@ -33,15 +33,9 @@ var _Input = require('../Input');
 | 
			
		||||
 | 
			
		||||
var _Input2 = _interopRequireDefault(_Input);
 | 
			
		||||
 | 
			
		||||
var _reactHelpers = require('../utils/reactHelpers');
 | 
			
		||||
 | 
			
		||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 | 
			
		||||
 | 
			
		||||
var babelPluginFlowReactPropTypes_proptype_Element = require('react').babelPluginFlowReactPropTypes_proptype_Element || require('prop-types').any;
 | 
			
		||||
// @inheritedComponent Input
 | 
			
		||||
 | 
			
		||||
var babelPluginFlowReactPropTypes_proptype_ChildrenArray = require('react').babelPluginFlowReactPropTypes_proptype_ChildrenArray || require('prop-types').any; // Import to enforce the CSS injection order
 | 
			
		||||
 | 
			
		||||
// Import to enforce the CSS injection order
 | 
			
		||||
 | 
			
		||||
var styles = exports.styles = function styles(theme) {
 | 
			
		||||
  return {
 | 
			
		||||
@@ -50,16 +44,14 @@ var styles = exports.styles = function styles(theme) {
 | 
			
		||||
      width: '100%'
 | 
			
		||||
    },
 | 
			
		||||
    select: {
 | 
			
		||||
      '-moz-appearance': 'none', // Remove Firefox custom style
 | 
			
		||||
      '-webkit-appearance': 'none', // Fix SSR issue
 | 
			
		||||
      appearance: 'none', // Reset
 | 
			
		||||
      '-moz-appearance': 'none', // Reset
 | 
			
		||||
      '-webkit-appearance': 'none', // Reset
 | 
			
		||||
      // When interacting quickly, the text can end up selected.
 | 
			
		||||
      // Native select can't be selected either.
 | 
			
		||||
      userSelect: 'none',
 | 
			
		||||
      padding: '0 ' + theme.spacing.unit * 4 + 'px 2px 0',
 | 
			
		||||
      width: 'auto',
 | 
			
		||||
      paddingRight: theme.spacing.unit * 4,
 | 
			
		||||
      width: 'calc(100% - ' + theme.spacing.unit * 4 + 'px)',
 | 
			
		||||
      minWidth: theme.spacing.unit * 2, // So it doesn't collapse.
 | 
			
		||||
      height: 'calc(1em + ' + (theme.spacing.unit * 2 - 2) + 'px)',
 | 
			
		||||
      cursor: 'pointer',
 | 
			
		||||
      '&:focus': {
 | 
			
		||||
        // Show that it's not an text input
 | 
			
		||||
@@ -77,86 +69,26 @@ var styles = exports.styles = function styles(theme) {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    selectMenu: {
 | 
			
		||||
      width: 'auto', // Fix Safari textOverflow
 | 
			
		||||
      textOverflow: 'ellipsis',
 | 
			
		||||
      whiteSpace: 'nowrap',
 | 
			
		||||
      overflow: 'hidden',
 | 
			
		||||
      lineHeight: 'calc(1em + ' + (theme.spacing.unit * 2 - 2) + 'px)'
 | 
			
		||||
      minHeight: '1.1875em' // Reset (19px), match the native input line-height
 | 
			
		||||
    },
 | 
			
		||||
    disabled: {
 | 
			
		||||
      cursor: 'default'
 | 
			
		||||
    },
 | 
			
		||||
    icon: {
 | 
			
		||||
      // We use a position absolute over a flexbox in order to forward the pointer events
 | 
			
		||||
      // to the input.
 | 
			
		||||
      position: 'absolute',
 | 
			
		||||
      right: 0,
 | 
			
		||||
      top: 4,
 | 
			
		||||
      color: theme.palette.text.secondary,
 | 
			
		||||
      'pointer-events': 'none' // Don't block pinter events on the select under the icon.
 | 
			
		||||
      top: 'calc(50% - 12px)', // Center vertically
 | 
			
		||||
      color: theme.palette.action.active,
 | 
			
		||||
      'pointer-events': 'none' // Don't block pointer events on the select under the icon.
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
var babelPluginFlowReactPropTypes_proptype_Props = {
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, the width of the popover will automatically be set according to the items inside the
 | 
			
		||||
   * menu, otherwise it will be at least the width of the select input.
 | 
			
		||||
   */
 | 
			
		||||
  autoWidth: require('prop-types').bool,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The option elements to populate the select with.
 | 
			
		||||
   * Can be some `MenuItem` when `native` is false and `option` when `native` is true.
 | 
			
		||||
   */
 | 
			
		||||
  children: typeof $ReadOnlyArray === 'function' ? require('prop-types').instanceOf($ReadOnlyArray).isRequired : require('prop-types').any.isRequired,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Useful to extend the style applied to components.
 | 
			
		||||
   */
 | 
			
		||||
  classes: require('prop-types').object,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the selected item is displayed even if its value is empty.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  displayEmpty: require('prop-types').bool,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * An `Input` element; does not have to be a material-ui specific `Input`.
 | 
			
		||||
   */
 | 
			
		||||
  input: typeof babelPluginFlowReactPropTypes_proptype_Element === 'function' ? babelPluginFlowReactPropTypes_proptype_Element : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Element),
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * `classes` property applied to the `Input` element.
 | 
			
		||||
   */
 | 
			
		||||
  InputClasses: require('prop-types').object,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the component will be using a native `select` element.
 | 
			
		||||
   */
 | 
			
		||||
  native: require('prop-types').bool,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, `value` must be an array and the menu will support multiple selections.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  multiple: require('prop-types').bool,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the `Menu` element.
 | 
			
		||||
   */
 | 
			
		||||
  MenuProps: require('prop-types').object,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Render the selected value.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  renderValue: require('prop-types').func,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The input value, required for a controlled component.
 | 
			
		||||
   */
 | 
			
		||||
  value: require('prop-types').oneOfType([typeof $ReadOnlyArray === 'function' ? require('prop-types').instanceOf($ReadOnlyArray) : require('prop-types').any, require('prop-types').string, require('prop-types').number])
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}; // @inheritedComponent Input
 | 
			
		||||
 | 
			
		||||
function Select(props) {
 | 
			
		||||
  var autoWidth = props.autoWidth,
 | 
			
		||||
@@ -164,42 +96,128 @@ function Select(props) {
 | 
			
		||||
      classes = props.classes,
 | 
			
		||||
      displayEmpty = props.displayEmpty,
 | 
			
		||||
      input = props.input,
 | 
			
		||||
      InputClasses = props.InputClasses,
 | 
			
		||||
      native = props.native,
 | 
			
		||||
      multiple = props.multiple,
 | 
			
		||||
      inputProps = props.inputProps,
 | 
			
		||||
      MenuProps = props.MenuProps,
 | 
			
		||||
      multiple = props.multiple,
 | 
			
		||||
      native = props.native,
 | 
			
		||||
      onClose = props.onClose,
 | 
			
		||||
      onOpen = props.onOpen,
 | 
			
		||||
      open = props.open,
 | 
			
		||||
      renderValue = props.renderValue,
 | 
			
		||||
      other = (0, _objectWithoutProperties3.default)(props, ['autoWidth', 'children', 'classes', 'displayEmpty', 'input', 'InputClasses', 'native', 'multiple', 'MenuProps', 'renderValue']);
 | 
			
		||||
      SelectDisplayProps = props.SelectDisplayProps,
 | 
			
		||||
      other = (0, _objectWithoutProperties3.default)(props, ['autoWidth', 'children', 'classes', 'displayEmpty', 'input', 'inputProps', 'MenuProps', 'multiple', 'native', 'onClose', 'onOpen', 'open', 'renderValue', 'SelectDisplayProps']);
 | 
			
		||||
 | 
			
		||||
  // Instead of `Element<typeof Input>` to have more flexibility.
 | 
			
		||||
 | 
			
		||||
  process.env.NODE_ENV !== "production" ? (0, _warning2.default)((0, _reactHelpers.isMuiElement)(input, ['Input']), ['Material-UI: you have provided an invalid value to the `input` property.', 'We expect an element instance of the `Input` component.'].join('\n')) : void 0;
 | 
			
		||||
 | 
			
		||||
  return _react2.default.cloneElement(input, (0, _extends3.default)({
 | 
			
		||||
    // Most of the logic is implemented in `SelectInput`.
 | 
			
		||||
    // The `Select` component is a simple API wrapper to expose something better to play with.
 | 
			
		||||
    inputComponent: _SelectInput2.default,
 | 
			
		||||
    classes: InputClasses
 | 
			
		||||
  }, other, {
 | 
			
		||||
    inputProps: (0, _extends3.default)({}, input ? input.props.inputProps : {}, {
 | 
			
		||||
    inputProps: (0, _extends3.default)({
 | 
			
		||||
      autoWidth: autoWidth,
 | 
			
		||||
      children: children,
 | 
			
		||||
      classes: classes,
 | 
			
		||||
      displayEmpty: displayEmpty,
 | 
			
		||||
      native: native,
 | 
			
		||||
      multiple: multiple,
 | 
			
		||||
      MenuProps: MenuProps,
 | 
			
		||||
      renderValue: renderValue
 | 
			
		||||
    })
 | 
			
		||||
  }));
 | 
			
		||||
      multiple: multiple,
 | 
			
		||||
      native: native,
 | 
			
		||||
      onClose: onClose,
 | 
			
		||||
      onOpen: onOpen,
 | 
			
		||||
      open: open,
 | 
			
		||||
      renderValue: renderValue,
 | 
			
		||||
      SelectDisplayProps: SelectDisplayProps,
 | 
			
		||||
      type: undefined }, inputProps, input ? input.props.inputProps : {})
 | 
			
		||||
  }, other));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Select.propTypes = process.env.NODE_ENV !== "production" ? {
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, the width of the popover will automatically be set according to the items inside the
 | 
			
		||||
   * menu, otherwise it will be at least the width of the select input.
 | 
			
		||||
   */
 | 
			
		||||
  autoWidth: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * The option elements to populate the select with.
 | 
			
		||||
   * Can be some `MenuItem` when `native` is false and `option` when `native` is true.
 | 
			
		||||
   */
 | 
			
		||||
  children: _propTypes2.default.node,
 | 
			
		||||
  /**
 | 
			
		||||
   * Useful to extend the style applied to components.
 | 
			
		||||
   */
 | 
			
		||||
  classes: _propTypes2.default.object.isRequired,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the selected item is displayed even if its value is empty.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  displayEmpty: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * An `Input` element; does not have to be a material-ui specific `Input`.
 | 
			
		||||
   */
 | 
			
		||||
  input: _propTypes2.default.element,
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the `input` element.
 | 
			
		||||
   * When `native` is `true`, the properties are applied on the `select` element.
 | 
			
		||||
   */
 | 
			
		||||
  inputProps: _propTypes2.default.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the `Menu` element.
 | 
			
		||||
   */
 | 
			
		||||
  MenuProps: _propTypes2.default.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, `value` must be an array and the menu will support multiple selections.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  multiple: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the component will be using a native `select` element.
 | 
			
		||||
   */
 | 
			
		||||
  native: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback function fired when a menu item is selected.
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   * @param {object} child The react element that was selected
 | 
			
		||||
   */
 | 
			
		||||
  onChange: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the component requests to be closed.
 | 
			
		||||
   * Useful in controlled mode (see open).
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   */
 | 
			
		||||
  onClose: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the component requests to be opened.
 | 
			
		||||
   * Useful in controlled mode (see open).
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   */
 | 
			
		||||
  onOpen: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Control `select` open state.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  open: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * Render the selected value.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  renderValue: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the clickable div element.
 | 
			
		||||
   */
 | 
			
		||||
  SelectDisplayProps: _propTypes2.default.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * The input value, required for a controlled component.
 | 
			
		||||
   */
 | 
			
		||||
  value: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number, _propTypes2.default.arrayOf(_propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]))])
 | 
			
		||||
} : {};
 | 
			
		||||
 | 
			
		||||
Select.defaultProps = {
 | 
			
		||||
  autoWidth: false,
 | 
			
		||||
  displayEmpty: false,
 | 
			
		||||
  input: _react2.default.createElement(_Input2.default, null),
 | 
			
		||||
  native: false,
 | 
			
		||||
  multiple: false
 | 
			
		||||
  multiple: false,
 | 
			
		||||
  native: false
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Select.muiName = 'Select';
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										213
									
								
								goTorrentWebUI/node_modules/material-ui/Select/Select.js.flow
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										213
									
								
								goTorrentWebUI/node_modules/material-ui/Select/Select.js.flow
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,30 +1,25 @@
 | 
			
		||||
// @flow
 | 
			
		||||
// @inheritedComponent Input
 | 
			
		||||
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import type { ChildrenArray, Element } from 'react';
 | 
			
		||||
import warning from 'warning';
 | 
			
		||||
import PropTypes from 'prop-types';
 | 
			
		||||
import SelectInput from './SelectInput';
 | 
			
		||||
import withStyles from '../styles/withStyles';
 | 
			
		||||
import Input from '../Input'; // Import to enforce the CSS injection order
 | 
			
		||||
import { isMuiElement } from '../utils/reactHelpers';
 | 
			
		||||
 | 
			
		||||
export const styles = (theme: Object) => ({
 | 
			
		||||
export const styles = theme => ({
 | 
			
		||||
  root: {
 | 
			
		||||
    position: 'relative',
 | 
			
		||||
    width: '100%',
 | 
			
		||||
  },
 | 
			
		||||
  select: {
 | 
			
		||||
    '-moz-appearance': 'none', // Remove Firefox custom style
 | 
			
		||||
    '-webkit-appearance': 'none', // Fix SSR issue
 | 
			
		||||
    appearance: 'none', // Reset
 | 
			
		||||
    '-moz-appearance': 'none', // Reset
 | 
			
		||||
    '-webkit-appearance': 'none', // Reset
 | 
			
		||||
    // When interacting quickly, the text can end up selected.
 | 
			
		||||
    // Native select can't be selected either.
 | 
			
		||||
    userSelect: 'none',
 | 
			
		||||
    padding: `0 ${theme.spacing.unit * 4}px 2px 0`,
 | 
			
		||||
    width: 'auto',
 | 
			
		||||
    paddingRight: theme.spacing.unit * 4,
 | 
			
		||||
    width: `calc(100% - ${theme.spacing.unit * 4}px)`,
 | 
			
		||||
    minWidth: theme.spacing.unit * 2, // So it doesn't collapse.
 | 
			
		||||
    height: `calc(1em + ${theme.spacing.unit * 2 - 2}px)`,
 | 
			
		||||
    cursor: 'pointer',
 | 
			
		||||
    '&:focus': {
 | 
			
		||||
      // Show that it's not an text input
 | 
			
		||||
@@ -43,133 +38,163 @@ export const styles = (theme: Object) => ({
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  selectMenu: {
 | 
			
		||||
    width: 'auto', // Fix Safari textOverflow
 | 
			
		||||
    textOverflow: 'ellipsis',
 | 
			
		||||
    whiteSpace: 'nowrap',
 | 
			
		||||
    overflow: 'hidden',
 | 
			
		||||
    lineHeight: `calc(1em + ${theme.spacing.unit * 2 - 2}px)`,
 | 
			
		||||
    minHeight: '1.1875em', // Reset (19px), match the native input line-height
 | 
			
		||||
  },
 | 
			
		||||
  disabled: {
 | 
			
		||||
    cursor: 'default',
 | 
			
		||||
  },
 | 
			
		||||
  icon: {
 | 
			
		||||
    // We use a position absolute over a flexbox in order to forward the pointer events
 | 
			
		||||
    // to the input.
 | 
			
		||||
    position: 'absolute',
 | 
			
		||||
    right: 0,
 | 
			
		||||
    top: 4,
 | 
			
		||||
    color: theme.palette.text.secondary,
 | 
			
		||||
    'pointer-events': 'none', // Don't block pinter events on the select under the icon.
 | 
			
		||||
    top: 'calc(50% - 12px)', // Center vertically
 | 
			
		||||
    color: theme.palette.action.active,
 | 
			
		||||
    'pointer-events': 'none', // Don't block pointer events on the select under the icon.
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
type ProvidedProps = {
 | 
			
		||||
  classes: Object,
 | 
			
		||||
  displayEmpty: boolean,
 | 
			
		||||
  input: Element<any>,
 | 
			
		||||
  native: boolean,
 | 
			
		||||
  multiple: boolean,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export type Props = {
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, the width of the popover will automatically be set according to the items inside the
 | 
			
		||||
   * menu, otherwise it will be at least the width of the select input.
 | 
			
		||||
   */
 | 
			
		||||
  autoWidth?: boolean,
 | 
			
		||||
  /**
 | 
			
		||||
   * The option elements to populate the select with.
 | 
			
		||||
   * Can be some `MenuItem` when `native` is false and `option` when `native` is true.
 | 
			
		||||
   */
 | 
			
		||||
  children: $ReadOnlyArray<ChildrenArray<*>>,
 | 
			
		||||
  /**
 | 
			
		||||
   * Useful to extend the style applied to components.
 | 
			
		||||
   */
 | 
			
		||||
  classes?: Object,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the selected item is displayed even if its value is empty.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  displayEmpty?: boolean,
 | 
			
		||||
  /**
 | 
			
		||||
   * An `Input` element; does not have to be a material-ui specific `Input`.
 | 
			
		||||
   */
 | 
			
		||||
  input?: Element<any>,
 | 
			
		||||
  /**
 | 
			
		||||
   * `classes` property applied to the `Input` element.
 | 
			
		||||
   */
 | 
			
		||||
  InputClasses?: Object,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the component will be using a native `select` element.
 | 
			
		||||
   */
 | 
			
		||||
  native?: boolean,
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, `value` must be an array and the menu will support multiple selections.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  multiple?: boolean,
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the `Menu` element.
 | 
			
		||||
   */
 | 
			
		||||
  MenuProps?: Object,
 | 
			
		||||
  /**
 | 
			
		||||
   * Render the selected value.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  renderValue?: Function,
 | 
			
		||||
  /**
 | 
			
		||||
   * The input value, required for a controlled component.
 | 
			
		||||
   */
 | 
			
		||||
  value?: $ReadOnlyArray<string | number> | string | number,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function Select(props: ProvidedProps & Props) {
 | 
			
		||||
function Select(props) {
 | 
			
		||||
  const {
 | 
			
		||||
    autoWidth,
 | 
			
		||||
    children,
 | 
			
		||||
    classes,
 | 
			
		||||
    displayEmpty,
 | 
			
		||||
    input,
 | 
			
		||||
    InputClasses,
 | 
			
		||||
    native,
 | 
			
		||||
    multiple,
 | 
			
		||||
    inputProps,
 | 
			
		||||
    MenuProps,
 | 
			
		||||
    multiple,
 | 
			
		||||
    native,
 | 
			
		||||
    onClose,
 | 
			
		||||
    onOpen,
 | 
			
		||||
    open,
 | 
			
		||||
    renderValue,
 | 
			
		||||
    SelectDisplayProps,
 | 
			
		||||
    ...other
 | 
			
		||||
  } = props;
 | 
			
		||||
 | 
			
		||||
  // Instead of `Element<typeof Input>` to have more flexibility.
 | 
			
		||||
  warning(
 | 
			
		||||
    isMuiElement(input, ['Input']),
 | 
			
		||||
    [
 | 
			
		||||
      'Material-UI: you have provided an invalid value to the `input` property.',
 | 
			
		||||
      'We expect an element instance of the `Input` component.',
 | 
			
		||||
    ].join('\n'),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  return React.cloneElement(input, {
 | 
			
		||||
    // Most of the logic is implemented in `SelectInput`.
 | 
			
		||||
    // The `Select` component is a simple API wrapper to expose something better to play with.
 | 
			
		||||
    inputComponent: SelectInput,
 | 
			
		||||
    classes: InputClasses,
 | 
			
		||||
    ...other,
 | 
			
		||||
    inputProps: {
 | 
			
		||||
      ...(input ? input.props.inputProps : {}),
 | 
			
		||||
      autoWidth,
 | 
			
		||||
      children,
 | 
			
		||||
      classes,
 | 
			
		||||
      displayEmpty,
 | 
			
		||||
      native,
 | 
			
		||||
      multiple,
 | 
			
		||||
      MenuProps,
 | 
			
		||||
      multiple,
 | 
			
		||||
      native,
 | 
			
		||||
      onClose,
 | 
			
		||||
      onOpen,
 | 
			
		||||
      open,
 | 
			
		||||
      renderValue,
 | 
			
		||||
      SelectDisplayProps,
 | 
			
		||||
      type: undefined, // We render a select. We can ignore the type provided by the `Input`.
 | 
			
		||||
      ...inputProps,
 | 
			
		||||
      ...(input ? input.props.inputProps : {}),
 | 
			
		||||
    },
 | 
			
		||||
    ...other,
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Select.propTypes = {
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, the width of the popover will automatically be set according to the items inside the
 | 
			
		||||
   * menu, otherwise it will be at least the width of the select input.
 | 
			
		||||
   */
 | 
			
		||||
  autoWidth: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * The option elements to populate the select with.
 | 
			
		||||
   * Can be some `MenuItem` when `native` is false and `option` when `native` is true.
 | 
			
		||||
   */
 | 
			
		||||
  children: PropTypes.node,
 | 
			
		||||
  /**
 | 
			
		||||
   * Useful to extend the style applied to components.
 | 
			
		||||
   */
 | 
			
		||||
  classes: PropTypes.object.isRequired,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the selected item is displayed even if its value is empty.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  displayEmpty: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * An `Input` element; does not have to be a material-ui specific `Input`.
 | 
			
		||||
   */
 | 
			
		||||
  input: PropTypes.element,
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the `input` element.
 | 
			
		||||
   * When `native` is `true`, the properties are applied on the `select` element.
 | 
			
		||||
   */
 | 
			
		||||
  inputProps: PropTypes.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the `Menu` element.
 | 
			
		||||
   */
 | 
			
		||||
  MenuProps: PropTypes.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, `value` must be an array and the menu will support multiple selections.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  multiple: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the component will be using a native `select` element.
 | 
			
		||||
   */
 | 
			
		||||
  native: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback function fired when a menu item is selected.
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   * @param {object} child The react element that was selected
 | 
			
		||||
   */
 | 
			
		||||
  onChange: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the component requests to be closed.
 | 
			
		||||
   * Useful in controlled mode (see open).
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   */
 | 
			
		||||
  onClose: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the component requests to be opened.
 | 
			
		||||
   * Useful in controlled mode (see open).
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   */
 | 
			
		||||
  onOpen: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Control `select` open state.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  open: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * Render the selected value.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  renderValue: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the clickable div element.
 | 
			
		||||
   */
 | 
			
		||||
  SelectDisplayProps: PropTypes.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * The input value, required for a controlled component.
 | 
			
		||||
   */
 | 
			
		||||
  value: PropTypes.oneOfType([
 | 
			
		||||
    PropTypes.string,
 | 
			
		||||
    PropTypes.number,
 | 
			
		||||
    PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
 | 
			
		||||
  ]),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Select.defaultProps = {
 | 
			
		||||
  autoWidth: false,
 | 
			
		||||
  displayEmpty: false,
 | 
			
		||||
  input: <Input />,
 | 
			
		||||
  native: false,
 | 
			
		||||
  multiple: false,
 | 
			
		||||
  native: false,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Select.muiName = 'Select';
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										26
									
								
								goTorrentWebUI/node_modules/material-ui/Select/SelectInput.d.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								goTorrentWebUI/node_modules/material-ui/Select/SelectInput.d.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,29 +1,31 @@
 | 
			
		||||
import * as React from 'react';
 | 
			
		||||
import { StandardProps } from '..';
 | 
			
		||||
import { MenuProps } from '../Menu';
 | 
			
		||||
 | 
			
		||||
export interface SelectInputProps extends StandardProps<{}, SelectInputClassKey> {
 | 
			
		||||
  autoWidth: boolean;
 | 
			
		||||
  disabled?: boolean;
 | 
			
		||||
  native: boolean;
 | 
			
		||||
  inputRef?: (
 | 
			
		||||
    ref: HTMLSelectElement | { node: HTMLInputElement; value: SelectInputProps['value'] },
 | 
			
		||||
  ) => void;
 | 
			
		||||
  MenuProps?: Partial<MenuProps>;
 | 
			
		||||
  multiple: boolean;
 | 
			
		||||
  MenuProps?: Object;
 | 
			
		||||
  name?: string;
 | 
			
		||||
  native: boolean;
 | 
			
		||||
  onBlur?: React.FocusEventHandler<any>;
 | 
			
		||||
  onChange?: (event: React.ChangeEvent<{}>, child: React.ReactNode) => void,
 | 
			
		||||
  onChange?: (event: React.ChangeEvent<{}>, child: React.ReactNode) => void;
 | 
			
		||||
  onClose?: (event: React.ChangeEvent<{}>) => void;
 | 
			
		||||
  onFocus?: React.FocusEventHandler<any>;
 | 
			
		||||
  onOpen?: (event: React.ChangeEvent<{}>) => void;
 | 
			
		||||
  open?: boolean;
 | 
			
		||||
  readOnly?: boolean;
 | 
			
		||||
  renderValue?: Function;
 | 
			
		||||
  selectRef?: Function;
 | 
			
		||||
  renderValue?: (value: SelectInputProps['value']) => React.ReactNode;
 | 
			
		||||
  SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
 | 
			
		||||
  tabIndex?: number;
 | 
			
		||||
  value?: string | number | Array<string | number>;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type SelectInputClassKey =
 | 
			
		||||
  | 'root'
 | 
			
		||||
  | 'select'
 | 
			
		||||
  | 'selectMenu'
 | 
			
		||||
  | 'disabled'
 | 
			
		||||
  | 'icon'
 | 
			
		||||
  ;
 | 
			
		||||
export type SelectInputClassKey = 'root' | 'select' | 'selectMenu' | 'disabled' | 'icon';
 | 
			
		||||
 | 
			
		||||
declare const SelectInput: React.ComponentType<SelectInputProps>;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										368
									
								
								goTorrentWebUI/node_modules/material-ui/Select/SelectInput.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										368
									
								
								goTorrentWebUI/node_modules/material-ui/Select/SelectInput.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -44,6 +44,10 @@ 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);
 | 
			
		||||
@@ -56,117 +60,18 @@ var _warning = require('warning');
 | 
			
		||||
 | 
			
		||||
var _warning2 = _interopRequireDefault(_warning);
 | 
			
		||||
 | 
			
		||||
var _ArrowDropDown = require('../internal/svg-icons/ArrowDropDown');
 | 
			
		||||
 | 
			
		||||
var _ArrowDropDown2 = _interopRequireDefault(_ArrowDropDown);
 | 
			
		||||
 | 
			
		||||
var _Menu = require('../Menu/Menu');
 | 
			
		||||
 | 
			
		||||
var _Menu2 = _interopRequireDefault(_Menu);
 | 
			
		||||
 | 
			
		||||
var _Input = require('../Input/Input');
 | 
			
		||||
 | 
			
		||||
var _ArrowDropDown = require('../svg-icons/ArrowDropDown');
 | 
			
		||||
 | 
			
		||||
var _ArrowDropDown2 = _interopRequireDefault(_ArrowDropDown);
 | 
			
		||||
 | 
			
		||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 | 
			
		||||
 | 
			
		||||
var babelPluginFlowReactPropTypes_proptype_Node = require('react').babelPluginFlowReactPropTypes_proptype_Node || require('prop-types').any;
 | 
			
		||||
 | 
			
		||||
var babelPluginFlowReactPropTypes_proptype_Element = require('react').babelPluginFlowReactPropTypes_proptype_Element || require('prop-types').any;
 | 
			
		||||
 | 
			
		||||
var babelPluginFlowReactPropTypes_proptype_Props = {
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, the width of the popover will automatically be set according to the items inside the
 | 
			
		||||
   * menu, otherwise it will be at least the width of the select input.
 | 
			
		||||
   */
 | 
			
		||||
  autoWidth: require('prop-types').bool.isRequired,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The option elements to populate the select with.
 | 
			
		||||
   * Can be some `MenuItem` when `native` is false and `option` when `native` is true.
 | 
			
		||||
   */
 | 
			
		||||
  children: typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node.isRequired ? babelPluginFlowReactPropTypes_proptype_Node.isRequired : babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node).isRequired,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Useful to extend the style applied to components.
 | 
			
		||||
   */
 | 
			
		||||
  classes: require('prop-types').object,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The CSS class name of the select element.
 | 
			
		||||
   */
 | 
			
		||||
  className: require('prop-types').string,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the select will be disabled.
 | 
			
		||||
   */
 | 
			
		||||
  disabled: require('prop-types').bool,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the selected item is displayed even if its value is empty.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  displayEmpty: require('prop-types').bool.isRequired,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the component will be using a native `select` element.
 | 
			
		||||
   */
 | 
			
		||||
  native: require('prop-types').bool.isRequired,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, `value` must be an array and the menu will support multiple selections.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  multiple: require('prop-types').bool.isRequired,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the `Menu` element.
 | 
			
		||||
   */
 | 
			
		||||
  MenuProps: require('prop-types').object,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Name attribute of the `select` or hidden `input` element.
 | 
			
		||||
   */
 | 
			
		||||
  name: require('prop-types').string,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  onBlur: require('prop-types').func,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback function fired when a menu item is selected.
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   * @param {object} child The react element that was selected
 | 
			
		||||
   */
 | 
			
		||||
  onChange: require('prop-types').func,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  onFocus: require('prop-types').func,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  readOnly: require('prop-types').bool,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Render the selected value.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  renderValue: require('prop-types').func,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Use that property to pass a ref callback to the native select element.
 | 
			
		||||
   */
 | 
			
		||||
  selectRef: require('prop-types').func,
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The value of the component, required for a controlled component.
 | 
			
		||||
   */
 | 
			
		||||
  value: require('prop-types').oneOfType([require('prop-types').string, require('prop-types').number, typeof $ReadOnlyArray === 'function' ? require('prop-types').instanceOf($ReadOnlyArray) : require('prop-types').any])
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @ignore - internal component.
 | 
			
		||||
 */
 | 
			
		||||
@@ -185,53 +90,69 @@ var SelectInput = function (_React$Component) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = SelectInput.__proto__ || (0, _getPrototypeOf2.default)(SelectInput)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
 | 
			
		||||
      anchorEl: null,
 | 
			
		||||
      open: false
 | 
			
		||||
    }, _this.ignoreNextBlur = false, _this.handleClick = function (event) {
 | 
			
		||||
    }, _this.ignoreNextBlur = false, _this.displayNode = null, _this.isControlled = _this.props.open !== undefined, _this.update = _this.isControlled ? function (_ref2) {
 | 
			
		||||
      var event = _ref2.event,
 | 
			
		||||
          open = _ref2.open;
 | 
			
		||||
 | 
			
		||||
      if (open) {
 | 
			
		||||
        _this.props.onOpen(event);
 | 
			
		||||
      } else {
 | 
			
		||||
        _this.props.onClose(event);
 | 
			
		||||
      }
 | 
			
		||||
    } : function (_ref3) {
 | 
			
		||||
      var open = _ref3.open;
 | 
			
		||||
      return _this.setState({ open: open });
 | 
			
		||||
    }, _this.handleClick = function (event) {
 | 
			
		||||
      // Opening the menu is going to blur the. It will be focused back when closed.
 | 
			
		||||
      _this.ignoreNextBlur = true;
 | 
			
		||||
      _this.setState({
 | 
			
		||||
      _this.update({
 | 
			
		||||
        open: true,
 | 
			
		||||
        anchorEl: event.currentTarget
 | 
			
		||||
        event: event
 | 
			
		||||
      });
 | 
			
		||||
    }, _this.handleRequestClose = function () {
 | 
			
		||||
      _this.setState({
 | 
			
		||||
        open: false
 | 
			
		||||
    }, _this.handleClose = function (event) {
 | 
			
		||||
      _this.update({
 | 
			
		||||
        open: false,
 | 
			
		||||
        event: event
 | 
			
		||||
      });
 | 
			
		||||
    }, _this.handleItemClick = function (child) {
 | 
			
		||||
      return function (event) {
 | 
			
		||||
        if (!_this.props.multiple) {
 | 
			
		||||
          _this.setState({
 | 
			
		||||
            open: false
 | 
			
		||||
          _this.update({
 | 
			
		||||
            open: false,
 | 
			
		||||
            event: event
 | 
			
		||||
          });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (_this.props.onChange) {
 | 
			
		||||
          var _onChange = _this.props.onChange;
 | 
			
		||||
        var _this$props = _this.props,
 | 
			
		||||
            onChange = _this$props.onChange,
 | 
			
		||||
            name = _this$props.name;
 | 
			
		||||
 | 
			
		||||
          var _value = void 0;
 | 
			
		||||
          var _target = void 0;
 | 
			
		||||
 | 
			
		||||
        if (onChange) {
 | 
			
		||||
          var value = void 0;
 | 
			
		||||
          var target = void 0;
 | 
			
		||||
 | 
			
		||||
          if (event.target) {
 | 
			
		||||
            _target = event.target;
 | 
			
		||||
            target = event.target;
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          if (_this.props.multiple) {
 | 
			
		||||
            _value = Array.isArray(_this.props.value) ? [].concat((0, _toConsumableArray3.default)(_this.props.value)) : [];
 | 
			
		||||
            var itemIndex = _value.indexOf(child.props.value);
 | 
			
		||||
            value = Array.isArray(_this.props.value) ? [].concat((0, _toConsumableArray3.default)(_this.props.value)) : [];
 | 
			
		||||
            var itemIndex = value.indexOf(child.props.value);
 | 
			
		||||
            if (itemIndex === -1) {
 | 
			
		||||
              _value.push(child.props.value);
 | 
			
		||||
              value.push(child.props.value);
 | 
			
		||||
            } else {
 | 
			
		||||
              _value.splice(itemIndex, 1);
 | 
			
		||||
              value.splice(itemIndex, 1);
 | 
			
		||||
            }
 | 
			
		||||
          } else {
 | 
			
		||||
            _value = child.props.value;
 | 
			
		||||
            value = child.props.value;
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          event.persist();
 | 
			
		||||
          event.target = (0, _extends3.default)({}, _target, { value: _value });
 | 
			
		||||
          event.target = (0, _extends3.default)({}, target, { value: value, name: name });
 | 
			
		||||
 | 
			
		||||
          _onChange(event, child);
 | 
			
		||||
          onChange(event, child);
 | 
			
		||||
        }
 | 
			
		||||
      };
 | 
			
		||||
    }, _this.handleBlur = function (event) {
 | 
			
		||||
@@ -254,17 +175,17 @@ var SelectInput = function (_React$Component) {
 | 
			
		||||
        event.preventDefault();
 | 
			
		||||
        // Opening the menu is going to blur the. It will be focused back when closed.
 | 
			
		||||
        _this.ignoreNextBlur = true;
 | 
			
		||||
        _this.setState({
 | 
			
		||||
        _this.update({
 | 
			
		||||
          open: true,
 | 
			
		||||
          anchorEl: event.currentTarget
 | 
			
		||||
          event: event
 | 
			
		||||
        });
 | 
			
		||||
      }
 | 
			
		||||
    }, _this.handleSelectRef = function (node) {
 | 
			
		||||
      if (!_this.props.selectRef) {
 | 
			
		||||
      if (!_this.props.inputRef) {
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      _this.props.selectRef({
 | 
			
		||||
      _this.props.inputRef({
 | 
			
		||||
        node: node,
 | 
			
		||||
        // By pass the native input as we expose a rich object (array).
 | 
			
		||||
        value: _this.props.value
 | 
			
		||||
@@ -273,6 +194,17 @@ var SelectInput = function (_React$Component) {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  (0, _createClass3.default)(SelectInput, [{
 | 
			
		||||
    key: 'componentDidMount',
 | 
			
		||||
    value: function componentDidMount() {
 | 
			
		||||
      if (this.isControlled && this.props.open) {
 | 
			
		||||
        // Focus the display node so the focus is restored on this element once
 | 
			
		||||
        // the menu is closed.
 | 
			
		||||
        this.displayNode.focus();
 | 
			
		||||
        // Rerender with the resolve `displayNode` reference.
 | 
			
		||||
        this.forceUpdate();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }, {
 | 
			
		||||
    key: 'render',
 | 
			
		||||
    value: function render() {
 | 
			
		||||
      var _this2 = this;
 | 
			
		||||
@@ -280,24 +212,32 @@ var SelectInput = function (_React$Component) {
 | 
			
		||||
      var _props = this.props,
 | 
			
		||||
          autoWidth = _props.autoWidth,
 | 
			
		||||
          children = _props.children,
 | 
			
		||||
          classNameProp = _props.className,
 | 
			
		||||
          classes = _props.classes,
 | 
			
		||||
          classNameProp = _props.className,
 | 
			
		||||
          disabled = _props.disabled,
 | 
			
		||||
          displayEmpty = _props.displayEmpty,
 | 
			
		||||
          name = _props.name,
 | 
			
		||||
          native = _props.native,
 | 
			
		||||
          multiple = _props.multiple,
 | 
			
		||||
          inputRef = _props.inputRef,
 | 
			
		||||
          _props$MenuProps = _props.MenuProps,
 | 
			
		||||
          MenuProps = _props$MenuProps === undefined ? {} : _props$MenuProps,
 | 
			
		||||
          multiple = _props.multiple,
 | 
			
		||||
          name = _props.name,
 | 
			
		||||
          native = _props.native,
 | 
			
		||||
          onBlur = _props.onBlur,
 | 
			
		||||
          onChange = _props.onChange,
 | 
			
		||||
          onClose = _props.onClose,
 | 
			
		||||
          onFocus = _props.onFocus,
 | 
			
		||||
          onOpen = _props.onOpen,
 | 
			
		||||
          openProp = _props.open,
 | 
			
		||||
          readOnly = _props.readOnly,
 | 
			
		||||
          renderValue = _props.renderValue,
 | 
			
		||||
          selectRef = _props.selectRef,
 | 
			
		||||
          SelectDisplayProps = _props.SelectDisplayProps,
 | 
			
		||||
          tabIndexProp = _props.tabIndex,
 | 
			
		||||
          _props$type = _props.type,
 | 
			
		||||
          type = _props$type === undefined ? 'hidden' : _props$type,
 | 
			
		||||
          value = _props.value,
 | 
			
		||||
          other = (0, _objectWithoutProperties3.default)(_props, ['autoWidth', 'children', 'className', 'classes', 'disabled', 'displayEmpty', 'name', 'native', 'multiple', 'MenuProps', 'onBlur', 'onChange', 'onFocus', 'readOnly', 'renderValue', 'selectRef', 'value']);
 | 
			
		||||
          other = (0, _objectWithoutProperties3.default)(_props, ['autoWidth', 'children', 'classes', 'className', 'disabled', 'displayEmpty', 'inputRef', 'MenuProps', 'multiple', 'name', 'native', 'onBlur', 'onChange', 'onClose', 'onFocus', 'onOpen', 'open', 'readOnly', 'renderValue', 'SelectDisplayProps', 'tabIndex', 'type', 'value']);
 | 
			
		||||
 | 
			
		||||
      var open = this.isControlled && this.displayNode ? openProp : this.state.open;
 | 
			
		||||
 | 
			
		||||
      if (native) {
 | 
			
		||||
        process.env.NODE_ENV !== "production" ? (0, _warning2.default)(multiple === false, 'Material-UI: you can not use the `native` and `multiple` properties ' + 'at the same time on a `Select` component.') : void 0;
 | 
			
		||||
@@ -317,10 +257,9 @@ var SelectInput = function (_React$Component) {
 | 
			
		||||
              onChange: onChange,
 | 
			
		||||
              onFocus: onFocus,
 | 
			
		||||
              value: value,
 | 
			
		||||
              readOnly: readOnly
 | 
			
		||||
            }, other, {
 | 
			
		||||
              ref: selectRef
 | 
			
		||||
            }),
 | 
			
		||||
              readOnly: readOnly,
 | 
			
		||||
              ref: inputRef
 | 
			
		||||
            }, other),
 | 
			
		||||
            children
 | 
			
		||||
          ),
 | 
			
		||||
          _react2.default.createElement(_ArrowDropDown2.default, { className: classes.icon })
 | 
			
		||||
@@ -378,51 +317,61 @@ var SelectInput = function (_React$Component) {
 | 
			
		||||
        display = multiple ? displayMultiple.join(', ') : displaySingle;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      var minimumMenuWidth = this.state.anchorEl != null && !autoWidth ? this.state.anchorEl.clientWidth : undefined;
 | 
			
		||||
      var MenuMinWidth = this.displayNode && !autoWidth ? this.displayNode.clientWidth : undefined;
 | 
			
		||||
 | 
			
		||||
      var tabIndex = void 0;
 | 
			
		||||
      if (typeof tabIndexProp !== 'undefined') {
 | 
			
		||||
        tabIndex = tabIndexProp;
 | 
			
		||||
      } else {
 | 
			
		||||
        tabIndex = disabled ? null : 0;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      return _react2.default.createElement(
 | 
			
		||||
        'div',
 | 
			
		||||
        { className: classes.root },
 | 
			
		||||
        _react2.default.createElement(
 | 
			
		||||
          'div',
 | 
			
		||||
          {
 | 
			
		||||
          (0, _extends3.default)({
 | 
			
		||||
            className: (0, _classnames2.default)(classes.select, classes.selectMenu, (0, _defineProperty3.default)({}, classes.disabled, disabled), classNameProp),
 | 
			
		||||
            ref: function ref(node) {
 | 
			
		||||
              _this2.displayNode = node;
 | 
			
		||||
            },
 | 
			
		||||
 | 
			
		||||
            'aria-pressed': this.state.open ? 'true' : 'false',
 | 
			
		||||
            tabIndex: disabled ? null : 0,
 | 
			
		||||
            'aria-pressed': open ? 'true' : 'false',
 | 
			
		||||
            tabIndex: tabIndex,
 | 
			
		||||
            role: 'button',
 | 
			
		||||
            'aria-owns': this.state.open ? 'menu-' + (name || '') : null,
 | 
			
		||||
            'aria-owns': open ? 'menu-' + (name || '') : null,
 | 
			
		||||
            'aria-haspopup': 'true',
 | 
			
		||||
            onKeyDown: this.handleKeyDown,
 | 
			
		||||
            onBlur: this.handleBlur,
 | 
			
		||||
            onClick: disabled || readOnly ? null : this.handleClick,
 | 
			
		||||
            onFocus: onFocus
 | 
			
		||||
          },
 | 
			
		||||
          }, SelectDisplayProps),
 | 
			
		||||
          _react2.default.createElement('span', { dangerouslySetInnerHTML: { __html: '​' } }),
 | 
			
		||||
          display
 | 
			
		||||
        ),
 | 
			
		||||
        _react2.default.createElement('input', (0, _extends3.default)({
 | 
			
		||||
          value: Array.isArray(value) ? value.join(',') : value,
 | 
			
		||||
          name: name,
 | 
			
		||||
          readOnly: readOnly
 | 
			
		||||
        }, other, {
 | 
			
		||||
          readOnly: readOnly,
 | 
			
		||||
          ref: this.handleSelectRef,
 | 
			
		||||
          type: 'hidden'
 | 
			
		||||
        })),
 | 
			
		||||
          type: type
 | 
			
		||||
        }, other)),
 | 
			
		||||
        _react2.default.createElement(_ArrowDropDown2.default, { className: classes.icon }),
 | 
			
		||||
        _react2.default.createElement(
 | 
			
		||||
          _Menu2.default,
 | 
			
		||||
          (0, _extends3.default)({
 | 
			
		||||
            id: 'menu-' + (name || ''),
 | 
			
		||||
            anchorEl: this.state.anchorEl,
 | 
			
		||||
            open: this.state.open,
 | 
			
		||||
            onRequestClose: this.handleRequestClose
 | 
			
		||||
            anchorEl: this.displayNode,
 | 
			
		||||
            open: open,
 | 
			
		||||
            onClose: this.handleClose
 | 
			
		||||
          }, MenuProps, {
 | 
			
		||||
            MenuListProps: (0, _extends3.default)({}, MenuProps.MenuListProps, {
 | 
			
		||||
            MenuListProps: (0, _extends3.default)({
 | 
			
		||||
              role: 'listbox'
 | 
			
		||||
            }),
 | 
			
		||||
            }, MenuProps.MenuListProps),
 | 
			
		||||
            PaperProps: (0, _extends3.default)({}, MenuProps.PaperProps, {
 | 
			
		||||
              style: (0, _extends3.default)({
 | 
			
		||||
                minWidth: minimumMenuWidth
 | 
			
		||||
                minWidth: MenuMinWidth
 | 
			
		||||
              }, MenuProps.PaperProps != null ? MenuProps.PaperProps.style : null)
 | 
			
		||||
            })
 | 
			
		||||
          }),
 | 
			
		||||
@@ -434,5 +383,114 @@ var SelectInput = function (_React$Component) {
 | 
			
		||||
  return SelectInput;
 | 
			
		||||
}(_react2.default.Component);
 | 
			
		||||
 | 
			
		||||
SelectInput.muiName = 'SelectInput';
 | 
			
		||||
SelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, the width of the popover will automatically be set according to the items inside the
 | 
			
		||||
   * menu, otherwise it will be at least the width of the select input.
 | 
			
		||||
   */
 | 
			
		||||
  autoWidth: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * The option elements to populate the select with.
 | 
			
		||||
   * Can be some `MenuItem` when `native` is false and `option` when `native` is true.
 | 
			
		||||
   */
 | 
			
		||||
  children: _propTypes2.default.node,
 | 
			
		||||
  /**
 | 
			
		||||
   * Useful to extend the style applied to components.
 | 
			
		||||
   */
 | 
			
		||||
  classes: _propTypes2.default.object.isRequired,
 | 
			
		||||
  /**
 | 
			
		||||
   * The CSS class name of the select element.
 | 
			
		||||
   */
 | 
			
		||||
  className: _propTypes2.default.string,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the select will be disabled.
 | 
			
		||||
   */
 | 
			
		||||
  disabled: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the selected item is displayed even if its value is empty.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  displayEmpty: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * Use that property to pass a ref callback to the native select element.
 | 
			
		||||
   */
 | 
			
		||||
  inputRef: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the `Menu` element.
 | 
			
		||||
   */
 | 
			
		||||
  MenuProps: _propTypes2.default.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, `value` must be an array and the menu will support multiple selections.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  multiple: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * Name attribute of the `select` or hidden `input` element.
 | 
			
		||||
   */
 | 
			
		||||
  name: _propTypes2.default.string,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the component will be using a native `select` element.
 | 
			
		||||
   */
 | 
			
		||||
  native: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  onBlur: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback function fired when a menu item is selected.
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   * @param {object} child The react element that was selected
 | 
			
		||||
   */
 | 
			
		||||
  onChange: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the component requests to be closed.
 | 
			
		||||
   * Useful in controlled mode (see open).
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   */
 | 
			
		||||
  onClose: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  onFocus: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the component requests to be opened.
 | 
			
		||||
   * Useful in controlled mode (see open).
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   */
 | 
			
		||||
  onOpen: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Control `select` open state.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  open: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  readOnly: _propTypes2.default.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * Render the selected value.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  renderValue: _propTypes2.default.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the clickable div element.
 | 
			
		||||
   */
 | 
			
		||||
  SelectDisplayProps: _propTypes2.default.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  tabIndex: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  type: _propTypes2.default.string,
 | 
			
		||||
  /**
 | 
			
		||||
   * The value of the component, required for a controlled component.
 | 
			
		||||
   */
 | 
			
		||||
  value: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number, _propTypes2.default.arrayOf(_propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]))])
 | 
			
		||||
} : {};
 | 
			
		||||
 | 
			
		||||
exports.default = SelectInput;
 | 
			
		||||
							
								
								
									
										328
									
								
								goTorrentWebUI/node_modules/material-ui/Select/SelectInput.js.flow
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										328
									
								
								goTorrentWebUI/node_modules/material-ui/Select/SelectInput.js.flow
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,139 +1,71 @@
 | 
			
		||||
// @flow
 | 
			
		||||
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import type { Element, Node } from 'react';
 | 
			
		||||
import PropTypes from 'prop-types';
 | 
			
		||||
import classNames from 'classnames';
 | 
			
		||||
import keycode from 'keycode';
 | 
			
		||||
import warning from 'warning';
 | 
			
		||||
import ArrowDropDownIcon from '../internal/svg-icons/ArrowDropDown';
 | 
			
		||||
import Menu from '../Menu/Menu';
 | 
			
		||||
import { isDirty } from '../Input/Input';
 | 
			
		||||
import ArrowDropDownIcon from '../svg-icons/ArrowDropDown';
 | 
			
		||||
 | 
			
		||||
type ProvidedProps = {
 | 
			
		||||
  classes: Object,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export type Props = {
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, the width of the popover will automatically be set according to the items inside the
 | 
			
		||||
   * menu, otherwise it will be at least the width of the select input.
 | 
			
		||||
   */
 | 
			
		||||
  autoWidth: boolean,
 | 
			
		||||
  /**
 | 
			
		||||
   * The option elements to populate the select with.
 | 
			
		||||
   * Can be some `MenuItem` when `native` is false and `option` when `native` is true.
 | 
			
		||||
   */
 | 
			
		||||
  children: Node,
 | 
			
		||||
  /**
 | 
			
		||||
   * Useful to extend the style applied to components.
 | 
			
		||||
   */
 | 
			
		||||
  classes?: Object,
 | 
			
		||||
  /**
 | 
			
		||||
   * The CSS class name of the select element.
 | 
			
		||||
   */
 | 
			
		||||
  className?: string,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the select will be disabled.
 | 
			
		||||
   */
 | 
			
		||||
  disabled?: boolean,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the selected item is displayed even if its value is empty.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  displayEmpty: boolean,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the component will be using a native `select` element.
 | 
			
		||||
   */
 | 
			
		||||
  native: boolean,
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, `value` must be an array and the menu will support multiple selections.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  multiple: boolean,
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the `Menu` element.
 | 
			
		||||
   */
 | 
			
		||||
  MenuProps?: Object,
 | 
			
		||||
  /**
 | 
			
		||||
   * Name attribute of the `select` or hidden `input` element.
 | 
			
		||||
   */
 | 
			
		||||
  name?: string,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  onBlur?: Function,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback function fired when a menu item is selected.
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   * @param {object} child The react element that was selected
 | 
			
		||||
   */
 | 
			
		||||
  onChange?: (event: SyntheticUIEvent<*>, child: Element<any>) => void,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  onFocus?: Function,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  readOnly?: boolean,
 | 
			
		||||
  /**
 | 
			
		||||
   * Render the selected value.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  renderValue?: Function,
 | 
			
		||||
  /**
 | 
			
		||||
   * Use that property to pass a ref callback to the native select element.
 | 
			
		||||
   */
 | 
			
		||||
  selectRef?: Function,
 | 
			
		||||
  /**
 | 
			
		||||
   * The value of the component, required for a controlled component.
 | 
			
		||||
   */
 | 
			
		||||
  value?: string | number | $ReadOnlyArray<string | number>,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
type State = {
 | 
			
		||||
  open: boolean,
 | 
			
		||||
  anchorEl: ?HTMLElement,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @ignore - internal component.
 | 
			
		||||
 */
 | 
			
		||||
class SelectInput extends React.Component<ProvidedProps & Props, State> {
 | 
			
		||||
  static muiName = 'SelectInput';
 | 
			
		||||
 | 
			
		||||
class SelectInput extends React.Component {
 | 
			
		||||
  state = {
 | 
			
		||||
    anchorEl: null,
 | 
			
		||||
    open: false,
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  ignoreNextBlur = false;
 | 
			
		||||
  componentDidMount() {
 | 
			
		||||
    if (this.isControlled && this.props.open) {
 | 
			
		||||
      // Focus the display node so the focus is restored on this element once
 | 
			
		||||
      // the menu is closed.
 | 
			
		||||
      this.displayNode.focus();
 | 
			
		||||
      // Rerender with the resolve `displayNode` reference.
 | 
			
		||||
      this.forceUpdate();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleClick = (event: SyntheticMouseEvent<HTMLElement>) => {
 | 
			
		||||
  ignoreNextBlur = false;
 | 
			
		||||
  displayNode = null;
 | 
			
		||||
  isControlled = this.props.open !== undefined;
 | 
			
		||||
 | 
			
		||||
  update = this.isControlled
 | 
			
		||||
    ? ({ event, open }) => {
 | 
			
		||||
        if (open) {
 | 
			
		||||
          this.props.onOpen(event);
 | 
			
		||||
        } else {
 | 
			
		||||
          this.props.onClose(event);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    : ({ open }) => this.setState({ open });
 | 
			
		||||
 | 
			
		||||
  handleClick = event => {
 | 
			
		||||
    // Opening the menu is going to blur the. It will be focused back when closed.
 | 
			
		||||
    this.ignoreNextBlur = true;
 | 
			
		||||
    this.setState({
 | 
			
		||||
    this.update({
 | 
			
		||||
      open: true,
 | 
			
		||||
      anchorEl: event.currentTarget,
 | 
			
		||||
      event,
 | 
			
		||||
    });
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  handleRequestClose = () => {
 | 
			
		||||
    this.setState({
 | 
			
		||||
  handleClose = event => {
 | 
			
		||||
    this.update({
 | 
			
		||||
      open: false,
 | 
			
		||||
      event,
 | 
			
		||||
    });
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  handleItemClick = (child: Element<any>) => (event: SyntheticMouseEvent<> & { target?: any }) => {
 | 
			
		||||
  handleItemClick = child => event => {
 | 
			
		||||
    if (!this.props.multiple) {
 | 
			
		||||
      this.setState({
 | 
			
		||||
      this.update({
 | 
			
		||||
        open: false,
 | 
			
		||||
        event,
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (this.props.onChange) {
 | 
			
		||||
      const { onChange } = this.props;
 | 
			
		||||
    const { onChange, name } = this.props;
 | 
			
		||||
 | 
			
		||||
    if (onChange) {
 | 
			
		||||
      let value;
 | 
			
		||||
      let target;
 | 
			
		||||
 | 
			
		||||
@@ -154,13 +86,13 @@ class SelectInput extends React.Component<ProvidedProps & Props, State> {
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      event.persist();
 | 
			
		||||
      event.target = { ...target, value };
 | 
			
		||||
      event.target = { ...target, value, name };
 | 
			
		||||
 | 
			
		||||
      onChange(event, child);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  handleBlur = (event: SyntheticFocusEvent<>) => {
 | 
			
		||||
  handleBlur = event => {
 | 
			
		||||
    if (this.ignoreNextBlur === true) {
 | 
			
		||||
      // The parent components are relying on the bubbling of the event.
 | 
			
		||||
      event.stopPropagation();
 | 
			
		||||
@@ -173,7 +105,7 @@ class SelectInput extends React.Component<ProvidedProps & Props, State> {
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  handleKeyDown = (event: SyntheticKeyboardEvent<HTMLElement>) => {
 | 
			
		||||
  handleKeyDown = event => {
 | 
			
		||||
    if (this.props.readOnly) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -182,19 +114,19 @@ class SelectInput extends React.Component<ProvidedProps & Props, State> {
 | 
			
		||||
      event.preventDefault();
 | 
			
		||||
      // Opening the menu is going to blur the. It will be focused back when closed.
 | 
			
		||||
      this.ignoreNextBlur = true;
 | 
			
		||||
      this.setState({
 | 
			
		||||
      this.update({
 | 
			
		||||
        open: true,
 | 
			
		||||
        anchorEl: event.currentTarget,
 | 
			
		||||
        event,
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  handleSelectRef = (node: ?HTMLElement) => {
 | 
			
		||||
    if (!this.props.selectRef) {
 | 
			
		||||
  handleSelectRef = node => {
 | 
			
		||||
    if (!this.props.inputRef) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.props.selectRef({
 | 
			
		||||
    this.props.inputRef({
 | 
			
		||||
      node,
 | 
			
		||||
      // By pass the native input as we expose a rich object (array).
 | 
			
		||||
      value: this.props.value,
 | 
			
		||||
@@ -205,23 +137,30 @@ class SelectInput extends React.Component<ProvidedProps & Props, State> {
 | 
			
		||||
    const {
 | 
			
		||||
      autoWidth,
 | 
			
		||||
      children,
 | 
			
		||||
      className: classNameProp,
 | 
			
		||||
      classes,
 | 
			
		||||
      className: classNameProp,
 | 
			
		||||
      disabled,
 | 
			
		||||
      displayEmpty,
 | 
			
		||||
      inputRef,
 | 
			
		||||
      MenuProps = {},
 | 
			
		||||
      multiple,
 | 
			
		||||
      name,
 | 
			
		||||
      native,
 | 
			
		||||
      multiple,
 | 
			
		||||
      MenuProps = {},
 | 
			
		||||
      onBlur,
 | 
			
		||||
      onChange,
 | 
			
		||||
      onClose,
 | 
			
		||||
      onFocus,
 | 
			
		||||
      onOpen,
 | 
			
		||||
      open: openProp,
 | 
			
		||||
      readOnly,
 | 
			
		||||
      renderValue,
 | 
			
		||||
      selectRef,
 | 
			
		||||
      SelectDisplayProps,
 | 
			
		||||
      tabIndex: tabIndexProp,
 | 
			
		||||
      type = 'hidden',
 | 
			
		||||
      value,
 | 
			
		||||
      ...other
 | 
			
		||||
    } = this.props;
 | 
			
		||||
    const open = this.isControlled && this.displayNode ? openProp : this.state.open;
 | 
			
		||||
 | 
			
		||||
    if (native) {
 | 
			
		||||
      warning(
 | 
			
		||||
@@ -255,8 +194,8 @@ class SelectInput extends React.Component<ProvidedProps & Props, State> {
 | 
			
		||||
            onFocus={onFocus}
 | 
			
		||||
            value={value}
 | 
			
		||||
            readOnly={readOnly}
 | 
			
		||||
            ref={inputRef}
 | 
			
		||||
            {...other}
 | 
			
		||||
            ref={selectRef}
 | 
			
		||||
          >
 | 
			
		||||
            {children}
 | 
			
		||||
          </select>
 | 
			
		||||
@@ -322,8 +261,14 @@ class SelectInput extends React.Component<ProvidedProps & Props, State> {
 | 
			
		||||
      display = multiple ? displayMultiple.join(', ') : displaySingle;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const minimumMenuWidth =
 | 
			
		||||
      this.state.anchorEl != null && !autoWidth ? this.state.anchorEl.clientWidth : undefined;
 | 
			
		||||
    const MenuMinWidth = this.displayNode && !autoWidth ? this.displayNode.clientWidth : undefined;
 | 
			
		||||
 | 
			
		||||
    let tabIndex;
 | 
			
		||||
    if (typeof tabIndexProp !== 'undefined') {
 | 
			
		||||
      tabIndex = tabIndexProp;
 | 
			
		||||
    } else {
 | 
			
		||||
      tabIndex = disabled ? null : 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return (
 | 
			
		||||
      <div className={classes.root}>
 | 
			
		||||
@@ -336,42 +281,49 @@ class SelectInput extends React.Component<ProvidedProps & Props, State> {
 | 
			
		||||
            },
 | 
			
		||||
            classNameProp,
 | 
			
		||||
          )}
 | 
			
		||||
          ref={node => {
 | 
			
		||||
            this.displayNode = node;
 | 
			
		||||
          }}
 | 
			
		||||
          data-mui-test="SelectDisplay"
 | 
			
		||||
          aria-pressed={this.state.open ? 'true' : 'false'}
 | 
			
		||||
          tabIndex={disabled ? null : 0}
 | 
			
		||||
          aria-pressed={open ? 'true' : 'false'}
 | 
			
		||||
          tabIndex={tabIndex}
 | 
			
		||||
          role="button"
 | 
			
		||||
          aria-owns={this.state.open ? `menu-${name || ''}` : null}
 | 
			
		||||
          aria-owns={open ? `menu-${name || ''}` : null}
 | 
			
		||||
          aria-haspopup="true"
 | 
			
		||||
          onKeyDown={this.handleKeyDown}
 | 
			
		||||
          onBlur={this.handleBlur}
 | 
			
		||||
          onClick={disabled || readOnly ? null : this.handleClick}
 | 
			
		||||
          onFocus={onFocus}
 | 
			
		||||
          {...SelectDisplayProps}
 | 
			
		||||
        >
 | 
			
		||||
          {/* So the vertical align positioning algorithm quicks in. */}
 | 
			
		||||
          {/* eslint-disable-next-line react/no-danger */}
 | 
			
		||||
          <span dangerouslySetInnerHTML={{ __html: '​' }} />
 | 
			
		||||
          {display}
 | 
			
		||||
        </div>
 | 
			
		||||
        <input
 | 
			
		||||
          value={Array.isArray(value) ? value.join(',') : value}
 | 
			
		||||
          name={name}
 | 
			
		||||
          readOnly={readOnly}
 | 
			
		||||
          {...other}
 | 
			
		||||
          ref={this.handleSelectRef}
 | 
			
		||||
          type="hidden"
 | 
			
		||||
          type={type}
 | 
			
		||||
          {...other}
 | 
			
		||||
        />
 | 
			
		||||
        <ArrowDropDownIcon className={classes.icon} />
 | 
			
		||||
        <Menu
 | 
			
		||||
          id={`menu-${name || ''}`}
 | 
			
		||||
          anchorEl={this.state.anchorEl}
 | 
			
		||||
          open={this.state.open}
 | 
			
		||||
          onRequestClose={this.handleRequestClose}
 | 
			
		||||
          anchorEl={this.displayNode}
 | 
			
		||||
          open={open}
 | 
			
		||||
          onClose={this.handleClose}
 | 
			
		||||
          {...MenuProps}
 | 
			
		||||
          MenuListProps={{
 | 
			
		||||
            ...MenuProps.MenuListProps,
 | 
			
		||||
            role: 'listbox',
 | 
			
		||||
            ...MenuProps.MenuListProps,
 | 
			
		||||
          }}
 | 
			
		||||
          PaperProps={{
 | 
			
		||||
            ...MenuProps.PaperProps,
 | 
			
		||||
            style: {
 | 
			
		||||
              minWidth: minimumMenuWidth,
 | 
			
		||||
              minWidth: MenuMinWidth,
 | 
			
		||||
              ...(MenuProps.PaperProps != null ? MenuProps.PaperProps.style : null),
 | 
			
		||||
            },
 | 
			
		||||
          }}
 | 
			
		||||
@@ -383,4 +335,118 @@ class SelectInput extends React.Component<ProvidedProps & Props, State> {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SelectInput.propTypes = {
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, the width of the popover will automatically be set according to the items inside the
 | 
			
		||||
   * menu, otherwise it will be at least the width of the select input.
 | 
			
		||||
   */
 | 
			
		||||
  autoWidth: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * The option elements to populate the select with.
 | 
			
		||||
   * Can be some `MenuItem` when `native` is false and `option` when `native` is true.
 | 
			
		||||
   */
 | 
			
		||||
  children: PropTypes.node,
 | 
			
		||||
  /**
 | 
			
		||||
   * Useful to extend the style applied to components.
 | 
			
		||||
   */
 | 
			
		||||
  classes: PropTypes.object.isRequired,
 | 
			
		||||
  /**
 | 
			
		||||
   * The CSS class name of the select element.
 | 
			
		||||
   */
 | 
			
		||||
  className: PropTypes.string,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the select will be disabled.
 | 
			
		||||
   */
 | 
			
		||||
  disabled: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the selected item is displayed even if its value is empty.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  displayEmpty: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * Use that property to pass a ref callback to the native select element.
 | 
			
		||||
   */
 | 
			
		||||
  inputRef: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the `Menu` element.
 | 
			
		||||
   */
 | 
			
		||||
  MenuProps: PropTypes.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * If true, `value` must be an array and the menu will support multiple selections.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  multiple: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * Name attribute of the `select` or hidden `input` element.
 | 
			
		||||
   */
 | 
			
		||||
  name: PropTypes.string,
 | 
			
		||||
  /**
 | 
			
		||||
   * If `true`, the component will be using a native `select` element.
 | 
			
		||||
   */
 | 
			
		||||
  native: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  onBlur: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback function fired when a menu item is selected.
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   * @param {object} child The react element that was selected
 | 
			
		||||
   */
 | 
			
		||||
  onChange: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the component requests to be closed.
 | 
			
		||||
   * Useful in controlled mode (see open).
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   */
 | 
			
		||||
  onClose: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  onFocus: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Callback fired when the component requests to be opened.
 | 
			
		||||
   * Useful in controlled mode (see open).
 | 
			
		||||
   *
 | 
			
		||||
   * @param {object} event The event source of the callback
 | 
			
		||||
   */
 | 
			
		||||
  onOpen: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Control `select` open state.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  open: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  readOnly: PropTypes.bool,
 | 
			
		||||
  /**
 | 
			
		||||
   * Render the selected value.
 | 
			
		||||
   * You can only use it when the `native` property is `false` (default).
 | 
			
		||||
   */
 | 
			
		||||
  renderValue: PropTypes.func,
 | 
			
		||||
  /**
 | 
			
		||||
   * Properties applied to the clickable div element.
 | 
			
		||||
   */
 | 
			
		||||
  SelectDisplayProps: PropTypes.object,
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
 | 
			
		||||
  /**
 | 
			
		||||
   * @ignore
 | 
			
		||||
   */
 | 
			
		||||
  type: PropTypes.string,
 | 
			
		||||
  /**
 | 
			
		||||
   * The value of the component, required for a controlled component.
 | 
			
		||||
   */
 | 
			
		||||
  value: PropTypes.oneOfType([
 | 
			
		||||
    PropTypes.string,
 | 
			
		||||
    PropTypes.number,
 | 
			
		||||
    PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
 | 
			
		||||
  ]),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default SelectInput;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								goTorrentWebUI/node_modules/material-ui/Select/index.js.flow
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								goTorrentWebUI/node_modules/material-ui/Select/index.js.flow
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,3 +1 @@
 | 
			
		||||
// @flow
 | 
			
		||||
 | 
			
		||||
export { default } from './Select';
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user