carbon-components-react
Advanced tools
Comparing version 3.1.2 to 3.1.3
@@ -27,2 +27,6 @@ 'use strict'; | ||
var _windowOrGlobal = require('window-or-global'); | ||
var _windowOrGlobal2 = _interopRequireDefault(_windowOrGlobal); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -60,3 +64,3 @@ | ||
var currentPosition = window.pageYOffset; // eslint-disable-line no-undef | ||
var currentPosition = _windowOrGlobal2.default.pageYOffset || 0; | ||
@@ -91,3 +95,3 @@ if (currentPosition > 86) { | ||
var debouncedScroll = (0, _lodash2.default)(this.handleScroll, 25); | ||
window.addEventListener('scroll', debouncedScroll); // eslint-disable-line no-undef | ||
_windowOrGlobal2.default.addEventListener('scroll', debouncedScroll); | ||
} | ||
@@ -108,3 +112,3 @@ }, { | ||
value: function componentWillUnmount() { | ||
window.removeEventListener('scroll', this.handleScroll); // eslint-disable-line no-undef | ||
_windowOrGlobal2.default.removeEventListener('scroll', this.handleScroll); | ||
} | ||
@@ -111,0 +115,0 @@ }, { |
@@ -23,2 +23,6 @@ 'use strict'; | ||
var _windowOrGlobal = require('window-or-global'); | ||
var _windowOrGlobal2 = _interopRequireDefault(_windowOrGlobal); | ||
var _InteriorLeftNavList = require('./InteriorLeftNavList'); | ||
@@ -45,3 +49,2 @@ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
/* global window */ | ||
@@ -63,3 +66,3 @@ var InteriorLeftNav = function (_Component) { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = InteriorLeftNav.__proto__ || Object.getPrototypeOf(InteriorLeftNav)).call.apply(_ref, [this].concat(args))), _this), _this.state = { | ||
activeHref: _this.props.activeHref || window.location.pathname, | ||
activeHref: _this.props.activeHref || _windowOrGlobal2.default.location && _windowOrGlobal2.default.location.pathname, | ||
open: true | ||
@@ -66,0 +69,0 @@ }, _this.componentWillReceiveProps = function (nextProps) { |
@@ -51,4 +51,4 @@ 'use strict'; | ||
return child; // eslint-disable-line | ||
} // eslint-disable-line | ||
) : childArray.map(function (child, index) { | ||
}) // eslint-disable-line | ||
: childArray.map(function (child, index) { | ||
if (index % 2 === 0) { | ||
@@ -55,0 +55,0 @@ // eslint-disable-line |
@@ -21,2 +21,6 @@ 'use strict'; | ||
var _windowOrGlobal = require('window-or-global'); | ||
var _windowOrGlobal2 = _interopRequireDefault(_windowOrGlobal); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -54,3 +58,3 @@ | ||
var scroll = window.scrollY; // eslint-disable-line no-undef | ||
var scroll = _windowOrGlobal2.default.scrollY || 0; | ||
@@ -57,0 +61,0 @@ var _this$props$menuPosit = _this.props.menuPosition, |
@@ -6,4 +6,9 @@ 'use strict'; | ||
}); | ||
// mdn resize function | ||
var _windowOrGlobal = require('window-or-global'); | ||
var _windowOrGlobal2 = _interopRequireDefault(_windowOrGlobal); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var OptimizedResize = function optimizedResize() { | ||
@@ -26,3 +31,3 @@ var callbacks = []; | ||
running = true; | ||
window.requestAnimationFrame(runCallbacks); // eslint-disable-line no-undef | ||
_windowOrGlobal2.default.requestAnimationFrame(runCallbacks); | ||
} | ||
@@ -45,3 +50,3 @@ } | ||
if (!callbacks.length) { | ||
window.addEventListener('resize', resize); // eslint-disable-line no-undef | ||
_windowOrGlobal2.default.addEventListener('resize', resize); | ||
} | ||
@@ -59,4 +64,3 @@ addCallback(callback); | ||
}; | ||
}(); | ||
}(); // mdn resize function | ||
exports.default = OptimizedResize; |
@@ -17,2 +17,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import debounce from 'lodash.debounce'; | ||
import window from 'window-or-global'; | ||
@@ -41,3 +42,3 @@ var DetailPageHeader = function (_Component) { | ||
var currentPosition = window.pageYOffset; // eslint-disable-line no-undef | ||
var currentPosition = window.pageYOffset || 0; | ||
@@ -72,3 +73,3 @@ if (currentPosition > 86) { | ||
var debouncedScroll = debounce(this.handleScroll, 25); | ||
window.addEventListener('scroll', debouncedScroll); // eslint-disable-line no-undef | ||
window.addEventListener('scroll', debouncedScroll); | ||
} | ||
@@ -89,3 +90,3 @@ }, { | ||
value: function componentWillUnmount() { | ||
window.removeEventListener('scroll', this.handleScroll); // eslint-disable-line no-undef | ||
window.removeEventListener('scroll', this.handleScroll); | ||
} | ||
@@ -92,0 +93,0 @@ }, { |
@@ -14,6 +14,6 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import PropTypes from 'prop-types'; | ||
/* global window */ | ||
import React, { Component } from 'react'; | ||
import classnames from 'classnames'; | ||
import window from 'window-or-global'; | ||
import InteriorLeftNavList from './InteriorLeftNavList'; | ||
@@ -38,3 +38,3 @@ import InteriorLeftNavItem from './InteriorLeftNavItem'; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = InteriorLeftNav.__proto__ || Object.getPrototypeOf(InteriorLeftNav)).call.apply(_ref, [this].concat(args))), _this), _this.state = { | ||
activeHref: _this.props.activeHref || window.location.pathname, | ||
activeHref: _this.props.activeHref || window.location && window.location.pathname, | ||
open: true | ||
@@ -41,0 +41,0 @@ }, _this.componentWillReceiveProps = function (nextProps) { |
@@ -35,4 +35,4 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
return child; // eslint-disable-line | ||
} // eslint-disable-line | ||
) : childArray.map(function (child, index) { | ||
}) // eslint-disable-line | ||
: childArray.map(function (child, index) { | ||
if (index % 2 === 0) { | ||
@@ -39,0 +39,0 @@ // eslint-disable-line |
@@ -12,2 +12,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
import ReactDOM from 'react-dom'; | ||
import window from 'window-or-global'; | ||
@@ -38,3 +39,3 @@ var FloatingMenu = function (_React$Component) { | ||
var scroll = window.scrollY; // eslint-disable-line no-undef | ||
var scroll = window.scrollY || 0; | ||
@@ -41,0 +42,0 @@ var _this$props$menuPosit = _this.props.menuPosition, |
// mdn resize function | ||
import window from 'window-or-global'; | ||
@@ -20,3 +21,3 @@ var OptimizedResize = function optimizedResize() { | ||
running = true; | ||
window.requestAnimationFrame(runCallbacks); // eslint-disable-line no-undef | ||
window.requestAnimationFrame(runCallbacks); | ||
} | ||
@@ -39,3 +40,3 @@ } | ||
if (!callbacks.length) { | ||
window.addEventListener('resize', resize); // eslint-disable-line no-undef | ||
window.addEventListener('resize', resize); | ||
} | ||
@@ -42,0 +43,0 @@ addCallback(callback); |
@@ -91,2 +91,3 @@ { | ||
"lodash.debounce": "^4.0.8", | ||
"window-or-global": "^1.0.1", | ||
"react-addons-css-transition-group": "^15.4.2", | ||
@@ -96,3 +97,2 @@ "warning": "3.0.0" | ||
"devDependencies": { | ||
"@kadira/react-storybook-addon-info": "3.2.1", | ||
"@storybook/addon-centered": "3.0.0", | ||
@@ -173,3 +173,3 @@ "@storybook/addon-info": "^3.0.0", | ||
}, | ||
"version": "3.1.2" | ||
"version": "3.1.3" | ||
} |
544134
36
11774
9
+ Addedwindow-or-global@^1.0.1
+ Addedwindow-or-global@1.0.1(transitive)