react-tabs
Advanced tools
Comparing version 0.6.1 to 0.6.2
@@ -62,38 +62,19 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
}); | ||
exports.TabPanel = exports.Tab = exports.TabList = exports.Tabs = undefined; | ||
var _Tabs = __webpack_require__(1); | ||
Object.defineProperty(exports, 'Tabs', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_Tabs).default; | ||
} | ||
}); | ||
var _Tabs2 = _interopRequireDefault(_Tabs); | ||
var _TabList = __webpack_require__(9); | ||
Object.defineProperty(exports, 'TabList', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_TabList).default; | ||
} | ||
}); | ||
var _TabList2 = _interopRequireDefault(_TabList); | ||
var _Tab = __webpack_require__(8); | ||
Object.defineProperty(exports, 'Tab', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_Tab).default; | ||
} | ||
}); | ||
var _Tab2 = _interopRequireDefault(_Tab); | ||
var _TabPanel = __webpack_require__(11); | ||
Object.defineProperty(exports, 'TabPanel', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_TabPanel).default; | ||
} | ||
}); | ||
var _TabPanel2 = _interopRequireDefault(_TabPanel); | ||
@@ -103,2 +84,16 @@ function _interopRequireDefault(obj) { | ||
} | ||
exports.Tabs = | ||
// For bc we also export a default object, remove in 1.0 | ||
_Tabs2.default; | ||
exports.TabList = _TabList2.default; | ||
exports.Tab = _Tab2.default; | ||
exports.TabPanel = _TabPanel2.default; | ||
exports.default = { | ||
Tabs: _Tabs2.default, | ||
TabList: _TabList2.default, | ||
Tab: _Tab2.default, | ||
TabPanel: _TabPanel2.default | ||
}; | ||
@@ -195,3 +190,3 @@ /***/ }, | ||
getInitialState: function getInitialState() { | ||
return this.copyPropsToState(this.props); | ||
return this.copyPropsToState(this.props, this.state); | ||
}, | ||
@@ -209,3 +204,10 @@ getChildContext: function getChildContext() { | ||
componentWillReceiveProps: function componentWillReceiveProps(newProps) { | ||
this.setState(this.copyPropsToState(newProps)); | ||
var _this = this; | ||
// Use a transactional update to prevent race conditions | ||
// when reading the state in copyPropsToState | ||
// See https://github.com/reactjs/react-tabs/issues/51 | ||
this.setState(function (state) { | ||
return _this.copyPropsToState(newProps, state); | ||
}); | ||
}, | ||
@@ -221,9 +223,14 @@ setSelected: function setSelected(index, focus) { | ||
// Update selected index | ||
this.setState({ selectedIndex: index, focus: focus === true }); | ||
// Check if the change event handler cancels the tab change | ||
var cancel = false; | ||
// Call change event handler | ||
if (typeof this.props.onSelect === 'function') { | ||
this.props.onSelect(index, last); | ||
cancel = this.props.onSelect(index, last) === false; | ||
} | ||
if (!cancel) { | ||
// Update selected index | ||
this.setState({ selectedIndex: index, focus: focus === true }); | ||
} | ||
}, | ||
@@ -412,3 +419,3 @@ getNextTab: function getNextTab(index) { | ||
// This is an anti-pattern, so sue me | ||
copyPropsToState: function copyPropsToState(props) { | ||
copyPropsToState: function copyPropsToState(props, state) { | ||
var selectedIndex = props.selectedIndex; | ||
@@ -425,4 +432,4 @@ | ||
if (selectedIndex === -1) { | ||
if (this.state && this.state.selectedIndex) { | ||
selectedIndex = this.state.selectedIndex; | ||
if (state && state.selectedIndex) { | ||
selectedIndex = state.selectedIndex; | ||
} else { | ||
@@ -462,3 +469,3 @@ selectedIndex = 0; | ||
render: function render() { | ||
var _this = this; | ||
var _this2 = this; | ||
@@ -480,3 +487,3 @@ // This fixes an issue with focus management. | ||
setTimeout(function () { | ||
_this.state.focus = false; | ||
_this2.state.focus = false; | ||
}, 0); | ||
@@ -731,15 +738,2 @@ } | ||
function syncNodeAttributes(node, props) { | ||
if (props.selected) { | ||
node.setAttribute('tabindex', '0'); | ||
node.setAttribute('selected', 'selected'); | ||
if (props.focus) { | ||
node.focus(); | ||
} | ||
} else { | ||
node.removeAttribute('tabindex'); | ||
node.removeAttribute('selected'); | ||
} | ||
} | ||
module.exports = _react2.default.createClass({ | ||
@@ -751,2 +745,3 @@ displayName: 'Tab', | ||
id: _react.PropTypes.string, | ||
focus: _react.PropTypes.bool, | ||
selected: _react.PropTypes.bool, | ||
@@ -767,7 +762,12 @@ disabled: _react.PropTypes.bool, | ||
componentDidMount: function componentDidMount() { | ||
syncNodeAttributes((0, _reactDom.findDOMNode)(this), this.props); | ||
this.checkFocus(); | ||
}, | ||
componentDidUpdate: function componentDidUpdate() { | ||
syncNodeAttributes((0, _reactDom.findDOMNode)(this), this.props); | ||
this.checkFocus(); | ||
}, | ||
checkFocus: function checkFocus() { | ||
if (this.props.selected && this.props.focus) { | ||
(0, _reactDom.findDOMNode)(this).focus(); | ||
} | ||
}, | ||
render: function render() { | ||
@@ -794,3 +794,4 @@ var _props = this.props; | ||
'aria-disabled': disabled ? 'true' : 'false', | ||
'aria-controls': panelId | ||
'aria-controls': panelId, | ||
tabIndex: selected ? '0' : null | ||
}), children); | ||
@@ -797,0 +798,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports.ReactTabs=t(require("React"),require("ReactDOM")):e.ReactTabs=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=r(1);Object.defineProperty(t,"Tabs",{enumerable:!0,get:function(){return n(a)["default"]}});var o=r(9);Object.defineProperty(t,"TabList",{enumerable:!0,get:function(){return n(o)["default"]}});var s=r(8);Object.defineProperty(t,"Tab",{enumerable:!0,get:function(){return n(s)["default"]}});var i=r(11);Object.defineProperty(t,"TabPanel",{enumerable:!0,get:function(){return n(i)["default"]}})},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function o(e){return"LI"===e.nodeName&&"tab"===e.getAttribute("role")}function s(e){return"true"===e.getAttribute("aria-disabled")}var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r(2),c=n(l),u=r(3),d=r(4),p=n(d),f=r(5),b=n(f),h=r(6),y=n(h),T=r(7),v=n(T),x=!0;e.exports=c["default"].createClass({displayName:"Tabs",propTypes:{className:l.PropTypes.string,selectedIndex:l.PropTypes.number,onSelect:l.PropTypes.func,focus:l.PropTypes.bool,children:v["default"],forceRenderTabPanel:l.PropTypes.bool},childContextTypes:{forceRenderTabPanel:l.PropTypes.bool},statics:{setUseDefaultStyles:function(e){x=e}},getDefaultProps:function(){return{selectedIndex:-1,focus:!1,forceRenderTabPanel:!1}},getInitialState:function(){return this.copyPropsToState(this.props)},getChildContext:function(){return{forceRenderTabPanel:this.props.forceRenderTabPanel}},componentDidMount:function(){x&&(0,b["default"])(r(10))},componentWillReceiveProps:function(e){this.setState(this.copyPropsToState(e))},setSelected:function(e,t){if(e!==this.state.selectedIndex&&!(0>e||e>=this.getTabsCount())){var r=this.state.selectedIndex;this.setState({selectedIndex:e,focus:t===!0}),"function"==typeof this.props.onSelect&&this.props.onSelect(e,r)}},getNextTab:function(e){for(var t=this.getTabsCount(),r=e+1;t>r;r++){var n=this.getTab(r);if(!s((0,u.findDOMNode)(n)))return r}for(var a=0;e>a;a++){var o=this.getTab(a);if(!s((0,u.findDOMNode)(o)))return a}return e},getPrevTab:function(e){for(var t=e;t--;){var r=this.getTab(t);if(!s((0,u.findDOMNode)(r)))return t}for(t=this.getTabsCount();t-- >e;){var n=this.getTab(t);if(!s((0,u.findDOMNode)(n)))return t}return e},getTabsCount:function(){return this.props.children&&this.props.children[0]?c["default"].Children.count(this.props.children[0].props.children):0},getPanelsCount:function(){return c["default"].Children.count(this.props.children.slice(1))},getTabList:function(){return this.refs.tablist},getTab:function(e){return this.refs["tabs-"+e]},getPanel:function(e){return this.refs["panels-"+e]},getChildren:function(){for(var e=0,t=0,r=this.props.children,n=this.state,a=this.tabIds=this.tabIds||[],o=this.panelIds=this.panelIds||[],s=this.tabIds.length-this.getTabsCount();s++<0;)a.push((0,y["default"])()),o.push((0,y["default"])());return c["default"].Children.map(r,function(r){if(null===r)return null;var s=null;if(0===t++)s=(0,l.cloneElement)(r,{ref:"tablist",children:c["default"].Children.map(r.props.children,function(t){if(null===t)return null;var r="tabs-"+e,s=a[e],i=o[e],c=n.selectedIndex===e,u=c&&n.focus;return e++,(0,l.cloneElement)(t,{ref:r,id:s,panelId:i,selected:c,focus:u})})}),e=0;else{var i="panels-"+e,u=o[e],d=a[e],p=n.selectedIndex===e;e++,s=(0,l.cloneElement)(r,{ref:i,id:u,tabId:d,selected:p})}return s})},handleKeyDown:function(e){if(this.isTabFromContainer(e.target)){var t=this.state.selectedIndex,r=!1;37===e.keyCode||38===e.keyCode?(t=this.getPrevTab(t),r=!0):39!==e.keyCode&&40!==e.keyCode||(t=this.getNextTab(t),r=!0),r&&e.preventDefault(),this.setSelected(t,!0)}},handleClick:function(e){var t=e.target;do if(this.isTabFromContainer(t)){if(s(t))return;var r=[].slice.call(t.parentNode.children).indexOf(t);return void this.setSelected(r)}while(null!==(t=t.parentNode))},copyPropsToState:function(e){var t=e.selectedIndex;return-1===t&&(t=this.state&&this.state.selectedIndex?this.state.selectedIndex:0),{selectedIndex:t,focus:e.focus}},isTabFromContainer:function(e){if(!o(e))return!1;var t=e.parentElement,r=(0,u.findDOMNode)(this);do{if(t===r)return!0;if(t.getAttribute("data-tabs"))break;t=t.parentElement}while(t);return!1},render:function(){var e=this;this.state.focus&&setTimeout(function(){e.state.focus=!1},0);var t=this.props,r=t.className,n=a(t,["className"]);return delete n.selectedIndex,delete n.onSelect,delete n.focus,delete n.children,delete n.forceRenderTabPanel,delete n.onClick,delete n.onKeyDown,c["default"].createElement("div",i({},n,{className:(0,p["default"])("ReactTabs","react-tabs",r),onClick:this.handleClick,onKeyDown:this.handleKeyDown,"data-tabs":!0}),this.getChildren())}})},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){var n,a;/*! | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports.ReactTabs=t(require("React"),require("ReactDOM")):e.ReactTabs=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.TabPanel=t.Tab=t.TabList=t.Tabs=void 0;var a=r(1),o=n(a),s=r(9),i=n(s),l=r(8),c=n(l),u=r(11),d=n(u);t.Tabs=o["default"],t.TabList=i["default"],t.Tab=c["default"],t.TabPanel=d["default"],t["default"]={Tabs:o["default"],TabList:i["default"],Tab:c["default"],TabPanel:d["default"]}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function o(e){return"LI"===e.nodeName&&"tab"===e.getAttribute("role")}function s(e){return"true"===e.getAttribute("aria-disabled")}var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r(2),c=n(l),u=r(3),d=r(4),p=n(d),f=r(5),b=n(f),h=r(6),T=n(h),y=r(7),v=n(y),x=!0;e.exports=c["default"].createClass({displayName:"Tabs",propTypes:{className:l.PropTypes.string,selectedIndex:l.PropTypes.number,onSelect:l.PropTypes.func,focus:l.PropTypes.bool,children:v["default"],forceRenderTabPanel:l.PropTypes.bool},childContextTypes:{forceRenderTabPanel:l.PropTypes.bool},statics:{setUseDefaultStyles:function(e){x=e}},getDefaultProps:function(){return{selectedIndex:-1,focus:!1,forceRenderTabPanel:!1}},getInitialState:function(){return this.copyPropsToState(this.props,this.state)},getChildContext:function(){return{forceRenderTabPanel:this.props.forceRenderTabPanel}},componentDidMount:function(){x&&(0,b["default"])(r(10))},componentWillReceiveProps:function(e){var t=this;this.setState(function(r){return t.copyPropsToState(e,r)})},setSelected:function(e,t){if(e!==this.state.selectedIndex&&!(e<0||e>=this.getTabsCount())){var r=this.state.selectedIndex,n=!1;"function"==typeof this.props.onSelect&&(n=this.props.onSelect(e,r)===!1),n||this.setState({selectedIndex:e,focus:t===!0})}},getNextTab:function(e){for(var t=this.getTabsCount(),r=e+1;r<t;r++){var n=this.getTab(r);if(!s((0,u.findDOMNode)(n)))return r}for(var a=0;a<e;a++){var o=this.getTab(a);if(!s((0,u.findDOMNode)(o)))return a}return e},getPrevTab:function(e){for(var t=e;t--;){var r=this.getTab(t);if(!s((0,u.findDOMNode)(r)))return t}for(t=this.getTabsCount();t-- >e;){var n=this.getTab(t);if(!s((0,u.findDOMNode)(n)))return t}return e},getTabsCount:function(){return this.props.children&&this.props.children[0]?c["default"].Children.count(this.props.children[0].props.children):0},getPanelsCount:function(){return c["default"].Children.count(this.props.children.slice(1))},getTabList:function(){return this.refs.tablist},getTab:function(e){return this.refs["tabs-"+e]},getPanel:function(e){return this.refs["panels-"+e]},getChildren:function(){for(var e=0,t=0,r=this.props.children,n=this.state,a=this.tabIds=this.tabIds||[],o=this.panelIds=this.panelIds||[],s=this.tabIds.length-this.getTabsCount();s++<0;)a.push((0,T["default"])()),o.push((0,T["default"])());return c["default"].Children.map(r,function(r){if(null===r)return null;var s=null;if(0===t++)s=(0,l.cloneElement)(r,{ref:"tablist",children:c["default"].Children.map(r.props.children,function(t){if(null===t)return null;var r="tabs-"+e,s=a[e],i=o[e],c=n.selectedIndex===e,u=c&&n.focus;return e++,(0,l.cloneElement)(t,{ref:r,id:s,panelId:i,selected:c,focus:u})})}),e=0;else{var i="panels-"+e,u=o[e],d=a[e],p=n.selectedIndex===e;e++,s=(0,l.cloneElement)(r,{ref:i,id:u,tabId:d,selected:p})}return s})},handleKeyDown:function(e){if(this.isTabFromContainer(e.target)){var t=this.state.selectedIndex,r=!1;37===e.keyCode||38===e.keyCode?(t=this.getPrevTab(t),r=!0):39!==e.keyCode&&40!==e.keyCode||(t=this.getNextTab(t),r=!0),r&&e.preventDefault(),this.setSelected(t,!0)}},handleClick:function(e){var t=e.target;do if(this.isTabFromContainer(t)){if(s(t))return;var r=[].slice.call(t.parentNode.children).indexOf(t);return void this.setSelected(r)}while(null!==(t=t.parentNode))},copyPropsToState:function(e,t){var r=e.selectedIndex;return r===-1&&(r=t&&t.selectedIndex?t.selectedIndex:0),{selectedIndex:r,focus:e.focus}},isTabFromContainer:function(e){if(!o(e))return!1;var t=e.parentElement,r=(0,u.findDOMNode)(this);do{if(t===r)return!0;if(t.getAttribute("data-tabs"))break;t=t.parentElement}while(t);return!1},render:function(){var e=this;this.state.focus&&setTimeout(function(){e.state.focus=!1},0);var t=this.props,r=t.className,n=a(t,["className"]);return delete n.selectedIndex,delete n.onSelect,delete n.focus,delete n.children,delete n.forceRenderTabPanel,delete n.onClick,delete n.onKeyDown,c["default"].createElement("div",i({},n,{className:(0,p["default"])("ReactTabs","react-tabs",r),onClick:this.handleClick,onKeyDown:this.handleKeyDown,"data-tabs":!0}),this.getChildren())}})},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){var n,a;/*! | ||
Copyright (c) 2016 Jed Watson. | ||
@@ -6,3 +6,3 @@ Licensed under the MIT License (MIT), see | ||
*/ | ||
!function(){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n))e.push(r.apply(null,n));else if("object"===a)for(var s in n)o.call(n,s)&&n[s]&&e.push(s)}}return e.join(" ")}var o={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=r:(n=[],a=function(){return r}.apply(t,n),!(void 0!==a&&(e.exports=a)))}()},function(e,t,r){!function(){function t(e){var t=[];for(var n in e)t.push(r(n,e[n]));a(t)}function r(e,t){return e+" {\n"+n(t)+"\n}"}function n(e){var t=[];for(var r in e)t.push(" "+r+": "+e[r]+";");return t.join("\n")}function a(e){var t=document.getElementById("jss-styles");if(!t){t=document.createElement("style"),t.setAttribute("id","jss-styles");var r=document.getElementsByTagName("head")[0];r.insertBefore(t,r.firstChild)}var n=document.createTextNode(e.join("\n\n"));t.appendChild(n)}e.exports=t}()},function(e,t){"use strict";var r=0;e.exports=function(){return"react-tabs-"+r++}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var a=r(2),o=n(a),s=r(8),i=n(s),l=r(9),c=n(l);e.exports=function(e,t){var r=void 0,n=0,a=0,s=e[t];return o["default"].Children.forEach(s,function(e){null!==e&&(e.type===c["default"]?o["default"].Children.forEach(e.props.children,function(e){null!==e&&(e.type===i["default"]?n++:r=new Error("Expected 'Tab' but found '"+(e.type.displayName||e.type)+"'"))}):"TabPanel"===e.type.displayName?a++:r=new Error("Expected 'TabList' or 'TabPanel' but found '"+(e.type.displayName||e.type)+"'"))}),n!==a&&(r=new Error("There should be an equal number of 'Tabs' and 'TabPanels'."+("Received "+n+" 'Tabs' and "+a+" 'TabPanels'."))),r}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function o(e,t){t.selected?(e.setAttribute("tabindex","0"),e.setAttribute("selected","selected"),t.focus&&e.focus()):(e.removeAttribute("tabindex"),e.removeAttribute("selected"))}var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(2),l=n(i),c=r(3),u=r(4),d=n(u);e.exports=l["default"].createClass({displayName:"Tab",propTypes:{className:i.PropTypes.string,id:i.PropTypes.string,selected:i.PropTypes.bool,disabled:i.PropTypes.bool,panelId:i.PropTypes.string,children:i.PropTypes.oneOfType([i.PropTypes.array,i.PropTypes.object,i.PropTypes.string])},getDefaultProps:function(){return{focus:!1,selected:!1,id:null,panelId:null}},componentDidMount:function(){o((0,c.findDOMNode)(this),this.props)},componentDidUpdate:function(){o((0,c.findDOMNode)(this),this.props)},render:function(){var e=this.props,t=e.selected,r=e.disabled,n=e.panelId,o=e.className,i=e.children,c=e.id,u=a(e,["selected","disabled","panelId","className","children","id"]);return l["default"].createElement("li",s({},u,{className:(0,d["default"])("ReactTabs__Tab",o,{"ReactTabs__Tab--selected":t,"ReactTabs__Tab--disabled":r}),role:"tab",id:c,"aria-selected":t?"true":"false","aria-expanded":t?"true":"false","aria-disabled":r?"true":"false","aria-controls":n}),i)}})},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(2),i=n(s),l=r(4),c=n(l);e.exports=i["default"].createClass({displayName:"TabList",propTypes:{className:s.PropTypes.string,children:s.PropTypes.oneOfType([s.PropTypes.object,s.PropTypes.array])},render:function(){var e=this.props,t=e.className,r=e.children,n=a(e,["className","children"]);return i["default"].createElement("ul",o({},n,{className:(0,c["default"])("ReactTabs__TabList",t),role:"tablist"}),r)}})},function(e,t){"use strict";e.exports={".react-tabs [role=tablist]":{"border-bottom":"1px solid #aaa",margin:"0 0 10px",padding:"0"},".react-tabs [role=tab]":{display:"inline-block",border:"1px solid transparent","border-bottom":"none",bottom:"-1px",position:"relative","list-style":"none",padding:"6px 12px",cursor:"pointer"},".react-tabs [role=tab][aria-selected=true]":{background:"#fff","border-color":"#aaa",color:"black","border-radius":"5px 5px 0 0","-moz-border-radius":"5px 5px 0 0","-webkit-border-radius":"5px 5px 0 0"},".react-tabs [role=tab][aria-disabled=true]":{color:"GrayText",cursor:"default"},".react-tabs [role=tab]:focus":{"box-shadow":"0 0 5px hsl(208, 99%, 50%)","border-color":"hsl(208, 99%, 50%)",outline:"none"},".react-tabs [role=tab]:focus:after":{content:'""',position:"absolute",height:"5px",left:"-4px",right:"-4px",bottom:"-5px",background:"#fff"}}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(2),i=n(s),l=r(4),c=n(l);e.exports=i["default"].createClass({displayName:"TabPanel",propTypes:{children:s.PropTypes.oneOfType([s.PropTypes.array,s.PropTypes.object,s.PropTypes.string]),className:s.PropTypes.string,id:s.PropTypes.string,selected:s.PropTypes.bool,style:s.PropTypes.object,tabId:s.PropTypes.string},contextTypes:{forceRenderTabPanel:s.PropTypes.bool},getDefaultProps:function(){return{selected:!1,id:null,tabId:null}},render:function(){var e=this.props,t=e.className,r=e.children,n=e.selected,s=e.id,l=e.tabId,u=e.style,d=a(e,["className","children","selected","id","tabId","style"]);return i["default"].createElement("div",o({},d,{className:(0,c["default"])("ReactTabs__TabPanel",t,{"ReactTabs__TabPanel--selected":n}),role:"tabpanel",id:s,"aria-labelledby":l,style:o({},u,{display:n?null:"none"})}),this.context.forceRenderTabPanel||n?r:null)}})}])}); | ||
!function(){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n))e.push(r.apply(null,n));else if("object"===a)for(var s in n)o.call(n,s)&&n[s]&&e.push(s)}}return e.join(" ")}var o={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=r:(n=[],a=function(){return r}.apply(t,n),!(void 0!==a&&(e.exports=a)))}()},function(e,t,r){!function(){function t(e){var t=[];for(var n in e)t.push(r(n,e[n]));a(t)}function r(e,t){return e+" {\n"+n(t)+"\n}"}function n(e){var t=[];for(var r in e)t.push(" "+r+": "+e[r]+";");return t.join("\n")}function a(e){var t=document.getElementById("jss-styles");if(!t){t=document.createElement("style"),t.setAttribute("id","jss-styles");var r=document.getElementsByTagName("head")[0];r.insertBefore(t,r.firstChild)}var n=document.createTextNode(e.join("\n\n"));t.appendChild(n)}e.exports=t}()},function(e,t){"use strict";var r=0;e.exports=function(){return"react-tabs-"+r++}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var a=r(2),o=n(a),s=r(8),i=n(s),l=r(9),c=n(l);e.exports=function(e,t){var r=void 0,n=0,a=0,s=e[t];return o["default"].Children.forEach(s,function(e){null!==e&&(e.type===c["default"]?o["default"].Children.forEach(e.props.children,function(e){null!==e&&(e.type===i["default"]?n++:r=new Error("Expected 'Tab' but found '"+(e.type.displayName||e.type)+"'"))}):"TabPanel"===e.type.displayName?a++:r=new Error("Expected 'TabList' or 'TabPanel' but found '"+(e.type.displayName||e.type)+"'"))}),n!==a&&(r=new Error("There should be an equal number of 'Tabs' and 'TabPanels'."+("Received "+n+" 'Tabs' and "+a+" 'TabPanels'."))),r}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(2),i=n(s),l=r(3),c=r(4),u=n(c);e.exports=i["default"].createClass({displayName:"Tab",propTypes:{className:s.PropTypes.string,id:s.PropTypes.string,focus:s.PropTypes.bool,selected:s.PropTypes.bool,disabled:s.PropTypes.bool,panelId:s.PropTypes.string,children:s.PropTypes.oneOfType([s.PropTypes.array,s.PropTypes.object,s.PropTypes.string])},getDefaultProps:function(){return{focus:!1,selected:!1,id:null,panelId:null}},componentDidMount:function(){this.checkFocus()},componentDidUpdate:function(){this.checkFocus()},checkFocus:function(){this.props.selected&&this.props.focus&&(0,l.findDOMNode)(this).focus()},render:function(){var e=this.props,t=e.selected,r=e.disabled,n=e.panelId,s=e.className,l=e.children,c=e.id,d=a(e,["selected","disabled","panelId","className","children","id"]);return i["default"].createElement("li",o({},d,{className:(0,u["default"])("ReactTabs__Tab",s,{"ReactTabs__Tab--selected":t,"ReactTabs__Tab--disabled":r}),role:"tab",id:c,"aria-selected":t?"true":"false","aria-expanded":t?"true":"false","aria-disabled":r?"true":"false","aria-controls":n,tabIndex:t?"0":null}),l)}})},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(2),i=n(s),l=r(4),c=n(l);e.exports=i["default"].createClass({displayName:"TabList",propTypes:{className:s.PropTypes.string,children:s.PropTypes.oneOfType([s.PropTypes.object,s.PropTypes.array])},render:function(){var e=this.props,t=e.className,r=e.children,n=a(e,["className","children"]);return i["default"].createElement("ul",o({},n,{className:(0,c["default"])("ReactTabs__TabList",t),role:"tablist"}),r)}})},function(e,t){"use strict";e.exports={".react-tabs [role=tablist]":{"border-bottom":"1px solid #aaa",margin:"0 0 10px",padding:"0"},".react-tabs [role=tab]":{display:"inline-block",border:"1px solid transparent","border-bottom":"none",bottom:"-1px",position:"relative","list-style":"none",padding:"6px 12px",cursor:"pointer"},".react-tabs [role=tab][aria-selected=true]":{background:"#fff","border-color":"#aaa",color:"black","border-radius":"5px 5px 0 0","-moz-border-radius":"5px 5px 0 0","-webkit-border-radius":"5px 5px 0 0"},".react-tabs [role=tab][aria-disabled=true]":{color:"GrayText",cursor:"default"},".react-tabs [role=tab]:focus":{"box-shadow":"0 0 5px hsl(208, 99%, 50%)","border-color":"hsl(208, 99%, 50%)",outline:"none"},".react-tabs [role=tab]:focus:after":{content:'""',position:"absolute",height:"5px",left:"-4px",right:"-4px",bottom:"-5px",background:"#fff"}}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(2),i=n(s),l=r(4),c=n(l);e.exports=i["default"].createClass({displayName:"TabPanel",propTypes:{children:s.PropTypes.oneOfType([s.PropTypes.array,s.PropTypes.object,s.PropTypes.string]),className:s.PropTypes.string,id:s.PropTypes.string,selected:s.PropTypes.bool,style:s.PropTypes.object,tabId:s.PropTypes.string},contextTypes:{forceRenderTabPanel:s.PropTypes.bool},getDefaultProps:function(){return{selected:!1,id:null,tabId:null}},render:function(){var e=this.props,t=e.className,r=e.children,n=e.selected,s=e.id,l=e.tabId,u=e.style,d=a(e,["className","children","selected","id","tabId","style"]);return i["default"].createElement("div",o({},d,{className:(0,c["default"])("ReactTabs__TabPanel",t,{"ReactTabs__TabPanel--selected":n}),role:"tabpanel",id:s,"aria-labelledby":l,style:o({},u,{display:n?null:"none"})}),this.context.forceRenderTabPanel||n?r:null)}})}])}); | ||
//# sourceMappingURL=react-tabs.min.js.map |
{ | ||
"name": "react-tabs", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "React tabs component", | ||
@@ -14,3 +14,3 @@ "main": "lib/main.js", | ||
"lint": "eslint src", | ||
"preversion": "npm run lint && npm test && npm run bundle && git add dist/ && git commit -m 'Publish: build bower distribution'", | ||
"preversion": "npm run lint && npm test && npm run build && npm run bundle && git add dist/ && git commit -m 'Publish: build bower distribution'", | ||
"prepublish": "npm run build", | ||
@@ -17,0 +17,0 @@ "test": "jest", |
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
191849
1451