Completely updated React, fixed #11, (hopefully)
This commit is contained in:
25
goTorrentWebUI/node_modules/material-ui/Switch/Switch.d.ts
generated
vendored
25
goTorrentWebUI/node_modules/material-ui/Switch/Switch.d.ts
generated
vendored
@@ -2,30 +2,9 @@ import * as React from 'react';
|
||||
import { StandardProps } from '..';
|
||||
import { SwitchBaseProps, SwitchBaseClassKey } from '../internal/SwitchBase';
|
||||
|
||||
export interface SwitchProps extends StandardProps<
|
||||
SwitchBaseProps,
|
||||
SwitchClassKey
|
||||
> {
|
||||
checked?: boolean | string;
|
||||
checkedClassName?: string;
|
||||
checkedIcon?: React.ReactNode;
|
||||
defaultChecked?: boolean;
|
||||
disabled?: boolean;
|
||||
disabledClassName?: string;
|
||||
disableRipple?: boolean;
|
||||
icon?: React.ReactNode;
|
||||
inputProps?: object;
|
||||
name?: string;
|
||||
onChange?: (event: React.ChangeEvent<{}>, checked: boolean) => void;
|
||||
tabIndex?: number;
|
||||
value?: string;
|
||||
}
|
||||
export interface SwitchProps extends StandardProps<SwitchBaseProps, SwitchClassKey> {}
|
||||
|
||||
export type SwitchClassKey =
|
||||
| SwitchBaseClassKey
|
||||
| 'bar'
|
||||
| 'icon'
|
||||
;
|
||||
export type SwitchClassKey = SwitchBaseClassKey | 'bar' | 'icon';
|
||||
|
||||
declare const Switch: React.ComponentType<SwitchProps>;
|
||||
|
||||
|
173
goTorrentWebUI/node_modules/material-ui/Switch/Switch.js
generated
vendored
173
goTorrentWebUI/node_modules/material-ui/Switch/Switch.js
generated
vendored
@@ -5,24 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.styles = undefined;
|
||||
|
||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _extends2 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends3 = _interopRequireDefault(_extends2);
|
||||
|
||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
||||
|
||||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
||||
|
||||
var _ref; // weak
|
||||
|
||||
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);
|
||||
@@ -37,15 +39,15 @@ var _SwitchBase2 = _interopRequireDefault(_SwitchBase);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Node = require('react').babelPluginFlowReactPropTypes_proptype_Node || require('prop-types').any;
|
||||
|
||||
var styles = exports.styles = function styles(theme) {
|
||||
return {
|
||||
root: {
|
||||
display: 'inline-flex',
|
||||
width: 62,
|
||||
position: 'relative',
|
||||
flexShrink: 0
|
||||
flexShrink: 0,
|
||||
// For correct alignment with the text.
|
||||
verticalAlign: 'middle'
|
||||
},
|
||||
bar: {
|
||||
borderRadius: 7,
|
||||
@@ -60,7 +62,7 @@ var styles = exports.styles = function styles(theme) {
|
||||
transition: theme.transitions.create(['opacity', 'background-color'], {
|
||||
duration: theme.transitions.duration.shortest
|
||||
}),
|
||||
backgroundColor: theme.palette.type === 'light' ? '#000' : '#fff',
|
||||
backgroundColor: theme.palette.type === 'light' ? theme.palette.common.black : theme.palette.common.white,
|
||||
opacity: theme.palette.type === 'light' ? 0.38 : 0.3
|
||||
},
|
||||
icon: {
|
||||
@@ -70,6 +72,9 @@ var styles = exports.styles = function styles(theme) {
|
||||
height: 20,
|
||||
borderRadius: '50%'
|
||||
},
|
||||
iconChecked: {
|
||||
boxShadow: theme.shadows[2]
|
||||
},
|
||||
// For SwitchBase
|
||||
default: {
|
||||
zIndex: 1,
|
||||
@@ -79,140 +84,132 @@ var styles = exports.styles = function styles(theme) {
|
||||
})
|
||||
},
|
||||
checked: {
|
||||
color: theme.palette.primary[500],
|
||||
transform: 'translateX(14px)',
|
||||
'& + $bar': {
|
||||
backgroundColor: theme.palette.primary[500],
|
||||
opacity: 0.5
|
||||
}
|
||||
},
|
||||
checkedPrimary: {
|
||||
color: theme.palette.primary.main,
|
||||
'& + $bar': {
|
||||
backgroundColor: theme.palette.primary.main
|
||||
}
|
||||
},
|
||||
checkedSecondary: {
|
||||
color: theme.palette.secondary.main,
|
||||
'& + $bar': {
|
||||
backgroundColor: theme.palette.secondary.main
|
||||
}
|
||||
},
|
||||
disabled: {
|
||||
color: theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[800],
|
||||
'& + $bar': {
|
||||
backgroundColor: theme.palette.type === 'light' ? '#000' : '#fff',
|
||||
backgroundColor: theme.palette.type === 'light' ? theme.palette.common.black : theme.palette.common.white,
|
||||
opacity: theme.palette.type === 'light' ? 0.12 : 0.1
|
||||
},
|
||||
'& $icon': {
|
||||
boxShadow: theme.shadows[1]
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var SwitchBase = (0, _SwitchBase2.default)();
|
||||
function Switch(props) {
|
||||
var _classNames;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Props = {
|
||||
var classes = props.classes,
|
||||
className = props.className,
|
||||
color = props.color,
|
||||
other = (0, _objectWithoutProperties3.default)(props, ['classes', 'className', 'color']);
|
||||
|
||||
var icon = _react2.default.createElement('span', { className: classes.icon });
|
||||
var checkedIcon = _react2.default.createElement('span', { className: (0, _classnames2.default)(classes.icon, classes.iconChecked) });
|
||||
var checkedClass = (0, _classnames2.default)(classes.checked, (_classNames = {}, (0, _defineProperty3.default)(_classNames, classes.checkedPrimary, color === 'primary'), (0, _defineProperty3.default)(_classNames, classes.checkedSecondary, color === 'secondary'), _classNames));
|
||||
|
||||
return _react2.default.createElement(
|
||||
'span',
|
||||
{ className: (0, _classnames2.default)(classes.root, className) },
|
||||
_react2.default.createElement(_SwitchBase2.default, (0, _extends3.default)({
|
||||
icon: icon,
|
||||
classes: {
|
||||
default: classes.default,
|
||||
checked: checkedClass,
|
||||
disabled: classes.disabled
|
||||
},
|
||||
checkedIcon: checkedIcon
|
||||
}, other)),
|
||||
_react2.default.createElement('span', { className: classes.bar })
|
||||
);
|
||||
}
|
||||
|
||||
Switch.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* If `true`, the component is checked.
|
||||
*/
|
||||
checked: require('prop-types').oneOfType([require('prop-types').bool, require('prop-types').string]),
|
||||
|
||||
/**
|
||||
* The CSS class name of the root element when checked.
|
||||
*/
|
||||
checkedClassName: require('prop-types').string,
|
||||
|
||||
checked: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.string]),
|
||||
/**
|
||||
* The icon to display when the component is checked.
|
||||
* If a string is provided, it will be used as a font ligature.
|
||||
*/
|
||||
checkedIcon: typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node),
|
||||
|
||||
checkedIcon: _propTypes2.default.node,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: require('prop-types').object,
|
||||
|
||||
classes: _propTypes2.default.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: require('prop-types').string,
|
||||
|
||||
className: _propTypes2.default.string,
|
||||
/**
|
||||
* The color of the component. It supports those theme colors that make sense for this component.
|
||||
*/
|
||||
color: _propTypes2.default.oneOf(['primary', 'secondary']),
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
defaultChecked: require('prop-types').bool,
|
||||
|
||||
defaultChecked: _propTypes2.default.bool,
|
||||
/**
|
||||
* If `true`, the switch will be disabled.
|
||||
*/
|
||||
disabled: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* The CSS class name of the root element when disabled.
|
||||
*/
|
||||
disabledClassName: require('prop-types').string,
|
||||
|
||||
disabled: _propTypes2.default.bool,
|
||||
/**
|
||||
* If `true`, the ripple effect will be disabled.
|
||||
*/
|
||||
disableRipple: require('prop-types').bool,
|
||||
|
||||
disableRipple: _propTypes2.default.bool,
|
||||
/**
|
||||
* The icon to display when the component is unchecked.
|
||||
* If a string is provided, it will be used as a font ligature.
|
||||
*/
|
||||
icon: typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node),
|
||||
|
||||
icon: _propTypes2.default.node,
|
||||
/**
|
||||
* The id of the `input` element.
|
||||
*/
|
||||
id: _propTypes2.default.string,
|
||||
/**
|
||||
* Properties applied to the `input` element.
|
||||
*/
|
||||
inputProps: require('prop-types').object,
|
||||
|
||||
inputProps: _propTypes2.default.object,
|
||||
/**
|
||||
* Use that property to pass a ref callback to the native input component.
|
||||
*/
|
||||
inputRef: require('prop-types').func,
|
||||
|
||||
/*
|
||||
* @ignore
|
||||
*/
|
||||
name: require('prop-types').string,
|
||||
|
||||
inputRef: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired when the state is changed.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
* @param {boolean} checked The `checked` value of the switch
|
||||
*/
|
||||
onChange: require('prop-types').func,
|
||||
|
||||
onChange: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
* The input component property `type`.
|
||||
*/
|
||||
tabIndex: require('prop-types').oneOfType([require('prop-types').number, require('prop-types').string]),
|
||||
|
||||
type: _propTypes2.default.string,
|
||||
/**
|
||||
* The value of the component.
|
||||
*/
|
||||
value: require('prop-types').string
|
||||
value: _propTypes2.default.string
|
||||
} : {};
|
||||
|
||||
Switch.defaultProps = {
|
||||
color: 'secondary'
|
||||
};
|
||||
|
||||
|
||||
function Switch(props) {
|
||||
var classes = props.classes,
|
||||
className = props.className,
|
||||
other = (0, _objectWithoutProperties3.default)(props, ['classes', 'className']);
|
||||
|
||||
var icon = _react2.default.createElement('div', { className: classes.icon });
|
||||
|
||||
return _react2.default.createElement(
|
||||
'div',
|
||||
{ className: (0, _classnames2.default)(classes.root, className) },
|
||||
_react2.default.createElement(SwitchBase, (0, _extends3.default)({
|
||||
icon: icon,
|
||||
classes: {
|
||||
default: classes.default,
|
||||
checked: classes.checked,
|
||||
disabled: classes.disabled
|
||||
},
|
||||
checkedIcon: icon
|
||||
}, other)),
|
||||
_react2.default.createElement('div', { className: classes.bar })
|
||||
);
|
||||
}
|
||||
|
||||
Switch.propTypes = process.env.NODE_ENV !== "production" ? (_ref = {
|
||||
classes: require('prop-types').object.isRequired,
|
||||
checked: require('prop-types').oneOfType([require('prop-types').bool, require('prop-types').string]),
|
||||
checkedClassName: require('prop-types').string,
|
||||
checkedIcon: typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node)
|
||||
}, (0, _defineProperty3.default)(_ref, 'classes', require('prop-types').object), (0, _defineProperty3.default)(_ref, 'className', require('prop-types').string), (0, _defineProperty3.default)(_ref, 'defaultChecked', require('prop-types').bool), (0, _defineProperty3.default)(_ref, 'disabled', require('prop-types').bool), (0, _defineProperty3.default)(_ref, 'disabledClassName', require('prop-types').string), (0, _defineProperty3.default)(_ref, 'disableRipple', require('prop-types').bool), (0, _defineProperty3.default)(_ref, 'icon', typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node)), (0, _defineProperty3.default)(_ref, 'inputProps', require('prop-types').object), (0, _defineProperty3.default)(_ref, 'inputRef', require('prop-types').func), (0, _defineProperty3.default)(_ref, 'name', require('prop-types').string), (0, _defineProperty3.default)(_ref, 'onChange', require('prop-types').func), (0, _defineProperty3.default)(_ref, 'tabIndex', require('prop-types').oneOfType([require('prop-types').number, require('prop-types').string])), (0, _defineProperty3.default)(_ref, 'value', require('prop-types').string), _ref) : {};
|
||||
exports.default = (0, _withStyles2.default)(styles, { name: 'MuiSwitch' })(Switch);
|
139
goTorrentWebUI/node_modules/material-ui/Switch/Switch.js.flow
generated
vendored
139
goTorrentWebUI/node_modules/material-ui/Switch/Switch.js.flow
generated
vendored
@@ -1,17 +1,17 @@
|
||||
// @flow weak
|
||||
|
||||
import React from 'react';
|
||||
import type { Node } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import withStyles from '../styles/withStyles';
|
||||
import createSwitch from '../internal/SwitchBase';
|
||||
import SwitchBase from '../internal/SwitchBase';
|
||||
|
||||
export const styles = (theme: Object) => ({
|
||||
export const styles = theme => ({
|
||||
root: {
|
||||
display: 'inline-flex',
|
||||
width: 62,
|
||||
position: 'relative',
|
||||
flexShrink: 0,
|
||||
// For correct alignment with the text.
|
||||
verticalAlign: 'middle',
|
||||
},
|
||||
bar: {
|
||||
borderRadius: 7,
|
||||
@@ -26,7 +26,8 @@ export const styles = (theme: Object) => ({
|
||||
transition: theme.transitions.create(['opacity', 'background-color'], {
|
||||
duration: theme.transitions.duration.shortest,
|
||||
}),
|
||||
backgroundColor: theme.palette.type === 'light' ? '#000' : '#fff',
|
||||
backgroundColor:
|
||||
theme.palette.type === 'light' ? theme.palette.common.black : theme.palette.common.white,
|
||||
opacity: theme.palette.type === 'light' ? 0.38 : 0.3,
|
||||
},
|
||||
icon: {
|
||||
@@ -36,6 +37,9 @@ export const styles = (theme: Object) => ({
|
||||
height: 20,
|
||||
borderRadius: '50%',
|
||||
},
|
||||
iconChecked: {
|
||||
boxShadow: theme.shadows[2],
|
||||
},
|
||||
// For SwitchBase
|
||||
default: {
|
||||
zIndex: 1,
|
||||
@@ -45,119 +49,130 @@ export const styles = (theme: Object) => ({
|
||||
}),
|
||||
},
|
||||
checked: {
|
||||
color: theme.palette.primary[500],
|
||||
transform: 'translateX(14px)',
|
||||
'& + $bar': {
|
||||
backgroundColor: theme.palette.primary[500],
|
||||
opacity: 0.5,
|
||||
},
|
||||
},
|
||||
checkedPrimary: {
|
||||
color: theme.palette.primary.main,
|
||||
'& + $bar': {
|
||||
backgroundColor: theme.palette.primary.main,
|
||||
},
|
||||
},
|
||||
checkedSecondary: {
|
||||
color: theme.palette.secondary.main,
|
||||
'& + $bar': {
|
||||
backgroundColor: theme.palette.secondary.main,
|
||||
},
|
||||
},
|
||||
disabled: {
|
||||
color: theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[800],
|
||||
'& + $bar': {
|
||||
backgroundColor: theme.palette.type === 'light' ? '#000' : '#fff',
|
||||
backgroundColor:
|
||||
theme.palette.type === 'light' ? theme.palette.common.black : theme.palette.common.white,
|
||||
opacity: theme.palette.type === 'light' ? 0.12 : 0.1,
|
||||
},
|
||||
'& $icon': {
|
||||
boxShadow: theme.shadows[1],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const SwitchBase = createSwitch();
|
||||
function Switch(props) {
|
||||
const { classes, className, color, ...other } = props;
|
||||
const icon = <span className={classes.icon} />;
|
||||
const checkedIcon = <span className={classNames(classes.icon, classes.iconChecked)} />;
|
||||
const checkedClass = classNames(classes.checked, {
|
||||
[classes.checkedPrimary]: color === 'primary',
|
||||
[classes.checkedSecondary]: color === 'secondary',
|
||||
});
|
||||
|
||||
type ProvidedProps = {
|
||||
classes: Object,
|
||||
};
|
||||
return (
|
||||
<span className={classNames(classes.root, className)}>
|
||||
<SwitchBase
|
||||
icon={icon}
|
||||
classes={{
|
||||
default: classes.default,
|
||||
checked: checkedClass,
|
||||
disabled: classes.disabled,
|
||||
}}
|
||||
checkedIcon={checkedIcon}
|
||||
{...other}
|
||||
/>
|
||||
<span className={classes.bar} />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export type Props = {
|
||||
Switch.propTypes = {
|
||||
/**
|
||||
* If `true`, the component is checked.
|
||||
*/
|
||||
checked?: boolean | string,
|
||||
/**
|
||||
* The CSS class name of the root element when checked.
|
||||
*/
|
||||
checkedClassName?: string,
|
||||
checked: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
||||
/**
|
||||
* The icon to display when the component is checked.
|
||||
* If a string is provided, it will be used as a font ligature.
|
||||
*/
|
||||
checkedIcon?: Node,
|
||||
checkedIcon: PropTypes.node,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes?: Object,
|
||||
classes: PropTypes.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className?: string,
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* The color of the component. It supports those theme colors that make sense for this component.
|
||||
*/
|
||||
color: PropTypes.oneOf(['primary', 'secondary']),
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
defaultChecked?: boolean,
|
||||
defaultChecked: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the switch will be disabled.
|
||||
*/
|
||||
disabled?: boolean,
|
||||
/**
|
||||
* The CSS class name of the root element when disabled.
|
||||
*/
|
||||
disabledClassName?: string,
|
||||
disabled: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the ripple effect will be disabled.
|
||||
*/
|
||||
disableRipple?: boolean,
|
||||
disableRipple: PropTypes.bool,
|
||||
/**
|
||||
* The icon to display when the component is unchecked.
|
||||
* If a string is provided, it will be used as a font ligature.
|
||||
*/
|
||||
icon?: Node,
|
||||
icon: PropTypes.node,
|
||||
/**
|
||||
* The id of the `input` element.
|
||||
*/
|
||||
id: PropTypes.string,
|
||||
/**
|
||||
* Properties applied to the `input` element.
|
||||
*/
|
||||
inputProps?: Object,
|
||||
inputProps: PropTypes.object,
|
||||
/**
|
||||
* Use that property to pass a ref callback to the native input component.
|
||||
*/
|
||||
inputRef?: Function,
|
||||
/*
|
||||
* @ignore
|
||||
*/
|
||||
name?: string,
|
||||
inputRef: PropTypes.func,
|
||||
/**
|
||||
* Callback fired when the state is changed.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
* @param {boolean} checked The `checked` value of the switch
|
||||
*/
|
||||
onChange?: Function,
|
||||
onChange: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
* The input component property `type`.
|
||||
*/
|
||||
tabIndex?: number | string,
|
||||
type: PropTypes.string,
|
||||
/**
|
||||
* The value of the component.
|
||||
*/
|
||||
value?: string,
|
||||
value: PropTypes.string,
|
||||
};
|
||||
|
||||
function Switch(props: ProvidedProps & Props) {
|
||||
const { classes, className, ...other } = props;
|
||||
const icon = <div className={classes.icon} />;
|
||||
|
||||
return (
|
||||
<div className={classNames(classes.root, className)}>
|
||||
<SwitchBase
|
||||
icon={icon}
|
||||
classes={{
|
||||
default: classes.default,
|
||||
checked: classes.checked,
|
||||
disabled: classes.disabled,
|
||||
}}
|
||||
checkedIcon={icon}
|
||||
{...other}
|
||||
/>
|
||||
<div className={classes.bar} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Switch.defaultProps = {
|
||||
color: 'secondary',
|
||||
};
|
||||
|
||||
export default withStyles(styles, { name: 'MuiSwitch' })(Switch);
|
||||
|
2
goTorrentWebUI/node_modules/material-ui/Switch/index.js.flow
generated
vendored
2
goTorrentWebUI/node_modules/material-ui/Switch/index.js.flow
generated
vendored
@@ -1,3 +1 @@
|
||||
// @flow
|
||||
|
||||
export { default } from './Switch';
|
||||
|
Reference in New Issue
Block a user