Completely updated React, fixed #11, (hopefully)
This commit is contained in:
426
goTorrentWebUI/node_modules/material-ui/Popover/Popover.js
generated
vendored
426
goTorrentWebUI/node_modules/material-ui/Popover/Popover.js
generated
vendored
@@ -37,6 +37,10 @@ var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _reactDom = require('react-dom');
|
||||
|
||||
var _reactDom2 = _interopRequireDefault(_reactDom);
|
||||
@@ -49,6 +53,14 @@ var _contains = require('dom-helpers/query/contains');
|
||||
|
||||
var _contains2 = _interopRequireDefault(_contains);
|
||||
|
||||
var _ownerDocument = require('dom-helpers/ownerDocument');
|
||||
|
||||
var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
||||
|
||||
var _ownerWindow = require('dom-helpers/ownerWindow');
|
||||
|
||||
var _ownerWindow2 = _interopRequireDefault(_ownerWindow);
|
||||
|
||||
var _debounce = require('lodash/debounce');
|
||||
|
||||
var _debounce2 = _interopRequireDefault(_debounce);
|
||||
@@ -61,7 +73,7 @@ var _withStyles = require('../styles/withStyles');
|
||||
|
||||
var _withStyles2 = _interopRequireDefault(_withStyles);
|
||||
|
||||
var _Modal = require('../internal/Modal');
|
||||
var _Modal = require('../Modal');
|
||||
|
||||
var _Modal2 = _interopRequireDefault(_Modal);
|
||||
|
||||
@@ -75,12 +87,6 @@ var _Paper2 = _interopRequireDefault(_Paper);
|
||||
|
||||
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_TransitionClasses = require('../internal/transition').babelPluginFlowReactPropTypes_proptype_TransitionClasses || require('prop-types').any;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_TransitionCallback = require('../internal/transition').babelPluginFlowReactPropTypes_proptype_TransitionCallback || require('prop-types').any;
|
||||
|
||||
function getOffsetTop(rect, vertical) {
|
||||
var offset = 0;
|
||||
|
||||
@@ -93,7 +99,7 @@ function getOffsetTop(rect, vertical) {
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
} // @inheritedComponent Modal
|
||||
|
||||
function getOffsetLeft(rect, horizontal) {
|
||||
var offset = 0;
|
||||
@@ -127,6 +133,10 @@ function getScrollParent(parent, child) {
|
||||
return scrollTop;
|
||||
}
|
||||
|
||||
function getAnchorEl(anchorEl) {
|
||||
return typeof anchorEl === 'function' ? anchorEl() : anchorEl;
|
||||
}
|
||||
|
||||
var styles = exports.styles = {
|
||||
paper: {
|
||||
position: 'absolute',
|
||||
@@ -144,140 +154,6 @@ var styles = exports.styles = {
|
||||
}
|
||||
};
|
||||
|
||||
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]).isRequired,
|
||||
vertical: require('prop-types').oneOfType([require('prop-types').oneOf(['top']), require('prop-types').oneOf(['center']), require('prop-types').oneOf(['bottom']), require('prop-types').number]).isRequired
|
||||
};
|
||||
var babelPluginFlowReactPropTypes_proptype_Props = {
|
||||
/**
|
||||
* This is the DOM element that will be used
|
||||
* to set the position of the popover.
|
||||
*/
|
||||
anchorEl: typeof HTMLElement === 'function' ? require('prop-types').instanceOf(HTMLElement) : require('prop-types').any,
|
||||
|
||||
/**
|
||||
* This is the point on the anchor where the popover's
|
||||
* `anchorEl` will attach to.
|
||||
*
|
||||
* Options:
|
||||
* vertical: [top, center, bottom];
|
||||
* horizontal: [left, center, right].
|
||||
*/
|
||||
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]).isRequired,
|
||||
vertical: require('prop-types').oneOfType([require('prop-types').oneOf(['top']), require('prop-types').oneOf(['center']), require('prop-types').oneOf(['bottom']), require('prop-types').number]).isRequired
|
||||
}),
|
||||
|
||||
/**
|
||||
* 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,
|
||||
|
||||
/**
|
||||
* The elevation of the popover.
|
||||
*/
|
||||
elevation: require('prop-types').number,
|
||||
|
||||
/**
|
||||
* This function is called in order to retrieve the content anchor element.
|
||||
* It's the opposite of the `anchorEl` property.
|
||||
* The content anchor element should be an element inside the popover.
|
||||
* It's used to correctly scroll and set the position of the popover.
|
||||
* The positioning strategy tries to make the content anchor element just above the
|
||||
* anchor element.
|
||||
*/
|
||||
getContentAnchorEl: require('prop-types').func,
|
||||
|
||||
/**
|
||||
* Specifies how close to the edge of the window the popover can appear.
|
||||
*/
|
||||
marginThreshold: require('prop-types').number,
|
||||
|
||||
/**
|
||||
* Callback fired before the component is entering.
|
||||
*/
|
||||
onEnter: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* Callback fired when the component is entering.
|
||||
*/
|
||||
onEntering: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* Callback fired when the component has entered.
|
||||
*/
|
||||
onEntered: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* Callback fired before the component is exiting.
|
||||
*/
|
||||
onExit: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* Callback fired when the component is exiting.
|
||||
*/
|
||||
onExiting: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* Callback fired when the component has exited.
|
||||
*/
|
||||
onExited: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
*/
|
||||
onRequestClose: require('prop-types').func,
|
||||
|
||||
/**
|
||||
* If `true`, the popover is visible.
|
||||
*/
|
||||
open: require('prop-types').bool.isRequired,
|
||||
|
||||
/**
|
||||
* Properties applied to the `Paper` element.
|
||||
*/
|
||||
PaperProps: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
role: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* This is the point on the popover which
|
||||
* will attach to the anchor's origin.
|
||||
*
|
||||
* Options:
|
||||
* vertical: [top, center, bottom, x(px)];
|
||||
* horizontal: [left, center, right, x(px)].
|
||||
*/
|
||||
transformOrigin: 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]).isRequired,
|
||||
vertical: require('prop-types').oneOfType([require('prop-types').oneOf(['top']), require('prop-types').oneOf(['center']), require('prop-types').oneOf(['bottom']), require('prop-types').number]).isRequired
|
||||
}),
|
||||
|
||||
/**
|
||||
* The animation classNames applied to the component as it enters or exits.
|
||||
* This property is a direct binding to [`CSSTransition.classNames`](https://reactcommunity.org/react-transition-group/#CSSTransition-prop-classNames).
|
||||
*/
|
||||
transitionClasses: typeof babelPluginFlowReactPropTypes_proptype_TransitionClasses === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionClasses : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionClasses),
|
||||
|
||||
/**
|
||||
* Set to 'auto' to automatically calculate transition time based on height.
|
||||
*/
|
||||
transitionDuration: require('prop-types').oneOfType([require('prop-types').number, require('prop-types').shape({
|
||||
enter: require('prop-types').number,
|
||||
exit: require('prop-types').number
|
||||
}), require('prop-types').oneOf(['auto'])])
|
||||
};
|
||||
|
||||
var Popover = function (_React$Component) {
|
||||
(0, _inherits3.default)(Popover, _React$Component);
|
||||
|
||||
@@ -297,13 +173,14 @@ var Popover = function (_React$Component) {
|
||||
}, _this.setPositioningStyles = function (element) {
|
||||
if (element && element.style) {
|
||||
var positioning = _this.getPositioningStyle(element);
|
||||
|
||||
element.style.top = positioning.top;
|
||||
element.style.left = positioning.left;
|
||||
element.style.transformOrigin = positioning.transformOrigin;
|
||||
}
|
||||
}, _this.getPositioningStyle = function (element) {
|
||||
var marginThreshold = _this.props.marginThreshold;
|
||||
var _this$props = _this.props,
|
||||
anchorEl = _this$props.anchorEl,
|
||||
marginThreshold = _this$props.marginThreshold;
|
||||
|
||||
// Check if the parent has requested anchoring on an inner content node
|
||||
|
||||
@@ -324,9 +201,12 @@ var Popover = function (_React$Component) {
|
||||
var bottom = top + elemRect.height;
|
||||
var right = left + elemRect.width;
|
||||
|
||||
// Use the parent window of the anchorEl if provided
|
||||
var containerWindow = (0, _ownerWindow2.default)(getAnchorEl(anchorEl));
|
||||
|
||||
// Window thresholds taking required margin into account
|
||||
var heightThreshold = window.innerHeight - marginThreshold;
|
||||
var widthThreshold = window.innerWidth - marginThreshold;
|
||||
var heightThreshold = containerWindow.innerHeight - marginThreshold;
|
||||
var widthThreshold = containerWindow.innerWidth - marginThreshold;
|
||||
|
||||
// Check if the vertical axis needs shifting
|
||||
if (top < marginThreshold) {
|
||||
@@ -370,18 +250,34 @@ var Popover = function (_React$Component) {
|
||||
}
|
||||
|
||||
(0, _createClass3.default)(Popover, [{
|
||||
key: 'componentDidMount',
|
||||
value: function componentDidMount() {
|
||||
if (this.props.action) {
|
||||
this.props.action({
|
||||
updatePosition: this.handleResize
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'getAnchorOffset',
|
||||
|
||||
|
||||
// Returns the top/left offset of the position
|
||||
// to attach to on the anchor element (or body if none is provided)
|
||||
value: function getAnchorOffset(contentAnchorOffset) {
|
||||
// $FlowFixMe
|
||||
var _props = this.props,
|
||||
anchorEl = _props.anchorEl,
|
||||
anchorOrigin = _props.anchorOrigin;
|
||||
anchorOrigin = _props.anchorOrigin,
|
||||
anchorReference = _props.anchorReference,
|
||||
anchorPosition = _props.anchorPosition;
|
||||
|
||||
var anchorElement = anchorEl || document.body;
|
||||
|
||||
if (anchorReference === 'anchorPosition') {
|
||||
return anchorPosition;
|
||||
}
|
||||
|
||||
// If an anchor element wasn't provided, just use the parent body element of this Popover
|
||||
var anchorElement = getAnchorEl(anchorEl) || (0, _ownerDocument2.default)(_reactDom2.default.findDOMNode(this.transitionEl)).body;
|
||||
var anchorRect = anchorElement.getBoundingClientRect();
|
||||
var anchorVertical = contentAnchorOffset === 0 ? anchorOrigin.vertical : 'center';
|
||||
|
||||
@@ -396,10 +292,14 @@ var Popover = function (_React$Component) {
|
||||
}, {
|
||||
key: 'getContentAnchorOffset',
|
||||
value: function getContentAnchorOffset(element) {
|
||||
var _props2 = this.props,
|
||||
getContentAnchorEl = _props2.getContentAnchorEl,
|
||||
anchorReference = _props2.anchorReference;
|
||||
|
||||
var contentAnchorOffset = 0;
|
||||
|
||||
if (this.props.getContentAnchorEl) {
|
||||
var contentAnchorEl = this.props.getContentAnchorEl(element);
|
||||
if (getContentAnchorEl && anchorReference === 'anchorEl') {
|
||||
var contentAnchorEl = getContentAnchorEl(element);
|
||||
|
||||
if (contentAnchorEl && (0, _contains2.default)(element, contentAnchorEl)) {
|
||||
var scrollTop = getScrollParent(element, contentAnchorEl);
|
||||
@@ -407,7 +307,7 @@ var Popover = function (_React$Component) {
|
||||
}
|
||||
|
||||
// != the default value
|
||||
process.env.NODE_ENV !== "production" ? (0, _warning2.default)(this.props.anchorOrigin.vertical === 'top', ['Material-UI: you can not change the default `anchorOrigin.vertical` value when also ', 'providing the `getContentAnchorEl` property to the popover component.', 'Only use one of the two properties', 'Set `getContentAnchorEl` to null or left `anchorOrigin.vertical` unchanged'].join()) : void 0;
|
||||
process.env.NODE_ENV !== "production" ? (0, _warning2.default)(this.props.anchorOrigin.vertical === 'top', ['Material-UI: you can not change the default `anchorOrigin.vertical` value ', 'when also providing the `getContentAnchorEl` property to the popover component.', 'Only use one of the two properties.', 'Set `getContentAnchorEl` to null or left `anchorOrigin.vertical` unchanged.'].join('\n')) : void 0;
|
||||
}
|
||||
|
||||
return contentAnchorOffset;
|
||||
@@ -432,54 +332,68 @@ var Popover = function (_React$Component) {
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
var _props2 = this.props,
|
||||
anchorEl = _props2.anchorEl,
|
||||
anchorOrigin = _props2.anchorOrigin,
|
||||
children = _props2.children,
|
||||
classes = _props2.classes,
|
||||
elevation = _props2.elevation,
|
||||
getContentAnchorEl = _props2.getContentAnchorEl,
|
||||
marginThreshold = _props2.marginThreshold,
|
||||
onEnter = _props2.onEnter,
|
||||
onEntering = _props2.onEntering,
|
||||
onEntered = _props2.onEntered,
|
||||
onExit = _props2.onExit,
|
||||
onExiting = _props2.onExiting,
|
||||
onExited = _props2.onExited,
|
||||
open = _props2.open,
|
||||
PaperProps = _props2.PaperProps,
|
||||
role = _props2.role,
|
||||
transformOrigin = _props2.transformOrigin,
|
||||
transitionClasses = _props2.transitionClasses,
|
||||
transitionDuration = _props2.transitionDuration,
|
||||
other = (0, _objectWithoutProperties3.default)(_props2, ['anchorEl', 'anchorOrigin', 'children', 'classes', 'elevation', 'getContentAnchorEl', 'marginThreshold', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited', 'open', 'PaperProps', 'role', 'transformOrigin', 'transitionClasses', 'transitionDuration']);
|
||||
var _props3 = this.props,
|
||||
action = _props3.action,
|
||||
anchorEl = _props3.anchorEl,
|
||||
anchorOrigin = _props3.anchorOrigin,
|
||||
anchorPosition = _props3.anchorPosition,
|
||||
anchorReference = _props3.anchorReference,
|
||||
children = _props3.children,
|
||||
classes = _props3.classes,
|
||||
containerProp = _props3.container,
|
||||
elevation = _props3.elevation,
|
||||
getContentAnchorEl = _props3.getContentAnchorEl,
|
||||
marginThreshold = _props3.marginThreshold,
|
||||
onEnter = _props3.onEnter,
|
||||
onEntered = _props3.onEntered,
|
||||
onEntering = _props3.onEntering,
|
||||
onExit = _props3.onExit,
|
||||
onExited = _props3.onExited,
|
||||
onExiting = _props3.onExiting,
|
||||
open = _props3.open,
|
||||
PaperProps = _props3.PaperProps,
|
||||
role = _props3.role,
|
||||
transformOrigin = _props3.transformOrigin,
|
||||
TransitionProp = _props3.transition,
|
||||
transitionDuration = _props3.transitionDuration,
|
||||
other = (0, _objectWithoutProperties3.default)(_props3, ['action', 'anchorEl', 'anchorOrigin', 'anchorPosition', 'anchorReference', 'children', 'classes', 'container', 'elevation', 'getContentAnchorEl', 'marginThreshold', 'onEnter', 'onEntered', 'onEntering', 'onExit', 'onExited', 'onExiting', 'open', 'PaperProps', 'role', 'transformOrigin', 'transition', 'transitionDuration']);
|
||||
|
||||
// If the container prop is provided, use that
|
||||
// If the anchorEl prop is provided, use its parent body element as the container
|
||||
// If neither are provided let the Modal take care of choosing the container
|
||||
|
||||
var container = containerProp || (anchorEl ? (0, _ownerDocument2.default)(getAnchorEl(anchorEl)).body : undefined);
|
||||
|
||||
var transitionProps = {};
|
||||
// The provided transition might not support the auto timeout value.
|
||||
if (TransitionProp === _Grow2.default) {
|
||||
transitionProps.timeout = transitionDuration;
|
||||
}
|
||||
|
||||
return _react2.default.createElement(
|
||||
_Modal2.default,
|
||||
(0, _extends3.default)({ show: open, BackdropInvisible: true }, other),
|
||||
(0, _extends3.default)({ container: container, open: open, BackdropProps: { invisible: true } }, other),
|
||||
_react2.default.createElement(
|
||||
_Grow2.default,
|
||||
{
|
||||
TransitionProp,
|
||||
(0, _extends3.default)({
|
||||
appear: true,
|
||||
'in': open,
|
||||
onEnter: this.handleEnter,
|
||||
onEntering: onEntering,
|
||||
onEntered: onEntered,
|
||||
onEntering: onEntering,
|
||||
onExit: onExit,
|
||||
onExiting: onExiting,
|
||||
onExited: onExited,
|
||||
onExiting: onExiting,
|
||||
role: role,
|
||||
transitionClasses: transitionClasses,
|
||||
timeout: transitionDuration,
|
||||
rootRef: function rootRef(node) {
|
||||
ref: function ref(node) {
|
||||
_this2.transitionEl = node;
|
||||
}
|
||||
},
|
||||
}, transitionProps),
|
||||
_react2.default.createElement(
|
||||
_Paper2.default,
|
||||
(0, _extends3.default)({
|
||||
className: classes.paper,
|
||||
|
||||
elevation: elevation
|
||||
}, PaperProps),
|
||||
_react2.default.createElement(_reactEventListener2.default, { target: 'window', onResize: this.handleResize }),
|
||||
@@ -492,17 +406,159 @@ var Popover = function (_React$Component) {
|
||||
return Popover;
|
||||
}(_react2.default.Component);
|
||||
|
||||
Popover.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* This is callback property. It's called by the component on mount.
|
||||
* This is useful when you want to trigger an action programmatically.
|
||||
* It currently only supports updatePosition() action.
|
||||
*
|
||||
* @param {object} actions This object contains all posible actions
|
||||
* that can be triggered programmatically.
|
||||
*/
|
||||
action: _propTypes2.default.func,
|
||||
/**
|
||||
* This is the DOM element, or a function that returns the DOM element,
|
||||
* that may be used to set the position of the popover.
|
||||
*/
|
||||
anchorEl: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.func]),
|
||||
/**
|
||||
* This is the point on the anchor where the popover's
|
||||
* `anchorEl` will attach to. This is not used when the
|
||||
* anchorReference is 'anchorPosition'.
|
||||
*
|
||||
* Options:
|
||||
* vertical: [top, center, bottom];
|
||||
* horizontal: [left, center, right].
|
||||
*/
|
||||
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'])])
|
||||
}),
|
||||
/**
|
||||
* This is the position that may be used
|
||||
* to set the position of the popover.
|
||||
* The coordinates are relative to
|
||||
* the application's client area.
|
||||
*/
|
||||
anchorPosition: _propTypes2.default.shape({
|
||||
top: _propTypes2.default.number,
|
||||
left: _propTypes2.default.number
|
||||
}),
|
||||
/*
|
||||
* This determines which anchor prop to refer to to set
|
||||
* the position of the popover.
|
||||
*/
|
||||
anchorReference: _propTypes2.default.oneOf(['anchorEl', 'anchorPosition']),
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
children: _propTypes2.default.node,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: _propTypes2.default.object.isRequired,
|
||||
/**
|
||||
* A node, component instance, or function that returns either.
|
||||
* The `container` will passed to the Modal component.
|
||||
* By default, it's using the body of the anchorEl's top-level document object,
|
||||
* so it's simply `document.body` most of the time.
|
||||
*/
|
||||
container: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.func]),
|
||||
/**
|
||||
* The elevation of the popover.
|
||||
*/
|
||||
elevation: _propTypes2.default.number,
|
||||
/**
|
||||
* This function is called in order to retrieve the content anchor element.
|
||||
* It's the opposite of the `anchorEl` property.
|
||||
* The content anchor element should be an element inside the popover.
|
||||
* It's used to correctly scroll and set the position of the popover.
|
||||
* The positioning strategy tries to make the content anchor element just above the
|
||||
* anchor element.
|
||||
*/
|
||||
getContentAnchorEl: _propTypes2.default.func,
|
||||
/**
|
||||
* Specifies how close to the edge of the window the popover can appear.
|
||||
*/
|
||||
marginThreshold: _propTypes2.default.number,
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
*/
|
||||
onClose: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired before the component is entering.
|
||||
*/
|
||||
onEnter: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired when the component has entered.
|
||||
*/
|
||||
onEntered: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired when the component is entering.
|
||||
*/
|
||||
onEntering: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired before the component is exiting.
|
||||
*/
|
||||
onExit: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired when the component has exited.
|
||||
*/
|
||||
onExited: _propTypes2.default.func,
|
||||
/**
|
||||
* Callback fired when the component is exiting.
|
||||
*/
|
||||
onExiting: _propTypes2.default.func,
|
||||
/**
|
||||
* If `true`, the popover is visible.
|
||||
*/
|
||||
open: _propTypes2.default.bool.isRequired,
|
||||
/**
|
||||
* Properties applied to the `Paper` element.
|
||||
*/
|
||||
PaperProps: _propTypes2.default.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
role: _propTypes2.default.string,
|
||||
/**
|
||||
* This is the point on the popover which
|
||||
* will attach to the anchor's origin.
|
||||
*
|
||||
* Options:
|
||||
* vertical: [top, center, bottom, x(px)];
|
||||
* horizontal: [left, center, right, x(px)].
|
||||
*/
|
||||
transformOrigin: _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'])])
|
||||
}),
|
||||
/**
|
||||
* Transition component.
|
||||
*/
|
||||
transition: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]),
|
||||
/**
|
||||
* Set to 'auto' to automatically calculate transition time based on height.
|
||||
*/
|
||||
transitionDuration: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({ enter: _propTypes2.default.number, exit: _propTypes2.default.number }), _propTypes2.default.oneOf(['auto'])])
|
||||
} : {};
|
||||
|
||||
Popover.defaultProps = {
|
||||
anchorReference: 'anchorEl',
|
||||
anchorOrigin: {
|
||||
vertical: 'top',
|
||||
horizontal: 'left'
|
||||
},
|
||||
elevation: 8,
|
||||
marginThreshold: 16,
|
||||
transformOrigin: {
|
||||
vertical: 'top',
|
||||
horizontal: 'left'
|
||||
},
|
||||
transitionDuration: 'auto',
|
||||
elevation: 8,
|
||||
marginThreshold: 16
|
||||
transition: _Grow2.default,
|
||||
transitionDuration: 'auto'
|
||||
};
|
||||
|
||||
exports.default = (0, _withStyles2.default)(styles, { name: 'MuiPopover' })(Popover);
|
Reference in New Issue
Block a user