Completely updated React, fixed #11, (hopefully)
This commit is contained in:
28
goTorrentWebUI/node_modules/material-ui/Snackbar/Snackbar.d.ts
generated
vendored
28
goTorrentWebUI/node_modules/material-ui/Snackbar/Snackbar.d.ts
generated
vendored
@@ -1,28 +1,31 @@
|
||||
import * as React from 'react';
|
||||
import { StandardProps } from '..';
|
||||
import { TransitionDuration, TransitionHandlers } from '../internal/transition';
|
||||
import { SnackbarContentProps } from '.';
|
||||
import { TransitionHandlerProps, TransitionProps } from '../transitions/transition';
|
||||
|
||||
export type Origin = {
|
||||
export type SnackBarOrigin = {
|
||||
horizontal?: 'left' | 'center' | 'right' | number;
|
||||
vertical?: 'top' | 'center' | 'bottom' | number;
|
||||
};
|
||||
|
||||
export interface SnackbarProps extends StandardProps<
|
||||
React.HTMLAttributes<HTMLDivElement> & Partial<TransitionHandlers>,
|
||||
SnackbarClassKey
|
||||
> {
|
||||
export interface SnackbarProps
|
||||
extends StandardProps<
|
||||
React.HTMLAttributes<HTMLDivElement> & Partial<TransitionHandlerProps>,
|
||||
SnackbarClassKey
|
||||
> {
|
||||
action?: React.ReactElement<any> | React.ReactElement<any>[];
|
||||
anchorOrigin?: Origin;
|
||||
anchorOrigin?: SnackBarOrigin;
|
||||
autoHideDuration?: number;
|
||||
resumeHideDuration?: number;
|
||||
transitionDuration?: TransitionDuration;
|
||||
disableWindowBlurListener?: boolean;
|
||||
message?: React.ReactElement<any>;
|
||||
onClose?: (event: React.SyntheticEvent<any>, reason: string) => void;
|
||||
onMouseEnter?: React.MouseEventHandler<any>;
|
||||
onMouseLeave?: React.MouseEventHandler<any>;
|
||||
onRequestClose?: (event: React.SyntheticEvent<any>, reason: string) => void;
|
||||
open: boolean;
|
||||
SnackbarContentProps?: Object;
|
||||
resumeHideDuration?: number;
|
||||
SnackbarContentProps?: Partial<SnackbarContentProps>;
|
||||
transition?: React.ReactType;
|
||||
transitionDuration?: TransitionProps['timeout'];
|
||||
}
|
||||
|
||||
export type SnackbarClassKey =
|
||||
@@ -32,8 +35,7 @@ export type SnackbarClassKey =
|
||||
| 'anchorTopRight'
|
||||
| 'anchorBottomRight'
|
||||
| 'anchorTopLeft'
|
||||
| 'anchorBottomLeft'
|
||||
;
|
||||
| 'anchorBottomLeft';
|
||||
|
||||
declare const Snackbar: React.ComponentType<SnackbarProps>;
|
||||
|
||||
|
415
goTorrentWebUI/node_modules/material-ui/Snackbar/Snackbar.js
generated
vendored
415
goTorrentWebUI/node_modules/material-ui/Snackbar/Snackbar.js
generated
vendored
@@ -5,10 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.styles = undefined;
|
||||
|
||||
var _extends2 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends3 = _interopRequireDefault(_extends2);
|
||||
|
||||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
||||
|
||||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
||||
@@ -37,10 +33,18 @@ var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _extends8 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends9 = _interopRequireDefault(_extends8);
|
||||
|
||||
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);
|
||||
@@ -71,16 +75,6 @@ var _SnackbarContent2 = _interopRequireDefault(_SnackbarContent);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Node = require('react').babelPluginFlowReactPropTypes_proptype_Node || require('prop-types').any;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Element = require('react').babelPluginFlowReactPropTypes_proptype_Element || require('prop-types').any;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_ComponentType = require('prop-types').func;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_TransitionCallback = require('../internal/transition').babelPluginFlowReactPropTypes_proptype_TransitionCallback || require('prop-types').any;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_TransitionDuration = require('../internal/transition').babelPluginFlowReactPropTypes_proptype_TransitionDuration || require('prop-types').any;
|
||||
|
||||
var styles = exports.styles = function styles(theme) {
|
||||
var gutter = theme.spacing.unit * 3;
|
||||
var top = { top: 0 };
|
||||
@@ -107,180 +101,23 @@ var styles = exports.styles = function styles(theme) {
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center'
|
||||
},
|
||||
anchorTopCenter: (0, _defineProperty3.default)({
|
||||
extend: [top]
|
||||
}, theme.breakpoints.up('md'), {
|
||||
extend: [center]
|
||||
}),
|
||||
anchorBottomCenter: (0, _defineProperty3.default)({
|
||||
extend: [bottom]
|
||||
}, theme.breakpoints.up('md'), {
|
||||
extend: [center]
|
||||
}),
|
||||
anchorTopRight: (0, _defineProperty3.default)({
|
||||
extend: [top, right]
|
||||
}, theme.breakpoints.up('md'), {
|
||||
left: 'auto',
|
||||
extend: [topSpace, rightSpace]
|
||||
}),
|
||||
anchorBottomRight: (0, _defineProperty3.default)({
|
||||
extend: [bottom, right]
|
||||
}, theme.breakpoints.up('md'), {
|
||||
left: 'auto',
|
||||
extend: [bottomSpace, rightSpace]
|
||||
}),
|
||||
anchorTopLeft: (0, _defineProperty3.default)({
|
||||
extend: [top, left]
|
||||
}, theme.breakpoints.up('md'), {
|
||||
right: 'auto',
|
||||
extend: [topSpace, leftSpace]
|
||||
}),
|
||||
anchorBottomLeft: (0, _defineProperty3.default)({
|
||||
extend: [bottom, left]
|
||||
}, theme.breakpoints.up('md'), {
|
||||
right: 'auto',
|
||||
extend: [bottomSpace, leftSpace]
|
||||
})
|
||||
anchorTopCenter: (0, _extends9.default)({}, top, (0, _defineProperty3.default)({}, theme.breakpoints.up('md'), (0, _extends9.default)({}, center))),
|
||||
anchorBottomCenter: (0, _extends9.default)({}, bottom, (0, _defineProperty3.default)({}, theme.breakpoints.up('md'), (0, _extends9.default)({}, center))),
|
||||
anchorTopRight: (0, _extends9.default)({}, top, right, (0, _defineProperty3.default)({}, theme.breakpoints.up('md'), (0, _extends9.default)({
|
||||
left: 'auto'
|
||||
}, topSpace, rightSpace))),
|
||||
anchorBottomRight: (0, _extends9.default)({}, bottom, right, (0, _defineProperty3.default)({}, theme.breakpoints.up('md'), (0, _extends9.default)({
|
||||
left: 'auto'
|
||||
}, bottomSpace, rightSpace))),
|
||||
anchorTopLeft: (0, _extends9.default)({}, top, left, (0, _defineProperty3.default)({}, theme.breakpoints.up('md'), (0, _extends9.default)({
|
||||
right: 'auto'
|
||||
}, topSpace, leftSpace))),
|
||||
anchorBottomLeft: (0, _extends9.default)({}, bottom, left, (0, _defineProperty3.default)({}, theme.breakpoints.up('md'), (0, _extends9.default)({
|
||||
right: 'auto'
|
||||
}, bottomSpace, leftSpace)))
|
||||
};
|
||||
};
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Origin = {
|
||||
horizontal: require('prop-types').oneOfType([require('prop-types').oneOf(['left']), require('prop-types').oneOf(['center']), require('prop-types').oneOf(['right']), require('prop-types').number]),
|
||||
vertical: require('prop-types').oneOfType([require('prop-types').oneOf(['top']), require('prop-types').oneOf(['center']), require('prop-types').oneOf(['bottom']), require('prop-types').number])
|
||||
};
|
||||
var babelPluginFlowReactPropTypes_proptype_Props = {
|
||||
/**
|
||||
* The action to display.
|
||||
*/
|
||||
action: typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node),
|
||||
|
||||
/**
|
||||
* The anchor of the `Snackbar`.
|
||||
*/
|
||||
anchorOrigin: require('prop-types').shape({
|
||||
horizontal: require('prop-types').oneOfType([require('prop-types').oneOf(['left']), require('prop-types').oneOf(['center']), require('prop-types').oneOf(['right']), require('prop-types').number]),
|
||||
vertical: require('prop-types').oneOfType([require('prop-types').oneOf(['top']), require('prop-types').oneOf(['center']), require('prop-types').oneOf(['bottom']), require('prop-types').number])
|
||||
}),
|
||||
|
||||
/**
|
||||
* The number of milliseconds to wait before automatically dismissing.
|
||||
* This behavior is disabled by default with the `null` value.
|
||||
*/
|
||||
autoHideDuration: require('prop-types').number,
|
||||
|
||||
/**
|
||||
* The number of milliseconds to wait before dismissing after user interaction.
|
||||
* If `autoHideDuration` property isn't specified, it does nothing.
|
||||
* If `autoHideDuration` property is specified but `resumeHideDuration` isn't,
|
||||
* we default to `autoHideDuration / 2` ms.
|
||||
*/
|
||||
resumeHideDuration: require('prop-types').number,
|
||||
|
||||
/**
|
||||
* If you wish the take control over the children of the component you can use that property.
|
||||
* When using it, no `SnackbarContent` component will be rendered.
|
||||
*/
|
||||
children: typeof babelPluginFlowReactPropTypes_proptype_Element === 'function' ? babelPluginFlowReactPropTypes_proptype_Element : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Element),
|
||||
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* When displaying multiple consecutive Snackbars from a parent rendering a single
|
||||
* <Snackbar/>, add the key property to ensure independent treatment of each message.
|
||||
* e.g. <Snackbar key={message} />, otherwise, the message may update-in-place and
|
||||
* features such as autoHideDuration may be canceled.
|
||||
*/
|
||||
key: require('prop-types').any,
|
||||
|
||||
/**
|
||||
* The message to display.
|
||||
*/
|
||||
message: typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node),
|
||||
|
||||
/**
|
||||
* Callback fired before the transition is entering.
|
||||
*/
|
||||
onEnter: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* Callback fired when the transition is entering.
|
||||
*/
|
||||
onEntering: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* Callback fired when the transition has entered.
|
||||
*/
|
||||
onEntered: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* Callback fired before the transition is exiting.
|
||||
*/
|
||||
onExit: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* Callback fired when the transition is exiting.
|
||||
*/
|
||||
onExiting: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* Callback fired when the transition has exited.
|
||||
*/
|
||||
onExited: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onMouseEnter: require('prop-types').func,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onMouseLeave: require('prop-types').func,
|
||||
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
*
|
||||
* Typically `onRequestClose` is used to set state in the parent component,
|
||||
* which is used to control the `Snackbar` `open` prop.
|
||||
*
|
||||
* The `reason` parameter can optionally be used to control the response to `onRequestClose`,
|
||||
* for example ignoring `clickaway`.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
* @param {string} reason Can be:`"timeout"` (`autoHideDuration` expired) or: `"clickaway"`
|
||||
*/
|
||||
onRequestClose: require('prop-types').func,
|
||||
|
||||
/**
|
||||
* If true, `Snackbar` is open.
|
||||
*/
|
||||
open: require('prop-types').bool.isRequired,
|
||||
|
||||
/**
|
||||
* Properties applied to the `SnackbarContent` element.
|
||||
*/
|
||||
SnackbarContentProps: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* Transition component.
|
||||
*/
|
||||
transition: typeof babelPluginFlowReactPropTypes_proptype_ComponentType === 'function' ? babelPluginFlowReactPropTypes_proptype_ComponentType : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_ComponentType),
|
||||
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
transitionDuration: typeof babelPluginFlowReactPropTypes_proptype_TransitionDuration === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionDuration : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionDuration)
|
||||
};
|
||||
|
||||
var Snackbar = function (_React$Component) {
|
||||
(0, _inherits3.default)(Snackbar, _React$Component);
|
||||
|
||||
@@ -309,20 +146,20 @@ var Snackbar = function (_React$Component) {
|
||||
}
|
||||
_this.handleResume();
|
||||
}, _this.handleClickAway = function (event) {
|
||||
if (_this.props.onRequestClose) {
|
||||
_this.props.onRequestClose(event, 'clickaway');
|
||||
if (_this.props.onClose) {
|
||||
_this.props.onClose(event, 'clickaway');
|
||||
}
|
||||
}, _this.handlePause = function () {
|
||||
clearTimeout(_this.timerAutoHide);
|
||||
}, _this.handleResume = function () {
|
||||
if (_this.props.autoHideDuration !== undefined) {
|
||||
if (_this.props.autoHideDuration != null) {
|
||||
if (_this.props.resumeHideDuration !== undefined) {
|
||||
_this.setAutoHideTimer(_this.props.resumeHideDuration);
|
||||
return;
|
||||
}
|
||||
_this.setAutoHideTimer((_this.props.autoHideDuration || 0) * 0.5);
|
||||
}
|
||||
}, _this.handleTransitionExited = function () {
|
||||
}, _this.handleExited = function () {
|
||||
_this.setState({ exited: true });
|
||||
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
|
||||
}
|
||||
@@ -344,7 +181,7 @@ var Snackbar = function (_React$Component) {
|
||||
}, {
|
||||
key: 'componentWillReceiveProps',
|
||||
value: function componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.open && this.state.exited) {
|
||||
if (nextProps.open) {
|
||||
this.setState({ exited: false });
|
||||
}
|
||||
}
|
||||
@@ -374,17 +211,17 @@ var Snackbar = function (_React$Component) {
|
||||
|
||||
var autoHideDuration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
||||
|
||||
if (!this.props.onRequestClose || this.props.autoHideDuration === undefined) {
|
||||
if (!this.props.onClose || this.props.autoHideDuration == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
clearTimeout(this.timerAutoHide);
|
||||
this.timerAutoHide = setTimeout(function () {
|
||||
if (!_this2.props.onRequestClose || _this2.props.autoHideDuration === undefined) {
|
||||
if (!_this2.props.onClose || _this2.props.autoHideDuration == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
_this2.props.onRequestClose(null, 'timeout');
|
||||
_this2.props.onClose(null, 'timeout');
|
||||
}, autoHideDuration || this.props.autoHideDuration || 0);
|
||||
}
|
||||
|
||||
@@ -404,73 +241,71 @@ var Snackbar = function (_React$Component) {
|
||||
vertical = _props$anchorOrigin.vertical,
|
||||
horizontal = _props$anchorOrigin.horizontal,
|
||||
autoHideDuration = _props.autoHideDuration,
|
||||
resumeHideDuration = _props.resumeHideDuration,
|
||||
children = _props.children,
|
||||
classes = _props.classes,
|
||||
className = _props.className,
|
||||
transitionDuration = _props.transitionDuration,
|
||||
disableWindowBlurListener = _props.disableWindowBlurListener,
|
||||
message = _props.message,
|
||||
onClose = _props.onClose,
|
||||
onEnter = _props.onEnter,
|
||||
onEntering = _props.onEntering,
|
||||
onEntered = _props.onEntered,
|
||||
onEntering = _props.onEntering,
|
||||
onExit = _props.onExit,
|
||||
onExiting = _props.onExiting,
|
||||
onExited = _props.onExited,
|
||||
onExiting = _props.onExiting,
|
||||
onMouseEnter = _props.onMouseEnter,
|
||||
onMouseLeave = _props.onMouseLeave,
|
||||
onRequestClose = _props.onRequestClose,
|
||||
open = _props.open,
|
||||
resumeHideDuration = _props.resumeHideDuration,
|
||||
SnackbarContentProps = _props.SnackbarContentProps,
|
||||
TransitionProp = _props.transition,
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['action', 'anchorOrigin', 'autoHideDuration', 'resumeHideDuration', 'children', 'classes', 'className', 'transitionDuration', 'message', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited', 'onMouseEnter', 'onMouseLeave', 'onRequestClose', 'open', 'SnackbarContentProps', 'transition']);
|
||||
transitionDuration = _props.transitionDuration,
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['action', 'anchorOrigin', 'autoHideDuration', 'children', 'classes', 'className', 'disableWindowBlurListener', 'message', 'onClose', 'onEnter', 'onEntered', 'onEntering', 'onExit', 'onExited', 'onExiting', 'onMouseEnter', 'onMouseLeave', 'open', 'resumeHideDuration', 'SnackbarContentProps', 'transition', 'transitionDuration']);
|
||||
|
||||
|
||||
if (!open && this.state.exited) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var transitionProps = {
|
||||
in: open,
|
||||
appear: true,
|
||||
timeout: transitionDuration,
|
||||
onEnter: onEnter,
|
||||
onEntering: onEntering,
|
||||
onEntered: onEntered,
|
||||
onExit: onExit,
|
||||
onExiting: onExiting,
|
||||
onExited: (0, _helpers.createChainedFunction)(this.handleTransitionExited, onExited)
|
||||
};
|
||||
var transitionContent = children || _react2.default.createElement(_SnackbarContent2.default, (0, _extends3.default)({ message: message, action: action }, SnackbarContentProps));
|
||||
var transitionProps = {};
|
||||
|
||||
var transition = void 0;
|
||||
if (TransitionProp) {
|
||||
transition = _react2.default.createElement(
|
||||
TransitionProp,
|
||||
transitionProps,
|
||||
transitionContent
|
||||
);
|
||||
} else {
|
||||
transition = _react2.default.createElement(
|
||||
_Slide2.default,
|
||||
(0, _extends3.default)({ direction: vertical === 'top' ? 'down' : 'up' }, transitionProps),
|
||||
transitionContent
|
||||
);
|
||||
// The provided transition might not support the direction property.
|
||||
if (TransitionProp === _Slide2.default) {
|
||||
transitionProps.direction = vertical === 'top' ? 'down' : 'up';
|
||||
}
|
||||
|
||||
return _react2.default.createElement(
|
||||
_reactEventListener2.default,
|
||||
{ target: 'window', onFocus: this.handleResume, onBlur: this.handlePause },
|
||||
{
|
||||
target: 'window',
|
||||
onFocus: disableWindowBlurListener ? undefined : this.handleResume,
|
||||
onBlur: disableWindowBlurListener ? undefined : this.handlePause
|
||||
},
|
||||
_react2.default.createElement(
|
||||
_ClickAwayListener2.default,
|
||||
{ onClickAway: this.handleClickAway },
|
||||
_react2.default.createElement(
|
||||
'div',
|
||||
(0, _extends3.default)({
|
||||
className: (0, _classnames2.default)(classes.root, classes['anchor' + (0, _helpers.capitalizeFirstLetter)(vertical) + (0, _helpers.capitalizeFirstLetter)(horizontal)], className),
|
||||
(0, _extends9.default)({
|
||||
className: (0, _classnames2.default)(classes.root, classes['anchor' + (0, _helpers.capitalize)(vertical) + (0, _helpers.capitalize)(horizontal)], className),
|
||||
onMouseEnter: this.handleMouseEnter,
|
||||
onMouseLeave: this.handleMouseLeave
|
||||
}, other),
|
||||
transition
|
||||
_react2.default.createElement(
|
||||
TransitionProp,
|
||||
(0, _extends9.default)({
|
||||
appear: true,
|
||||
'in': open,
|
||||
onEnter: onEnter,
|
||||
onEntered: onEntered,
|
||||
onEntering: onEntering,
|
||||
onExit: onExit,
|
||||
onExited: (0, _helpers.createChainedFunction)(this.handleExited, onExited),
|
||||
onExiting: onExiting,
|
||||
timeout: transitionDuration
|
||||
}, transitionProps),
|
||||
children || _react2.default.createElement(_SnackbarContent2.default, (0, _extends9.default)({ message: message, action: action }, SnackbarContentProps))
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -479,11 +314,133 @@ var Snackbar = function (_React$Component) {
|
||||
return Snackbar;
|
||||
}(_react2.default.Component);
|
||||
|
||||
Snackbar.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* The action to display.
|
||||
*/
|
||||
action: _propTypes2.default.node,
|
||||
/**
|
||||
* The anchor of the `Snackbar`.
|
||||
*/
|
||||
anchorOrigin: _propTypes2.default.shape({
|
||||
horizontal: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.oneOf(['left', 'center', 'right'])]),
|
||||
vertical: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.oneOf(['top', 'center', 'bottom'])])
|
||||
}),
|
||||
/**
|
||||
* The number of milliseconds to wait before automatically calling the
|
||||
* `onClose` function. `onClose` should then set the state of the `open`
|
||||
* prop to hide the Snackbar. This behavior is disabled by default with
|
||||
* the `null` value.
|
||||
*/
|
||||
autoHideDuration: _propTypes2.default.number,
|
||||
/**
|
||||
* If you wish the take control over the children of the component you can use this property.
|
||||
* When used, you replace the `SnackbarContent` component with the children.
|
||||
*/
|
||||
children: _propTypes2.default.element,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: _propTypes2.default.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: _propTypes2.default.string,
|
||||
/**
|
||||
* If `true`, the `autoHideDuration` timer will expire even if the window is not focused.
|
||||
*/
|
||||
disableWindowBlurListener: _propTypes2.default.bool,
|
||||
/**
|
||||
* When displaying multiple consecutive Snackbars from a parent rendering a single
|
||||
* <Snackbar/>, add the key property to ensure independent treatment of each message.
|
||||
* e.g. <Snackbar key={message} />, otherwise, the message may update-in-place and
|
||||
* features such as autoHideDuration may be canceled.
|
||||
*/
|
||||
key: _propTypes2.default.any,
|
||||
/**
|
||||
* The message to display.
|
||||
*/
|
||||
message: _propTypes2.default.node,
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
* Typically `onClose` is used to set state in the parent component,
|
||||
* which is used to control the `Snackbar` `open` prop.
|
||||
* The `reason` parameter can optionally be used to control the response to `onClose`,
|
||||
* for example ignoring `clickaway`.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
* @param {string} reason Can be:`"timeout"` (`autoHideDuration` expired) or: `"clickaway"`
|
||||
*/
|
||||
onClose: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired before the transition is entering.
|
||||
*/
|
||||
onEnter: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired when the transition has entered.
|
||||
*/
|
||||
onEntered: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired when the transition is entering.
|
||||
*/
|
||||
onEntering: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired before the transition is exiting.
|
||||
*/
|
||||
onExit: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired when the transition has exited.
|
||||
*/
|
||||
onExited: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired when the transition is exiting.
|
||||
*/
|
||||
onExiting: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onMouseEnter: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onMouseLeave: _propTypes2.default.func,
|
||||
/**
|
||||
* If true, `Snackbar` is open.
|
||||
*/
|
||||
open: _propTypes2.default.bool,
|
||||
/**
|
||||
* The number of milliseconds to wait before dismissing after user interaction.
|
||||
* If `autoHideDuration` property isn't specified, it does nothing.
|
||||
* If `autoHideDuration` property is specified but `resumeHideDuration` isn't,
|
||||
* we default to `autoHideDuration / 2` ms.
|
||||
*/
|
||||
resumeHideDuration: _propTypes2.default.number,
|
||||
/**
|
||||
* Properties applied to the `SnackbarContent` element.
|
||||
*/
|
||||
SnackbarContentProps: _propTypes2.default.object,
|
||||
/**
|
||||
* Transition component.
|
||||
*/
|
||||
transition: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]),
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
transitionDuration: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({ enter: _propTypes2.default.number, exit: _propTypes2.default.number })])
|
||||
} : {};
|
||||
|
||||
Snackbar.defaultProps = {
|
||||
anchorOrigin: { vertical: 'bottom', horizontal: 'center' },
|
||||
anchorOrigin: {
|
||||
vertical: 'bottom',
|
||||
horizontal: 'center'
|
||||
},
|
||||
disableWindowBlurListener: false,
|
||||
transition: _Slide2.default,
|
||||
transitionDuration: {
|
||||
enter: _transitions.duration.enteringScreen,
|
||||
exit: _transitions.duration.leavingScreen
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = (0, _withStyles2.default)(styles, { flip: false, name: 'MuiSnackbar' })(Snackbar);
|
390
goTorrentWebUI/node_modules/material-ui/Snackbar/Snackbar.js.flow
generated
vendored
390
goTorrentWebUI/node_modules/material-ui/Snackbar/Snackbar.js.flow
generated
vendored
@@ -1,18 +1,15 @@
|
||||
// @flow
|
||||
|
||||
import React from 'react';
|
||||
import type { ComponentType, Element, Node } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import EventListener from 'react-event-listener';
|
||||
import withStyles from '../styles/withStyles';
|
||||
import { duration } from '../styles/transitions';
|
||||
import ClickAwayListener from '../utils/ClickAwayListener';
|
||||
import { capitalizeFirstLetter, createChainedFunction } from '../utils/helpers';
|
||||
import { capitalize, createChainedFunction } from '../utils/helpers';
|
||||
import Slide from '../transitions/Slide';
|
||||
import SnackbarContent from './SnackbarContent';
|
||||
import type { TransitionDuration, TransitionCallback } from '../internal/transition';
|
||||
|
||||
export const styles = (theme: Object) => {
|
||||
export const styles = theme => {
|
||||
const gutter = theme.spacing.unit * 3;
|
||||
const top = { top: 0 };
|
||||
const bottom = { bottom: 0 };
|
||||
@@ -39,180 +36,57 @@ export const styles = (theme: Object) => {
|
||||
alignItems: 'center',
|
||||
},
|
||||
anchorTopCenter: {
|
||||
extend: [top],
|
||||
...top,
|
||||
[theme.breakpoints.up('md')]: {
|
||||
extend: [center],
|
||||
...center,
|
||||
},
|
||||
},
|
||||
anchorBottomCenter: {
|
||||
extend: [bottom],
|
||||
...bottom,
|
||||
[theme.breakpoints.up('md')]: {
|
||||
extend: [center],
|
||||
...center,
|
||||
},
|
||||
},
|
||||
anchorTopRight: {
|
||||
extend: [top, right],
|
||||
...top,
|
||||
...right,
|
||||
[theme.breakpoints.up('md')]: {
|
||||
left: 'auto',
|
||||
extend: [topSpace, rightSpace],
|
||||
...topSpace,
|
||||
...rightSpace,
|
||||
},
|
||||
},
|
||||
anchorBottomRight: {
|
||||
extend: [bottom, right],
|
||||
...bottom,
|
||||
...right,
|
||||
[theme.breakpoints.up('md')]: {
|
||||
left: 'auto',
|
||||
extend: [bottomSpace, rightSpace],
|
||||
...bottomSpace,
|
||||
...rightSpace,
|
||||
},
|
||||
},
|
||||
anchorTopLeft: {
|
||||
extend: [top, left],
|
||||
...top,
|
||||
...left,
|
||||
[theme.breakpoints.up('md')]: {
|
||||
right: 'auto',
|
||||
extend: [topSpace, leftSpace],
|
||||
...topSpace,
|
||||
...leftSpace,
|
||||
},
|
||||
},
|
||||
anchorBottomLeft: {
|
||||
extend: [bottom, left],
|
||||
...bottom,
|
||||
...left,
|
||||
[theme.breakpoints.up('md')]: {
|
||||
right: 'auto',
|
||||
extend: [bottomSpace, leftSpace],
|
||||
...bottomSpace,
|
||||
...leftSpace,
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export type Origin = {
|
||||
horizontal?: 'left' | 'center' | 'right' | number,
|
||||
vertical?: 'top' | 'center' | 'bottom' | number,
|
||||
};
|
||||
|
||||
type ProvidedProps = {
|
||||
anchorOrigin: Origin,
|
||||
classes: Object,
|
||||
};
|
||||
|
||||
export type Props = {
|
||||
/**
|
||||
* The action to display.
|
||||
*/
|
||||
action?: Node,
|
||||
/**
|
||||
* The anchor of the `Snackbar`.
|
||||
*/
|
||||
anchorOrigin?: Origin,
|
||||
/**
|
||||
* The number of milliseconds to wait before automatically dismissing.
|
||||
* This behavior is disabled by default with the `null` value.
|
||||
*/
|
||||
autoHideDuration?: ?number,
|
||||
/**
|
||||
* The number of milliseconds to wait before dismissing after user interaction.
|
||||
* If `autoHideDuration` property isn't specified, it does nothing.
|
||||
* If `autoHideDuration` property is specified but `resumeHideDuration` isn't,
|
||||
* we default to `autoHideDuration / 2` ms.
|
||||
*/
|
||||
resumeHideDuration?: number,
|
||||
/**
|
||||
* If you wish the take control over the children of the component you can use that property.
|
||||
* When using it, no `SnackbarContent` component will be rendered.
|
||||
*/
|
||||
children?: Element<any>,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes?: Object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className?: string,
|
||||
/**
|
||||
* When displaying multiple consecutive Snackbars from a parent rendering a single
|
||||
* <Snackbar/>, add the key property to ensure independent treatment of each message.
|
||||
* e.g. <Snackbar key={message} />, otherwise, the message may update-in-place and
|
||||
* features such as autoHideDuration may be canceled.
|
||||
*/
|
||||
key?: any,
|
||||
/**
|
||||
* The message to display.
|
||||
*/
|
||||
message?: Node,
|
||||
/**
|
||||
* Callback fired before the transition is entering.
|
||||
*/
|
||||
onEnter?: TransitionCallback,
|
||||
/**
|
||||
* Callback fired when the transition is entering.
|
||||
*/
|
||||
onEntering?: TransitionCallback,
|
||||
/**
|
||||
* Callback fired when the transition has entered.
|
||||
*/
|
||||
onEntered?: TransitionCallback,
|
||||
/**
|
||||
* Callback fired before the transition is exiting.
|
||||
*/
|
||||
onExit?: TransitionCallback,
|
||||
/**
|
||||
* Callback fired when the transition is exiting.
|
||||
*/
|
||||
onExiting?: TransitionCallback,
|
||||
/**
|
||||
* Callback fired when the transition has exited.
|
||||
*/
|
||||
onExited?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onMouseEnter?: Function,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onMouseLeave?: Function,
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
*
|
||||
* Typically `onRequestClose` is used to set state in the parent component,
|
||||
* which is used to control the `Snackbar` `open` prop.
|
||||
*
|
||||
* The `reason` parameter can optionally be used to control the response to `onRequestClose`,
|
||||
* for example ignoring `clickaway`.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
* @param {string} reason Can be:`"timeout"` (`autoHideDuration` expired) or: `"clickaway"`
|
||||
*/
|
||||
onRequestClose?: (event: ?Event, reason: string) => void,
|
||||
/**
|
||||
* If true, `Snackbar` is open.
|
||||
*/
|
||||
open: boolean,
|
||||
/**
|
||||
* Properties applied to the `SnackbarContent` element.
|
||||
*/
|
||||
SnackbarContentProps?: Object,
|
||||
/**
|
||||
* Transition component.
|
||||
*/
|
||||
transition?: ComponentType<*>,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
transitionDuration?: TransitionDuration,
|
||||
};
|
||||
|
||||
type State = {
|
||||
exited: boolean,
|
||||
};
|
||||
|
||||
class Snackbar extends React.Component<ProvidedProps & Props, State> {
|
||||
static defaultProps = {
|
||||
anchorOrigin: { vertical: 'bottom', horizontal: 'center' },
|
||||
transitionDuration: {
|
||||
enter: duration.enteringScreen,
|
||||
exit: duration.leavingScreen,
|
||||
},
|
||||
};
|
||||
|
||||
class Snackbar extends React.Component {
|
||||
state = {
|
||||
// Used to only render active snackbars.
|
||||
exited: false,
|
||||
@@ -231,7 +105,7 @@ class Snackbar extends React.Component<ProvidedProps & Props, State> {
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.open && this.state.exited) {
|
||||
if (nextProps.open) {
|
||||
this.setState({ exited: false });
|
||||
}
|
||||
}
|
||||
@@ -252,17 +126,17 @@ class Snackbar extends React.Component<ProvidedProps & Props, State> {
|
||||
|
||||
// Timer that controls delay before snackbar auto hides
|
||||
setAutoHideTimer(autoHideDuration = null) {
|
||||
if (!this.props.onRequestClose || this.props.autoHideDuration === undefined) {
|
||||
if (!this.props.onClose || this.props.autoHideDuration == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
clearTimeout(this.timerAutoHide);
|
||||
this.timerAutoHide = setTimeout(() => {
|
||||
if (!this.props.onRequestClose || this.props.autoHideDuration === undefined) {
|
||||
if (!this.props.onClose || this.props.autoHideDuration == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.props.onRequestClose(null, 'timeout');
|
||||
this.props.onClose(null, 'timeout');
|
||||
}, autoHideDuration || this.props.autoHideDuration || 0);
|
||||
}
|
||||
|
||||
@@ -283,8 +157,8 @@ class Snackbar extends React.Component<ProvidedProps & Props, State> {
|
||||
};
|
||||
|
||||
handleClickAway = (event: Event) => {
|
||||
if (this.props.onRequestClose) {
|
||||
this.props.onRequestClose(event, 'clickaway');
|
||||
if (this.props.onClose) {
|
||||
this.props.onClose(event, 'clickaway');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -297,7 +171,7 @@ class Snackbar extends React.Component<ProvidedProps & Props, State> {
|
||||
// Restart the timer when the user is no longer interacting with the Snackbar
|
||||
// or when the window is shown back.
|
||||
handleResume = () => {
|
||||
if (this.props.autoHideDuration !== undefined) {
|
||||
if (this.props.autoHideDuration != null) {
|
||||
if (this.props.resumeHideDuration !== undefined) {
|
||||
this.setAutoHideTimer(this.props.resumeHideDuration);
|
||||
return;
|
||||
@@ -306,7 +180,7 @@ class Snackbar extends React.Component<ProvidedProps & Props, State> {
|
||||
}
|
||||
};
|
||||
|
||||
handleTransitionExited = () => {
|
||||
handleExited = () => {
|
||||
this.setState({ exited: true });
|
||||
};
|
||||
|
||||
@@ -315,24 +189,25 @@ class Snackbar extends React.Component<ProvidedProps & Props, State> {
|
||||
action,
|
||||
anchorOrigin: { vertical, horizontal },
|
||||
autoHideDuration,
|
||||
resumeHideDuration,
|
||||
children,
|
||||
classes,
|
||||
className,
|
||||
transitionDuration,
|
||||
disableWindowBlurListener,
|
||||
message,
|
||||
onClose,
|
||||
onEnter,
|
||||
onEntering,
|
||||
onEntered,
|
||||
onEntering,
|
||||
onExit,
|
||||
onExiting,
|
||||
onExited,
|
||||
onExiting,
|
||||
onMouseEnter,
|
||||
onMouseLeave,
|
||||
onRequestClose,
|
||||
open,
|
||||
resumeHideDuration,
|
||||
SnackbarContentProps,
|
||||
transition: TransitionProp,
|
||||
transitionDuration,
|
||||
...other
|
||||
} = this.props;
|
||||
|
||||
@@ -340,48 +215,46 @@ class Snackbar extends React.Component<ProvidedProps & Props, State> {
|
||||
return null;
|
||||
}
|
||||
|
||||
const transitionProps = {
|
||||
in: open,
|
||||
appear: true,
|
||||
timeout: transitionDuration,
|
||||
onEnter,
|
||||
onEntering,
|
||||
onEntered,
|
||||
onExit,
|
||||
onExiting,
|
||||
onExited: createChainedFunction(this.handleTransitionExited, onExited),
|
||||
};
|
||||
const transitionContent = children || (
|
||||
<SnackbarContent message={message} action={action} {...SnackbarContentProps} />
|
||||
);
|
||||
const transitionProps = {};
|
||||
|
||||
let transition;
|
||||
if (TransitionProp) {
|
||||
transition = <TransitionProp {...transitionProps}>{transitionContent}</TransitionProp>;
|
||||
} else {
|
||||
transition = (
|
||||
<Slide direction={vertical === 'top' ? 'down' : 'up'} {...transitionProps}>
|
||||
{transitionContent}
|
||||
</Slide>
|
||||
);
|
||||
// The provided transition might not support the direction property.
|
||||
if (TransitionProp === Slide) {
|
||||
transitionProps.direction = vertical === 'top' ? 'down' : 'up';
|
||||
}
|
||||
|
||||
return (
|
||||
<EventListener target="window" onFocus={this.handleResume} onBlur={this.handlePause}>
|
||||
<EventListener
|
||||
target="window"
|
||||
onFocus={disableWindowBlurListener ? undefined : this.handleResume}
|
||||
onBlur={disableWindowBlurListener ? undefined : this.handlePause}
|
||||
>
|
||||
<ClickAwayListener onClickAway={this.handleClickAway}>
|
||||
<div
|
||||
className={classNames(
|
||||
classes.root,
|
||||
classes[
|
||||
`anchor${capitalizeFirstLetter(vertical)}${capitalizeFirstLetter(horizontal)}`
|
||||
],
|
||||
classes[`anchor${capitalize(vertical)}${capitalize(horizontal)}`],
|
||||
className,
|
||||
)}
|
||||
onMouseEnter={this.handleMouseEnter}
|
||||
onMouseLeave={this.handleMouseLeave}
|
||||
{...other}
|
||||
>
|
||||
{transition}
|
||||
<TransitionProp
|
||||
appear
|
||||
in={open}
|
||||
onEnter={onEnter}
|
||||
onEntered={onEntered}
|
||||
onEntering={onEntering}
|
||||
onExit={onExit}
|
||||
onExited={createChainedFunction(this.handleExited, onExited)}
|
||||
onExiting={onExiting}
|
||||
timeout={transitionDuration}
|
||||
{...transitionProps}
|
||||
>
|
||||
{children || (
|
||||
<SnackbarContent message={message} action={action} {...SnackbarContentProps} />
|
||||
)}
|
||||
</TransitionProp>
|
||||
</div>
|
||||
</ClickAwayListener>
|
||||
</EventListener>
|
||||
@@ -389,4 +262,139 @@ class Snackbar extends React.Component<ProvidedProps & Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
Snackbar.propTypes = {
|
||||
/**
|
||||
* The action to display.
|
||||
*/
|
||||
action: PropTypes.node,
|
||||
/**
|
||||
* The anchor of the `Snackbar`.
|
||||
*/
|
||||
anchorOrigin: PropTypes.shape({
|
||||
horizontal: PropTypes.oneOfType([
|
||||
PropTypes.number,
|
||||
PropTypes.oneOf(['left', 'center', 'right']),
|
||||
]),
|
||||
vertical: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['top', 'center', 'bottom'])]),
|
||||
}),
|
||||
/**
|
||||
* The number of milliseconds to wait before automatically calling the
|
||||
* `onClose` function. `onClose` should then set the state of the `open`
|
||||
* prop to hide the Snackbar. This behavior is disabled by default with
|
||||
* the `null` value.
|
||||
*/
|
||||
autoHideDuration: PropTypes.number,
|
||||
/**
|
||||
* If you wish the take control over the children of the component you can use this property.
|
||||
* When used, you replace the `SnackbarContent` component with the children.
|
||||
*/
|
||||
children: PropTypes.element,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: PropTypes.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* If `true`, the `autoHideDuration` timer will expire even if the window is not focused.
|
||||
*/
|
||||
disableWindowBlurListener: PropTypes.bool,
|
||||
/**
|
||||
* When displaying multiple consecutive Snackbars from a parent rendering a single
|
||||
* <Snackbar/>, add the key property to ensure independent treatment of each message.
|
||||
* e.g. <Snackbar key={message} />, otherwise, the message may update-in-place and
|
||||
* features such as autoHideDuration may be canceled.
|
||||
*/
|
||||
key: PropTypes.any,
|
||||
/**
|
||||
* The message to display.
|
||||
*/
|
||||
message: PropTypes.node,
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
* Typically `onClose` is used to set state in the parent component,
|
||||
* which is used to control the `Snackbar` `open` prop.
|
||||
* The `reason` parameter can optionally be used to control the response to `onClose`,
|
||||
* for example ignoring `clickaway`.
|
||||
*
|
||||
* @param {object} event The event source of the callback
|
||||
* @param {string} reason Can be:`"timeout"` (`autoHideDuration` expired) or: `"clickaway"`
|
||||
*/
|
||||
onClose: PropTypes.func,
|
||||
/**
|
||||
* Callback fired before the transition is entering.
|
||||
*/
|
||||
onEnter: PropTypes.func,
|
||||
/**
|
||||
* Callback fired when the transition has entered.
|
||||
*/
|
||||
onEntered: PropTypes.func,
|
||||
/**
|
||||
* Callback fired when the transition is entering.
|
||||
*/
|
||||
onEntering: PropTypes.func,
|
||||
/**
|
||||
* Callback fired before the transition is exiting.
|
||||
*/
|
||||
onExit: PropTypes.func,
|
||||
/**
|
||||
* Callback fired when the transition has exited.
|
||||
*/
|
||||
onExited: PropTypes.func,
|
||||
/**
|
||||
* Callback fired when the transition is exiting.
|
||||
*/
|
||||
onExiting: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onMouseEnter: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onMouseLeave: PropTypes.func,
|
||||
/**
|
||||
* If true, `Snackbar` is open.
|
||||
*/
|
||||
open: PropTypes.bool,
|
||||
/**
|
||||
* The number of milliseconds to wait before dismissing after user interaction.
|
||||
* If `autoHideDuration` property isn't specified, it does nothing.
|
||||
* If `autoHideDuration` property is specified but `resumeHideDuration` isn't,
|
||||
* we default to `autoHideDuration / 2` ms.
|
||||
*/
|
||||
resumeHideDuration: PropTypes.number,
|
||||
/**
|
||||
* Properties applied to the `SnackbarContent` element.
|
||||
*/
|
||||
SnackbarContentProps: PropTypes.object,
|
||||
/**
|
||||
* Transition component.
|
||||
*/
|
||||
transition: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
transitionDuration: PropTypes.oneOfType([
|
||||
PropTypes.number,
|
||||
PropTypes.shape({ enter: PropTypes.number, exit: PropTypes.number }),
|
||||
]),
|
||||
};
|
||||
|
||||
Snackbar.defaultProps = {
|
||||
anchorOrigin: {
|
||||
vertical: 'bottom',
|
||||
horizontal: 'center',
|
||||
},
|
||||
disableWindowBlurListener: false,
|
||||
transition: Slide,
|
||||
transitionDuration: {
|
||||
enter: duration.enteringScreen,
|
||||
exit: duration.leavingScreen,
|
||||
},
|
||||
};
|
||||
|
||||
export default withStyles(styles, { flip: false, name: 'MuiSnackbar' })(Snackbar);
|
||||
|
11
goTorrentWebUI/node_modules/material-ui/Snackbar/SnackbarContent.d.ts
generated
vendored
11
goTorrentWebUI/node_modules/material-ui/Snackbar/SnackbarContent.d.ts
generated
vendored
@@ -3,19 +3,12 @@ import { StandardProps } from '..';
|
||||
import { PaperProps } from '../Paper';
|
||||
import { PaperClassKey } from '../Paper/Paper';
|
||||
|
||||
export interface SnackbarContentProps extends StandardProps<
|
||||
PaperProps,
|
||||
SnackbarContentClasskey
|
||||
> {
|
||||
export interface SnackbarContentProps extends StandardProps<PaperProps, SnackbarContentClassKey> {
|
||||
action?: React.ReactElement<any>;
|
||||
message: React.ReactElement<any> | string;
|
||||
}
|
||||
|
||||
export type SnackbarContentClasskey =
|
||||
| PaperClassKey
|
||||
| 'message'
|
||||
| 'action'
|
||||
;
|
||||
export type SnackbarContentClassKey = PaperClassKey | 'message' | 'action';
|
||||
|
||||
declare const SnackbarContent: React.ComponentType<SnackbarContentProps>;
|
||||
|
||||
|
65
goTorrentWebUI/node_modules/material-ui/Snackbar/SnackbarContent.js
generated
vendored
65
goTorrentWebUI/node_modules/material-ui/Snackbar/SnackbarContent.js
generated
vendored
@@ -17,13 +17,14 @@ var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _ref;
|
||||
// @inheritedComponent Paper
|
||||
|
||||
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);
|
||||
@@ -40,15 +41,15 @@ var _Typography = require('../Typography');
|
||||
|
||||
var _Typography2 = _interopRequireDefault(_Typography);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _colorManipulator = require('../styles/colorManipulator');
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Node = require('react').babelPluginFlowReactPropTypes_proptype_Node || require('prop-types').any;
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var styles = exports.styles = function styles(theme) {
|
||||
var _root;
|
||||
|
||||
var type = theme.palette.type === 'light' ? 'dark' : 'light';
|
||||
var backgroundColor = theme.palette.shades[type].background.default;
|
||||
var emphasis = theme.palette.type === 'light' ? 0.8 : 0.98;
|
||||
var backgroundColor = (0, _colorManipulator.emphasize)(theme.palette.background.default, emphasis);
|
||||
|
||||
return {
|
||||
root: (_root = {
|
||||
@@ -63,7 +64,7 @@ var styles = exports.styles = function styles(theme) {
|
||||
minWidth: 288,
|
||||
maxWidth: 568,
|
||||
borderRadius: 2
|
||||
}), (0, _defineProperty3.default)(_root, theme.breakpoints.down('md'), {
|
||||
}), (0, _defineProperty3.default)(_root, theme.breakpoints.down('sm'), {
|
||||
flexGrow: 1
|
||||
}), _root),
|
||||
message: {
|
||||
@@ -77,30 +78,7 @@ var styles = exports.styles = function styles(theme) {
|
||||
marginRight: -theme.spacing.unit
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Props = {
|
||||
/**
|
||||
* The action to display.
|
||||
*/
|
||||
action: typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node),
|
||||
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* The message to display.
|
||||
*/
|
||||
message: typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node.isRequired ? babelPluginFlowReactPropTypes_proptype_Node.isRequired : babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node).isRequired
|
||||
};
|
||||
|
||||
}; // @inheritedComponent Paper
|
||||
|
||||
function SnackbarContent(props) {
|
||||
var action = props.action,
|
||||
@@ -135,8 +113,23 @@ function SnackbarContent(props) {
|
||||
);
|
||||
}
|
||||
|
||||
SnackbarContent.propTypes = process.env.NODE_ENV !== "production" ? (_ref = {
|
||||
classes: require('prop-types').object.isRequired,
|
||||
action: 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, 'message', typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node.isRequired ? babelPluginFlowReactPropTypes_proptype_Node.isRequired : babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node).isRequired), _ref) : {};
|
||||
SnackbarContent.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* The action to display.
|
||||
*/
|
||||
action: _propTypes2.default.node,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: _propTypes2.default.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: _propTypes2.default.string,
|
||||
/**
|
||||
* The message to display.
|
||||
*/
|
||||
message: _propTypes2.default.node
|
||||
} : {};
|
||||
|
||||
exports.default = (0, _withStyles2.default)(styles, { name: 'MuiSnackbarContent' })(SnackbarContent);
|
56
goTorrentWebUI/node_modules/material-ui/Snackbar/SnackbarContent.js.flow
generated
vendored
56
goTorrentWebUI/node_modules/material-ui/Snackbar/SnackbarContent.js.flow
generated
vendored
@@ -1,16 +1,16 @@
|
||||
// @flow
|
||||
// @inheritedComponent Paper
|
||||
|
||||
import React from 'react';
|
||||
import type { Node } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import withStyles from '../styles/withStyles';
|
||||
import Paper from '../Paper';
|
||||
import Typography from '../Typography';
|
||||
import { emphasize } from '../styles/colorManipulator';
|
||||
|
||||
export const styles = (theme: Object) => {
|
||||
const type = theme.palette.type === 'light' ? 'dark' : 'light';
|
||||
const backgroundColor = theme.palette.shades[type].background.default;
|
||||
export const styles = theme => {
|
||||
const emphasis = theme.palette.type === 'light' ? 0.8 : 0.98;
|
||||
const backgroundColor = emphasize(theme.palette.background.default, emphasis);
|
||||
|
||||
return {
|
||||
root: {
|
||||
@@ -26,7 +26,7 @@ export const styles = (theme: Object) => {
|
||||
maxWidth: 568,
|
||||
borderRadius: 2,
|
||||
},
|
||||
[theme.breakpoints.down('md')]: {
|
||||
[theme.breakpoints.down('sm')]: {
|
||||
flexGrow: 1,
|
||||
},
|
||||
},
|
||||
@@ -43,30 +43,7 @@ export const styles = (theme: Object) => {
|
||||
};
|
||||
};
|
||||
|
||||
type ProvidedProps = {
|
||||
classes: Object,
|
||||
};
|
||||
|
||||
export type Props = {
|
||||
/**
|
||||
* The action to display.
|
||||
*/
|
||||
action?: Node,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes?: Object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className?: string,
|
||||
/**
|
||||
* The message to display.
|
||||
*/
|
||||
message: Node,
|
||||
};
|
||||
|
||||
function SnackbarContent(props: ProvidedProps & Props) {
|
||||
function SnackbarContent(props) {
|
||||
const { action, classes, className, message, ...other } = props;
|
||||
|
||||
return (
|
||||
@@ -87,4 +64,23 @@ function SnackbarContent(props: ProvidedProps & Props) {
|
||||
);
|
||||
}
|
||||
|
||||
SnackbarContent.propTypes = {
|
||||
/**
|
||||
* The action to display.
|
||||
*/
|
||||
action: PropTypes.node,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: PropTypes.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* The message to display.
|
||||
*/
|
||||
message: PropTypes.node,
|
||||
};
|
||||
|
||||
export default withStyles(styles, { name: 'MuiSnackbarContent' })(SnackbarContent);
|
||||
|
2
goTorrentWebUI/node_modules/material-ui/Snackbar/index.js.flow
generated
vendored
2
goTorrentWebUI/node_modules/material-ui/Snackbar/index.js.flow
generated
vendored
@@ -1,4 +1,2 @@
|
||||
// @flow
|
||||
|
||||
export { default } from './Snackbar';
|
||||
export { default as SnackbarContent } from './SnackbarContent';
|
||||
|
Reference in New Issue
Block a user