Completely updated React, fixed #11, (hopefully)
This commit is contained in:
38
goTorrentWebUI/node_modules/material-ui/TextField/TextField.d.ts
generated
vendored
38
goTorrentWebUI/node_modules/material-ui/TextField/TextField.d.ts
generated
vendored
@@ -2,52 +2,44 @@ import * as React from 'react';
|
||||
import { StandardProps, PropTypes } from '..';
|
||||
import { FormControlProps, FormHelperTextProps } from '../Form';
|
||||
import { InputProps, InputLabelProps } from '../Input';
|
||||
import { FormControlClassKey } from '../Form/FormControl'
|
||||
import { FormControlClassKey } from '../Form/FormControl';
|
||||
import { SelectProps } from '../Select';
|
||||
|
||||
export interface TextFieldProps extends StandardProps<
|
||||
FormControlProps,
|
||||
TextFieldClassKey,
|
||||
'onChange' | 'defaultValue'
|
||||
> {
|
||||
export interface TextFieldProps
|
||||
extends StandardProps<FormControlProps, TextFieldClassKey, 'onChange' | 'defaultValue'> {
|
||||
autoComplete?: string;
|
||||
autoFocus?: boolean;
|
||||
children?: React.ReactNode;
|
||||
defaultValue?: string | number;
|
||||
disabled?: boolean;
|
||||
error?: boolean;
|
||||
FormHelperTextProps?: FormHelperTextProps;
|
||||
FormHelperTextProps?: Partial<FormHelperTextProps>;
|
||||
fullWidth?: boolean;
|
||||
helperText?: React.ReactNode;
|
||||
helperTextClassName?: string;
|
||||
id?: string;
|
||||
inputClassName?: string;
|
||||
InputClassName?: string;
|
||||
InputLabelProps?: InputLabelProps;
|
||||
inputProps?: Object;
|
||||
InputProps?: InputProps;
|
||||
InputLabelProps?: Partial<InputLabelProps>;
|
||||
InputProps?: Partial<InputProps>;
|
||||
inputProps?: InputProps['inputProps'];
|
||||
inputRef?: React.Ref<any>;
|
||||
label?: React.ReactNode;
|
||||
labelClassName?: string;
|
||||
margin?: PropTypes.Margin;
|
||||
multiline?: boolean;
|
||||
name?: string;
|
||||
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
||||
placeholder?: string;
|
||||
required?: boolean;
|
||||
rootRef?: React.Ref<any>;
|
||||
rows?: string | number;
|
||||
rowsMax?: string | number;
|
||||
select?: boolean;
|
||||
SelectProps?: Object;
|
||||
SelectProps?: Partial<SelectProps>;
|
||||
type?: string;
|
||||
value?: string | number;
|
||||
margin?: PropTypes.Margin;
|
||||
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
||||
value?: Array<string | number> | string | number;
|
||||
}
|
||||
|
||||
export type TextFieldClassKey =
|
||||
| FormControlClassKey
|
||||
;
|
||||
export type TextFieldClassKey = FormControlClassKey;
|
||||
|
||||
declare const TextField: React.ComponentType<TextFieldProps>;
|
||||
|
||||
declare const Input: React.ComponentType<TextFieldProps>;
|
||||
|
||||
export default Input;
|
||||
export default TextField;
|
||||
|
392
goTorrentWebUI/node_modules/material-ui/TextField/TextField.js
generated
vendored
392
goTorrentWebUI/node_modules/material-ui/TextField/TextField.js
generated
vendored
@@ -20,6 +20,10 @@ var _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _Input = require('../Input');
|
||||
|
||||
var _Input2 = _interopRequireDefault(_Input);
|
||||
@@ -38,186 +42,34 @@ var _Select2 = _interopRequireDefault(_Select);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// @inheritedComponent FormControl
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Node = require('react').babelPluginFlowReactPropTypes_proptype_Node || require('prop-types').any;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_ChildrenArray = require('react').babelPluginFlowReactPropTypes_proptype_ChildrenArray || require('prop-types').any;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Props = {
|
||||
/**
|
||||
* This property helps users to fill forms faster, especially on mobile devices.
|
||||
* The name can be confusion, it's more like an autofill.
|
||||
* You can learn about it with that article
|
||||
* https://developers.google.com/web/updates/2015/06/checkout-faster-with-autofill
|
||||
*/
|
||||
autoComplete: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* If `true`, the input will be focused during the first mount.
|
||||
*/
|
||||
autoFocus: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
children: typeof babelPluginFlowReactPropTypes_proptype_ChildrenArray === 'function' ? babelPluginFlowReactPropTypes_proptype_ChildrenArray : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_ChildrenArray),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* The default value of the `Input` element.
|
||||
*/
|
||||
defaultValue: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* If `true`, the input will be disabled.
|
||||
*/
|
||||
disabled: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* If `true`, the label will be displayed in an error state.
|
||||
*/
|
||||
error: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* Properties applied to the `FormHelperText` element.
|
||||
*/
|
||||
FormHelperTextProps: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* If `true`, the input will take up the full width of its container.
|
||||
*/
|
||||
fullWidth: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* The helper text content.
|
||||
*/
|
||||
helperText: typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node),
|
||||
|
||||
/**
|
||||
* The CSS class name of the helper text element.
|
||||
*/
|
||||
helperTextClassName: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* The id of the `input` element.
|
||||
*/
|
||||
id: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* The CSS class name of the `input` element.
|
||||
*/
|
||||
inputClassName: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* The CSS class name of the `Input` element.
|
||||
*/
|
||||
InputClassName: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* Properties applied to the `InputLabel` element.
|
||||
*/
|
||||
InputLabelProps: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* Properties applied to the `input` element.
|
||||
*/
|
||||
inputProps: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* Properties applied to the `Input` element.
|
||||
*/
|
||||
InputProps: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* Use that property to pass a ref callback to the native input component.
|
||||
*/
|
||||
inputRef: require('prop-types').func,
|
||||
|
||||
/**
|
||||
* The label content.
|
||||
*/
|
||||
label: typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node),
|
||||
|
||||
/**
|
||||
* The CSS class name of the label element.
|
||||
*/
|
||||
labelClassName: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* If `true`, a textarea element will be rendered instead of an input.
|
||||
*/
|
||||
multiline: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* Name attribute of the `input` element.
|
||||
*/
|
||||
name: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* Callback fired when the value is changed.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
*/
|
||||
onChange: require('prop-types').func,
|
||||
|
||||
/**
|
||||
* The short hint displayed in the input before the user enters a value.
|
||||
*/
|
||||
placeholder: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* If `true`, the label is displayed as required.
|
||||
*/
|
||||
required: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* Use that property to pass a ref callback to the root component.
|
||||
*/
|
||||
rootRef: require('prop-types').func,
|
||||
|
||||
/**
|
||||
* Number of rows to display when multiline option is set to true.
|
||||
*/
|
||||
rows: require('prop-types').oneOfType([require('prop-types').string, require('prop-types').number]),
|
||||
|
||||
/**
|
||||
* Maximum number of rows to display when multiline option is set to true.
|
||||
*/
|
||||
rowsMax: require('prop-types').oneOfType([require('prop-types').string, require('prop-types').number]),
|
||||
|
||||
/**
|
||||
* Render a `Select` element while passing the `Input` element to `Select` as `input` parameter.
|
||||
* If this option is set you must pass the options of the select as children.
|
||||
*/
|
||||
select: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* Properties applied to the `Select` element.
|
||||
*/
|
||||
SelectProps: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* Type attribute of the `Input` element. It should be a valid HTML5 input type.
|
||||
*/
|
||||
type: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* The value of the `Input` element, required for a controlled component.
|
||||
*/
|
||||
value: require('prop-types').oneOfType([require('prop-types').string, require('prop-types').number]),
|
||||
|
||||
/**
|
||||
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
||||
*/
|
||||
margin: require('prop-types').oneOf(['none', 'dense', 'normal'])
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The `TextField` is a convenience wrapper for the most common cases (80%).
|
||||
* It cannot be all things to all people, otherwise the API would grow out of control.
|
||||
*
|
||||
* ## Advanced Configuration
|
||||
*
|
||||
* It's important to understand that the text field is a simple abstraction
|
||||
* on top of the following components:
|
||||
* - [FormControl](/api/form-control)
|
||||
* - [InputLabel](/api/input-label)
|
||||
* - [Input](/api/input)
|
||||
* - [FormHelperText](/api/form-helper-text)
|
||||
*
|
||||
* If you wish to alter the properties applied to the native input, you can do as follow:
|
||||
*
|
||||
* ```jsx
|
||||
* const inputProps = {
|
||||
* step: 300,
|
||||
* };
|
||||
*
|
||||
* return <TextField id="time" type="time" inputProps={inputProps} />;
|
||||
* ```
|
||||
*
|
||||
* For advanced cases, please look at the source of TextField by clicking on the
|
||||
* "Edit this page" button above. Consider either:
|
||||
* - using the upper case props for passing values direct to the components.
|
||||
* - using the underlying components directly as shown in the demos.
|
||||
*/
|
||||
function TextField(props) {
|
||||
var autoComplete = props.autoComplete,
|
||||
autoFocus = props.autoFocus,
|
||||
@@ -226,50 +78,40 @@ function TextField(props) {
|
||||
defaultValue = props.defaultValue,
|
||||
disabled = props.disabled,
|
||||
error = props.error,
|
||||
FormHelperTextProps = props.FormHelperTextProps,
|
||||
fullWidth = props.fullWidth,
|
||||
helperText = props.helperText,
|
||||
helperTextClassName = props.helperTextClassName,
|
||||
id = props.id,
|
||||
inputClassName = props.inputClassName,
|
||||
InputClassName = props.InputClassName,
|
||||
inputPropsProp = props.inputProps,
|
||||
InputLabelProps = props.InputLabelProps,
|
||||
inputProps = props.inputProps,
|
||||
InputProps = props.InputProps,
|
||||
inputRef = props.inputRef,
|
||||
label = props.label,
|
||||
labelClassName = props.labelClassName,
|
||||
InputLabelProps = props.InputLabelProps,
|
||||
helperText = props.helperText,
|
||||
helperTextClassName = props.helperTextClassName,
|
||||
FormHelperTextProps = props.FormHelperTextProps,
|
||||
fullWidth = props.fullWidth,
|
||||
required = props.required,
|
||||
type = props.type,
|
||||
multiline = props.multiline,
|
||||
name = props.name,
|
||||
onChange = props.onChange,
|
||||
placeholder = props.placeholder,
|
||||
rootRef = props.rootRef,
|
||||
required = props.required,
|
||||
rows = props.rows,
|
||||
rowsMax = props.rowsMax,
|
||||
select = props.select,
|
||||
SelectProps = props.SelectProps,
|
||||
type = props.type,
|
||||
value = props.value,
|
||||
other = (0, _objectWithoutProperties3.default)(props, ['autoComplete', 'autoFocus', 'children', 'className', 'defaultValue', 'disabled', 'error', 'id', 'inputClassName', 'InputClassName', 'inputProps', 'InputProps', 'inputRef', 'label', 'labelClassName', 'InputLabelProps', 'helperText', 'helperTextClassName', 'FormHelperTextProps', 'fullWidth', 'required', 'type', 'multiline', 'name', 'onChange', 'placeholder', 'rootRef', 'rows', 'rowsMax', 'select', 'SelectProps', 'value']);
|
||||
other = (0, _objectWithoutProperties3.default)(props, ['autoComplete', 'autoFocus', 'children', 'className', 'defaultValue', 'disabled', 'error', 'FormHelperTextProps', 'fullWidth', 'helperText', 'helperTextClassName', 'id', 'InputLabelProps', 'inputProps', 'InputProps', 'inputRef', 'label', 'labelClassName', 'multiline', 'name', 'onChange', 'placeholder', 'required', 'rows', 'rowsMax', 'select', 'SelectProps', 'type', 'value']);
|
||||
|
||||
|
||||
var inputProps = inputPropsProp;
|
||||
|
||||
if (inputClassName) {
|
||||
inputProps = (0, _extends3.default)({
|
||||
className: inputClassName
|
||||
}, inputProps);
|
||||
}
|
||||
|
||||
process.env.NODE_ENV !== "production" ? (0, _warning2.default)(!select || Boolean(children), 'Material-UI: `children` must be passed when using the `TextField` component with `select`.') : void 0;
|
||||
|
||||
var helperTextId = helperText && id ? id + '-helper-text' : undefined;
|
||||
var InputComponent = _react2.default.createElement(_Input2.default, (0, _extends3.default)({
|
||||
autoComplete: autoComplete,
|
||||
autoFocus: autoFocus,
|
||||
className: InputClassName,
|
||||
defaultValue: defaultValue,
|
||||
disabled: disabled,
|
||||
fullWidth: fullWidth,
|
||||
multiline: multiline,
|
||||
name: name,
|
||||
rows: rows,
|
||||
@@ -277,22 +119,21 @@ function TextField(props) {
|
||||
type: type,
|
||||
value: value,
|
||||
id: id,
|
||||
inputProps: inputProps,
|
||||
inputRef: inputRef,
|
||||
onChange: onChange,
|
||||
placeholder: placeholder
|
||||
placeholder: placeholder,
|
||||
inputProps: inputProps
|
||||
}, InputProps));
|
||||
|
||||
return _react2.default.createElement(
|
||||
_FormControl2.default,
|
||||
(0, _extends3.default)({
|
||||
fullWidth: fullWidth,
|
||||
'aria-describedby': helperTextId,
|
||||
className: className,
|
||||
error: error,
|
||||
fullWidth: fullWidth,
|
||||
required: required
|
||||
}, other, {
|
||||
ref: rootRef
|
||||
}),
|
||||
}, other),
|
||||
label && _react2.default.createElement(
|
||||
_Input.InputLabel,
|
||||
(0, _extends3.default)({ htmlFor: id, className: labelClassName }, InputLabelProps),
|
||||
@@ -300,18 +141,147 @@ function TextField(props) {
|
||||
),
|
||||
select ? _react2.default.createElement(
|
||||
_Select2.default,
|
||||
(0, _extends3.default)({ input: InputComponent }, SelectProps),
|
||||
(0, _extends3.default)({ value: value, input: InputComponent }, SelectProps),
|
||||
children
|
||||
) : InputComponent,
|
||||
helperText && _react2.default.createElement(
|
||||
_FormHelperText2.default,
|
||||
(0, _extends3.default)({ className: helperTextClassName }, FormHelperTextProps),
|
||||
(0, _extends3.default)({ className: helperTextClassName, id: helperTextId }, FormHelperTextProps),
|
||||
helperText
|
||||
)
|
||||
);
|
||||
}
|
||||
} // @inheritedComponent FormControl
|
||||
|
||||
TextField.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: _propTypes2.default.string,
|
||||
/**
|
||||
* If `true`, the input will be focused during the first mount.
|
||||
*/
|
||||
autoFocus: _propTypes2.default.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
children: _propTypes2.default.node,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: _propTypes2.default.string,
|
||||
/**
|
||||
* The default value of the `Input` element.
|
||||
*/
|
||||
defaultValue: _propTypes2.default.string,
|
||||
/**
|
||||
* If `true`, the input will be disabled.
|
||||
*/
|
||||
disabled: _propTypes2.default.bool,
|
||||
/**
|
||||
* If `true`, the label will be displayed in an error state.
|
||||
*/
|
||||
error: _propTypes2.default.bool,
|
||||
/**
|
||||
* Properties applied to the `FormHelperText` element.
|
||||
*/
|
||||
FormHelperTextProps: _propTypes2.default.object,
|
||||
/**
|
||||
* If `true`, the input will take up the full width of its container.
|
||||
*/
|
||||
fullWidth: _propTypes2.default.bool,
|
||||
/**
|
||||
* The helper text content.
|
||||
*/
|
||||
helperText: _propTypes2.default.node,
|
||||
/**
|
||||
* The CSS class name of the helper text element.
|
||||
*/
|
||||
helperTextClassName: _propTypes2.default.string,
|
||||
/**
|
||||
* The id of the `input` element.
|
||||
* Use that property to make `label` and `helperText` accessible for screen readers.
|
||||
*/
|
||||
id: _propTypes2.default.string,
|
||||
/**
|
||||
* Properties applied to the `InputLabel` element.
|
||||
*/
|
||||
InputLabelProps: _propTypes2.default.object,
|
||||
/**
|
||||
* Properties applied to the `Input` element.
|
||||
*/
|
||||
InputProps: _propTypes2.default.object,
|
||||
/**
|
||||
* Properties applied to the native `input` element.
|
||||
*/
|
||||
inputProps: _propTypes2.default.object,
|
||||
/**
|
||||
* Use that property to pass a ref callback to the native input component.
|
||||
*/
|
||||
inputRef: _propTypes2.default.func,
|
||||
/**
|
||||
* The label content.
|
||||
*/
|
||||
label: _propTypes2.default.node,
|
||||
/**
|
||||
* The CSS class name of the label element.
|
||||
*/
|
||||
labelClassName: _propTypes2.default.string,
|
||||
/**
|
||||
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
||||
*/
|
||||
margin: _propTypes2.default.oneOf(['none', 'dense', 'normal']),
|
||||
/**
|
||||
* If `true`, a textarea element will be rendered instead of an input.
|
||||
*/
|
||||
multiline: _propTypes2.default.bool,
|
||||
/**
|
||||
* Name attribute of the `input` element.
|
||||
*/
|
||||
name: _propTypes2.default.string,
|
||||
/**
|
||||
* Callback fired when the value is changed.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
*/
|
||||
onChange: _propTypes2.default.func,
|
||||
/**
|
||||
* The short hint displayed in the input before the user enters a value.
|
||||
*/
|
||||
placeholder: _propTypes2.default.string,
|
||||
/**
|
||||
* If `true`, the label is displayed as required.
|
||||
*/
|
||||
required: _propTypes2.default.bool,
|
||||
/**
|
||||
* Number of rows to display when multiline option is set to true.
|
||||
*/
|
||||
rows: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
|
||||
/**
|
||||
* Maximum number of rows to display when multiline option is set to true.
|
||||
*/
|
||||
rowsMax: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
|
||||
/**
|
||||
* Render a `Select` element while passing the `Input` element to `Select` as `input` parameter.
|
||||
* If this option is set you must pass the options of the select as children.
|
||||
*/
|
||||
select: _propTypes2.default.bool,
|
||||
/**
|
||||
* Properties applied to the `Select` element.
|
||||
*/
|
||||
SelectProps: _propTypes2.default.object,
|
||||
/**
|
||||
* Type attribute of the `Input` element. It should be a valid HTML5 input type.
|
||||
*/
|
||||
type: _propTypes2.default.string,
|
||||
/**
|
||||
* The value of the `Input` element, 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]))])
|
||||
} : {};
|
||||
|
||||
TextField.propTypes = process.env.NODE_ENV !== "production" ? babelPluginFlowReactPropTypes_proptype_Props : {};
|
||||
TextField.defaultProps = {
|
||||
required: false,
|
||||
select: false
|
||||
|
349
goTorrentWebUI/node_modules/material-ui/TextField/TextField.js.flow
generated
vendored
349
goTorrentWebUI/node_modules/material-ui/TextField/TextField.js.flow
generated
vendored
@@ -1,156 +1,42 @@
|
||||
// @flow
|
||||
// @inheritedComponent FormControl
|
||||
|
||||
import React from 'react';
|
||||
import warning from 'warning';
|
||||
import type { ChildrenArray, Node } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Input, { InputLabel } from '../Input';
|
||||
import FormControl from '../Form/FormControl';
|
||||
import FormHelperText from '../Form/FormHelperText';
|
||||
import Select from '../Select/Select';
|
||||
|
||||
export type Props = {
|
||||
/**
|
||||
* This property helps users to fill forms faster, especially on mobile devices.
|
||||
* The name can be confusion, it's more like an autofill.
|
||||
* You can learn about it with that article
|
||||
* https://developers.google.com/web/updates/2015/06/checkout-faster-with-autofill
|
||||
*/
|
||||
autoComplete?: string,
|
||||
/**
|
||||
* If `true`, the input will be focused during the first mount.
|
||||
*/
|
||||
autoFocus?: boolean,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
children?: ChildrenArray<*>,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className?: string,
|
||||
/**
|
||||
* The default value of the `Input` element.
|
||||
*/
|
||||
defaultValue?: string,
|
||||
/**
|
||||
* If `true`, the input will be disabled.
|
||||
*/
|
||||
disabled?: boolean,
|
||||
/**
|
||||
* If `true`, the label will be displayed in an error state.
|
||||
*/
|
||||
error?: boolean,
|
||||
/**
|
||||
* Properties applied to the `FormHelperText` element.
|
||||
*/
|
||||
FormHelperTextProps?: Object,
|
||||
/**
|
||||
* If `true`, the input will take up the full width of its container.
|
||||
*/
|
||||
fullWidth?: boolean,
|
||||
/**
|
||||
* The helper text content.
|
||||
*/
|
||||
helperText?: Node,
|
||||
/**
|
||||
* The CSS class name of the helper text element.
|
||||
*/
|
||||
helperTextClassName?: string,
|
||||
/**
|
||||
* The id of the `input` element.
|
||||
*/
|
||||
id?: string,
|
||||
/**
|
||||
* The CSS class name of the `input` element.
|
||||
*/
|
||||
inputClassName?: string,
|
||||
/**
|
||||
* The CSS class name of the `Input` element.
|
||||
*/
|
||||
InputClassName?: string,
|
||||
/**
|
||||
* Properties applied to the `InputLabel` element.
|
||||
*/
|
||||
InputLabelProps?: Object,
|
||||
/**
|
||||
* Properties applied to the `input` element.
|
||||
*/
|
||||
inputProps?: Object,
|
||||
/**
|
||||
* Properties applied to the `Input` element.
|
||||
*/
|
||||
InputProps?: Object,
|
||||
/**
|
||||
* Use that property to pass a ref callback to the native input component.
|
||||
*/
|
||||
inputRef?: Function,
|
||||
/**
|
||||
* The label content.
|
||||
*/
|
||||
label?: Node,
|
||||
/**
|
||||
* The CSS class name of the label element.
|
||||
*/
|
||||
labelClassName?: string,
|
||||
/**
|
||||
* If `true`, a textarea element will be rendered instead of an input.
|
||||
*/
|
||||
multiline?: boolean,
|
||||
/**
|
||||
* Name attribute of the `input` element.
|
||||
*/
|
||||
name?: string,
|
||||
/**
|
||||
* Callback fired when the value is changed.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
*/
|
||||
onChange?: (event: SyntheticInputEvent<>) => void,
|
||||
/**
|
||||
* The short hint displayed in the input before the user enters a value.
|
||||
*/
|
||||
placeholder?: string,
|
||||
/**
|
||||
* If `true`, the label is displayed as required.
|
||||
*/
|
||||
required?: boolean,
|
||||
/**
|
||||
* Use that property to pass a ref callback to the root component.
|
||||
*/
|
||||
rootRef?: Function,
|
||||
/**
|
||||
* Number of rows to display when multiline option is set to true.
|
||||
*/
|
||||
rows?: string | number,
|
||||
/**
|
||||
* Maximum number of rows to display when multiline option is set to true.
|
||||
*/
|
||||
rowsMax?: string | number,
|
||||
/**
|
||||
* Render a `Select` element while passing the `Input` element to `Select` as `input` parameter.
|
||||
* If this option is set you must pass the options of the select as children.
|
||||
*/
|
||||
select?: boolean,
|
||||
/**
|
||||
* Properties applied to the `Select` element.
|
||||
*/
|
||||
SelectProps?: Object,
|
||||
/**
|
||||
* Type attribute of the `Input` element. It should be a valid HTML5 input type.
|
||||
*/
|
||||
type?: string,
|
||||
/**
|
||||
* The value of the `Input` element, required for a controlled component.
|
||||
*/
|
||||
value?: string | number,
|
||||
/**
|
||||
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
||||
*/
|
||||
margin?: 'none' | 'dense' | 'normal',
|
||||
};
|
||||
|
||||
function TextField(props: Props) {
|
||||
/**
|
||||
* The `TextField` is a convenience wrapper for the most common cases (80%).
|
||||
* It cannot be all things to all people, otherwise the API would grow out of control.
|
||||
*
|
||||
* ## Advanced Configuration
|
||||
*
|
||||
* It's important to understand that the text field is a simple abstraction
|
||||
* on top of the following components:
|
||||
* - [FormControl](/api/form-control)
|
||||
* - [InputLabel](/api/input-label)
|
||||
* - [Input](/api/input)
|
||||
* - [FormHelperText](/api/form-helper-text)
|
||||
*
|
||||
* If you wish to alter the properties applied to the native input, you can do as follow:
|
||||
*
|
||||
* ```jsx
|
||||
* const inputProps = {
|
||||
* step: 300,
|
||||
* };
|
||||
*
|
||||
* return <TextField id="time" type="time" inputProps={inputProps} />;
|
||||
* ```
|
||||
*
|
||||
* For advanced cases, please look at the source of TextField by clicking on the
|
||||
* "Edit this page" button above. Consider either:
|
||||
* - using the upper case props for passing values direct to the components.
|
||||
* - using the underlying components directly as shown in the demos.
|
||||
*/
|
||||
function TextField(props) {
|
||||
const {
|
||||
autoComplete,
|
||||
autoFocus,
|
||||
@@ -159,55 +45,44 @@ function TextField(props: Props) {
|
||||
defaultValue,
|
||||
disabled,
|
||||
error,
|
||||
FormHelperTextProps,
|
||||
fullWidth,
|
||||
helperText,
|
||||
helperTextClassName,
|
||||
id,
|
||||
inputClassName,
|
||||
InputClassName,
|
||||
inputProps: inputPropsProp,
|
||||
InputLabelProps,
|
||||
inputProps,
|
||||
InputProps,
|
||||
inputRef,
|
||||
label,
|
||||
labelClassName,
|
||||
InputLabelProps,
|
||||
helperText,
|
||||
helperTextClassName,
|
||||
FormHelperTextProps,
|
||||
fullWidth,
|
||||
required,
|
||||
type,
|
||||
multiline,
|
||||
name,
|
||||
onChange,
|
||||
placeholder,
|
||||
rootRef,
|
||||
required,
|
||||
rows,
|
||||
rowsMax,
|
||||
select,
|
||||
SelectProps,
|
||||
type,
|
||||
value,
|
||||
...other
|
||||
} = props;
|
||||
|
||||
let inputProps = inputPropsProp;
|
||||
|
||||
if (inputClassName) {
|
||||
inputProps = {
|
||||
className: inputClassName,
|
||||
...inputProps,
|
||||
};
|
||||
}
|
||||
|
||||
warning(
|
||||
!select || Boolean(children),
|
||||
'Material-UI: `children` must be passed when using the `TextField` component with `select`.',
|
||||
);
|
||||
|
||||
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
||||
const InputComponent = (
|
||||
<Input
|
||||
autoComplete={autoComplete}
|
||||
autoFocus={autoFocus}
|
||||
className={InputClassName}
|
||||
defaultValue={defaultValue}
|
||||
disabled={disabled}
|
||||
fullWidth={fullWidth}
|
||||
multiline={multiline}
|
||||
name={name}
|
||||
rows={rows}
|
||||
@@ -215,22 +90,22 @@ function TextField(props: Props) {
|
||||
type={type}
|
||||
value={value}
|
||||
id={id}
|
||||
inputProps={inputProps}
|
||||
inputRef={inputRef}
|
||||
onChange={onChange}
|
||||
placeholder={placeholder}
|
||||
inputProps={inputProps}
|
||||
{...InputProps}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<FormControl
|
||||
fullWidth={fullWidth}
|
||||
aria-describedby={helperTextId}
|
||||
className={className}
|
||||
error={error}
|
||||
fullWidth={fullWidth}
|
||||
required={required}
|
||||
{...other}
|
||||
ref={rootRef}
|
||||
>
|
||||
{label && (
|
||||
<InputLabel htmlFor={id} className={labelClassName} {...InputLabelProps}>
|
||||
@@ -238,14 +113,14 @@ function TextField(props: Props) {
|
||||
</InputLabel>
|
||||
)}
|
||||
{select ? (
|
||||
<Select input={InputComponent} {...SelectProps}>
|
||||
<Select value={value} input={InputComponent} {...SelectProps}>
|
||||
{children}
|
||||
</Select>
|
||||
) : (
|
||||
InputComponent
|
||||
)}
|
||||
{helperText && (
|
||||
<FormHelperText className={helperTextClassName} {...FormHelperTextProps}>
|
||||
<FormHelperText className={helperTextClassName} id={helperTextId} {...FormHelperTextProps}>
|
||||
{helperText}
|
||||
</FormHelperText>
|
||||
)}
|
||||
@@ -253,6 +128,140 @@ function TextField(props: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
TextField.propTypes = {
|
||||
/**
|
||||
* 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,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* The default value of the `Input` element.
|
||||
*/
|
||||
defaultValue: PropTypes.string,
|
||||
/**
|
||||
* If `true`, the input will be disabled.
|
||||
*/
|
||||
disabled: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the label will be displayed in an error state.
|
||||
*/
|
||||
error: PropTypes.bool,
|
||||
/**
|
||||
* Properties applied to the `FormHelperText` element.
|
||||
*/
|
||||
FormHelperTextProps: PropTypes.object,
|
||||
/**
|
||||
* If `true`, the input will take up the full width of its container.
|
||||
*/
|
||||
fullWidth: PropTypes.bool,
|
||||
/**
|
||||
* The helper text content.
|
||||
*/
|
||||
helperText: PropTypes.node,
|
||||
/**
|
||||
* The CSS class name of the helper text element.
|
||||
*/
|
||||
helperTextClassName: PropTypes.string,
|
||||
/**
|
||||
* The id of the `input` element.
|
||||
* Use that property to make `label` and `helperText` accessible for screen readers.
|
||||
*/
|
||||
id: PropTypes.string,
|
||||
/**
|
||||
* Properties applied to the `InputLabel` element.
|
||||
*/
|
||||
InputLabelProps: PropTypes.object,
|
||||
/**
|
||||
* Properties applied to the `Input` element.
|
||||
*/
|
||||
InputProps: PropTypes.object,
|
||||
/**
|
||||
* Properties applied to the native `input` element.
|
||||
*/
|
||||
inputProps: PropTypes.object,
|
||||
/**
|
||||
* Use that property to pass a ref callback to the native input component.
|
||||
*/
|
||||
inputRef: PropTypes.func,
|
||||
/**
|
||||
* The label content.
|
||||
*/
|
||||
label: PropTypes.node,
|
||||
/**
|
||||
* The CSS class name of the label element.
|
||||
*/
|
||||
labelClassName: PropTypes.string,
|
||||
/**
|
||||
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
||||
*/
|
||||
margin: PropTypes.oneOf(['none', 'dense', 'normal']),
|
||||
/**
|
||||
* If `true`, a textarea element will be rendered instead of an input.
|
||||
*/
|
||||
multiline: PropTypes.bool,
|
||||
/**
|
||||
* Name attribute of the `input` element.
|
||||
*/
|
||||
name: PropTypes.string,
|
||||
/**
|
||||
* Callback fired when the value is changed.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
*/
|
||||
onChange: PropTypes.func,
|
||||
/**
|
||||
* The short hint displayed in the input before the user enters a value.
|
||||
*/
|
||||
placeholder: PropTypes.string,
|
||||
/**
|
||||
* If `true`, the label is displayed as required.
|
||||
*/
|
||||
required: 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]),
|
||||
/**
|
||||
* Render a `Select` element while passing the `Input` element to `Select` as `input` parameter.
|
||||
* If this option is set you must pass the options of the select as children.
|
||||
*/
|
||||
select: PropTypes.bool,
|
||||
/**
|
||||
* Properties applied to the `Select` element.
|
||||
*/
|
||||
SelectProps: PropTypes.object,
|
||||
/**
|
||||
* Type attribute of the `Input` element. It should be a valid HTML5 input type.
|
||||
*/
|
||||
type: PropTypes.string,
|
||||
/**
|
||||
* The value of the `Input` element, required for a controlled component.
|
||||
*/
|
||||
value: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.number,
|
||||
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
||||
]),
|
||||
};
|
||||
|
||||
TextField.defaultProps = {
|
||||
required: false,
|
||||
select: false,
|
||||
|
2
goTorrentWebUI/node_modules/material-ui/TextField/index.js.flow
generated
vendored
2
goTorrentWebUI/node_modules/material-ui/TextField/index.js.flow
generated
vendored
@@ -1,3 +1 @@
|
||||
// @flow
|
||||
|
||||
export { default } from './TextField';
|
||||
|
Reference in New Issue
Block a user