Completely updated React, fixed #11, (hopefully)
This commit is contained in:
18
goTorrentWebUI/node_modules/material-ui/es/Input/Input.d.ts
generated
vendored
18
goTorrentWebUI/node_modules/material-ui/es/Input/Input.d.ts
generated
vendored
@@ -1,14 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import { StandardProps } from '..';
|
||||
|
||||
export interface InputProps extends StandardProps<
|
||||
React.HTMLAttributes<HTMLDivElement>,
|
||||
InputClassKey,
|
||||
'onChange' | 'onKeyUp' | 'onKeyDown' | 'defaultValue'
|
||||
> {
|
||||
export interface InputProps
|
||||
extends StandardProps<
|
||||
React.HTMLAttributes<HTMLDivElement>,
|
||||
InputClassKey,
|
||||
'onChange' | 'onKeyUp' | 'onKeyDown' | 'defaultValue'
|
||||
> {
|
||||
autoComplete?: string;
|
||||
autoFocus?: boolean;
|
||||
inputComponent?: React.ReactNode;
|
||||
defaultValue?: string | number;
|
||||
disabled?: boolean;
|
||||
disableUnderline?: boolean;
|
||||
@@ -16,6 +16,7 @@ export interface InputProps extends StandardProps<
|
||||
error?: boolean;
|
||||
fullWidth?: boolean;
|
||||
id?: string;
|
||||
inputComponent?: React.ReactType<InputProps>;
|
||||
inputProps?:
|
||||
| React.TextareaHTMLAttributes<HTMLTextAreaElement>
|
||||
| React.InputHTMLAttributes<HTMLInputElement>;
|
||||
@@ -28,7 +29,7 @@ export interface InputProps extends StandardProps<
|
||||
rowsMax?: string | number;
|
||||
startAdornment?: React.ReactNode;
|
||||
type?: string;
|
||||
value?: string | number;
|
||||
value?: Array<string | number> | string | number;
|
||||
onClean?: () => void;
|
||||
onDirty?: () => void;
|
||||
/**
|
||||
@@ -59,8 +60,7 @@ export type InputClassKey =
|
||||
| 'inputSingleline'
|
||||
| 'inputSearch'
|
||||
| 'inputMultiline'
|
||||
| 'fullWidth'
|
||||
;
|
||||
| 'fullWidth';
|
||||
|
||||
declare const Input: React.ComponentType<InputProps>;
|
||||
|
||||
|
391
goTorrentWebUI/node_modules/material-ui/es/Input/Input.js
generated
vendored
391
goTorrentWebUI/node_modules/material-ui/es/Input/Input.js
generated
vendored
@@ -1,15 +1,9 @@
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
// weak
|
||||
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
||||
import React from 'react';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import withStyles from '../styles/withStyles';
|
||||
import { isMuiComponent } from '../utils/reactHelpers';
|
||||
import Textarea from './Textarea';
|
||||
|
||||
// Supports determination of isControlled().
|
||||
@@ -19,7 +13,7 @@ import Textarea from './Textarea';
|
||||
// @param value
|
||||
// @returns {boolean} true if string (including '') or number (including zero)
|
||||
export function hasValue(value) {
|
||||
return value !== undefined && value !== null && !(Array.isArray(value) && value.length === 0);
|
||||
return value != null && !(Array.isArray(value) && value.length === 0);
|
||||
}
|
||||
|
||||
// Determine if field is dirty (a.k.a. filled).
|
||||
@@ -45,30 +39,31 @@ export function isAdornedStart(obj) {
|
||||
}
|
||||
|
||||
export const styles = theme => {
|
||||
const light = theme.palette.type === 'light';
|
||||
const placeholder = {
|
||||
color: 'currentColor',
|
||||
opacity: theme.palette.type === 'light' ? 0.42 : 0.5,
|
||||
opacity: light ? 0.42 : 0.5,
|
||||
transition: theme.transitions.create('opacity', {
|
||||
duration: theme.transitions.duration.shorter,
|
||||
easing: theme.transitions.easing.ease
|
||||
duration: theme.transitions.duration.shorter
|
||||
})
|
||||
};
|
||||
const placeholderHidden = {
|
||||
opacity: 0
|
||||
};
|
||||
const placeholderVisible = {
|
||||
opacity: theme.palette.type === 'light' ? 0.42 : 0.5
|
||||
opacity: light ? 0.42 : 0.5
|
||||
};
|
||||
const bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
|
||||
|
||||
return {
|
||||
root: {
|
||||
// Mimics the default input display property used by browsers for an input.
|
||||
display: 'inline-flex',
|
||||
alignItems: 'baseline',
|
||||
position: 'relative',
|
||||
fontFamily: theme.typography.fontFamily,
|
||||
color: theme.palette.input.inputText,
|
||||
fontSize: theme.typography.pxToRem(16)
|
||||
color: light ? 'rgba(0, 0, 0, 0.87)' : theme.palette.common.white,
|
||||
fontSize: theme.typography.pxToRem(16),
|
||||
lineHeight: '1.1875em' // Reset (19px), match the native input line-height
|
||||
},
|
||||
formControl: {
|
||||
'label + &': {
|
||||
@@ -77,7 +72,7 @@ export const styles = theme => {
|
||||
},
|
||||
inkbar: {
|
||||
'&:after': {
|
||||
backgroundColor: theme.palette.primary[theme.palette.type === 'light' ? 'A700' : 'A200'],
|
||||
backgroundColor: theme.palette.primary[light ? 'dark' : 'light'],
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
// Doing the other way around crash on IE11 "''" https://github.com/cssinjs/jss/issues/242
|
||||
@@ -98,21 +93,61 @@ export const styles = theme => {
|
||||
},
|
||||
error: {
|
||||
'&:after': {
|
||||
backgroundColor: theme.palette.error.A400,
|
||||
backgroundColor: theme.palette.error.main,
|
||||
transform: 'scaleX(1)' // error is always underlined in red
|
||||
}
|
||||
},
|
||||
focused: {},
|
||||
disabled: {
|
||||
color: theme.palette.text.disabled
|
||||
},
|
||||
underline: {
|
||||
'&:before': {
|
||||
backgroundColor: bottomLineColor,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
// Doing the other way around crash on IE11 "''" https://github.com/cssinjs/jss/issues/242
|
||||
content: '""',
|
||||
height: 1,
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
transition: theme.transitions.create('background-color', {
|
||||
duration: theme.transitions.duration.shorter
|
||||
}),
|
||||
pointerEvents: 'none' // Transparent to the hover style.
|
||||
},
|
||||
'&:hover:not($disabled):before': {
|
||||
backgroundColor: theme.palette.text.primary,
|
||||
height: 2
|
||||
},
|
||||
'&$disabled:before': {
|
||||
background: 'transparent',
|
||||
backgroundImage: `linear-gradient(to right, ${bottomLineColor} 33%, transparent 0%)`,
|
||||
backgroundPosition: 'left top',
|
||||
backgroundRepeat: 'repeat-x',
|
||||
backgroundSize: '5px 1px'
|
||||
}
|
||||
},
|
||||
multiline: {
|
||||
padding: `${theme.spacing.unit - 2}px 0 ${theme.spacing.unit - 1}px`
|
||||
},
|
||||
fullWidth: {
|
||||
width: '100%'
|
||||
},
|
||||
input: {
|
||||
font: 'inherit',
|
||||
color: 'currentColor',
|
||||
// slight alteration to spec spacing to match visual spec result
|
||||
padding: `${theme.spacing.unit - 1}px 0 ${theme.spacing.unit + 1}px`,
|
||||
padding: `${theme.spacing.unit - 2}px 0 ${theme.spacing.unit - 1}px`,
|
||||
border: 0,
|
||||
boxSizing: 'content-box',
|
||||
verticalAlign: 'middle',
|
||||
background: 'none',
|
||||
margin: 0, // Reset for Safari
|
||||
// Remove grey highlight
|
||||
WebkitTapHighlightColor: 'transparent',
|
||||
display: 'block',
|
||||
// Make the flex item shrink with Firefox
|
||||
minWidth: 0,
|
||||
width: '100%',
|
||||
'&::-webkit-input-placeholder': placeholder,
|
||||
'&::-moz-placeholder': placeholder, // Firefox 19+
|
||||
@@ -127,7 +162,7 @@ export const styles = theme => {
|
||||
},
|
||||
'&::-webkit-search-decoration': {
|
||||
// Remove the padding when type=search.
|
||||
appearance: 'none'
|
||||
'-webkit-appearance': 'none'
|
||||
},
|
||||
// Show and hide the placeholder logic
|
||||
'label[data-shrink=false] + $formControl &': {
|
||||
@@ -142,62 +177,53 @@ export const styles = theme => {
|
||||
}
|
||||
},
|
||||
inputDense: {
|
||||
paddingTop: theme.spacing.unit / 2
|
||||
},
|
||||
disabled: {
|
||||
color: theme.palette.text.disabled
|
||||
},
|
||||
focused: {},
|
||||
underline: {
|
||||
'&:before': {
|
||||
backgroundColor: theme.palette.input.bottomLine,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
// Doing the other way around crash on IE11 "''" https://github.com/cssinjs/jss/issues/242
|
||||
content: '""',
|
||||
height: 1,
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
transition: theme.transitions.create('background-color', {
|
||||
duration: theme.transitions.duration.shorter,
|
||||
easing: theme.transitions.easing.ease
|
||||
}),
|
||||
pointerEvents: 'none' // Transparent to the hover style.
|
||||
},
|
||||
'&:hover:not($disabled):before': {
|
||||
backgroundColor: theme.palette.text.primary,
|
||||
height: 2
|
||||
},
|
||||
'&$disabled:before': {
|
||||
background: 'transparent',
|
||||
backgroundImage: `linear-gradient(to right, ${theme.palette.input.bottomLine} 33%, transparent 0%)`,
|
||||
backgroundPosition: 'left top',
|
||||
backgroundRepeat: 'repeat-x',
|
||||
backgroundSize: '5px 1px'
|
||||
}
|
||||
},
|
||||
multiline: {
|
||||
padding: `${theme.spacing.unit - 2}px 0 ${theme.spacing.unit - 1}px`
|
||||
paddingTop: theme.spacing.unit / 2 - 1
|
||||
},
|
||||
inputDisabled: {
|
||||
opacity: 1 // Reset iOS opacity
|
||||
},
|
||||
inputSingleline: {
|
||||
height: '1em'
|
||||
},
|
||||
inputSearch: {
|
||||
appearance: 'textfield' // Improve type search style.
|
||||
inputType: {
|
||||
// type="date" or type="time", etc. have specific styles we need to reset.
|
||||
height: '1.1875em' // Reset (19px), match the native input line-height
|
||||
},
|
||||
inputMultiline: {
|
||||
resize: 'none',
|
||||
padding: 0
|
||||
},
|
||||
fullWidth: {
|
||||
width: '100%'
|
||||
inputSearch: {
|
||||
// Improve type search style.
|
||||
'-moz-appearance': 'textfield',
|
||||
'-webkit-appearance': 'textfield'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
function formControlState(props, context) {
|
||||
let disabled = props.disabled;
|
||||
let error = props.error;
|
||||
let margin = props.margin;
|
||||
|
||||
if (context && context.muiFormControl) {
|
||||
if (typeof disabled === 'undefined') {
|
||||
disabled = context.muiFormControl.disabled;
|
||||
}
|
||||
|
||||
if (typeof error === 'undefined') {
|
||||
error = context.muiFormControl.error;
|
||||
}
|
||||
|
||||
if (typeof margin === 'undefined') {
|
||||
margin = context.muiFormControl.margin;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
disabled,
|
||||
error,
|
||||
margin
|
||||
};
|
||||
}
|
||||
|
||||
class Input extends React.Component {
|
||||
constructor(...args) {
|
||||
var _temp;
|
||||
@@ -205,6 +231,13 @@ class Input extends React.Component {
|
||||
return _temp = super(...args), this.state = {
|
||||
focused: false
|
||||
}, this.input = null, this.handleFocus = event => {
|
||||
// Fix an bug with IE11 where the focus/blur events are triggered
|
||||
// while the input is disabled.
|
||||
if (formControlState(this.props, this.context).disabled) {
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({ focused: true });
|
||||
if (this.props.onFocus) {
|
||||
this.props.onFocus(event);
|
||||
@@ -215,7 +248,7 @@ class Input extends React.Component {
|
||||
this.props.onBlur(event);
|
||||
}
|
||||
}, this.handleChange = event => {
|
||||
if (!this.isControlled()) {
|
||||
if (!this.isControlled) {
|
||||
this.checkDirty(this.input);
|
||||
}
|
||||
|
||||
@@ -225,41 +258,54 @@ class Input extends React.Component {
|
||||
}
|
||||
}, this.handleRefInput = node => {
|
||||
this.input = node;
|
||||
|
||||
if (this.props.inputRef) {
|
||||
this.props.inputRef(node);
|
||||
} else if (this.props.inputProps && this.props.inputProps.ref) {
|
||||
this.props.inputProps.ref(node);
|
||||
}
|
||||
}, _temp;
|
||||
}
|
||||
|
||||
getChildContext() {
|
||||
// We are consuming the parent muiFormControl context.
|
||||
// We don't want a child to consume it a second time.
|
||||
return {
|
||||
muiFormControl: null
|
||||
};
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
if (this.isControlled()) {
|
||||
this.isControlled = this.props.value != null;
|
||||
|
||||
if (this.isControlled) {
|
||||
this.checkDirty(this.props);
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (!this.isControlled()) {
|
||||
if (!this.isControlled) {
|
||||
this.checkDirty(this.input);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
// The blur won't fire when the disabled state is set on a focused input.
|
||||
// We need to book keep the focused state manually.
|
||||
if (!this.props.disabled && nextProps.disabled) {
|
||||
if (!formControlState(this.props, this.context).disabled && formControlState(nextProps, nextContext).disabled) {
|
||||
this.setState({
|
||||
focused: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUpdate(nextProps) {
|
||||
if (this.isControlled(nextProps)) {
|
||||
componentWillUpdate(nextProps, nextState, nextContext) {
|
||||
if (this.isControlled) {
|
||||
this.checkDirty(nextProps);
|
||||
} // else performed in the onChange
|
||||
|
||||
// Book keep the focused state.
|
||||
if (!this.props.disabled && nextProps.disabled) {
|
||||
if (!formControlState(this.props, this.context).disabled && formControlState(nextProps, nextContext).disabled) {
|
||||
const { muiFormControl } = this.context;
|
||||
if (muiFormControl && muiFormControl.onBlur) {
|
||||
muiFormControl.onBlur();
|
||||
@@ -270,14 +316,6 @@ class Input extends React.Component {
|
||||
// Holds the input reference
|
||||
|
||||
|
||||
// A controlled input accepts its current value as a prop.
|
||||
//
|
||||
// @see https://facebook.github.io/react/docs/forms.html#controlled-components
|
||||
// @returns {boolean} true if string (including '') or number (including zero)
|
||||
isControlled(props = this.props) {
|
||||
return hasValue(props.value);
|
||||
}
|
||||
|
||||
checkDirty(obj) {
|
||||
const { muiFormControl } = this.context;
|
||||
|
||||
@@ -318,44 +356,27 @@ class Input extends React.Component {
|
||||
inputRef,
|
||||
margin: marginProp,
|
||||
multiline,
|
||||
name,
|
||||
onBlur,
|
||||
onFocus,
|
||||
onChange,
|
||||
onClean,
|
||||
onDirty,
|
||||
onFocus,
|
||||
onKeyDown,
|
||||
onKeyUp,
|
||||
placeholder,
|
||||
name,
|
||||
readOnly,
|
||||
rows,
|
||||
rowsMax,
|
||||
startAdornment,
|
||||
type,
|
||||
// $FlowFixMe
|
||||
value
|
||||
} = _props,
|
||||
inputPropsProp = _objectWithoutProperties(_props.inputProps, ['className']),
|
||||
other = _objectWithoutProperties(_props, ['autoComplete', 'autoFocus', 'classes', 'className', 'defaultValue', 'disabled', 'disableUnderline', 'endAdornment', 'error', 'fullWidth', 'id', 'inputComponent', 'inputProps', 'inputRef', 'margin', 'multiline', 'onBlur', 'onFocus', 'onChange', 'onClean', 'onDirty', 'onKeyDown', 'onKeyUp', 'placeholder', 'name', 'readOnly', 'rows', 'rowsMax', 'startAdornment', 'type', 'value']);
|
||||
other = _objectWithoutProperties(_props, ['autoComplete', 'autoFocus', 'classes', 'className', 'defaultValue', 'disabled', 'disableUnderline', 'endAdornment', 'error', 'fullWidth', 'id', 'inputComponent', 'inputProps', 'inputRef', 'margin', 'multiline', 'name', 'onBlur', 'onChange', 'onClean', 'onDirty', 'onFocus', 'onKeyDown', 'onKeyUp', 'placeholder', 'readOnly', 'rows', 'rowsMax', 'startAdornment', 'type', 'value']);
|
||||
|
||||
const { muiFormControl } = this.context;
|
||||
let disabled = disabledProp;
|
||||
let error = errorProp;
|
||||
let margin = marginProp;
|
||||
|
||||
if (muiFormControl) {
|
||||
if (typeof disabled === 'undefined') {
|
||||
disabled = muiFormControl.disabled;
|
||||
}
|
||||
|
||||
if (typeof error === 'undefined') {
|
||||
error = muiFormControl.error;
|
||||
}
|
||||
|
||||
if (typeof margin === 'undefined') {
|
||||
margin = muiFormControl.margin;
|
||||
}
|
||||
}
|
||||
const { disabled, error, margin } = formControlState(this.props, this.context);
|
||||
|
||||
const className = classNames(classes.root, {
|
||||
[classes.disabled]: disabled,
|
||||
@@ -370,29 +391,28 @@ class Input extends React.Component {
|
||||
|
||||
const inputClassName = classNames(classes.input, {
|
||||
[classes.inputDisabled]: disabled,
|
||||
[classes.inputSingleline]: !multiline,
|
||||
[classes.inputSearch]: type === 'search',
|
||||
[classes.inputType]: type !== 'text',
|
||||
[classes.inputMultiline]: multiline,
|
||||
[classes.inputSearch]: type === 'search',
|
||||
[classes.inputDense]: margin === 'dense'
|
||||
}, inputPropsClassName);
|
||||
|
||||
const required = muiFormControl && muiFormControl.required === true;
|
||||
|
||||
let InputComponent = 'input';
|
||||
let inputProps = _extends({
|
||||
let inputProps = _extends({}, inputPropsProp, {
|
||||
ref: this.handleRefInput
|
||||
}, inputPropsProp);
|
||||
});
|
||||
|
||||
if (inputComponent) {
|
||||
InputComponent = inputComponent;
|
||||
|
||||
if (isMuiComponent(InputComponent, ['SelectInput'])) {
|
||||
inputProps = _extends({
|
||||
selectRef: this.handleRefInput
|
||||
}, inputProps, {
|
||||
ref: null
|
||||
});
|
||||
}
|
||||
inputProps = _extends({
|
||||
// Rename ref to inputRef as we don't know the
|
||||
// provided `inputComponent` structure.
|
||||
inputRef: this.handleRefInput
|
||||
}, inputProps, {
|
||||
ref: null
|
||||
});
|
||||
} else if (multiline) {
|
||||
if (rows && !rowsMax) {
|
||||
InputComponent = 'textarea';
|
||||
@@ -427,22 +447,165 @@ class Input extends React.Component {
|
||||
placeholder: placeholder,
|
||||
type: type,
|
||||
readOnly: readOnly,
|
||||
rows: rows
|
||||
rows: rows,
|
||||
'aria-required': required,
|
||||
'aria-invalid': error
|
||||
}, inputProps)),
|
||||
endAdornment
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Input.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* This property helps users to fill forms faster, especially on mobile devices.
|
||||
* The name can be confusing, as it's more like an autofill.
|
||||
* You can learn more about it here:
|
||||
* https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill
|
||||
*/
|
||||
autoComplete: PropTypes.string,
|
||||
/**
|
||||
* If `true`, the input will be focused during the first mount.
|
||||
*/
|
||||
autoFocus: PropTypes.bool,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: PropTypes.object.isRequired,
|
||||
/**
|
||||
* The CSS class name of the wrapper element.
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* The default input value, useful when not controlling the component.
|
||||
*/
|
||||
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
/**
|
||||
* If `true`, the input will be disabled.
|
||||
*/
|
||||
disabled: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the input will not have an underline.
|
||||
*/
|
||||
disableUnderline: PropTypes.bool,
|
||||
/**
|
||||
* End `InputAdornment` for this component.
|
||||
*/
|
||||
endAdornment: PropTypes.node,
|
||||
/**
|
||||
* If `true`, the input will indicate an error. This is normally obtained via context from
|
||||
* FormControl.
|
||||
*/
|
||||
error: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the input will take up the full width of its container.
|
||||
*/
|
||||
fullWidth: PropTypes.bool,
|
||||
/**
|
||||
* The id of the `input` element.
|
||||
*/
|
||||
id: PropTypes.string,
|
||||
/**
|
||||
* The component used for the native input.
|
||||
* Either a string to use a DOM element or a component.
|
||||
*/
|
||||
inputComponent: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
||||
/**
|
||||
* Properties applied to the `input` element.
|
||||
*/
|
||||
inputProps: PropTypes.object,
|
||||
/**
|
||||
* Use that property to pass a ref callback to the native input component.
|
||||
*/
|
||||
inputRef: PropTypes.func,
|
||||
/**
|
||||
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
|
||||
* FormControl.
|
||||
*/
|
||||
margin: PropTypes.oneOf(['dense', 'none']),
|
||||
/**
|
||||
* If `true`, a textarea element will be rendered.
|
||||
*/
|
||||
multiline: PropTypes.bool,
|
||||
/**
|
||||
* Name attribute of the `input` element.
|
||||
*/
|
||||
name: PropTypes.string,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onBlur: PropTypes.func,
|
||||
/**
|
||||
* Callback fired when the value is changed.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
*/
|
||||
onChange: PropTypes.func,
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
onClean: PropTypes.func,
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
onDirty: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onFocus: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onKeyDown: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onKeyUp: PropTypes.func,
|
||||
/**
|
||||
* The short hint displayed in the input before the user enters a value.
|
||||
*/
|
||||
placeholder: PropTypes.string,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
readOnly: PropTypes.bool,
|
||||
/**
|
||||
* Number of rows to display when multiline option is set to true.
|
||||
*/
|
||||
rows: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
/**
|
||||
* Maximum number of rows to display when multiline option is set to true.
|
||||
*/
|
||||
rowsMax: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
/**
|
||||
* Start `InputAdornment` for this component.
|
||||
*/
|
||||
startAdornment: PropTypes.node,
|
||||
/**
|
||||
* Type of the input element. It should be a valid HTML5 input type.
|
||||
*/
|
||||
type: PropTypes.string,
|
||||
/**
|
||||
* The input value, required for a controlled component.
|
||||
*/
|
||||
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))])
|
||||
} : {};
|
||||
|
||||
Input.muiName = 'Input';
|
||||
|
||||
Input.defaultProps = {
|
||||
disableUnderline: false,
|
||||
fullWidth: false,
|
||||
multiline: false,
|
||||
type: 'text'
|
||||
};
|
||||
|
||||
Input.contextTypes = {
|
||||
muiFormControl: PropTypes.object
|
||||
};
|
||||
|
||||
Input.childContextTypes = {
|
||||
muiFormControl: PropTypes.object
|
||||
};
|
||||
|
||||
export default withStyles(styles, { name: 'MuiInput' })(Input);
|
8
goTorrentWebUI/node_modules/material-ui/es/Input/InputAdornment.d.ts
generated
vendored
8
goTorrentWebUI/node_modules/material-ui/es/Input/InputAdornment.d.ts
generated
vendored
@@ -2,16 +2,12 @@ import * as React from 'react';
|
||||
import { StandardProps } from '..';
|
||||
|
||||
export interface InputAdornmentProps extends StandardProps<{}, InputAdornmentClassKey> {
|
||||
component?: React.ReactType;
|
||||
component?: React.ReactType<InputAdornmentProps>;
|
||||
disableTypography?: boolean;
|
||||
position: 'start' | 'end';
|
||||
}
|
||||
|
||||
export type InputAdornmentClassKey =
|
||||
| 'root'
|
||||
| 'positionStart'
|
||||
| 'positionEnd'
|
||||
;
|
||||
export type InputAdornmentClassKey = 'root' | 'positionStart' | 'positionEnd';
|
||||
|
||||
declare const InputAdornment: React.ComponentType<InputAdornmentProps>;
|
||||
|
||||
|
44
goTorrentWebUI/node_modules/material-ui/es/Input/InputAdornment.js
generated
vendored
44
goTorrentWebUI/node_modules/material-ui/es/Input/InputAdornment.js
generated
vendored
@@ -1,18 +1,16 @@
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
||||
import React from 'react';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import Typography from '../Typography';
|
||||
import withStyles from '../styles/withStyles';
|
||||
|
||||
export const styles = theme => ({
|
||||
root: {
|
||||
'label + div > &': {
|
||||
marginTop: -theme.spacing.unit * 2
|
||||
}
|
||||
display: 'flex',
|
||||
maxHeight: '2em',
|
||||
alignItems: 'center'
|
||||
},
|
||||
positionStart: {
|
||||
marginRight: theme.spacing.unit
|
||||
@@ -43,12 +41,40 @@ function InputAdornment(props) {
|
||||
}, other),
|
||||
typeof children === 'string' && !disableTypography ? React.createElement(
|
||||
Typography,
|
||||
{ color: 'secondary' },
|
||||
{ color: 'textSecondary' },
|
||||
children
|
||||
) : children
|
||||
);
|
||||
}
|
||||
|
||||
InputAdornment.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* The content of the component, normally an `IconButton` or string.
|
||||
*/
|
||||
children: PropTypes.node.isRequired,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: PropTypes.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* The component used for the root node.
|
||||
* Either a string to use a DOM element or a component.
|
||||
*/
|
||||
component: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
||||
/**
|
||||
* If children is a string then disable wrapping in a Typography component.
|
||||
*/
|
||||
disableTypography: PropTypes.bool,
|
||||
/**
|
||||
* The position this adornment should appear relative to the `Input`.
|
||||
*/
|
||||
position: PropTypes.oneOf(['start', 'end'])
|
||||
} : {};
|
||||
|
||||
InputAdornment.defaultProps = {
|
||||
component: 'div',
|
||||
disableTypography: false
|
||||
|
10
goTorrentWebUI/node_modules/material-ui/es/Input/InputLabel.d.ts
generated
vendored
10
goTorrentWebUI/node_modules/material-ui/es/Input/InputLabel.d.ts
generated
vendored
@@ -1,14 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import { StandardProps } from '..';
|
||||
import { FormLabelProps, FormLabelClassKey } from '../Form/FormLabel';
|
||||
import { ClassNameMap } from '../styles/withStyles';
|
||||
|
||||
export interface InputLabelProps extends StandardProps<
|
||||
FormLabelProps,
|
||||
InputLabelClassKey
|
||||
> {
|
||||
export interface InputLabelProps extends StandardProps<FormLabelProps, InputLabelClassKey> {
|
||||
disableAnimation?: boolean;
|
||||
disabled?: boolean;
|
||||
error?: boolean;
|
||||
FormControlClasses?: Partial<ClassNameMap<FormLabelClassKey>>;
|
||||
focused?: boolean;
|
||||
required?: boolean;
|
||||
shrink?: boolean;
|
||||
@@ -19,8 +18,7 @@ export type InputLabelClassKey =
|
||||
| 'formControl'
|
||||
| 'labelDense'
|
||||
| 'shrink'
|
||||
| 'animated'
|
||||
;
|
||||
| 'animated';
|
||||
|
||||
declare const InputLabel: React.ComponentType<InputLabelProps>;
|
||||
|
||||
|
73
goTorrentWebUI/node_modules/material-ui/es/Input/InputLabel.js
generated
vendored
73
goTorrentWebUI/node_modules/material-ui/es/Input/InputLabel.js
generated
vendored
@@ -1,9 +1,8 @@
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
||||
// @inheritedComponent FormLabel
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import withStyles from '../styles/withStyles';
|
||||
@@ -11,14 +10,14 @@ import { FormLabel } from '../Form';
|
||||
|
||||
export const styles = theme => ({
|
||||
root: {
|
||||
transformOrigin: `top ${theme.direction === 'ltr' ? 'left' : 'right'}`
|
||||
transformOrigin: 'top left'
|
||||
},
|
||||
formControl: {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
// slight alteration to spec spacing to match visual spec result
|
||||
transform: `translate(0, ${theme.spacing.unit * 3 - 1}px) scale(1)`
|
||||
transform: `translate(0, ${theme.spacing.unit * 3}px) scale(1)`
|
||||
},
|
||||
labelDense: {
|
||||
// Compensation for the `Input.inputDense` style.
|
||||
@@ -26,7 +25,7 @@ export const styles = theme => ({
|
||||
},
|
||||
shrink: {
|
||||
transform: 'translate(0, 1.5px) scale(0.75)',
|
||||
transformOrigin: `top ${theme.direction === 'ltr' ? 'left' : 'right'}`
|
||||
transformOrigin: 'top left'
|
||||
},
|
||||
animated: {
|
||||
transition: theme.transitions.create('transform', {
|
||||
@@ -35,22 +34,22 @@ export const styles = theme => ({
|
||||
})
|
||||
},
|
||||
disabled: {
|
||||
color: theme.palette.input.disabled
|
||||
color: theme.palette.text.disabled
|
||||
}
|
||||
});
|
||||
|
||||
function InputLabel(props, context) {
|
||||
const {
|
||||
disabled,
|
||||
disableAnimation,
|
||||
children,
|
||||
classes,
|
||||
className: classNameProp,
|
||||
disableAnimation,
|
||||
disabled,
|
||||
FormControlClasses,
|
||||
shrink: shrinkProp,
|
||||
margin: marginProp
|
||||
margin: marginProp,
|
||||
shrink: shrinkProp
|
||||
} = props,
|
||||
other = _objectWithoutProperties(props, ['disabled', 'disableAnimation', 'children', 'classes', 'className', 'FormControlClasses', 'shrink', 'margin']);
|
||||
other = _objectWithoutProperties(props, ['children', 'classes', 'className', 'disableAnimation', 'disabled', 'FormControlClasses', 'margin', 'shrink']);
|
||||
|
||||
const { muiFormControl } = context;
|
||||
let shrink = shrinkProp;
|
||||
@@ -79,6 +78,54 @@ function InputLabel(props, context) {
|
||||
);
|
||||
}
|
||||
|
||||
InputLabel.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* The contents of the `InputLabel`.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: PropTypes.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* If `true`, the transition animation is disabled.
|
||||
*/
|
||||
disableAnimation: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, apply disabled class.
|
||||
*/
|
||||
disabled: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the label will be displayed in an error state.
|
||||
*/
|
||||
error: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the input of this label is focused.
|
||||
*/
|
||||
focused: PropTypes.bool,
|
||||
/**
|
||||
* `classes` property applied to the `FormControl` element.
|
||||
*/
|
||||
FormControlClasses: PropTypes.object,
|
||||
/**
|
||||
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
|
||||
* FormControl.
|
||||
*/
|
||||
margin: PropTypes.oneOf(['dense']),
|
||||
/**
|
||||
* if `true`, the label will indicate that the input is required.
|
||||
*/
|
||||
required: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the label is shrunk.
|
||||
*/
|
||||
shrink: PropTypes.bool
|
||||
} : {};
|
||||
|
||||
InputLabel.defaultProps = {
|
||||
disabled: false,
|
||||
disableAnimation: false
|
||||
|
17
goTorrentWebUI/node_modules/material-ui/es/Input/Textarea.d.ts
generated
vendored
17
goTorrentWebUI/node_modules/material-ui/es/Input/Textarea.d.ts
generated
vendored
@@ -1,11 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import { StandardProps } from '..';
|
||||
|
||||
export interface TextareaProps extends StandardProps<
|
||||
React.TextareaHTMLAttributes<HTMLTextAreaElement>,
|
||||
TextareaClassKey,
|
||||
'rows'
|
||||
> {
|
||||
export interface TextareaProps
|
||||
extends StandardProps<
|
||||
React.TextareaHTMLAttributes<HTMLTextAreaElement>,
|
||||
TextareaClassKey,
|
||||
'rows'
|
||||
> {
|
||||
defaultValue?: any;
|
||||
disabled?: boolean;
|
||||
rows?: string | number;
|
||||
@@ -14,11 +15,7 @@ export interface TextareaProps extends StandardProps<
|
||||
value?: string;
|
||||
}
|
||||
|
||||
export type TextareaClassKey =
|
||||
| 'root'
|
||||
| 'shadow'
|
||||
| 'textarea'
|
||||
;
|
||||
export type TextareaClassKey = 'root' | 'shadow' | 'textarea';
|
||||
|
||||
declare const Textarea: React.ComponentType<TextareaProps>;
|
||||
|
||||
|
58
goTorrentWebUI/node_modules/material-ui/es/Input/Textarea.js
generated
vendored
58
goTorrentWebUI/node_modules/material-ui/es/Input/Textarea.js
generated
vendored
@@ -1,14 +1,13 @@
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
import debounce from 'lodash/debounce';
|
||||
import EventListener from 'react-event-listener';
|
||||
import withStyles from '../styles/withStyles';
|
||||
|
||||
const rowsHeight = 24;
|
||||
const ROWS_HEIGHT = 19;
|
||||
|
||||
export const styles = {
|
||||
root: {
|
||||
@@ -50,7 +49,7 @@ class Textarea extends React.Component {
|
||||
|
||||
return _temp = super(...args), this.state = {
|
||||
height: null
|
||||
}, this.handleResize = debounce(event => {
|
||||
}, this.shadow = null, this.singlelineShadow = null, this.input = null, this.value = null, this.handleResize = debounce(event => {
|
||||
this.syncHeightWithShadow(event);
|
||||
}, 166), this.handleRefInput = node => {
|
||||
this.input = node;
|
||||
@@ -81,7 +80,7 @@ class Textarea extends React.Component {
|
||||
// so that it can check whether they are dirty
|
||||
this.value = this.props.value || this.props.defaultValue || '';
|
||||
this.setState({
|
||||
height: Number(this.props.rows) * rowsHeight
|
||||
height: Number(this.props.rows) * ROWS_HEIGHT
|
||||
});
|
||||
}
|
||||
|
||||
@@ -171,15 +170,54 @@ class Textarea extends React.Component {
|
||||
className: classnames(classes.textarea, className),
|
||||
defaultValue: defaultValue,
|
||||
value: value,
|
||||
onChange: this.handleChange
|
||||
}, other, {
|
||||
onChange: this.handleChange,
|
||||
ref: this.handleRefInput
|
||||
}))
|
||||
}, other))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Textarea.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: PropTypes.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
disabled: PropTypes.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onChange: PropTypes.func,
|
||||
/**
|
||||
* Number of rows to display when multiline option is set to true.
|
||||
*/
|
||||
rows: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
/**
|
||||
* Maximum number of rows to display when multiline option is set to true.
|
||||
*/
|
||||
rowsMax: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
/**
|
||||
* Use that property to pass a ref callback to the native textarea element.
|
||||
*/
|
||||
textareaRef: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
||||
} : {};
|
||||
|
||||
Textarea.defaultProps = {
|
||||
rows: 1
|
||||
};
|
||||
|
||||
export default withStyles(styles, { name: 'MuiTextarea' })(Textarea);
|
1
goTorrentWebUI/node_modules/material-ui/es/Input/index.d.ts
generated
vendored
1
goTorrentWebUI/node_modules/material-ui/es/Input/index.d.ts
generated
vendored
@@ -4,4 +4,3 @@ export { default as InputLabel } from './InputLabel';
|
||||
export * from './InputLabel';
|
||||
export { default as InputAdornment } from './InputAdornment';
|
||||
export * from './InputAdornment';
|
||||
// NOTE: Textarea is missing from exports (intentional?)
|
||||
|
Reference in New Issue
Block a user