@trendmicro/react-navs
Advanced tools
Comparing version 0.8.3 to 0.8.4
532
lib/index.js
@@ -1,2 +0,2 @@ | ||
/*! react-navs v0.8.3 | (c) 2017 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-navs */ | ||
/*! react-navs v0.8.4 | (c) 2017 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-navs */ | ||
module.exports = | ||
@@ -68,3 +68,3 @@ /******/ (function(modules) { // webpackBootstrap | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 11); | ||
/******/ return __webpack_require__(__webpack_require__.s = 10); | ||
/******/ }) | ||
@@ -101,3 +101,3 @@ /************************************************************************/ | ||
module.exports = require("react-addons-shallow-compare"); | ||
module.exports = require("@trendmicro/react-dropdown"); | ||
@@ -108,3 +108,3 @@ /***/ }), | ||
module.exports = require("@trendmicro/react-dropdown"); | ||
module.exports = require("@trendmicro/react-anchor"); | ||
@@ -115,12 +115,6 @@ /***/ }), | ||
module.exports = require("@trendmicro/react-anchor"); | ||
module.exports = require("chained-function"); | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, exports) { | ||
module.exports = require("chained-function"); | ||
/***/ }), | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -131,13 +125,9 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
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; }; | ||
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; }; }(); | ||
var _class, _temp; | ||
var _chainedFunction = __webpack_require__(7); | ||
var _chainedFunction = __webpack_require__(6); | ||
@@ -158,6 +148,2 @@ var _chainedFunction2 = _interopRequireDefault(_chainedFunction); | ||
var _reactAddonsShallowCompare = __webpack_require__(4); | ||
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare); | ||
var _index = __webpack_require__(0); | ||
@@ -169,4 +155,2 @@ | ||
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; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
@@ -180,4 +164,4 @@ | ||
var Nav = (_temp = _class = function (_Component) { | ||
_inherits(Nav, _Component); | ||
var Nav = (_temp = _class = function (_PureComponent) { | ||
_inherits(Nav, _PureComponent); | ||
@@ -187,74 +171,65 @@ function Nav() { | ||
return _possibleConstructorReturn(this, (Nav.__proto__ || Object.getPrototypeOf(Nav)).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _PureComponent.apply(this, arguments)); | ||
} | ||
_createClass(Nav, [{ | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return (0, _reactAddonsShallowCompare2.default)(this, nextProps, nextState); | ||
} | ||
}, { | ||
key: 'isActive', | ||
value: function isActive(_ref, activeKey, activeHref) { | ||
var props = _ref.props; | ||
Nav.prototype.isActive = function isActive(_ref, activeKey, activeHref) { | ||
var props = _ref.props; | ||
if (props.active) { | ||
return true; | ||
} | ||
if (activeKey !== undefined && activeKey !== null && props.eventKey === activeKey) { | ||
return true; | ||
} | ||
if (activeHref && props.href === activeHref) { | ||
return true; | ||
} | ||
return false; | ||
if (props.active) { | ||
return true; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var _classes, | ||
_this2 = this; | ||
if (activeKey !== undefined && activeKey !== null && props.eventKey === activeKey) { | ||
return true; | ||
} | ||
if (activeHref && props.href === activeHref) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
var _props = this.props, | ||
navStyle = _props.navStyle, | ||
justified = _props.justified, | ||
stacked = _props.stacked, | ||
onSelect = _props.onSelect, | ||
role = _props.role, | ||
className = _props.className, | ||
children = _props.children, | ||
activeKey = _props.activeKey, | ||
activeHref = _props.activeHref, | ||
props = _objectWithoutProperties(_props, ['navStyle', 'justified', 'stacked', 'onSelect', 'role', 'className', 'children', 'activeKey', 'activeHref']); | ||
Nav.prototype.render = function render() { | ||
var _classes, | ||
_this2 = this; | ||
var navbar = this.context.$tm_navbar; | ||
var classes = (_classes = {}, _defineProperty(_classes, _index2.default.nav, true), _defineProperty(_classes, _index2.default.navbarNav, navbar && navStyle === 'navbar'), _defineProperty(_classes, _index2.default.navbarDefault, navbar && navbar.navbarStyle === 'default'), _defineProperty(_classes, _index2.default.navTabs, navStyle === 'tabs'), _defineProperty(_classes, _index2.default.navLightTabs, navStyle === 'light-tabs'), _defineProperty(_classes, _index2.default.navPanelTabs, navStyle === 'panel-tabs'), _defineProperty(_classes, _index2.default.navJustified, justified || navStyle === 'panel-tabs'), _defineProperty(_classes, _index2.default.navStacked, stacked), _classes); | ||
var _props = this.props, | ||
navStyle = _props.navStyle, | ||
justified = _props.justified, | ||
stacked = _props.stacked, | ||
onSelect = _props.onSelect, | ||
role = _props.role, | ||
className = _props.className, | ||
children = _props.children, | ||
activeKey = _props.activeKey, | ||
activeHref = _props.activeHref, | ||
props = _objectWithoutProperties(_props, ['navStyle', 'justified', 'stacked', 'onSelect', 'role', 'className', 'children', 'activeKey', 'activeHref']); | ||
return _react2.default.createElement( | ||
'ul', | ||
_extends({}, props, { | ||
role: role, | ||
className: (0, _classnames2.default)(className, classes) | ||
}), | ||
_react2.default.Children.map(children, function (child) { | ||
if (!_react2.default.isValidElement(child)) { | ||
return child; | ||
} | ||
var navbar = this.context.$tm_navbar; | ||
var classes = (_classes = {}, _classes[_index2.default.nav] = true, _classes[_index2.default.navbarNav] = navbar && navStyle === 'navbar', _classes[_index2.default.navbarDefault] = navbar && navbar.navbarStyle === 'default', _classes[_index2.default.navTabs] = navStyle === 'tabs', _classes[_index2.default.navLightTabs] = navStyle === 'light-tabs', _classes[_index2.default.navPanelTabs] = navStyle === 'panel-tabs', _classes[_index2.default.navJustified] = justified || navStyle === 'panel-tabs', _classes[_index2.default.navStacked] = stacked, _classes); | ||
var active = _this2.isActive(child, activeKey, activeHref); | ||
var childOnSelect = (0, _chainedFunction2.default)(child.props.onSelect, onSelect, navbar && navbar.onSelect); | ||
return _react2.default.createElement( | ||
'ul', | ||
_extends({}, props, { | ||
role: role, | ||
className: (0, _classnames2.default)(className, classes) | ||
}), | ||
_react2.default.Children.map(children, function (child) { | ||
if (!_react2.default.isValidElement(child)) { | ||
return child; | ||
} | ||
return (0, _react.cloneElement)(child, { | ||
active: active, | ||
activeKey: activeKey, | ||
activeHref: activeHref, | ||
onSelect: childOnSelect | ||
}); | ||
}) | ||
); | ||
} | ||
}]); | ||
var active = _this2.isActive(child, activeKey, activeHref); | ||
var childOnSelect = (0, _chainedFunction2.default)(child.props.onSelect, onSelect, navbar && navbar.onSelect); | ||
return (0, _react.cloneElement)(child, { | ||
active: active, | ||
activeKey: activeKey, | ||
activeHref: activeHref, | ||
onSelect: childOnSelect | ||
}); | ||
}) | ||
); | ||
}; | ||
return Nav; | ||
}(_react.Component), _class.propTypes = { | ||
}(_react.PureComponent), _class.propTypes = { | ||
// Marks the child NavItem with a matching `href` prop as active. | ||
@@ -293,3 +268,3 @@ activeHref: _propTypes2.default.string, | ||
/***/ }), | ||
/* 9 */ | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -300,17 +275,19 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
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; }; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
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; }; }(); | ||
var _class, _temp2; /* eslint no-continue: 0 */ | ||
var _reactAnchor = __webpack_require__(5); | ||
var _reactAnchor2 = _interopRequireDefault(_reactAnchor); | ||
var _reactDropdown = __webpack_require__(4); | ||
var _reactDropdown2 = _interopRequireDefault(_reactDropdown); | ||
var _classnames = __webpack_require__(1); | ||
@@ -328,18 +305,2 @@ | ||
var _reactAddonsShallowCompare = __webpack_require__(4); | ||
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare); | ||
var _reactAnchor = __webpack_require__(6); | ||
var _reactAnchor2 = _interopRequireDefault(_reactAnchor); | ||
var _reactDropdown = __webpack_require__(5); | ||
var _reactDropdown2 = _interopRequireDefault(_reactDropdown); | ||
var _splitComponentProps3 = __webpack_require__(12); | ||
var _splitComponentProps4 = _interopRequireDefault(_splitComponentProps3); | ||
var _index = __webpack_require__(0); | ||
@@ -351,4 +312,2 @@ | ||
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; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
@@ -362,8 +321,6 @@ | ||
var NavDropdown = (_temp2 = _class = function (_Component) { | ||
_inherits(NavDropdown, _Component); | ||
var NavDropdown = (_temp2 = _class = function (_PureComponent) { | ||
_inherits(NavDropdown, _PureComponent); | ||
function NavDropdown() { | ||
var _ref; | ||
var _temp, _this, _ret; | ||
@@ -377,3 +334,3 @@ | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = NavDropdown.__proto__ || Object.getPrototypeOf(NavDropdown)).call.apply(_ref, [this].concat(args))), _this), _this.actions = { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _PureComponent.call.apply(_PureComponent, [this].concat(args))), _this), _this.actions = { | ||
handleClick: function handleClick(event) { | ||
@@ -391,125 +348,116 @@ if (_this.props.onSelect) { | ||
_createClass(NavDropdown, [{ | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return (0, _reactAddonsShallowCompare2.default)(this, nextProps, nextState); | ||
NavDropdown.prototype.isActive = function isActive(_ref, activeKey, activeHref) { | ||
var props = _ref.props; | ||
if (props.active) { | ||
return true; | ||
} | ||
}, { | ||
key: 'isActive', | ||
value: function isActive(_ref2, activeKey, activeHref) { | ||
var props = _ref2.props; | ||
if (props.active) { | ||
return true; | ||
} | ||
if (activeKey !== undefined && props.eventKey === activeKey) { | ||
return true; | ||
} | ||
if (activeKey !== undefined && props.eventKey === activeKey) { | ||
return true; | ||
} | ||
if (activeHref && props.href === activeHref) { | ||
return true; | ||
} | ||
if (activeHref && props.href === activeHref) { | ||
return true; | ||
} | ||
if (_typeof(props.children) !== 'object') { | ||
return false; | ||
} | ||
if (_typeof(props.children) !== 'object') { | ||
return false; | ||
for (var _iterator = props.children, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref2 = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref2 = _i.value; | ||
} | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var child = _ref2; | ||
try { | ||
for (var _iterator = props.children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var child = _step.value; | ||
if (!_react2.default.isValidElement(child)) { | ||
continue; | ||
} | ||
if (!_react2.default.isValidElement(child)) { | ||
continue; | ||
} | ||
if (this.isActive(child, activeKey, activeHref)) { | ||
return true; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
if (this.isActive(child, activeKey, activeHref)) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var _this2 = this; | ||
var _props = this.props, | ||
title = _props.title, | ||
noCaret = _props.noCaret, | ||
activeKey = _props.activeKey, | ||
activeHref = _props.activeHref, | ||
className = _props.className, | ||
style = _props.style, | ||
children = _props.children, | ||
props = _objectWithoutProperties(_props, ['title', 'noCaret', 'activeKey', 'activeHref', 'className', 'style', 'children']); | ||
return false; | ||
}; | ||
var useCaret = !noCaret; | ||
NavDropdown.prototype.render = function render() { | ||
var _this2 = this, | ||
_classNames, | ||
_classNames2; | ||
var active = this.isActive(this, activeKey, activeHref); | ||
delete props.active; | ||
delete props.eventKey; | ||
var _props = this.props, | ||
title = _props.title, | ||
noCaret = _props.noCaret, | ||
activeKey = _props.activeKey, | ||
activeHref = _props.activeHref, | ||
className = _props.className, | ||
style = _props.style, | ||
children = _props.children, | ||
props = _objectWithoutProperties(_props, ['title', 'noCaret', 'activeKey', 'activeHref', 'className', 'style', 'children']); | ||
var _splitComponentProps = (0, _splitComponentProps4.default)(props, _reactDropdown2.default.ControlledComponent), | ||
_splitComponentProps2 = _slicedToArray(_splitComponentProps, 2), | ||
dropdownProps = _splitComponentProps2[0], | ||
toggleProps = _splitComponentProps2[1]; | ||
var useCaret = !noCaret; | ||
toggleProps.componentClass = _reactAnchor2.default; | ||
var active = this.isActive(this, activeKey, activeHref); | ||
delete props.active; | ||
delete props.eventKey; | ||
var dropdownMenuItems = _react2.default.Children.map(children, function (child) { | ||
if (!_react2.default.isValidElement(child)) { | ||
return child; | ||
} | ||
// Split component props | ||
var dropdownProps = {}; | ||
var toggleProps = {}; | ||
Object.keys(props).forEach(function (propName) { | ||
var propValue = props[propName]; | ||
if (_reactDropdown2.default.ControlledComponent.propTypes[propName]) { | ||
dropdownProps[propName] = propValue; | ||
} else { | ||
toggleProps[propName] = propValue; | ||
} | ||
}); | ||
toggleProps.componentClass = _reactAnchor2.default; | ||
return _react2.default.cloneElement(child, { | ||
active: _this2.isActive(child, activeKey, activeHref) | ||
}); | ||
var dropdownMenuItems = _react2.default.Children.map(children, function (child) { | ||
if (!_react2.default.isValidElement(child)) { | ||
return child; | ||
} | ||
return _react2.default.cloneElement(child, { | ||
active: _this2.isActive(child, activeKey, activeHref) | ||
}); | ||
}); | ||
return _react2.default.createElement( | ||
_reactDropdown2.default, | ||
_extends({}, dropdownProps, { | ||
componentClass: 'li', | ||
className: (0, _classnames2.default)(className, _defineProperty({}, _index2.default.active, active)), | ||
style: style | ||
}), | ||
_react2.default.createElement( | ||
_reactDropdown2.default.Toggle, | ||
_extends({ noCaret: true }, toggleProps), | ||
title, | ||
useCaret && _react2.default.createElement('span', { | ||
className: (0, _classnames2.default)(_index2.default.caret, _defineProperty({}, _index2.default.dropup, dropdownProps.dropup)) | ||
}) | ||
), | ||
_react2.default.createElement( | ||
_reactDropdown2.default.Menu, | ||
null, | ||
dropdownMenuItems | ||
) | ||
); | ||
} | ||
}]); | ||
return _react2.default.createElement( | ||
_reactDropdown2.default, | ||
_extends({}, dropdownProps, { | ||
componentClass: 'li', | ||
className: (0, _classnames2.default)(className, (_classNames = {}, _classNames[_index2.default.active] = active, _classNames)), | ||
style: style | ||
}), | ||
_react2.default.createElement( | ||
_reactDropdown2.default.Toggle, | ||
_extends({ noCaret: true }, toggleProps), | ||
title, | ||
useCaret && _react2.default.createElement('span', { | ||
className: (0, _classnames2.default)(_index2.default.caret, (_classNames2 = {}, _classNames2[_index2.default.dropup] = dropdownProps.dropup, _classNames2)) | ||
}) | ||
), | ||
_react2.default.createElement( | ||
_reactDropdown2.default.Menu, | ||
null, | ||
dropdownMenuItems | ||
) | ||
); | ||
}; | ||
return NavDropdown; | ||
}(_react.Component), _class.propTypes = _extends({}, _reactDropdown2.default.propTypes, { | ||
}(_react.PureComponent), _class.propTypes = _extends({}, _reactDropdown2.default.propTypes, { | ||
@@ -530,3 +478,3 @@ // Highlight the nav dropdown as active. | ||
/***/ }), | ||
/* 10 */ | ||
/* 9 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -537,14 +485,14 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
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; }; | ||
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; }; }(); | ||
var _class, _temp2; | ||
var _chainedFunction = __webpack_require__(7); | ||
var _reactAnchor = __webpack_require__(5); | ||
var _reactAnchor2 = _interopRequireDefault(_reactAnchor); | ||
var _chainedFunction = __webpack_require__(6); | ||
var _chainedFunction2 = _interopRequireDefault(_chainedFunction); | ||
@@ -564,10 +512,2 @@ | ||
var _reactAddonsShallowCompare = __webpack_require__(4); | ||
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare); | ||
var _reactAnchor = __webpack_require__(6); | ||
var _reactAnchor2 = _interopRequireDefault(_reactAnchor); | ||
var _index = __webpack_require__(0); | ||
@@ -579,4 +519,2 @@ | ||
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; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
@@ -590,8 +528,6 @@ | ||
var NavItem = (_temp2 = _class = function (_Component) { | ||
_inherits(NavItem, _Component); | ||
var NavItem = (_temp2 = _class = function (_PureComponent) { | ||
_inherits(NavItem, _PureComponent); | ||
function NavItem() { | ||
var _ref; | ||
var _temp, _this, _ret; | ||
@@ -605,3 +541,3 @@ | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = NavItem.__proto__ || Object.getPrototypeOf(NavItem)).call.apply(_ref, [this].concat(args))), _this), _this.actions = { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _PureComponent.call.apply(_PureComponent, [this].concat(args))), _this), _this.actions = { | ||
handleClick: function handleClick(event) { | ||
@@ -619,46 +555,40 @@ if (_this.props.onSelect) { | ||
_createClass(NavItem, [{ | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return (0, _reactAddonsShallowCompare2.default)(this, nextProps, nextState); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props, | ||
active = _props.active, | ||
disabled = _props.disabled, | ||
onClick = _props.onClick, | ||
className = _props.className, | ||
style = _props.style, | ||
props = _objectWithoutProperties(_props, ['active', 'disabled', 'onClick', 'className', 'style']); | ||
NavItem.prototype.render = function render() { | ||
var _classNames, _classNames2; | ||
delete props.onSelect; | ||
delete props.eventKey; | ||
var _props = this.props, | ||
active = _props.active, | ||
disabled = _props.disabled, | ||
onClick = _props.onClick, | ||
className = _props.className, | ||
style = _props.style, | ||
props = _objectWithoutProperties(_props, ['active', 'disabled', 'onClick', 'className', 'style']); | ||
// Injected down by <Nav> | ||
delete props.activeKey; | ||
delete props.activeHref; | ||
delete props.onSelect; | ||
delete props.eventKey; | ||
if (props.role === 'tab') { | ||
props['aria-selected'] = active; | ||
} | ||
// Injected down by <Nav> | ||
delete props.activeKey; | ||
delete props.activeHref; | ||
return _react2.default.createElement( | ||
'li', | ||
{ | ||
role: 'presentation', | ||
className: (0, _classnames2.default)(className, _defineProperty({}, _index2.default.active, active), _defineProperty({}, _index2.default.disabled, disabled)), | ||
style: style | ||
}, | ||
_react2.default.createElement(_reactAnchor2.default, _extends({}, props, { | ||
disabled: disabled, | ||
onClick: (0, _chainedFunction2.default)(onClick, this.actions.handleClick) | ||
})) | ||
); | ||
if (props.role === 'tab') { | ||
props['aria-selected'] = active; | ||
} | ||
}]); | ||
return _react2.default.createElement( | ||
'li', | ||
{ | ||
role: 'presentation', | ||
className: (0, _classnames2.default)(className, (_classNames = {}, _classNames[_index2.default.active] = active, _classNames), (_classNames2 = {}, _classNames2[_index2.default.disabled] = disabled, _classNames2)), | ||
style: style | ||
}, | ||
_react2.default.createElement(_reactAnchor2.default, _extends({}, props, { | ||
disabled: disabled, | ||
onClick: (0, _chainedFunction2.default)(onClick, this.actions.handleClick) | ||
})) | ||
); | ||
}; | ||
return NavItem; | ||
}(_react.Component), _class.propTypes = { | ||
}(_react.PureComponent), _class.propTypes = { | ||
// Highlight the nav item as active. | ||
@@ -691,3 +621,3 @@ active: _propTypes2.default.bool, | ||
/***/ }), | ||
/* 11 */ | ||
/* 10 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -698,8 +628,6 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.NavDropdown = exports.NavItem = exports.Nav = exports.MenuItem = undefined; | ||
var _reactDropdown = __webpack_require__(5); | ||
var _reactDropdown = __webpack_require__(4); | ||
@@ -713,11 +641,11 @@ Object.defineProperty(exports, 'MenuItem', { | ||
var _Nav2 = __webpack_require__(8); | ||
var _Nav2 = __webpack_require__(7); | ||
var _Nav3 = _interopRequireDefault(_Nav2); | ||
var _NavItem2 = __webpack_require__(10); | ||
var _NavItem2 = __webpack_require__(9); | ||
var _NavItem3 = _interopRequireDefault(_NavItem2); | ||
var _NavDropdown2 = __webpack_require__(9); | ||
var _NavDropdown2 = __webpack_require__(8); | ||
@@ -732,38 +660,4 @@ var _NavDropdown3 = _interopRequireDefault(_NavDropdown2); | ||
/***/ }), | ||
/* 12 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
exports.default = splitComponentProps; | ||
function splitComponentProps(props, Component) { | ||
var componentPropTypes = Component.propTypes; | ||
var parentProps = {}; | ||
var childProps = {}; | ||
Object.entries(props).forEach(function (_ref) { | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
propName = _ref2[0], | ||
propValue = _ref2[1]; | ||
if (componentPropTypes[propName]) { | ||
parentProps[propName] = propValue; | ||
} else { | ||
childProps[propName] = propValue; | ||
} | ||
}); | ||
return [parentProps, childProps]; | ||
} | ||
/***/ }) | ||
/******/ ]); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@trendmicro/react-navs", | ||
"version": "0.8.3", | ||
"version": "0.8.4", | ||
"description": "Trend Micro Components: React Navs", | ||
@@ -50,21 +50,20 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@trendmicro/react-anchor": "^0.5.4", | ||
"@trendmicro/react-dropdown": "^0.6.9", | ||
"@trendmicro/react-anchor": "^0.5.5", | ||
"@trendmicro/react-dropdown": "^0.6.11", | ||
"chained-function": "^0.5.0", | ||
"classnames": "^2.2.5", | ||
"prop-types": "^15.5.8", | ||
"react-addons-shallow-compare": "^0.14.0 || ^15.0.0" | ||
"prop-types": "^15.5.8" | ||
}, | ||
"devDependencies": { | ||
"@trendmicro/react-buttons": "~1.0.3", | ||
"babel-cli": "~6.24.0", | ||
"babel-core": "~6.24.0", | ||
"babel-eslint": "~7.2.1", | ||
"@trendmicro/react-buttons": "~1.0.4", | ||
"babel-cli": "~6.24.1", | ||
"babel-core": "~6.24.1", | ||
"babel-eslint": "~7.2.2", | ||
"babel-loader": "~6.4.1", | ||
"babel-plugin-transform-decorators-legacy": "~1.3.4", | ||
"babel-preset-es2015": "~6.24.0", | ||
"babel-preset-es2015": "~6.24.1", | ||
"babel-preset-react": "~6.24.1", | ||
"babel-preset-stage-0": "~6.24.1", | ||
"clean-css": "~4.0.10", | ||
"clean-css-cli": "~4.0.10", | ||
"clean-css": "~4.0.12", | ||
"clean-css-cli": "~4.0.12", | ||
"coveralls": "~2.13.0", | ||
@@ -74,3 +73,3 @@ "css-loader": "~0.28.0", | ||
"eslint-config-trendmicro": "~0.5.1", | ||
"eslint-loader": "~1.7.0", | ||
"eslint-loader": "~1.7.1", | ||
"eslint-plugin-import": "~2.2.0", | ||
@@ -88,7 +87,7 @@ "eslint-plugin-jsx-a11y": "~2.2.3", | ||
"react-dom": "^0.14.0 || ^15.0.0", | ||
"style-loader": "~0.16.0", | ||
"style-loader": "~0.16.1", | ||
"stylint": "~1.5.9", | ||
"stylint-loader": "~1.0.0", | ||
"stylus-loader": "~3.0.1", | ||
"tap": "~10.3.0", | ||
"tap": "~10.3.2", | ||
"trendmicro-ui": "~0.4.0", | ||
@@ -95,0 +94,0 @@ "url-loader": "~0.5.8", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
74258
759
- Removedreact-addons-shallow-compare@15.6.3(transitive)