UNPKG

react-tabs

Version:
1,030 lines (844 loc) 30 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("react"), require("react-dom")); else if(typeof define === 'function' && define.amd) define(["react", "react-dom"], factory); else if(typeof exports === 'object') exports["ReactTabs"] = factory(require("react"), require("react-dom")); else root["ReactTabs"] = factory(root["React"], root["ReactDOM"]); })(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.TabPanel = exports.Tab = exports.TabList = exports.Tabs = undefined; var _Tabs = __webpack_require__(1); var _Tabs2 = _interopRequireDefault(_Tabs); var _TabList = __webpack_require__(9); var _TabList2 = _interopRequireDefault(_TabList); var _Tab = __webpack_require__(8); var _Tab2 = _interopRequireDefault(_Tab); var _TabPanel = __webpack_require__(11); var _TabPanel2 = _interopRequireDefault(_TabPanel); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 = { Tabs: _Tabs2.default, TabList: _TabList2.default, Tab: _Tab2.default, TabPanel: _TabPanel2.default }; /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; 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 _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(3); var _classnames = __webpack_require__(4); var _classnames2 = _interopRequireDefault(_classnames); var _jsStylesheet = __webpack_require__(5); var _jsStylesheet2 = _interopRequireDefault(_jsStylesheet); var _uuid = __webpack_require__(6); var _uuid2 = _interopRequireDefault(_uuid); var _childrenPropType = __webpack_require__(7); var _childrenPropType2 = _interopRequireDefault(_childrenPropType); var _Tab = __webpack_require__(8); var _Tab2 = _interopRequireDefault(_Tab); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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; } // Determine if a node from event.target is a Tab element function isTabNode(node) { return node.nodeName === 'LI' && node.getAttribute('role') === 'tab'; } // Determine if a tab node is disabled function isTabDisabled(node) { return node.getAttribute('aria-disabled') === 'true'; } var useDefaultStyles = true; module.exports = _react2.default.createClass({ displayName: 'Tabs', propTypes: { className: _react.PropTypes.string, selectedIndex: _react.PropTypes.number, onSelect: _react.PropTypes.func, focus: _react.PropTypes.bool, children: _childrenPropType2.default, forceRenderTabPanel: _react.PropTypes.bool }, childContextTypes: { forceRenderTabPanel: _react.PropTypes.bool }, statics: { setUseDefaultStyles: function setUseDefaultStyles(use) { useDefaultStyles = use; } }, getDefaultProps: function getDefaultProps() { return { selectedIndex: -1, focus: false, forceRenderTabPanel: false }; }, getInitialState: function getInitialState() { return this.copyPropsToState(this.props, this.state); }, getChildContext: function getChildContext() { return { forceRenderTabPanel: this.props.forceRenderTabPanel }; }, componentDidMount: function componentDidMount() { if (useDefaultStyles) { (0, _jsStylesheet2.default)(__webpack_require__(10)); // eslint-disable-line global-require } }, componentWillReceiveProps: function componentWillReceiveProps(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); }); }, setSelected: function setSelected(index, focus) { // Don't do anything if nothing has changed if (index === this.state.selectedIndex) return; // Check index boundary if (index < 0 || index >= this.getTabsCount()) return; // Keep reference to last index for event handler var last = this.state.selectedIndex; // Check if the change event handler cancels the tab change var cancel = false; // Call change event handler if (typeof this.props.onSelect === 'function') { cancel = this.props.onSelect(index, last) === false; } if (!cancel) { // Update selected index this.setState({ selectedIndex: index, focus: focus === true }); } }, getNextTab: function getNextTab(index) { var count = this.getTabsCount(); // Look for non-disabled tab from index to the last tab on the right for (var i = index + 1; i < count; i++) { var tab = this.getTab(i); if (!isTabDisabled((0, _reactDom.findDOMNode)(tab))) { return i; } } // If no tab found, continue searching from first on left to index for (var _i = 0; _i < index; _i++) { var _tab = this.getTab(_i); if (!isTabDisabled((0, _reactDom.findDOMNode)(_tab))) { return _i; } } // No tabs are disabled, return index return index; }, getPrevTab: function getPrevTab(index) { var i = index; // Look for non-disabled tab from index to first tab on the left while (i--) { var tab = this.getTab(i); if (!isTabDisabled((0, _reactDom.findDOMNode)(tab))) { return i; } } // If no tab found, continue searching from last tab on right to index i = this.getTabsCount(); while (i-- > index) { var _tab2 = this.getTab(i); if (!isTabDisabled((0, _reactDom.findDOMNode)(_tab2))) { return i; } } // No tabs are disabled, return index return index; }, getTabsCount: function getTabsCount() { return this.props.children && this.props.children[0] ? _react2.default.Children.count(this.props.children[0].props.children) : 0; }, getPanelsCount: function getPanelsCount() { return _react2.default.Children.count(this.props.children.slice(1)); }, getTabList: function getTabList() { return this.refs.tablist; }, getTab: function getTab(index) { return this.refs['tabs-' + index]; }, getPanel: function getPanel(index) { return this.refs['panels-' + index]; }, getChildren: function getChildren() { var index = 0; var count = 0; var children = this.props.children; var state = this.state; var tabIds = this.tabIds = this.tabIds || []; var panelIds = this.panelIds = this.panelIds || []; var diff = this.tabIds.length - this.getTabsCount(); // Add ids if new tabs have been added // Don't bother removing ids, just keep them in case they are added again // This is more efficient, and keeps the uuid counter under control while (diff++ < 0) { tabIds.push((0, _uuid2.default)()); panelIds.push((0, _uuid2.default)()); } // Map children to dynamically setup refs return _react2.default.Children.map(children, function (child) { // null happens when conditionally rendering TabPanel/Tab // see https://github.com/rackt/react-tabs/issues/37 if (child === null) { return null; } var result = null; // Clone TabList and Tab components to have refs if (count++ === 0) { // TODO try setting the uuid in the "constructor" for `Tab`/`TabPanel` result = (0, _react.cloneElement)(child, { ref: 'tablist', children: _react2.default.Children.map(child.props.children, function (tab) { // null happens when conditionally rendering TabPanel/Tab // see https://github.com/rackt/react-tabs/issues/37 if (tab === null) { return null; } var ref = 'tabs-' + index; var id = tabIds[index]; var panelId = panelIds[index]; var selected = state.selectedIndex === index; var focus = selected && state.focus; index++; if (tab.type === _Tab2.default) { return (0, _react.cloneElement)(tab, { ref: ref, id: id, panelId: panelId, selected: selected, focus: focus }); } return tab; }) }); // Reset index for panels index = 0; } // Clone TabPanel components to have refs else { var ref = 'panels-' + index; var id = panelIds[index]; var tabId = tabIds[index]; var selected = state.selectedIndex === index; index++; result = (0, _react.cloneElement)(child, { ref: ref, id: id, tabId: tabId, selected: selected }); } return result; }); }, handleKeyDown: function handleKeyDown(e) { if (this.isTabFromContainer(e.target)) { var index = this.state.selectedIndex; var preventDefault = false; // Select next tab to the left if (e.keyCode === 37 || e.keyCode === 38) { index = this.getPrevTab(index); preventDefault = true; } // Select next tab to the right /* eslint brace-style:0 */ else if (e.keyCode === 39 || e.keyCode === 40) { index = this.getNextTab(index); preventDefault = true; } // This prevents scrollbars from moving around if (preventDefault) { e.preventDefault(); } this.setSelected(index, true); } }, handleClick: function handleClick(e) { var node = e.target; do { // eslint-disable-line no-cond-assign if (this.isTabFromContainer(node)) { if (isTabDisabled(node)) { return; } var index = [].slice.call(node.parentNode.children).indexOf(node); this.setSelected(index); return; } } while ((node = node.parentNode) !== null); }, // This is an anti-pattern, so sue me copyPropsToState: function copyPropsToState(props, state) { var selectedIndex = props.selectedIndex; // If no selectedIndex prop was supplied, then try // preserving the existing selectedIndex from state. // If the state has not selectedIndex, default // to the first tab in the TabList. // // TODO: Need automation testing around this // Manual testing can be done using examples/focus // See 'should preserve selectedIndex when typing' in specs/Tabs.spec.js if (selectedIndex === -1) { if (state && state.selectedIndex) { selectedIndex = state.selectedIndex; } else { selectedIndex = 0; } } return { selectedIndex: selectedIndex, focus: props.focus }; }, /** * Determine if a node from event.target is a Tab element for the current Tabs container. * If the clicked element is not a Tab, it returns false. * If it finds another Tabs container between the Tab and `this`, it returns false. */ isTabFromContainer: function isTabFromContainer(node) { // return immediately if the clicked element is not a Tab. if (!isTabNode(node)) { return false; } // Check if the first occurrence of a Tabs container is `this` one. var nodeAncestor = node.parentElement; var tabsNode = (0, _reactDom.findDOMNode)(this); do { if (nodeAncestor === tabsNode) return true;else if (nodeAncestor.getAttribute('data-tabs')) break; nodeAncestor = nodeAncestor.parentElement; } while (nodeAncestor); return false; }, render: function render() { var _this2 = this; // This fixes an issue with focus management. // // Ultimately, when focus is true, and an input has focus, // and any change on that input causes a state change/re-render, // focus gets sent back to the active tab, and input loses focus. // // Since the focus state only needs to be remembered // for the current render, we can reset it once the // render has happened. // // Don't use setState, because we don't want to re-render. // // See https://github.com/rackt/react-tabs/pull/7 if (this.state.focus) { setTimeout(function () { _this2.state.focus = false; }, 0); } var _props = this.props; var className = _props.className; var attributes = _objectWithoutProperties(_props, ['className']); // Delete all known props, so they don't get added to DOM delete attributes.selectedIndex; delete attributes.onSelect; delete attributes.focus; delete attributes.children; delete attributes.forceRenderTabPanel; delete attributes.onClick; delete attributes.onKeyDown; return _react2.default.createElement('div', _extends({}, attributes, { className: (0, _classnames2.default)('ReactTabs', 'react-tabs', className), onClick: this.handleClick, onKeyDown: this.handleKeyDown, 'data-tabs': true }), this.getChildren()); } }); /***/ }, /* 2 */ /***/ function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_2__; /***/ }, /* 3 */ /***/ function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_3__; /***/ }, /* 4 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /* global define */ (function () { 'use strict'; var hasOwn = {}.hasOwnProperty; function classNames () { var classes = []; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (!arg) continue; var argType = typeof arg; if (argType === 'string' || argType === 'number') { classes.push(arg); } else if (Array.isArray(arg)) { classes.push(classNames.apply(null, arg)); } else if (argType === 'object') { for (var key in arg) { if (hasOwn.call(arg, key) && arg[key]) { classes.push(key); } } } } return classes.join(' '); } if (typeof module !== 'undefined' && module.exports) { module.exports = classNames; } else if (true) { // register as 'classnames', consistent with npm package name !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { return classNames; }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { window.classNames = classNames; } }()); /***/ }, /* 5 */ /***/ function(module, exports, __webpack_require__) { !(function() { function jss(blocks) { var css = []; for (var block in blocks) css.push(createStyleBlock(block, blocks[block])); injectCSS(css); } function createStyleBlock(selector, rules) { return selector + ' {\n' + parseRules(rules) + '\n}'; } function parseRules(rules) { var css = []; for (var rule in rules) css.push(' '+rule+': '+rules[rule]+';'); return css.join('\n'); } function injectCSS(css) { var style = document.getElementById('jss-styles'); if (!style) { style = document.createElement('style'); style.setAttribute('id', 'jss-styles'); var head = document.getElementsByTagName('head')[0]; head.insertBefore(style, head.firstChild); } var node = document.createTextNode(css.join('\n\n')); style.appendChild(node); } if (true) module.exports = jss; else window.jss = jss; })(); /***/ }, /* 6 */ /***/ function(module, exports) { "use strict"; // Get a universally unique identifier var count = 0; module.exports = function uuid() { return "react-tabs-" + count++; }; /***/ }, /* 7 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _Tab = __webpack_require__(8); var _Tab2 = _interopRequireDefault(_Tab); var _TabList = __webpack_require__(9); var _TabList2 = _interopRequireDefault(_TabList); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } module.exports = function childrenPropTypes(props, propName) { var error = void 0; var tabsCount = 0; var panelsCount = 0; var children = props[propName]; _react2.default.Children.forEach(children, function (child) { // null happens when conditionally rendering TabPanel/Tab // see https://github.com/rackt/react-tabs/issues/37 if (child === null) { return; } if (child.type === _TabList2.default) { _react2.default.Children.forEach(child.props.children, function (c) { // null happens when conditionally rendering TabPanel/Tab // see https://github.com/rackt/react-tabs/issues/37 if (c === null) { return; } if (c.type === _Tab2.default) { tabsCount++; } }); } else if (child.type.displayName === 'TabPanel') { panelsCount++; } else { error = new Error('Expected \'TabList\' or \'TabPanel\' but found \'' + (child.type.displayName || child.type) + '\''); } }); if (tabsCount !== panelsCount) { error = new Error("There should be an equal number of 'Tabs' and 'TabPanels'." + ('Received ' + tabsCount + ' \'Tabs\' and ' + panelsCount + ' \'TabPanels\'.')); } return error; }; /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; 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 _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(3); var _classnames = __webpack_require__(4); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; } module.exports = _react2.default.createClass({ displayName: 'Tab', propTypes: { className: _react.PropTypes.string, id: _react.PropTypes.string, focus: _react.PropTypes.bool, selected: _react.PropTypes.bool, disabled: _react.PropTypes.bool, activeTabClassName: _react.PropTypes.string, disabledTabClassName: _react.PropTypes.string, panelId: _react.PropTypes.string, children: _react.PropTypes.oneOfType([_react.PropTypes.array, _react.PropTypes.object, _react.PropTypes.string]) }, getDefaultProps: function getDefaultProps() { return { focus: false, selected: false, id: null, panelId: null, activeTabClassName: 'ReactTabs__Tab--selected', disabledTabClassName: 'ReactTabs__Tab--disabled' }; }, componentDidMount: function componentDidMount() { this.checkFocus(); }, componentDidUpdate: function componentDidUpdate() { this.checkFocus(); }, checkFocus: function checkFocus() { if (this.props.selected && this.props.focus) { (0, _reactDom.findDOMNode)(this).focus(); } }, render: function render() { var _cx; var _props = this.props; var selected = _props.selected; var disabled = _props.disabled; var panelId = _props.panelId; var activeTabClassName = _props.activeTabClassName; var disabledTabClassName = _props.disabledTabClassName; var className = _props.className; var children = _props.children; var id = _props.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, (_cx = {}, _defineProperty(_cx, activeTabClassName, selected), _defineProperty(_cx, disabledTabClassName, disabled), _cx)), role: 'tab', id: id, 'aria-selected': selected ? 'true' : 'false', 'aria-disabled': disabled ? 'true' : 'false', 'aria-controls': panelId, tabIndex: selected ? '0' : null }), children); } }); /***/ }, /* 9 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; 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 _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _classnames = __webpack_require__(4); var _classnames2 = _interopRequireDefault(_classnames); var _Tab = __webpack_require__(8); var _Tab2 = _interopRequireDefault(_Tab); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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; } function renderChildren(props) { return _react2.default.Children.map(props.children, function (child) { // if child is not a tab we don't need to clone it // since we don't need to add custom props if (child.type !== _Tab2.default) { return child; } var clonedProps = { activeTabClassName: props.activeTabClassName, disabledTabClassName: props.disabledTabClassName }; return _react2.default.cloneElement(child, clonedProps); }); } module.exports = _react2.default.createClass({ displayName: 'TabList', propTypes: { className: _react.PropTypes.string, activeTabClassName: _react.PropTypes.string, disabledTabClassName: _react.PropTypes.string, children: _react.PropTypes.oneOfType([_react.PropTypes.object, _react.PropTypes.array]) }, render: function render() { var _props = this.props; var className = _props.className; var activeTabClassName = _props.activeTabClassName; var disabledTabClassName = _props.disabledTabClassName; var children = _props.children; var attributes = _objectWithoutProperties(_props, ['className', 'activeTabClassName', 'disabledTabClassName', 'children']); return _react2.default.createElement('ul', _extends({}, attributes, { className: (0, _classnames2.default)('ReactTabs__TabList', className), role: 'tablist' }), renderChildren({ activeTabClassName: activeTabClassName, disabledTabClassName: disabledTabClassName, children: children })); } }); /***/ }, /* 10 */ /***/ function(module, exports) { 'use strict'; module.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' } }; /***/ }, /* 11 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; 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 _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _classnames = __webpack_require__(4); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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; } module.exports = _react2.default.createClass({ displayName: 'TabPanel', propTypes: { children: _react.PropTypes.oneOfType([_react.PropTypes.array, _react.PropTypes.object, _react.PropTypes.string]), className: _react.PropTypes.string, id: _react.PropTypes.string, selected: _react.PropTypes.bool, style: _react.PropTypes.object, tabId: _react.PropTypes.string }, contextTypes: { forceRenderTabPanel: _react.PropTypes.bool }, getDefaultProps: function getDefaultProps() { return { selected: false, id: null, tabId: null }; }, render: function render() { var _props = this.props; var className = _props.className; var children = _props.children; var selected = _props.selected; var id = _props.id; var tabId = _props.tabId; var style = _props.style; var attributes = _objectWithoutProperties(_props, ['className', 'children', 'selected', 'id', 'tabId', 'style']); return _react2.default.createElement('div', _extends({}, attributes, { className: (0, _classnames2.default)('ReactTabs__TabPanel', className, { 'ReactTabs__TabPanel--selected': selected }), role: 'tabpanel', id: id, 'aria-labelledby': tabId, style: _extends({}, style, { display: selected ? null : 'none' }) }), this.context.forceRenderTabPanel || selected ? children : null); } }); /***/ } /******/ ]) }); ; //# sourceMappingURL=react-tabs.js.map