Completely updated React, fixed #11, (hopefully)

This commit is contained in:
2018-03-04 19:11:49 -05:00
parent 6e0afd6e2a
commit 34e5f5139a
13674 changed files with 333464 additions and 473223 deletions

View File

@@ -38,9 +38,9 @@ var _DefaultTransition2 = _interopRequireDefault(_DefaultTransition);
var _constant = require('./constant');
var _style = require('./style');
var _defaultStyle = require('./defaultStyle');
var _style2 = _interopRequireDefault(_style);
var _defaultStyle2 = _interopRequireDefault(_defaultStyle);
var _EventManager = require('./util/EventManager');
@@ -60,34 +60,33 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var toastPosition = function toastPosition(pos) {
var getToastPositionStyle = function getToastPositionStyle(pos) {
var positionKey = pos.toUpperCase().replace('-', '_');
var positionRule = typeof _constant.POSITION[positionKey] !== 'undefined' ? _style2.default[positionKey] : _style2.default.TOP_RIGHT;
var positionRule = typeof _constant.POSITION[positionKey] !== 'undefined' ? _defaultStyle2.default[positionKey] : _defaultStyle2.default.TOP_RIGHT;
/** define margin for center toast based on toast witdh */
if (positionKey.indexOf('CENTER') !== -1 && typeof positionRule.marginLeft === 'undefined') {
positionRule.marginLeft = '-' + parseInt(_style2.default.width, 10) / 2 + 'px';
positionRule.marginLeft = '-' + parseInt(_defaultStyle2.default.width, 10) / 2 + 'px';
}
return (0, _glamor.css)(positionRule, (0, _glamor.css)(_defineProperty({}, '@media ' + _style2.default.mobile, _extends({
return positionRule;
};
var styles = function styles(disablePointer, position) {
return (0, _glamor.css)(_extends({
zIndex: _defaultStyle2.default.zIndex,
position: 'fixed',
padding: '4px',
width: _defaultStyle2.default.width,
boxSizing: 'border-box',
color: '#fff'
}, disablePointer ? { pointerEvents: 'none' } : {}, _defineProperty({}, '@media ' + _defaultStyle2.default.mobile, _extends({
width: '100vw',
padding: 0,
left: 0,
margin: 0,
position: 'fixed'
}, pos.substring(0, 3) === 'top' ? { top: 0 } : { bottom: 0 }))));
};
var container = function container(disablePointer, position) {
return (0, _glamor.css)(_extends({
zIndex: _style2.default.zIndex,
position: 'fixed',
padding: '4px',
width: _style2.default.width,
boxSizing: 'border-box',
color: '#fff'
}, disablePointer ? { pointerEvents: 'none' } : {}, _defineProperty({}, '@media ' + _style2.default.mobile, {
width: '100vw',
padding: 0
})), toastPosition(position));
}, position.substring(0, 3) === 'top' ? { top: 0 } : { bottom: 0 }))), getToastPositionStyle(position));
};
var ToastContainer = function (_Component) {
@@ -294,7 +293,7 @@ var ToastContainer = function (_Component) {
return _react2.default.createElement(
_TransitionGroup2.default,
_extends({}, typeof className !== 'string' ? (0, _glamor.css)(container(disablePointer, position), className) : container(disablePointer, position), typeof className === 'string' && { className: className }, style !== null && { style: style }, {
_extends({}, typeof className !== 'string' ? (0, _glamor.css)(styles(disablePointer, position), className) : styles(disablePointer, position), typeof className === 'string' && { className: className }, style !== null && { style: style }, {
key: 'container-' + position
}),
toastToRender[position]