react-tabs
Advanced tools
Comparing version 0.6.2 to 0.7.0
# Changelog | ||
### 0.6.2 (Jun 24, 2016) | ||
- Fix bower bundling (#111, #112) | ||
### 0.6.1 (Jun 23, 2016) | ||
@@ -4,0 +8,0 @@ |
@@ -84,9 +84,9 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
exports.Tabs = | ||
// For bc we also export a default object, remove in 1.0 | ||
_Tabs2.default; | ||
exports.Tabs = _Tabs2.default; | ||
exports.TabList = _TabList2.default; | ||
exports.Tab = _Tab2.default; | ||
exports.TabPanel = _TabPanel2.default; | ||
// For bc we also export a default object, remove in 1.0 | ||
exports.default = { | ||
@@ -724,2 +724,10 @@ Tabs: _Tabs2.default, | ||
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) { | ||
@@ -740,2 +748,4 @@ var target = {};for (var i in obj) { | ||
disabled: _react.PropTypes.bool, | ||
activeTabClassName: _react.PropTypes.string, | ||
disabledTabClassName: _react.PropTypes.string, | ||
panelId: _react.PropTypes.string, | ||
@@ -750,3 +760,5 @@ children: _react.PropTypes.oneOfType([_react.PropTypes.array, _react.PropTypes.object, _react.PropTypes.string]) | ||
id: null, | ||
panelId: null | ||
panelId: null, | ||
activeTabClassName: 'ReactTabs__Tab--selected', | ||
disabledTabClassName: 'ReactTabs__Tab--disabled' | ||
}; | ||
@@ -766,2 +778,4 @@ }, | ||
render: function render() { | ||
var _cx; | ||
var _props = this.props; | ||
@@ -771,2 +785,4 @@ var selected = _props.selected; | ||
var panelId = _props.panelId; | ||
var activeTabClassName = _props.activeTabClassName; | ||
var disabledTabClassName = _props.disabledTabClassName; | ||
var className = _props.className; | ||
@@ -776,13 +792,11 @@ var children = _props.children; | ||
var attributes = _objectWithoutProperties(_props, ['selected', 'disabled', 'panelId', 'className', 'children', 'id']); | ||
var attributes = _objectWithoutProperties(_props, ['selected', 'disabled', 'panelId', 'activeTabClassName', 'disabledTabClassName', 'className', 'children', 'id']); | ||
delete attributes.focus; | ||
return _react2.default.createElement('li', _extends({}, attributes, { | ||
className: (0, _classnames2.default)('ReactTabs__Tab', className, { | ||
'ReactTabs__Tab--selected': selected, | ||
'ReactTabs__Tab--disabled': disabled | ||
}), | ||
className: (0, _classnames2.default)('ReactTabs__Tab', className, (_cx = {}, _defineProperty(_cx, activeTabClassName, selected), _defineProperty(_cx, disabledTabClassName, disabled), _cx)), | ||
role: 'tab', | ||
id: id, | ||
'aria-selected': selected ? 'true' : 'false', | ||
'aria-expanded': selected ? 'true' : 'false', | ||
'aria-disabled': disabled ? 'true' : 'false', | ||
@@ -829,2 +843,11 @@ 'aria-controls': panelId, | ||
function renderChildren(props) { | ||
return _react2.default.Children.map(props.children, function (child) { | ||
return _react2.default.cloneElement(child, { | ||
activeTabClassName: props.activeTabClassName, | ||
disabledTabClassName: props.disabledTabClassName | ||
}); | ||
}); | ||
} | ||
module.exports = _react2.default.createClass({ | ||
@@ -835,2 +858,4 @@ displayName: 'TabList', | ||
className: _react.PropTypes.string, | ||
activeTabClassName: _react.PropTypes.string, | ||
disabledTabClassName: _react.PropTypes.string, | ||
children: _react.PropTypes.oneOfType([_react.PropTypes.object, _react.PropTypes.array]) | ||
@@ -842,5 +867,7 @@ }, | ||
var className = _props.className; | ||
var activeTabClassName = _props.activeTabClassName; | ||
var disabledTabClassName = _props.disabledTabClassName; | ||
var children = _props.children; | ||
var attributes = _objectWithoutProperties(_props, ['className', 'children']); | ||
var attributes = _objectWithoutProperties(_props, ['className', 'activeTabClassName', 'disabledTabClassName', 'children']); | ||
@@ -850,3 +877,3 @@ return _react2.default.createElement('ul', _extends({}, attributes, { | ||
role: 'tablist' | ||
}), children); | ||
}), renderChildren({ activeTabClassName: activeTabClassName, disabledTabClassName: disabledTabClassName, children: children })); | ||
} | ||
@@ -853,0 +880,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}),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;/*! | ||
!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(a){if(r[a])return r[a].exports;var n=r[a]={exports:{},id:a,loaded:!1};return e[a].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function a(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 n=r(1),s=a(n),o=r(9),l=a(o),i=r(8),c=a(i),d=r(11),u=a(d);t.Tabs=s["default"],t.TabList=l["default"],t.Tab=c["default"],t.TabPanel=u["default"],t["default"]={Tabs:s["default"],TabList:l["default"],Tab:c["default"],TabPanel:u["default"]}},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){var r={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=e[a]);return r}function s(e){return"LI"===e.nodeName&&"tab"===e.getAttribute("role")}function o(e){return"true"===e.getAttribute("aria-disabled")}var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},i=r(2),c=a(i),d=r(3),u=r(4),p=a(u),f=r(5),b=a(f),T=r(6),h=a(T),y=r(7),v=a(y),m=!0;e.exports=c["default"].createClass({displayName:"Tabs",propTypes:{className:i.PropTypes.string,selectedIndex:i.PropTypes.number,onSelect:i.PropTypes.func,focus:i.PropTypes.bool,children:v["default"],forceRenderTabPanel:i.PropTypes.bool},childContextTypes:{forceRenderTabPanel:i.PropTypes.bool},statics:{setUseDefaultStyles:function(e){m=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(){m&&(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,a=!1;"function"==typeof this.props.onSelect&&(a=this.props.onSelect(e,r)===!1),a||this.setState({selectedIndex:e,focus:t===!0})}},getNextTab:function(e){for(var t=this.getTabsCount(),r=e+1;r<t;r++){var a=this.getTab(r);if(!o((0,d.findDOMNode)(a)))return r}for(var n=0;n<e;n++){var s=this.getTab(n);if(!o((0,d.findDOMNode)(s)))return n}return e},getPrevTab:function(e){for(var t=e;t--;){var r=this.getTab(t);if(!o((0,d.findDOMNode)(r)))return t}for(t=this.getTabsCount();t-- >e;){var a=this.getTab(t);if(!o((0,d.findDOMNode)(a)))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,a=this.state,n=this.tabIds=this.tabIds||[],s=this.panelIds=this.panelIds||[],o=this.tabIds.length-this.getTabsCount();o++<0;)n.push((0,h["default"])()),s.push((0,h["default"])());return c["default"].Children.map(r,function(r){if(null===r)return null;var o=null;if(0===t++)o=(0,i.cloneElement)(r,{ref:"tablist",children:c["default"].Children.map(r.props.children,function(t){if(null===t)return null;var r="tabs-"+e,o=n[e],l=s[e],c=a.selectedIndex===e,d=c&&a.focus;return e++,(0,i.cloneElement)(t,{ref:r,id:o,panelId:l,selected:c,focus:d})})}),e=0;else{var l="panels-"+e,d=s[e],u=n[e],p=a.selectedIndex===e;e++,o=(0,i.cloneElement)(r,{ref:l,id:d,tabId:u,selected:p})}return o})},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(o(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(!s(e))return!1;var t=e.parentElement,r=(0,d.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,a=n(t,["className"]);return delete a.selectedIndex,delete a.onSelect,delete a.focus,delete a.children,delete a.forceRenderTabPanel,delete a.onClick,delete a.onKeyDown,c["default"].createElement("div",l({},a,{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 a,n;/*! | ||
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}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)}})}])}); | ||
!function(){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++){var a=arguments[t];if(a){var n=typeof a;if("string"===n||"number"===n)e.push(a);else if(Array.isArray(a))e.push(r.apply(null,a));else if("object"===n)for(var o in a)s.call(a,o)&&a[o]&&e.push(o)}}return e.join(" ")}var s={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=r:(a=[],n=function(){return r}.apply(t,a),!(void 0!==n&&(e.exports=n)))}()},function(e,t,r){!function(){function t(e){var t=[];for(var a in e)t.push(r(a,e[a]));n(t)}function r(e,t){return e+" {\n"+a(t)+"\n}"}function a(e){var t=[];for(var r in e)t.push(" "+r+": "+e[r]+";");return t.join("\n")}function n(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 a=document.createTextNode(e.join("\n\n"));t.appendChild(a)}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 a(e){return e&&e.__esModule?e:{"default":e}}var n=r(2),s=a(n),o=r(8),l=a(o),i=r(9),c=a(i);e.exports=function(e,t){var r=void 0,a=0,n=0,o=e[t];return s["default"].Children.forEach(o,function(e){null!==e&&(e.type===c["default"]?s["default"].Children.forEach(e.props.children,function(e){null!==e&&(e.type===l["default"]?a++:r=new Error("Expected 'Tab' but found '"+(e.type.displayName||e.type)+"'"))}):"TabPanel"===e.type.displayName?n++:r=new Error("Expected 'TabList' or 'TabPanel' but found '"+(e.type.displayName||e.type)+"'"))}),a!==n&&(r=new Error("There should be an equal number of 'Tabs' and 'TabPanels'."+("Received "+a+" 'Tabs' and "+n+" 'TabPanels'."))),r}},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=e[a]);return r}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},l=r(2),i=a(l),c=r(3),d=r(4),u=a(d);e.exports=i["default"].createClass({displayName:"Tab",propTypes:{className:l.PropTypes.string,id:l.PropTypes.string,focus:l.PropTypes.bool,selected:l.PropTypes.bool,disabled:l.PropTypes.bool,activeTabClassName:l.PropTypes.string,disabledTabClassName:l.PropTypes.string,panelId:l.PropTypes.string,children:l.PropTypes.oneOfType([l.PropTypes.array,l.PropTypes.object,l.PropTypes.string])},getDefaultProps:function(){return{focus:!1,selected:!1,id:null,panelId:null,activeTabClassName:"ReactTabs__Tab--selected",disabledTabClassName:"ReactTabs__Tab--disabled"}},componentDidMount:function(){this.checkFocus()},componentDidUpdate:function(){this.checkFocus()},checkFocus:function(){this.props.selected&&this.props.focus&&(0,c.findDOMNode)(this).focus()},render:function(){var e,t=this.props,r=t.selected,a=t.disabled,l=t.panelId,c=t.activeTabClassName,d=t.disabledTabClassName,p=t.className,f=t.children,b=t.id,T=s(t,["selected","disabled","panelId","activeTabClassName","disabledTabClassName","className","children","id"]);return delete T.focus,i["default"].createElement("li",o({},T,{className:(0,u["default"])("ReactTabs__Tab",p,(e={},n(e,c,r),n(e,d,a),e)),role:"tab",id:b,"aria-selected":r?"true":"false","aria-disabled":a?"true":"false","aria-controls":l,tabIndex:r?"0":null}),f)}})},function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){var r={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=e[a]);return r}function s(e){return i["default"].Children.map(e.children,function(t){return i["default"].cloneElement(t,{activeTabClassName:e.activeTabClassName,disabledTabClassName:e.disabledTabClassName})})}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},l=r(2),i=a(l),c=r(4),d=a(c);e.exports=i["default"].createClass({displayName:"TabList",propTypes:{className:l.PropTypes.string,activeTabClassName:l.PropTypes.string,disabledTabClassName:l.PropTypes.string,children:l.PropTypes.oneOfType([l.PropTypes.object,l.PropTypes.array])},render:function(){var e=this.props,t=e.className,r=e.activeTabClassName,a=e.disabledTabClassName,l=e.children,c=n(e,["className","activeTabClassName","disabledTabClassName","children"]);return i["default"].createElement("ul",o({},c,{className:(0,d["default"])("ReactTabs__TabList",t),role:"tablist"}),s({activeTabClassName:r,disabledTabClassName:a,children:l}))}})},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 a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){var r={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=e[a]);return r}var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},o=r(2),l=a(o),i=r(4),c=a(i);e.exports=l["default"].createClass({displayName:"TabPanel",propTypes:{children:o.PropTypes.oneOfType([o.PropTypes.array,o.PropTypes.object,o.PropTypes.string]),className:o.PropTypes.string,id:o.PropTypes.string,selected:o.PropTypes.bool,style:o.PropTypes.object,tabId:o.PropTypes.string},contextTypes:{forceRenderTabPanel:o.PropTypes.bool},getDefaultProps:function(){return{selected:!1,id:null,tabId:null}},render:function(){var e=this.props,t=e.className,r=e.children,a=e.selected,o=e.id,i=e.tabId,d=e.style,u=n(e,["className","children","selected","id","tabId","style"]);return l["default"].createElement("div",s({},u,{className:(0,c["default"])("ReactTabs__TabPanel",t,{"ReactTabs__TabPanel--selected":a}),role:"tabpanel",id:o,"aria-labelledby":i,style:s({},d,{display:a?null:"none"})}),this.context.forceRenderTabPanel||a?r:null)}})}])}); | ||
//# sourceMappingURL=react-tabs.min.js.map |
@@ -17,2 +17,4 @@ 'use strict'; | ||
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; } | ||
@@ -29,2 +31,4 @@ | ||
disabled: _react.PropTypes.bool, | ||
activeTabClassName: _react.PropTypes.string, | ||
disabledTabClassName: _react.PropTypes.string, | ||
panelId: _react.PropTypes.string, | ||
@@ -39,3 +43,5 @@ children: _react.PropTypes.oneOfType([_react.PropTypes.array, _react.PropTypes.object, _react.PropTypes.string]) | ||
id: null, | ||
panelId: null | ||
panelId: null, | ||
activeTabClassName: 'ReactTabs__Tab--selected', | ||
disabledTabClassName: 'ReactTabs__Tab--disabled' | ||
}; | ||
@@ -55,2 +61,4 @@ }, | ||
render: function render() { | ||
var _cx; | ||
var _props = this.props; | ||
@@ -60,2 +68,4 @@ var selected = _props.selected; | ||
var panelId = _props.panelId; | ||
var activeTabClassName = _props.activeTabClassName; | ||
var disabledTabClassName = _props.disabledTabClassName; | ||
var className = _props.className; | ||
@@ -65,15 +75,13 @@ var children = _props.children; | ||
var attributes = _objectWithoutProperties(_props, ['selected', 'disabled', 'panelId', 'className', 'children', 'id']); | ||
var attributes = _objectWithoutProperties(_props, ['selected', 'disabled', 'panelId', 'activeTabClassName', 'disabledTabClassName', 'className', 'children', 'id']); | ||
delete attributes.focus; | ||
return _react2.default.createElement( | ||
'li', | ||
_extends({}, attributes, { | ||
className: (0, _classnames2.default)('ReactTabs__Tab', className, { | ||
'ReactTabs__Tab--selected': selected, | ||
'ReactTabs__Tab--disabled': disabled | ||
}), | ||
className: (0, _classnames2.default)('ReactTabs__Tab', className, (_cx = {}, _defineProperty(_cx, activeTabClassName, selected), _defineProperty(_cx, disabledTabClassName, disabled), _cx)), | ||
role: 'tab', | ||
id: id, | ||
'aria-selected': selected ? 'true' : 'false', | ||
'aria-expanded': selected ? 'true' : 'false', | ||
'aria-disabled': disabled ? 'true' : 'false', | ||
@@ -80,0 +88,0 @@ 'aria-controls': panelId, |
@@ -17,2 +17,11 @@ 'use strict'; | ||
function renderChildren(props) { | ||
return _react2.default.Children.map(props.children, function (child) { | ||
return _react2.default.cloneElement(child, { | ||
activeTabClassName: props.activeTabClassName, | ||
disabledTabClassName: props.disabledTabClassName | ||
}); | ||
}); | ||
} | ||
module.exports = _react2.default.createClass({ | ||
@@ -23,2 +32,4 @@ displayName: 'TabList', | ||
className: _react.PropTypes.string, | ||
activeTabClassName: _react.PropTypes.string, | ||
disabledTabClassName: _react.PropTypes.string, | ||
children: _react.PropTypes.oneOfType([_react.PropTypes.object, _react.PropTypes.array]) | ||
@@ -30,5 +41,7 @@ }, | ||
var className = _props.className; | ||
var activeTabClassName = _props.activeTabClassName; | ||
var disabledTabClassName = _props.disabledTabClassName; | ||
var children = _props.children; | ||
var attributes = _objectWithoutProperties(_props, ['className', 'children']); | ||
var attributes = _objectWithoutProperties(_props, ['className', 'activeTabClassName', 'disabledTabClassName', 'children']); | ||
@@ -41,5 +54,5 @@ return _react2.default.createElement( | ||
}), | ||
children | ||
renderChildren({ activeTabClassName: activeTabClassName, disabledTabClassName: disabledTabClassName, children: children }) | ||
); | ||
} | ||
}); |
@@ -26,9 +26,9 @@ 'use strict'; | ||
exports.Tabs = | ||
// For bc we also export a default object, remove in 1.0 | ||
_Tabs2.default; | ||
exports.Tabs = _Tabs2.default; | ||
exports.TabList = _TabList2.default; | ||
exports.Tab = _Tab2.default; | ||
exports.TabPanel = _TabPanel2.default; | ||
// For bc we also export a default object, remove in 1.0 | ||
exports.default = { | ||
@@ -35,0 +35,0 @@ Tabs: _Tabs2.default, |
{ | ||
"name": "react-tabs", | ||
"version": "0.6.2", | ||
"version": "0.7.0", | ||
"description": "React tabs component", | ||
@@ -47,3 +47,3 @@ "main": "lib/main.js", | ||
"babel-eslint": "^6.0.4", | ||
"babel-jest": "^12.1.0", | ||
"babel-jest": "^13.0.0", | ||
"babel-loader": "^6.2.4", | ||
@@ -60,3 +60,3 @@ "babel-preset-es2015": "^6.9.0", | ||
"eslint-plugin-react": "^5.1.1", | ||
"jest-cli": "^12.1.1", | ||
"jest-cli": "^13.0.0", | ||
"react": "^15.0.0", | ||
@@ -63,0 +63,0 @@ "react-addons-test-utils": "^15.0.0", |
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
200792
1492