Completely updated React, fixed #11, (hopefully)
This commit is contained in:
15
goTorrentWebUI/node_modules/material-ui/BottomNavigation/BottomNavigation.d.ts
generated
vendored
15
goTorrentWebUI/node_modules/material-ui/BottomNavigation/BottomNavigation.d.ts
generated
vendored
@@ -1,20 +1,19 @@
|
||||
import * as React from 'react';
|
||||
import { StandardProps } from '..';
|
||||
|
||||
export interface BottomNavigationProps extends StandardProps<
|
||||
React.HTMLAttributes<HTMLDivElement>,
|
||||
BottomNavigationClassKey,
|
||||
'onChange'
|
||||
> {
|
||||
export interface BottomNavigationProps
|
||||
extends StandardProps<
|
||||
React.HTMLAttributes<HTMLDivElement>,
|
||||
BottomNavigationClassKey,
|
||||
'onChange'
|
||||
> {
|
||||
children: React.ReactNode;
|
||||
onChange?: (event: React.ChangeEvent<{}>, value: any) => void;
|
||||
showLabels?: boolean;
|
||||
value?: any;
|
||||
}
|
||||
|
||||
export type BottomNavigationClassKey =
|
||||
| 'root'
|
||||
;
|
||||
export type BottomNavigationClassKey = 'root';
|
||||
|
||||
declare const BottomNavigation: React.ComponentType<BottomNavigationProps>;
|
||||
|
||||
|
89
goTorrentWebUI/node_modules/material-ui/BottomNavigation/BottomNavigation.js
generated
vendored
89
goTorrentWebUI/node_modules/material-ui/BottomNavigation/BottomNavigation.js
generated
vendored
@@ -5,10 +5,6 @@ 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);
|
||||
@@ -17,12 +13,14 @@ var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProp
|
||||
|
||||
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);
|
||||
@@ -33,8 +31,6 @@ var _withStyles2 = _interopRequireDefault(_withStyles);
|
||||
|
||||
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: {
|
||||
@@ -46,43 +42,6 @@ var styles = exports.styles = function styles(theme) {
|
||||
};
|
||||
};
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Props = {
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
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,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* Callback fired when the value changes.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
* @param {any} value We default to the index of the child
|
||||
*/
|
||||
onChange: require('prop-types').func,
|
||||
|
||||
/**
|
||||
* If `true`, all `BottomNavigationButton`s will show their labels.
|
||||
* By default only the selected `BottomNavigationButton` will show its label.
|
||||
*/
|
||||
showLabels: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* The value of the currently selected `BottomNavigationButton`.
|
||||
*/
|
||||
value: require('prop-types').any.isRequired
|
||||
};
|
||||
|
||||
|
||||
function BottomNavigation(props) {
|
||||
var childrenProp = props.children,
|
||||
classes = props.classes,
|
||||
@@ -96,6 +55,10 @@ function BottomNavigation(props) {
|
||||
var className = (0, _classnames2.default)(classes.root, classNameProp);
|
||||
|
||||
var children = _react2.default.Children.map(childrenProp, function (child, childIndex) {
|
||||
if (!_react2.default.isValidElement(child)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var childValue = child.props.value || childIndex;
|
||||
return _react2.default.cloneElement(child, {
|
||||
selected: childValue === value,
|
||||
@@ -112,11 +75,37 @@ function BottomNavigation(props) {
|
||||
);
|
||||
}
|
||||
|
||||
BottomNavigation.propTypes = process.env.NODE_ENV !== "production" ? (_ref = {
|
||||
classes: require('prop-types').object.isRequired,
|
||||
showLabels: require('prop-types').bool.isRequired,
|
||||
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
|
||||
}, (0, _defineProperty3.default)(_ref, 'classes', require('prop-types').object), (0, _defineProperty3.default)(_ref, 'className', require('prop-types').string), (0, _defineProperty3.default)(_ref, 'onChange', require('prop-types').func), (0, _defineProperty3.default)(_ref, 'showLabels', require('prop-types').bool), (0, _defineProperty3.default)(_ref, 'value', require('prop-types').any.isRequired), _ref) : {};
|
||||
BottomNavigation.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
children: _propTypes2.default.node.isRequired,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: _propTypes2.default.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: _propTypes2.default.string,
|
||||
/**
|
||||
* Callback fired when the value changes.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
* @param {any} value We default to the index of the child
|
||||
*/
|
||||
onChange: _propTypes2.default.func,
|
||||
/**
|
||||
* If `true`, all `BottomNavigationAction`s will show their labels.
|
||||
* By default, only the selected `BottomNavigationAction` will show its label.
|
||||
*/
|
||||
showLabels: _propTypes2.default.bool,
|
||||
/**
|
||||
* The value of the currently selected `BottomNavigationAction`.
|
||||
*/
|
||||
value: _propTypes2.default.any
|
||||
} : {};
|
||||
|
||||
BottomNavigation.defaultProps = {
|
||||
showLabels: false
|
||||
};
|
||||
|
79
goTorrentWebUI/node_modules/material-ui/BottomNavigation/BottomNavigation.js.flow
generated
vendored
79
goTorrentWebUI/node_modules/material-ui/BottomNavigation/BottomNavigation.js.flow
generated
vendored
@@ -1,11 +1,9 @@
|
||||
// @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';
|
||||
|
||||
export const styles = (theme: Object) => ({
|
||||
export const styles = theme => ({
|
||||
root: {
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
@@ -14,43 +12,7 @@ export const styles = (theme: Object) => ({
|
||||
},
|
||||
});
|
||||
|
||||
type ProvidedProps = {
|
||||
classes: Object,
|
||||
showLabels: boolean,
|
||||
};
|
||||
|
||||
export type Props = {
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
children: Node,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes?: Object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className?: string,
|
||||
/**
|
||||
* Callback fired when the value changes.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
* @param {any} value We default to the index of the child
|
||||
*/
|
||||
onChange?: Function,
|
||||
/**
|
||||
* If `true`, all `BottomNavigationButton`s will show their labels.
|
||||
* By default only the selected `BottomNavigationButton` will show its label.
|
||||
*/
|
||||
showLabels?: boolean,
|
||||
/**
|
||||
* The value of the currently selected `BottomNavigationButton`.
|
||||
*/
|
||||
value: any,
|
||||
};
|
||||
|
||||
function BottomNavigation(props: ProvidedProps & Props) {
|
||||
function BottomNavigation(props) {
|
||||
const {
|
||||
children: childrenProp,
|
||||
classes,
|
||||
@@ -64,6 +26,10 @@ function BottomNavigation(props: ProvidedProps & Props) {
|
||||
const className = classNames(classes.root, classNameProp);
|
||||
|
||||
const children = React.Children.map(childrenProp, (child, childIndex) => {
|
||||
if (!React.isValidElement(child)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const childValue = child.props.value || childIndex;
|
||||
return React.cloneElement(child, {
|
||||
selected: childValue === value,
|
||||
@@ -80,6 +46,37 @@ function BottomNavigation(props: ProvidedProps & Props) {
|
||||
);
|
||||
}
|
||||
|
||||
BottomNavigation.propTypes = {
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
children: PropTypes.node.isRequired,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: PropTypes.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* Callback fired when the value changes.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
* @param {any} value We default to the index of the child
|
||||
*/
|
||||
onChange: PropTypes.func,
|
||||
/**
|
||||
* If `true`, all `BottomNavigationAction`s will show their labels.
|
||||
* By default, only the selected `BottomNavigationAction` will show its label.
|
||||
*/
|
||||
showLabels: PropTypes.bool,
|
||||
/**
|
||||
* The value of the currently selected `BottomNavigationAction`.
|
||||
*/
|
||||
value: PropTypes.any,
|
||||
};
|
||||
|
||||
BottomNavigation.defaultProps = {
|
||||
showLabels: false,
|
||||
};
|
||||
|
@@ -2,11 +2,8 @@ import * as React from 'react';
|
||||
import { StandardProps } from '..';
|
||||
import { ButtonBaseProps, ButtonBaseClassKey } from '../ButtonBase';
|
||||
|
||||
export interface BottomNavigationButtonProps extends StandardProps<
|
||||
ButtonBaseProps,
|
||||
BottomNavigationButtonClassKey,
|
||||
'onChange'
|
||||
> {
|
||||
export interface BottomNavigationActionProps
|
||||
extends StandardProps<ButtonBaseProps, BottomNavigationActionClassKey, 'onChange'> {
|
||||
icon?: string | React.ReactElement<any>;
|
||||
label?: React.ReactNode;
|
||||
onChange?: (event: React.ChangeEvent<{}>, value: any) => void;
|
||||
@@ -16,17 +13,15 @@ export interface BottomNavigationButtonProps extends StandardProps<
|
||||
value?: any;
|
||||
}
|
||||
|
||||
export type BottomNavigationButtonClassKey =
|
||||
export type BottomNavigationActionClassKey =
|
||||
| ButtonBaseClassKey
|
||||
| 'selected'
|
||||
| 'selectedIconOnly'
|
||||
| 'wrapper'
|
||||
| 'label'
|
||||
| 'selectedLabel'
|
||||
| 'hiddenLabel'
|
||||
| 'icon'
|
||||
;
|
||||
| 'hiddenLabel';
|
||||
|
||||
declare const BottomNavigationButton: React.ComponentType<BottomNavigationButtonProps>;
|
||||
declare const BottomNavigationAction: React.ComponentType<BottomNavigationActionProps>;
|
||||
|
||||
export default BottomNavigationButton;
|
||||
export default BottomNavigationAction;
|
@@ -41,6 +41,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);
|
||||
@@ -53,24 +57,15 @@ var _ButtonBase = require('../ButtonBase');
|
||||
|
||||
var _ButtonBase2 = _interopRequireDefault(_ButtonBase);
|
||||
|
||||
var _Icon = require('../Icon');
|
||||
|
||||
var _Icon2 = _interopRequireDefault(_Icon);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Element = require('react').babelPluginFlowReactPropTypes_proptype_Element || require('prop-types').any;
|
||||
// @inheritedComponent ButtonBase
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Node = require('react').babelPluginFlowReactPropTypes_proptype_Node || require('prop-types').any;
|
||||
|
||||
var styles = exports.styles = function styles(theme) {
|
||||
return {
|
||||
root: {
|
||||
transition: theme.transitions.create(['color', 'padding-top'], {
|
||||
duration: theme.transitions.duration.short
|
||||
}),
|
||||
paddingTop: 8,
|
||||
paddingTop: theme.spacing.unit,
|
||||
paddingBottom: 10,
|
||||
paddingLeft: 12,
|
||||
paddingRight: 12,
|
||||
@@ -81,7 +76,7 @@ var styles = exports.styles = function styles(theme) {
|
||||
},
|
||||
selected: {
|
||||
paddingTop: 6,
|
||||
color: theme.palette.primary[500]
|
||||
color: theme.palette.primary.main
|
||||
},
|
||||
selectedIconOnly: {
|
||||
paddingTop: theme.spacing.unit * 2
|
||||
@@ -106,76 +101,25 @@ var styles = exports.styles = function styles(theme) {
|
||||
hiddenLabel: {
|
||||
opacity: 0,
|
||||
transitionDelay: '0s'
|
||||
},
|
||||
icon: {
|
||||
display: 'block',
|
||||
margin: 'auto'
|
||||
}
|
||||
};
|
||||
};
|
||||
}; // @inheritedComponent ButtonBase
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Props = {
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: require('prop-types').object,
|
||||
var BottomNavigationAction = function (_React$Component) {
|
||||
(0, _inherits3.default)(BottomNavigationAction, _React$Component);
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* The icon element. If a string is provided, it will be used as a font ligature.
|
||||
*/
|
||||
icon: require('prop-types').oneOfType([require('prop-types').string, typeof babelPluginFlowReactPropTypes_proptype_Element === 'function' ? babelPluginFlowReactPropTypes_proptype_Element : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Element)]),
|
||||
|
||||
/**
|
||||
* The label element.
|
||||
*/
|
||||
label: typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onChange: require('prop-types').func,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onClick: require('prop-types').func,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
selected: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* If `true`, the BottomNavigationButton will show its label.
|
||||
*/
|
||||
showLabel: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* You can provide your own value. Otherwise, we fallback to the child position index.
|
||||
*/
|
||||
value: require('prop-types').any
|
||||
};
|
||||
|
||||
var BottomNavigationButton = function (_React$Component) {
|
||||
(0, _inherits3.default)(BottomNavigationButton, _React$Component);
|
||||
|
||||
function BottomNavigationButton() {
|
||||
function BottomNavigationAction() {
|
||||
var _ref;
|
||||
|
||||
var _temp, _this, _ret;
|
||||
|
||||
(0, _classCallCheck3.default)(this, BottomNavigationButton);
|
||||
(0, _classCallCheck3.default)(this, BottomNavigationAction);
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = BottomNavigationButton.__proto__ || (0, _getPrototypeOf2.default)(BottomNavigationButton)).call.apply(_ref, [this].concat(args))), _this), _this.handleChange = function (event) {
|
||||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = BottomNavigationAction.__proto__ || (0, _getPrototypeOf2.default)(BottomNavigationAction)).call.apply(_ref, [this].concat(args))), _this), _this.handleChange = function (event) {
|
||||
var _this$props = _this.props,
|
||||
onChange = _this$props.onChange,
|
||||
value = _this$props.value,
|
||||
@@ -192,46 +136,31 @@ var BottomNavigationButton = function (_React$Component) {
|
||||
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
|
||||
}
|
||||
|
||||
(0, _createClass3.default)(BottomNavigationButton, [{
|
||||
(0, _createClass3.default)(BottomNavigationAction, [{
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _classNames, _classNames2;
|
||||
|
||||
var _props = this.props,
|
||||
label = _props.label,
|
||||
iconProp = _props.icon,
|
||||
selected = _props.selected,
|
||||
classes = _props.classes,
|
||||
classNameProp = _props.className,
|
||||
showLabelProp = _props.showLabel,
|
||||
icon = _props.icon,
|
||||
label = _props.label,
|
||||
onChange = _props.onChange,
|
||||
onClick = _props.onClick,
|
||||
selected = _props.selected,
|
||||
showLabelProp = _props.showLabel,
|
||||
value = _props.value,
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['label', 'icon', 'selected', 'classes', 'className', 'showLabel', 'onChange', 'value']);
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['classes', 'className', 'icon', 'label', 'onChange', 'onClick', 'selected', 'showLabel', 'value']);
|
||||
|
||||
|
||||
var className = (0, _classnames2.default)(classes.root, (_classNames = {}, (0, _defineProperty3.default)(_classNames, classes.selected, selected), (0, _defineProperty3.default)(_classNames, classes.selectedIconOnly, !showLabelProp && !selected), _classNames), classNameProp);
|
||||
|
||||
var icon = null;
|
||||
|
||||
if (iconProp) {
|
||||
if (_react2.default.isValidElement(iconProp) && typeof iconProp !== 'string') {
|
||||
icon = _react2.default.cloneElement(iconProp, {
|
||||
className: (0, _classnames2.default)(classes.icon, iconProp.props.className)
|
||||
});
|
||||
} else {
|
||||
icon = _react2.default.createElement(
|
||||
_Icon2.default,
|
||||
null,
|
||||
iconProp
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var labelClassName = (0, _classnames2.default)(classes.label, (_classNames2 = {}, (0, _defineProperty3.default)(_classNames2, classes.selectedLabel, selected), (0, _defineProperty3.default)(_classNames2, classes.hiddenLabel, !showLabelProp && !selected), _classNames2));
|
||||
|
||||
return _react2.default.createElement(
|
||||
_ButtonBase2.default,
|
||||
(0, _extends3.default)({ className: className, focusRipple: true }, other, { onClick: this.handleChange }),
|
||||
(0, _extends3.default)({ className: className, focusRipple: true, onClick: this.handleChange }, other),
|
||||
_react2.default.createElement(
|
||||
'span',
|
||||
{ className: classes.wrapper },
|
||||
@@ -245,7 +174,46 @@ var BottomNavigationButton = function (_React$Component) {
|
||||
);
|
||||
}
|
||||
}]);
|
||||
return BottomNavigationButton;
|
||||
return BottomNavigationAction;
|
||||
}(_react2.default.Component);
|
||||
|
||||
exports.default = (0, _withStyles2.default)(styles, { name: 'MuiBottomNavigationButton' })(BottomNavigationButton);
|
||||
BottomNavigationAction.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: _propTypes2.default.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: _propTypes2.default.string,
|
||||
/**
|
||||
* The icon element.
|
||||
*/
|
||||
icon: _propTypes2.default.node,
|
||||
/**
|
||||
* The label element.
|
||||
*/
|
||||
label: _propTypes2.default.node,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onChange: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onClick: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
selected: _propTypes2.default.bool,
|
||||
/**
|
||||
* If `true`, the BottomNavigationAction will show its label.
|
||||
*/
|
||||
showLabel: _propTypes2.default.bool,
|
||||
/**
|
||||
* You can provide your own value. Otherwise, we fallback to the child position index.
|
||||
*/
|
||||
value: _propTypes2.default.any
|
||||
} : {};
|
||||
|
||||
exports.default = (0, _withStyles2.default)(styles, { name: 'MuiBottomNavigationAction' })(BottomNavigationAction);
|
@@ -1,19 +1,17 @@
|
||||
// @flow
|
||||
// @inheritedComponent ButtonBase
|
||||
|
||||
import React from 'react';
|
||||
import type { Node, Element } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import withStyles from '../styles/withStyles';
|
||||
import ButtonBase from '../ButtonBase';
|
||||
import Icon from '../Icon';
|
||||
|
||||
export const styles = (theme: Object) => ({
|
||||
export const styles = theme => ({
|
||||
root: {
|
||||
transition: theme.transitions.create(['color', 'padding-top'], {
|
||||
duration: theme.transitions.duration.short,
|
||||
}),
|
||||
paddingTop: 8,
|
||||
paddingTop: theme.spacing.unit,
|
||||
paddingBottom: 10,
|
||||
paddingLeft: 12,
|
||||
paddingRight: 12,
|
||||
@@ -24,7 +22,7 @@ export const styles = (theme: Object) => ({
|
||||
},
|
||||
selected: {
|
||||
paddingTop: 6,
|
||||
color: theme.palette.primary[500],
|
||||
color: theme.palette.primary.main,
|
||||
},
|
||||
selectedIconOnly: {
|
||||
paddingTop: theme.spacing.unit * 2,
|
||||
@@ -50,56 +48,9 @@ export const styles = (theme: Object) => ({
|
||||
opacity: 0,
|
||||
transitionDelay: '0s',
|
||||
},
|
||||
icon: {
|
||||
display: 'block',
|
||||
margin: 'auto',
|
||||
},
|
||||
});
|
||||
|
||||
type ProvidedProps = {
|
||||
classes: Object,
|
||||
};
|
||||
|
||||
export type Props = {
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes?: Object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className?: string,
|
||||
/**
|
||||
* The icon element. If a string is provided, it will be used as a font ligature.
|
||||
*/
|
||||
icon?: string | Element<any>,
|
||||
/**
|
||||
* The label element.
|
||||
*/
|
||||
label?: Node,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onChange?: Function,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onClick?: Function,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
selected?: boolean,
|
||||
/**
|
||||
* If `true`, the BottomNavigationButton will show its label.
|
||||
*/
|
||||
showLabel?: boolean,
|
||||
/**
|
||||
* You can provide your own value. Otherwise, we fallback to the child position index.
|
||||
*/
|
||||
value?: any,
|
||||
};
|
||||
|
||||
class BottomNavigationButton extends React.Component<ProvidedProps & Props> {
|
||||
class BottomNavigationAction extends React.Component {
|
||||
handleChange = event => {
|
||||
const { onChange, value, onClick } = this.props;
|
||||
|
||||
@@ -114,13 +65,14 @@ class BottomNavigationButton extends React.Component<ProvidedProps & Props> {
|
||||
|
||||
render() {
|
||||
const {
|
||||
label,
|
||||
icon: iconProp,
|
||||
selected,
|
||||
classes,
|
||||
className: classNameProp,
|
||||
showLabel: showLabelProp,
|
||||
icon,
|
||||
label,
|
||||
onChange,
|
||||
onClick,
|
||||
selected,
|
||||
showLabel: showLabelProp,
|
||||
value,
|
||||
...other
|
||||
} = this.props;
|
||||
@@ -134,25 +86,13 @@ class BottomNavigationButton extends React.Component<ProvidedProps & Props> {
|
||||
classNameProp,
|
||||
);
|
||||
|
||||
let icon = null;
|
||||
|
||||
if (iconProp) {
|
||||
if (React.isValidElement(iconProp) && typeof iconProp !== 'string') {
|
||||
icon = React.cloneElement(iconProp, {
|
||||
className: classNames(classes.icon, iconProp.props.className),
|
||||
});
|
||||
} else {
|
||||
icon = <Icon>{iconProp}</Icon>;
|
||||
}
|
||||
}
|
||||
|
||||
const labelClassName = classNames(classes.label, {
|
||||
[classes.selectedLabel]: selected,
|
||||
[classes.hiddenLabel]: !showLabelProp && !selected,
|
||||
});
|
||||
|
||||
return (
|
||||
<ButtonBase className={className} focusRipple {...other} onClick={this.handleChange}>
|
||||
<ButtonBase className={className} focusRipple onClick={this.handleChange} {...other}>
|
||||
<span className={classes.wrapper}>
|
||||
{icon}
|
||||
<span className={labelClassName}>{label}</span>
|
||||
@@ -162,4 +102,43 @@ class BottomNavigationButton extends React.Component<ProvidedProps & Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default withStyles(styles, { name: 'MuiBottomNavigationButton' })(BottomNavigationButton);
|
||||
BottomNavigationAction.propTypes = {
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: PropTypes.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* The icon element.
|
||||
*/
|
||||
icon: PropTypes.node,
|
||||
/**
|
||||
* The label element.
|
||||
*/
|
||||
label: PropTypes.node,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onChange: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onClick: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
selected: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the BottomNavigationAction will show its label.
|
||||
*/
|
||||
showLabel: PropTypes.bool,
|
||||
/**
|
||||
* You can provide your own value. Otherwise, we fallback to the child position index.
|
||||
*/
|
||||
value: PropTypes.any,
|
||||
};
|
||||
|
||||
export default withStyles(styles, { name: 'MuiBottomNavigationAction' })(BottomNavigationAction);
|
4
goTorrentWebUI/node_modules/material-ui/BottomNavigation/index.d.ts
generated
vendored
4
goTorrentWebUI/node_modules/material-ui/BottomNavigation/index.d.ts
generated
vendored
@@ -1,4 +1,4 @@
|
||||
export { default } from './BottomNavigation';
|
||||
export * from './BottomNavigation';
|
||||
export { default as BottomNavigationButton } from './BottomNavigationButton';
|
||||
export * from './BottomNavigationButton';
|
||||
export { default as BottomNavigationAction } from './BottomNavigationAction';
|
||||
export * from './BottomNavigationAction';
|
||||
|
6
goTorrentWebUI/node_modules/material-ui/BottomNavigation/index.js
generated
vendored
6
goTorrentWebUI/node_modules/material-ui/BottomNavigation/index.js
generated
vendored
@@ -13,12 +13,12 @@ Object.defineProperty(exports, 'default', {
|
||||
}
|
||||
});
|
||||
|
||||
var _BottomNavigationButton = require('./BottomNavigationButton');
|
||||
var _BottomNavigationAction = require('./BottomNavigationAction');
|
||||
|
||||
Object.defineProperty(exports, 'BottomNavigationButton', {
|
||||
Object.defineProperty(exports, 'BottomNavigationAction', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_BottomNavigationButton).default;
|
||||
return _interopRequireDefault(_BottomNavigationAction).default;
|
||||
}
|
||||
});
|
||||
|
||||
|
4
goTorrentWebUI/node_modules/material-ui/BottomNavigation/index.js.flow
generated
vendored
4
goTorrentWebUI/node_modules/material-ui/BottomNavigation/index.js.flow
generated
vendored
@@ -1,4 +1,2 @@
|
||||
// @flow
|
||||
|
||||
export { default } from './BottomNavigation';
|
||||
export { default as BottomNavigationButton } from './BottomNavigationButton';
|
||||
export { default as BottomNavigationAction } from './BottomNavigationAction';
|
||||
|
Reference in New Issue
Block a user