react-tabs
Advanced tools
Comparing version 1.1.0 to 2.0.0
339
CHANGELOG.md
@@ -1,13 +0,98 @@ | ||
# Changelog | ||
# Change Log | ||
### 1.0.0 (May 10, 2017) | ||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. | ||
#### Breaking Changes | ||
<a name="2.0.0"></a> | ||
# [2.0.0](https://github.com/reactjs/react-tabs/compare/v1.1.0...v2.0.0) (2017-09-05) | ||
- Peer dependency for react requires now `^0.14.9` or `^15.3.0` | ||
- `activeTabClassName` moved from `<TabList />` to `<Tabs />` and renamed to `selectedTabClassName` | ||
- `disabledTabClassName` moved from `<TabList />` to `<Tabs />` | ||
- `className` property on all components now overwrites the default classes instead of adding a second class name | ||
### Bug Fixes | ||
* **tabs:** Fix activeElement check in iframes in Internet Explorer [#193](https://github.com/reactjs/react-tabs/issues/193) ([#194](https://github.com/reactjs/react-tabs/issues/194)) ([722d52f](https://github.com/reactjs/react-tabs/commit/722d52f)) | ||
### Features | ||
* **tabs:** Allow for higher order components. All HOC which use hoist-non-react-statics are supported out of the box ([#196](https://github.com/reactjs/react-tabs/issues/196)) ([1969e65](https://github.com/reactjs/react-tabs/commit/1969e65)) | ||
* **tabs:** Always call onSelected callback even if tab is active. ([#195](https://github.com/reactjs/react-tabs/issues/195)) ([bc1910a](https://github.com/reactjs/react-tabs/commit/bc1910a)) | ||
### BREAKING CHANGES | ||
* **tabs:** The `onSelect` callback will now also be called when clicking on the currently active tab. | ||
<a name="1.1.0"></a> | ||
## [1.1.0](https://github.com/researchgate/node-package-blueprint/compare/v1.0.0...v1.1.0) (2017-06-13) | ||
### Features | ||
* Add nested TabList and TabPanel support ([#184](https://github.com/reactjs/react-tabs/pull/184)) (Emmet McPoland) | ||
This allows random elements as children for the `<Tabs />` component, for example: | ||
```jsx | ||
<Tabs> | ||
<div id="tabs-nav-wrapper"> | ||
<button>Left</button> | ||
<div className="tabs-container"> | ||
<TabList>{tabs}</TabList> | ||
</div> | ||
<button>Right</button> | ||
</div> | ||
<div className="tab-panels"> | ||
{tabPanels} | ||
</div> | ||
</Tabs> | ||
``` | ||
<a name="1.0.0"></a> | ||
## [1.0.0](https://github.com/researchgate/node-package-blueprint/compare/v0.8.3...v1.0.0) (2017-05-10) | ||
### Features | ||
* New static method to reset the id counter for isomorphic apps. Call this before rendering your application on the server. ([#129](https://github.com/reactjs/react-tabs/pull/129)) (Neehar Venugopal) | ||
```js | ||
import { resetIdCounter } from 'react-tabs'; | ||
resetIdCounter(); | ||
``` | ||
* Allows arbitrary components anywhere inside `<TabList>` ([#139](https://github.com/reactjs/react-tabs/pull/139)) (Alexander Wallin) | ||
* Allow random order of `<TabList />`, `<TabPanel />` and other arbitrary components. The `<TabPanel />` components are matched to the `<Tab />` components in order from top to bottom. | ||
```js | ||
<Tabs> | ||
<TabPanel /> | ||
<div /> | ||
<TabList> | ||
<Tab /> | ||
<Tab /> | ||
</TabList> | ||
<span /> | ||
<TabPanel /> | ||
</Tabs> | ||
``` | ||
* Introduce controlled and uncontrolled mode. This two modes allow either to control the tabs from your component from the outside or leave the control to the tabs within react-tabs components. (see [README.md](https://github.com/reactjs/react-tabs#controlled-vs-uncontrolled-mode) for more information) | ||
* New prop `selectedTabPanelClassName` on `<Tabs />` to change the class name of the current selected tab panel. | ||
* New prop `defaultIndex` on `<Tabs />` to allow setting the initial displayed tab. | ||
* New prop `forceRender` on `<TabPanel />` to allow force rendering of individual tab panels. | ||
* New prop `selectedClassName` on `<TabPanel />` to allow changing selected class name of individual tab panels. | ||
* New prop `selectedClassName` on `<Tab />` to allow changing selected class name of individual tabs. | ||
* New prop `disabledClassName` on `<Tab />` to allow changing disabled class name of individual tabs. | ||
* Property `className` on all components can now officially take an array as argument. | ||
* PropTypes are now wrapped in `if(process.env.NODE_ENV === 'production') Component.propTypes = { ... }` in order to allow removing of proptypes in production builds. | ||
### BREAKING CHANGES | ||
* Peer dependency for react requires now `^0.14.9` or `^15.3.0` | ||
* `activeTabClassName` moved from `<TabList />` to `<Tabs />` and renamed to `selectedTabClassName` | ||
* `disabledTabClassName` moved from `<TabList />` to `<Tabs />` | ||
* `className` property on all components now overwrites the default classes instead of adding a second class name | ||
```js | ||
// 0.8 | ||
@@ -30,6 +115,6 @@ <Tabs className="tabs"> | ||
- `selectedIndex` now enables controlled mode, which disables internal management of the active tab. If you were using `selectedIndex` before to set the initial displayed tab use `defaultIndex` now. | ||
- The value `-1` for `selectedIndex` and `defaultIndex` do not activate the first tab anymore, but instead display no tab panel at all. Use `-1` if you want to display only the tabs but have non of them being selected. If you want to have the first tab selected us `0`. | ||
- Support for bower package manager was removed. | ||
- Removed deprecated default export of tabs: | ||
* `selectedIndex` now enables controlled mode, which disables internal management of the active tab. If you were using `selectedIndex` before to set the initial displayed tab use `defaultIndex` now. | ||
* The value `-1` for `selectedIndex` and `defaultIndex` do not activate the first tab anymore, but instead display no tab panel at all. Use `-1` if you want to display only the tabs but have non of them being selected. If you want to have the first tab selected us `0`. | ||
* Support for bower package manager was removed. | ||
* Removed deprecated default export of tabs: | ||
@@ -48,5 +133,5 @@ ```js | ||
- Removed jsstylesheet dependency and removed default style from javascript. If you want to use the default styles you can use one of the supported methods (see [README.md](https://github.com/reactjs/react-tabs#styling)) | ||
- The default class names were all lowercased and separated by hyphen, but still follow BEM methodology. E.g. `ReactTabs` -> `react-tabs`, `ReactTabs__TabPanel--selected` -> `react-tabs__tab-panel--selected` | ||
- `<TabPanel />` components do not set the inline style `display: none` anymore. Hidding and showing a tab panel is now completely done via css and classnames. If you have your own style for the tabs make sure to add the following rules: | ||
* Removed jsstylesheet dependency and removed default style from javascript. If you want to use the default styles you can use one of the supported methods (see [README.md](https://github.com/reactjs/react-tabs#styling)) | ||
* The default class names were all lowercased and separated by hyphen, but still follow BEM methodology. E.g. `ReactTabs` -> `react-tabs`, `ReactTabs__TabPanel--selected` -> `react-tabs__tab-panel--selected` | ||
* `<TabPanel />` components do not set the inline style `display: none` anymore. Hidding and showing a tab panel is now completely done via css and classnames. If you have your own style for the tabs make sure to add the following rules: | ||
@@ -64,154 +149,178 @@ ```css | ||
#### New Features | ||
<a name="0.8.3"></a> | ||
## [0.8.3](https://github.com/researchgate/node-package-blueprint/compare/v0.8.2...v0.8.3) (2017-04-19) | ||
- New static method to reset the id counter for isomorphic apps. Call this before rendering your application on the server. (#129) (Neehar Venugopal) | ||
### Bug Fixes | ||
```js | ||
import { resetIdCounter } from 'react-tabs'; | ||
* Fix deprecation warnings with react 15.5 | ||
resetIdCounter(); | ||
``` | ||
<a name="0.8.2"></a> | ||
## [0.8.2](https://github.com/researchgate/node-package-blueprint/compare/v0.8.1...v0.8.2) (2016-10-19) | ||
- Allows arbitrary components anywhere inside `<TabList>` (#139) (Alexander Wallin) | ||
- Allow random order of `<TabList />`, `<TabPanel />` and other arbitrary components. The `<TabPanel />` components are matched to the `<Tab />` components in order from top to bottom. | ||
### Bug Fixes | ||
```js | ||
<Tabs> | ||
<TabPanel /> | ||
<div /> | ||
<TabList> | ||
<Tab /> | ||
<Tab /> | ||
</TabList> | ||
<span /> | ||
<TabPanel /> | ||
</Tabs> | ||
``` | ||
* Fix UMD build ([#143](https://github.com/reactjs/react-tabs/pull/143)) | ||
- Introduce controlled and uncontrolled mode. This two modes allow either to control the tabs from your component from the outside or leave the control to the tabs within react-tabs components. (see [README.md](https://github.com/reactjs/react-tabs#controlled-vs-uncontrolled-mode) for more information) | ||
- New prop `selectedTabPanelClassName` on `<Tabs />` to change the class name of the current selected tab panel. | ||
- New prop `defaultIndex` on `<Tabs />` to allow setting the initial displayed tab. | ||
- New prop `forceRender` on `<TabPanel />` to allow force rendering of individual tab panels. | ||
- New prop `selectedClassName` on `<TabPanel />` to allow changing selected class name of individual tab panels. | ||
- New prop `selectedClassName` on `<Tab />` to allow changing selected class name of individual tabs. | ||
- New prop `disabledClassName` on `<Tab />` to allow changing disabled class name of individual tabs. | ||
- Property `className` on all components can now officially take an array as argument. | ||
- PropTypes are now wrapped in `if(process.env.NODE_ENV === 'production') Component.propTypes = { ... }` in order to allow removing of proptypes in production builds. | ||
<a name="0.8.0"></a> | ||
## [0.8.0](https://github.com/researchgate/node-package-blueprint/compare/v0.7.0...v0.8.0) (2016-09-14) | ||
#### Documentation | ||
### Features | ||
- Rewrite README.md | ||
- Change ReactDOM.render to render (#163) (Gerard Banasig) | ||
- Add NPM package badge (#164) (Hum4n01d) | ||
* Allow other components inside TabList ([#123](https://github.com/reactjs/react-tabs/pull/123)) | ||
#### Internal | ||
<a name="0.7.0"></a> | ||
## [0.7.0](https://github.com/researchgate/node-package-blueprint/compare/v0.6.2...v0.7.0) (2016-07-05) | ||
- Refactor components to use native classes (#134) (LeoAJ) | ||
- Refactor to not use react-dom and remove dependency on it | ||
- Update dependencies | ||
- Rename main.js to index.js | ||
- Update travis versions | ||
- Use prettier (#169) | ||
### Features | ||
### 0.8.3 (Apr 19, 2017) | ||
* Feature/add custom active and disabled class ([#108](https://github.com/reactjs/react-tabs/pull/108)) | ||
* Remove aria-expanded attribute ([#71](https://github.com/reactjs/react-tabs/pull/71)) | ||
- Fix deprecation warnings with react 15.5 | ||
### Bug Fixes | ||
### 0.8.2 (Oct 19, 2016) | ||
* Fix warning with react 15.2 | ||
- Fix UMD build (#143) | ||
<a name="0.6.2"></a> | ||
## [0.6.2](https://github.com/researchgate/node-package-blueprint/compare/v0.6.1...v0.6.2) (2016-06-24) | ||
### 0.8.0 (Sep 14, 2016) | ||
### Bug Fixes | ||
- Allow other components inside TabList (#123) | ||
* Fix bower bundling ([#111](https://github.com/reactjs/react-tabs/pull/111), [#112](https://github.com/reactjs/react-tabs/pull/112)) | ||
### 0.7.0 (Jul 05, 2016) | ||
<a name="0.6.1"></a> | ||
## [0.6.1](https://github.com/researchgate/node-package-blueprint/compare/v0.6.0...v0.6.1) (2016-06-23) | ||
- Feature/add custom active and disabled class (#108) | ||
- Remove aria-expanded attribute (#71) | ||
- Fix warning with react 15.2 | ||
### Bug Fixes | ||
### 0.6.2 (Jun 24, 2016) | ||
* Allow setState in onSelect ([#51](https://github.com/reactjs/react-tabs/pull/51), [#110](https://github.com/reactjs/react-tabs/pull/110)) | ||
- Fix bower bundling (#111, #112) | ||
<a name="0.6.0"></a> | ||
## [0.6.0](https://github.com/researchgate/node-package-blueprint/compare/v0.5.5...v0.6.0) (2016-06-20) | ||
### 0.6.1 (Jun 23, 2016) | ||
### Features | ||
- Allow setState in onSelect (#51, #110) | ||
* Add a cancel option to tab change event handler ([#73](https://github.com/reactjs/react-tabs/pull/73)) | ||
* Allow passing through custom attributes ([#93](https://github.com/reactjs/react-tabs/pull/93)) | ||
### 0.6.0 (Jun 20, 2016) | ||
### Bug Fixes | ||
- Add a cancel option to tab change event handler (#73) | ||
- DOMNode.setAttribute() expects the second param to be string (#75, #76) | ||
- Allow passing through custom attributes (#93) | ||
- Fix nesting of multiple instances of react-tabs (#103) | ||
* DOMNode.setAttribute() expects the second param to be string ([#75](https://github.com/reactjs/react-tabs/pull/75), [#76](https://github.com/reactjs/react-tabs/pull/76)) | ||
* Fix nesting of multiple instances of react-tabs ([#103](https://github.com/reactjs/react-tabs/pull/103)) | ||
### 0.5.5 (Jun 13, 2016) | ||
<a name="0.5.5"></a> | ||
## [0.5.5](https://github.com/researchgate/node-package-blueprint/compare/v0.5.4...v0.5.5) (2016-06-13) | ||
- Fix main exports of react tabs which were broken in 0.5.4 | ||
### Bug Fixes | ||
### 0.5.4 (Jun 10, 2016) | ||
* Fix main exports of react tabs which were broken in 0.5.4 | ||
- Update to support react 15 (#94) | ||
<a name="0.5.4"></a> | ||
## [0.5.4](https://github.com/researchgate/node-package-blueprint/compare/v0.5.4...v0.5.4) (2016-06-10) | ||
### 0.5.3 (Feb 01, 2016) | ||
### Bug Fixes | ||
- use correct spelling of aria-labelledby (#67) | ||
* Update to support react 15 ([#94](https://github.com/reactjs/react-tabs/pull/94)) | ||
### 0.5.2 (Jan 29, 2016) | ||
<a name="0.5.3"></a> | ||
## [0.5.3](https://github.com/researchgate/node-package-blueprint/compare/v0.5.2...v0.5.3) (2016-02-01) | ||
- Server Side Rendering won't work with default styles (#45) | ||
### Bug Fixes | ||
### 0.5.1 (Oct 22, 2015) | ||
* use correct spelling of aria-labelledby ([#67](https://github.com/reactjs/react-tabs/pull/67)) | ||
- Removing ReactDOM from bundle | ||
<a name="0.5.2"></a> | ||
## [0.5.2](https://github.com/researchgate/node-package-blueprint/compare/v0.5.1...v0.5.2) (2016-01-29) | ||
### 0.5.0 (Oct 22, 2015) | ||
### Bug Fixes | ||
- Fix conditional rendering of tabs (#37) | ||
- New configuration to disable styling via jss (#25) | ||
- Avoid white on white Tab labels (#40) | ||
- Support react 0.14 (#43) | ||
- Issue when conditionally rendering Tab/TabPanel (#37) | ||
* Server Side Rendering won't work with default styles ([#45](https://github.com/reactjs/react-tabs/pull/45)) | ||
### 0.4.1 (Sep 09, 2015) | ||
<a name="0.5.1"></a> | ||
## [0.5.1](https://github.com/researchgate/node-package-blueprint/compare/v0.5.0...v0.5.1) (2015-10-22) | ||
- Do not bundle react into dist (#26) | ||
### Bug Fixes | ||
### 0.4.0 (Aug 18, 2015) | ||
* Removing ReactDOM from bundle | ||
- Support rendering of hidden Tabs (#28) | ||
- Support supplying array of child nodes to Tab (#27) | ||
<a name="0.5.0"></a> | ||
## [0.5.0](https://github.com/researchgate/node-package-blueprint/compare/v0.4.1...v0.5.0) (2015-10-22) | ||
### 0.3.0 (Aug 11, 2015) | ||
### Features | ||
- Support for disabling tabs | ||
* New configuration to disable styling via jss ([#25](https://github.com/reactjs/react-tabs/pull/25)) | ||
* Avoid white on white Tab labels ([#40](https://github.com/reactjs/react-tabs/pull/40)) | ||
* Support react 0.14 ([#43](https://github.com/reactjs/react-tabs/pull/43)) | ||
### 0.2.1 (Jun 26, 2015) | ||
### Bug Fixes | ||
- Bower support (#22) | ||
- Issue with React being included twice (#23) | ||
* Fix conditional rendering of tabs ([#37](https://github.com/reactjs/react-tabs/pull/37)) | ||
* Issue when conditionally rendering Tab/TabPanel ([#37](https://github.com/reactjs/react-tabs/pull/37)) | ||
### 0.2.0 (Jun 07, 2015) | ||
<a name="0.4.1"></a> | ||
## [0.4.1](https://github.com/researchgate/node-package-blueprint/compare/v0.4.0...v0.4.1) (2015-09-22) | ||
- Allowing children of Tab to select Tab (#9) | ||
- Only render the selected TabPanel | ||
- Upgrading to React 0.13 | ||
- Removing JSX | ||
- Fixing issue with focus management (#7) | ||
- Fixing issue caused by no children being provided (#6) | ||
- Fixing issue that made dynamic Tabs difficult | ||
### Bug Fixes | ||
### 0.1.2 (Jul 23, 2014) | ||
* Do not bundle react into dist ([#26](https://github.com/reactjs/react-tabs/pull/26)) | ||
- Making Tab and TabPanel to be stateless | ||
- Throwing Error when Tab count and TabPanel count aren't equal | ||
<a name="0.4.0"></a> | ||
## [0.4.0](https://github.com/researchgate/node-package-blueprint/compare/v0.3.0...v0.4.0) (2015-08-18) | ||
### 0.1.1 (Jul 19, 2014) | ||
### Features | ||
- Fixing warning: Invalid access to component property | ||
- Fixing style weirdness in Firefox | ||
* Support rendering of hidden Tabs ([#28](https://github.com/reactjs/react-tabs/pull/28)) | ||
* Support supplying array of child nodes to Tab ([#27](https://github.com/reactjs/react-tabs/pull/27)) | ||
### 0.1.0 (Jul 18, 2014) | ||
<a name="0.3.0"></a> | ||
## [0.3.0](https://github.com/researchgate/node-package-blueprint/compare/v0.2.1...v0.3.0) (2015-08-11) | ||
- Initial release | ||
### Features | ||
* Support for disabling tabs | ||
<a name="0.2.1"></a> | ||
## [0.2.1](https://github.com/researchgate/node-package-blueprint/compare/v0.2.0...v0.2.1) (2015-01-26) | ||
### Bug Fixes | ||
* Bower support ([#22](https://github.com/reactjs/react-tabs/pull/22)) | ||
* Issue with React being included twice ([#23](https://github.com/reactjs/react-tabs/pull/23)) | ||
<a name="0.2.0"></a> | ||
## [0.2.0](https://github.com/researchgate/node-package-blueprint/compare/v0.1.2...v0.2.0) (2015-01-07) | ||
### Features | ||
* Allowing children of Tab to select Tab ([#9](https://github.com/reactjs/react-tabs/pull/9)) | ||
* Only render the selected TabPanel | ||
* Upgrading to React 0.13 | ||
* Removing JSX | ||
### Bug Fixes | ||
* Fixing issue with focus management ([#7](https://github.com/reactjs/react-tabs/pull/7)) | ||
* Fixing issue caused by no children being provided ([#6](https://github.com/reactjs/react-tabs/pull/6)) | ||
* Fixing issue that made dynamic Tabs difficult | ||
<a name="0.1.2"></a> | ||
## [0.1.2](https://github.com/researchgate/node-package-blueprint/compare/v0.1.1...v0.1.2) (2014-07-23) | ||
### Bug Fixes | ||
* Making Tab and TabPanel to be stateless | ||
* Throwing Error when Tab count and TabPanel count aren't equal | ||
<a name="0.1.1"></a> | ||
## [0.1.1](https://github.com/researchgate/node-package-blueprint/compare/v0.1.0...v0.1.1) (2014-07-19) | ||
### Bug Fixes | ||
* Fixing warning: Invalid access to component property | ||
* Fixing style weirdness in Firefox | ||
<a name="0.1.0"></a> | ||
## 0.1.0 (2014-07-18) | ||
### Features | ||
* Initial release |
@@ -10,3 +10,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
root["ReactTabs"] = factory(root["React"], root["PropTypes"], root["classNames"]); | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_5__) { | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_3__) { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
@@ -77,3 +77,3 @@ /******/ // The module cache | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 12); | ||
/******/ return __webpack_require__(__webpack_require__.s = 13); | ||
/******/ }) | ||
@@ -89,2 +89,8 @@ /************************************************************************/ | ||
/* 1 */ | ||
/***/ (function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_1__; | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -96,7 +102,234 @@ | ||
exports.__esModule = true; | ||
exports.isTab = isTab; | ||
exports.isTabPanel = isTabPanel; | ||
exports.isTabList = isTabList; | ||
function isTab(el) { | ||
return el.type.tabsRole === 'Tab'; | ||
} | ||
function isTabPanel(el) { | ||
return el.type.tabsRole === 'TabPanel'; | ||
} | ||
function isTabList(el) { | ||
return el.type.tabsRole === 'TabList'; | ||
} | ||
/***/ }), | ||
/* 3 */ | ||
/***/ (function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_3__; | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
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 _propTypes = __webpack_require__(3); | ||
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; }; | ||
exports.deepMap = deepMap; | ||
exports.deepForEach = deepForEach; | ||
var _react = __webpack_require__(0); | ||
var _elementTypes = __webpack_require__(2); | ||
function isTabChild(child) { | ||
return (0, _elementTypes.isTab)(child) || (0, _elementTypes.isTabList)(child) || (0, _elementTypes.isTabPanel)(child); | ||
} | ||
function deepMap(children, callback) { | ||
return _react.Children.map(children, function (child) { | ||
// null happens when conditionally rendering TabPanel/Tab | ||
// see https://github.com/reactjs/react-tabs/issues/37 | ||
if (child === null) return null; | ||
if (isTabChild(child)) { | ||
return callback(child); | ||
} | ||
if (child.props && child.props.children && _typeof(child.props.children) === 'object') { | ||
// Clone the child that has children and map them too | ||
return (0, _react.cloneElement)(child, _extends({}, child.props, { | ||
children: deepMap(child.props.children, callback) | ||
})); | ||
} | ||
return child; | ||
}); | ||
} | ||
function deepForEach(children, callback) { | ||
return _react.Children.forEach(children, function (child) { | ||
// null happens when conditionally rendering TabPanel/Tab | ||
// see https://github.com/reactjs/react-tabs/issues/37 | ||
if (child === null) return; | ||
if ((0, _elementTypes.isTab)(child) || (0, _elementTypes.isTabPanel)(child)) { | ||
callback(child); | ||
} else if (child.props && child.props.children && _typeof(child.props.children) === 'object') { | ||
if ((0, _elementTypes.isTabList)(child)) callback(child); | ||
deepForEach(child.props.children, callback); | ||
} | ||
}); | ||
} | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = uuid; | ||
exports.reset = reset; | ||
// Get a universally unique identifier | ||
var count = 0; | ||
function uuid() { | ||
return "react-tabs-" + count++; | ||
} | ||
function reset() { | ||
count = 0; | ||
} | ||
/***/ }), | ||
/* 6 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.getTabsCount = getTabsCount; | ||
exports.getPanelsCount = getPanelsCount; | ||
var _childrenDeepMap = __webpack_require__(4); | ||
var _elementTypes = __webpack_require__(2); | ||
function getTabsCount(children) { | ||
var tabCount = 0; | ||
(0, _childrenDeepMap.deepForEach)(children, function (child) { | ||
if ((0, _elementTypes.isTab)(child)) tabCount++; | ||
}); | ||
return tabCount; | ||
} | ||
function getPanelsCount(children) { | ||
var panelCount = 0; | ||
(0, _childrenDeepMap.deepForEach)(children, function (child) { | ||
if ((0, _elementTypes.isTabPanel)(child)) panelCount++; | ||
}); | ||
return panelCount; | ||
} | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
exports.__esModule = true; | ||
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; }; | ||
exports.childrenPropType = childrenPropType; | ||
exports.onSelectPropType = onSelectPropType; | ||
exports.selectedIndexPropType = selectedIndexPropType; | ||
var _childrenDeepMap = __webpack_require__(4); | ||
var _elementTypes = __webpack_require__(2); | ||
function childrenPropType(props, propName, componentName) { | ||
var error = void 0; | ||
var tabsCount = 0; | ||
var panelsCount = 0; | ||
var tabListFound = false; | ||
var listTabs = []; | ||
var children = props[propName]; | ||
(0, _childrenDeepMap.deepForEach)(children, function (child) { | ||
if ((0, _elementTypes.isTabList)(child)) { | ||
if (child.props && child.props.children && _typeof(child.props.children) === 'object') { | ||
(0, _childrenDeepMap.deepForEach)(child.props.children, function (listChild) { | ||
return listTabs.push(listChild); | ||
}); | ||
} | ||
if (tabListFound) { | ||
error = new Error("Found multiple 'TabList' components inside 'Tabs'. Only one is allowed."); | ||
} | ||
tabListFound = true; | ||
} | ||
if ((0, _elementTypes.isTab)(child)) { | ||
if (!tabListFound || listTabs.indexOf(child) === -1) { | ||
error = new Error("Found a 'Tab' component outside of the 'TabList' component. 'Tab' components have to be inside the 'TabList' component."); | ||
} | ||
tabsCount++; | ||
} else if ((0, _elementTypes.isTabPanel)(child)) { | ||
panelsCount++; | ||
} | ||
}); | ||
if (!error && tabsCount !== panelsCount) { | ||
error = new Error('There should be an equal number of \'Tab\' and \'TabPanel\' in `' + componentName + '`.' + ('Received ' + tabsCount + ' \'Tab\' and ' + panelsCount + ' \'TabPanel\'.')); | ||
} | ||
return error; | ||
} | ||
function onSelectPropType(props, propName, componentName, location, propFullName) { | ||
var prop = props[propName]; | ||
var name = propFullName || propName; | ||
var error = null; | ||
if (prop && typeof prop !== 'function') { | ||
error = new Error('Invalid ' + location + ' `' + name + '` of type `' + (typeof prop === 'undefined' ? 'undefined' : _typeof(prop)) + '` supplied to `' + componentName + '`, expected `function`.'); | ||
} else if (props.selectedIndex != null && prop == null) { | ||
error = new Error('The ' + location + ' `' + name + '` is marked as required in `' + componentName + '`, but its value is `undefined` or `null`.\n`onSelect` is required when `selectedIndex` is also set. Not doing so will make the tabs not do anything, as `selectedIndex` indicates that you want to handle the selected tab yourself.\nIf you only want to set the inital tab replace `selectedIndex` with `defaultIndex`.'); | ||
} | ||
return error; | ||
} | ||
function selectedIndexPropType(props, propName, componentName, location, propFullName) { | ||
var prop = props[propName]; | ||
var name = propFullName || propName; | ||
var error = null; | ||
if (prop != null && typeof prop !== 'number') { | ||
error = new Error('Invalid ' + location + ' `' + name + '` of type `' + (typeof prop === 'undefined' ? 'undefined' : _typeof(prop)) + '` supplied to `' + componentName + '`, expected `number`.'); | ||
} else if (props.defaultIndex != null && prop != null) { | ||
return new Error('The ' + location + ' `' + name + '` cannot be used together with `defaultIndex` in `' + componentName + '`.\nEither remove `' + name + '` to let `' + componentName + '` handle the selected tab internally or remove `defaultIndex` to handle it yourself.'); | ||
} | ||
return error; | ||
} | ||
/***/ }), | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
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 _propTypes = __webpack_require__(1); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
@@ -108,3 +341,3 @@ | ||
var _classnames = __webpack_require__(5); | ||
var _classnames = __webpack_require__(3); | ||
@@ -210,99 +443,7 @@ var _classnames2 = _interopRequireDefault(_classnames); | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Tab.tabsRole = 'Tab'; | ||
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 _propTypes = __webpack_require__(3); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _react = __webpack_require__(0); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _classnames = __webpack_require__(5); | ||
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; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var DEFAULT_CLASS = 'react-tabs__tab-panel'; | ||
var TabPanel = function (_Component) { | ||
_inherits(TabPanel, _Component); | ||
function TabPanel() { | ||
_classCallCheck(this, TabPanel); | ||
return _possibleConstructorReturn(this, _Component.apply(this, arguments)); | ||
} | ||
TabPanel.prototype.render = function render() { | ||
var _cx; | ||
var _props = this.props, | ||
children = _props.children, | ||
className = _props.className, | ||
forceRender = _props.forceRender, | ||
id = _props.id, | ||
selected = _props.selected, | ||
selectedClassName = _props.selectedClassName, | ||
tabId = _props.tabId, | ||
attributes = _objectWithoutProperties(_props, ['children', 'className', 'forceRender', 'id', 'selected', 'selectedClassName', 'tabId']); | ||
return _react2.default.createElement( | ||
'div', | ||
_extends({}, attributes, { | ||
className: (0, _classnames2.default)(className, (_cx = {}, _cx[selectedClassName] = selected, _cx)), | ||
role: 'tabpanel', | ||
id: id, | ||
'aria-labelledby': tabId | ||
}), | ||
forceRender || selected ? children : null | ||
); | ||
}; | ||
return TabPanel; | ||
}(_react.Component); | ||
TabPanel.defaultProps = { | ||
className: DEFAULT_CLASS, | ||
forceRender: false, | ||
selectedClassName: DEFAULT_CLASS + '--selected', | ||
style: {} | ||
}; | ||
exports.default = TabPanel; | ||
TabPanel.propTypes = true ? { | ||
children: _propTypes2.default.node, | ||
className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.array, _propTypes2.default.object]), | ||
forceRender: _propTypes2.default.bool, | ||
id: _propTypes2.default.string, // private | ||
selected: _propTypes2.default.bool, // private | ||
selectedClassName: _propTypes2.default.string, | ||
tabId: _propTypes2.default.string // private | ||
} : {}; | ||
/***/ }), | ||
/* 3 */ | ||
/***/ (function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_3__; | ||
/***/ }), | ||
/* 4 */ | ||
/* 9 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -317,3 +458,3 @@ | ||
var _propTypes = __webpack_require__(3); | ||
var _propTypes = __webpack_require__(1); | ||
@@ -326,3 +467,3 @@ var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _classnames = __webpack_require__(5); | ||
var _classnames = __webpack_require__(3); | ||
@@ -375,10 +516,7 @@ var _classnames2 = _interopRequireDefault(_classnames); | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_5__; | ||
TabList.tabsRole = 'TabList'; | ||
/***/ }), | ||
/* 6 */ | ||
/* 10 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -393,223 +531,85 @@ | ||
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 _propTypes = __webpack_require__(1); | ||
exports.deepMap = deepMap; | ||
exports.deepForEach = deepForEach; | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _react = __webpack_require__(0); | ||
var _Tab = __webpack_require__(1); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _Tab2 = _interopRequireDefault(_Tab); | ||
var _classnames = __webpack_require__(3); | ||
var _TabList = __webpack_require__(4); | ||
var _classnames2 = _interopRequireDefault(_classnames); | ||
var _TabList2 = _interopRequireDefault(_TabList); | ||
var _TabPanel = __webpack_require__(2); | ||
var _TabPanel2 = _interopRequireDefault(_TabPanel); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function isTabChild(child) { | ||
return child.type === _Tab2.default || child.type === _TabList2.default || child.type === _TabPanel2.default; | ||
} | ||
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 deepMap(children, callback) { | ||
return _react.Children.map(children, function (child) { | ||
// null happens when conditionally rendering TabPanel/Tab | ||
// see https://github.com/reactjs/react-tabs/issues/37 | ||
if (child === null) return null; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
if (isTabChild(child)) { | ||
return callback(child); | ||
} | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
if (child.props && child.props.children && _typeof(child.props.children) === 'object') { | ||
// Clone the child that has children and map them too | ||
return (0, _react.cloneElement)(child, _extends({}, child.props, { | ||
children: deepMap(child.props.children, callback) | ||
})); | ||
} | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
return child; | ||
}); | ||
} | ||
var DEFAULT_CLASS = 'react-tabs__tab-panel'; | ||
function deepForEach(children, callback) { | ||
return _react.Children.forEach(children, function (child) { | ||
// null happens when conditionally rendering TabPanel/Tab | ||
// see https://github.com/reactjs/react-tabs/issues/37 | ||
if (child === null) return; | ||
var TabPanel = function (_Component) { | ||
_inherits(TabPanel, _Component); | ||
if (child.type === _Tab2.default || child.type === _TabPanel2.default) { | ||
callback(child); | ||
} else if (child.props && child.props.children && _typeof(child.props.children) === 'object') { | ||
if (child.type === _TabList2.default) callback(child); | ||
deepForEach(child.props.children, callback); | ||
} | ||
}); | ||
} | ||
function TabPanel() { | ||
_classCallCheck(this, TabPanel); | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = uuid; | ||
exports.reset = reset; | ||
// Get a universally unique identifier | ||
var count = 0; | ||
function uuid() { | ||
return "react-tabs-" + count++; | ||
} | ||
function reset() { | ||
count = 0; | ||
} | ||
/***/ }), | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.getTabsCount = getTabsCount; | ||
exports.getPanelsCount = getPanelsCount; | ||
var _childrenDeepMap = __webpack_require__(6); | ||
var _Tab = __webpack_require__(1); | ||
var _Tab2 = _interopRequireDefault(_Tab); | ||
var _TabPanel = __webpack_require__(2); | ||
var _TabPanel2 = _interopRequireDefault(_TabPanel); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function getTabsCount(children) { | ||
var tabCount = 0; | ||
(0, _childrenDeepMap.deepForEach)(children, function (child) { | ||
if (child.type === _Tab2.default) tabCount++; | ||
}); | ||
return tabCount; | ||
} | ||
function getPanelsCount(children) { | ||
var panelCount = 0; | ||
(0, _childrenDeepMap.deepForEach)(children, function (child) { | ||
if (child.type === _TabPanel2.default) panelCount++; | ||
}); | ||
return panelCount; | ||
} | ||
/***/ }), | ||
/* 9 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
exports.__esModule = true; | ||
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; }; | ||
exports.childrenPropType = childrenPropType; | ||
exports.onSelectPropType = onSelectPropType; | ||
exports.selectedIndexPropType = selectedIndexPropType; | ||
var _childrenDeepMap = __webpack_require__(6); | ||
var _Tab = __webpack_require__(1); | ||
var _Tab2 = _interopRequireDefault(_Tab); | ||
var _TabList = __webpack_require__(4); | ||
var _TabList2 = _interopRequireDefault(_TabList); | ||
var _TabPanel = __webpack_require__(2); | ||
var _TabPanel2 = _interopRequireDefault(_TabPanel); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function childrenPropType(props, propName, componentName) { | ||
var error = void 0; | ||
var tabsCount = 0; | ||
var panelsCount = 0; | ||
var tabListFound = false; | ||
var listTabs = []; | ||
var children = props[propName]; | ||
(0, _childrenDeepMap.deepForEach)(children, function (child) { | ||
if (child.type === _TabList2.default) { | ||
if (child.props && child.props.children && _typeof(child.props.children) === 'object') { | ||
(0, _childrenDeepMap.deepForEach)(child.props.children, function (listChild) { | ||
return listTabs.push(listChild); | ||
}); | ||
} | ||
if (tabListFound) { | ||
error = new Error("Found multiple 'TabList' components inside 'Tabs'. Only one is allowed."); | ||
} | ||
tabListFound = true; | ||
} | ||
if (child.type === _Tab2.default) { | ||
if (!tabListFound || listTabs.indexOf(child) === -1) { | ||
error = new Error("Found a 'Tab' component outside of the 'TabList' component. 'Tab' components have to be inside the 'TabList' component."); | ||
} | ||
tabsCount++; | ||
} else if (child.type === _TabPanel2.default) { | ||
panelsCount++; | ||
} | ||
}); | ||
if (!error && tabsCount !== panelsCount) { | ||
error = new Error('There should be an equal number of \'Tab\' and \'TabPanel\' in `' + componentName + '`.' + ('Received ' + tabsCount + ' \'Tab\' and ' + panelsCount + ' \'TabPanel\'.')); | ||
return _possibleConstructorReturn(this, _Component.apply(this, arguments)); | ||
} | ||
return error; | ||
} | ||
TabPanel.prototype.render = function render() { | ||
var _cx; | ||
function onSelectPropType(props, propName, componentName, location, propFullName) { | ||
var prop = props[propName]; | ||
var name = propFullName || propName; | ||
var error = null; | ||
var _props = this.props, | ||
children = _props.children, | ||
className = _props.className, | ||
forceRender = _props.forceRender, | ||
id = _props.id, | ||
selected = _props.selected, | ||
selectedClassName = _props.selectedClassName, | ||
tabId = _props.tabId, | ||
attributes = _objectWithoutProperties(_props, ['children', 'className', 'forceRender', 'id', 'selected', 'selectedClassName', 'tabId']); | ||
if (prop && typeof prop !== 'function') { | ||
error = new Error('Invalid ' + location + ' `' + name + '` of type `' + (typeof prop === 'undefined' ? 'undefined' : _typeof(prop)) + '` supplied to `' + componentName + '`, expected `function`.'); | ||
} else if (props.selectedIndex != null && prop == null) { | ||
error = new Error('The ' + location + ' `' + name + '` is marked as required in `' + componentName + '`, but its value is `undefined` or `null`.\n`onSelect` is required when `selectedIndex` is also set. Not doing so will make the tabs not do anything, as `selectedIndex` indicates that you want to handle the selected tab yourself.\nIf you only want to set the inital tab replace `selectedIndex` with `defaultIndex`.'); | ||
} | ||
return _react2.default.createElement( | ||
'div', | ||
_extends({}, attributes, { | ||
className: (0, _classnames2.default)(className, (_cx = {}, _cx[selectedClassName] = selected, _cx)), | ||
role: 'tabpanel', | ||
id: id, | ||
'aria-labelledby': tabId | ||
}), | ||
forceRender || selected ? children : null | ||
); | ||
}; | ||
return error; | ||
} | ||
return TabPanel; | ||
}(_react.Component); | ||
function selectedIndexPropType(props, propName, componentName, location, propFullName) { | ||
var prop = props[propName]; | ||
var name = propFullName || propName; | ||
var error = null; | ||
TabPanel.defaultProps = { | ||
className: DEFAULT_CLASS, | ||
forceRender: false, | ||
selectedClassName: DEFAULT_CLASS + '--selected', | ||
style: {} | ||
}; | ||
exports.default = TabPanel; | ||
TabPanel.propTypes = true ? { | ||
children: _propTypes2.default.node, | ||
className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.array, _propTypes2.default.object]), | ||
forceRender: _propTypes2.default.bool, | ||
id: _propTypes2.default.string, // private | ||
selected: _propTypes2.default.bool, // private | ||
selectedClassName: _propTypes2.default.string, | ||
tabId: _propTypes2.default.string // private | ||
} : {}; | ||
if (prop != null && typeof prop !== 'number') { | ||
error = new Error('Invalid ' + location + ' `' + name + '` of type `' + (typeof prop === 'undefined' ? 'undefined' : _typeof(prop)) + '` supplied to `' + componentName + '`, expected `number`.'); | ||
} else if (props.defaultIndex != null && prop != null) { | ||
return new Error('The ' + location + ' `' + name + '` cannot be used together with `defaultIndex` in `' + componentName + '`.\nEither remove `' + name + '` to let `' + componentName + '` handle the selected tab internally or remove `defaultIndex` to handle it yourself.'); | ||
} | ||
return error; | ||
} | ||
TabPanel.tabsRole = 'TabPanel'; | ||
/***/ }), | ||
/* 10 */ | ||
/* 11 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -622,3 +622,3 @@ | ||
var _propTypes = __webpack_require__(3); | ||
var _propTypes = __webpack_require__(1); | ||
@@ -631,9 +631,9 @@ var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _propTypes3 = __webpack_require__(9); | ||
var _propTypes3 = __webpack_require__(7); | ||
var _UncontrolledTabs = __webpack_require__(11); | ||
var _UncontrolledTabs = __webpack_require__(12); | ||
var _UncontrolledTabs2 = _interopRequireDefault(_UncontrolledTabs); | ||
var _count = __webpack_require__(8); | ||
var _count = __webpack_require__(6); | ||
@@ -766,4 +766,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
Tabs.tabsRole = 'Tabs'; | ||
/***/ }), | ||
/* 11 */ | ||
/* 12 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -778,3 +781,3 @@ | ||
var _propTypes = __webpack_require__(3); | ||
var _propTypes = __webpack_require__(1); | ||
@@ -787,28 +790,18 @@ var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _classnames = __webpack_require__(5); | ||
var _classnames = __webpack_require__(3); | ||
var _classnames2 = _interopRequireDefault(_classnames); | ||
var _uuid = __webpack_require__(7); | ||
var _uuid = __webpack_require__(5); | ||
var _uuid2 = _interopRequireDefault(_uuid); | ||
var _propTypes3 = __webpack_require__(9); | ||
var _propTypes3 = __webpack_require__(7); | ||
var _Tab = __webpack_require__(1); | ||
var _count = __webpack_require__(6); | ||
var _Tab2 = _interopRequireDefault(_Tab); | ||
var _childrenDeepMap = __webpack_require__(4); | ||
var _TabList = __webpack_require__(4); | ||
var _elementTypes = __webpack_require__(2); | ||
var _TabList2 = _interopRequireDefault(_TabList); | ||
var _TabPanel = __webpack_require__(2); | ||
var _TabPanel2 = _interopRequireDefault(_TabPanel); | ||
var _count = __webpack_require__(8); | ||
var _childrenDeepMap = __webpack_require__(6); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -834,3 +827,12 @@ | ||
var canUseActiveElement = !!(typeof window !== 'undefined' && window.document && window.document.activeElement); | ||
var canUseActiveElement = void 0; | ||
try { | ||
canUseActiveElement = !!(typeof window !== 'undefined' && window.document && window.document.activeElement); | ||
} catch (e) { | ||
// Work around for IE bug when accessing document.activeElement in an iframe | ||
// Refer to the following resources: | ||
// http://stackoverflow.com/a/10982960/369687 | ||
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12733599 | ||
canUseActiveElement = false; | ||
} | ||
@@ -889,4 +891,2 @@ var UncontrolledTabs = function (_Component) { | ||
UncontrolledTabs.prototype.setSelected = function setSelected(index, event) { | ||
// Don't do anything if nothing has changed | ||
if (index === this.props.selectedIndex) return; | ||
// Check index boundary | ||
@@ -985,3 +985,3 @@ if (index < 0 || index >= this.getTabsCount()) return; | ||
// Clone TabList and Tab components to have refs | ||
if (child.type === _TabList2.default) { | ||
if ((0, _elementTypes.isTabList)(child)) { | ||
var listIndex = 0; | ||
@@ -994,5 +994,3 @@ | ||
if (canUseActiveElement) { | ||
wasTabFocused = _react2.default.Children.toArray(child.props.children).filter(function (tab) { | ||
return tab.type === _Tab2.default; | ||
}).some(function (tab, i) { | ||
wasTabFocused = _react2.default.Children.toArray(child.props.children).filter(_elementTypes.isTab).some(function (tab, i) { | ||
return document.activeElement === _this2.getTab(i); | ||
@@ -1025,3 +1023,3 @@ }); | ||
}); | ||
} else if (child.type === _TabPanel2.default) { | ||
} else if ((0, _elementTypes.isTabPanel)(child)) { | ||
var props = { | ||
@@ -1119,3 +1117,3 @@ id: _this2.panelIds[index], | ||
/***/ }), | ||
/* 12 */ | ||
/* 13 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -1129,19 +1127,19 @@ | ||
var _Tabs = __webpack_require__(10); | ||
var _Tabs = __webpack_require__(11); | ||
var _Tabs2 = _interopRequireDefault(_Tabs); | ||
var _TabList = __webpack_require__(4); | ||
var _TabList = __webpack_require__(9); | ||
var _TabList2 = _interopRequireDefault(_TabList); | ||
var _Tab = __webpack_require__(1); | ||
var _Tab = __webpack_require__(8); | ||
var _Tab2 = _interopRequireDefault(_Tab); | ||
var _TabPanel = __webpack_require__(2); | ||
var _TabPanel = __webpack_require__(10); | ||
var _TabPanel2 = _interopRequireDefault(_TabPanel); | ||
var _uuid = __webpack_require__(7); | ||
var _uuid = __webpack_require__(5); | ||
@@ -1148,0 +1146,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("classnames")):"function"==typeof define&&define.amd?define(["react","classnames"],t):"object"==typeof exports?exports.ReactTabs=t(require("react"),require("classnames")):e.ReactTabs=t(e.React,e.classNames)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=10)}([function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(0),i=r(u),f=n(3),p=r(f),d=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return l(t,e),t.prototype.componentDidMount=function(){this.checkFocus()},t.prototype.componentDidUpdate=function(){this.checkFocus()},t.prototype.checkFocus=function(){this.props.selected&&this.props.focus&&this.node.focus()},t.prototype.render=function(){var e,t=this,n=this.props,r=n.children,a=n.className,s=n.disabled,l=n.disabledClassName,u=(n.focus,n.id),f=n.panelId,d=n.selected,b=n.selectedClassName,h=n.tabRef,y=o(n,["children","className","disabled","disabledClassName","focus","id","panelId","selected","selectedClassName","tabRef"]);return i.default.createElement("li",c({},y,{className:(0,p.default)(a,(e={},e[b]=d,e[l]=s,e)),ref:function(e){t.node=e,h&&h(e)},role:"tab",id:u,"aria-selected":d?"true":"false","aria-disabled":s?"true":"false","aria-controls":f,tabIndex:d?"0":null}),r)},t}(u.Component);d.defaultProps={className:"react-tabs__tab",disabledClassName:"react-tabs__tab--disabled",focus:!1,id:null,panelId:null,selected:!1,selectedClassName:"react-tabs__tab--selected"},t.default=d,d.propTypes={}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(0),i=r(u),f=n(3),p=r(f),d=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return l(t,e),t.prototype.render=function(){var e,t=this.props,n=t.children,r=t.className,a=t.forceRender,s=t.id,l=t.selected,u=t.selectedClassName,f=t.tabId,d=o(t,["children","className","forceRender","id","selected","selectedClassName","tabId"]);return i.default.createElement("div",c({},d,{className:(0,p.default)(r,(e={},e[u]=l,e)),role:"tabpanel",id:s,"aria-labelledby":f}),a||l?n:null)},t}(u.Component);d.defaultProps={className:"react-tabs__tab-panel",forceRender:!1,selectedClassName:"react-tabs__tab-panel--selected",style:{}},t.default=d,d.propTypes={}},function(e,n){e.exports=t},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(0),i=r(u),f=n(3),p=r(f),d=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return l(t,e),t.prototype.render=function(){var e=this.props,t=e.children,n=e.className,r=o(e,["children","className"]);return i.default.createElement("ul",c({},r,{className:(0,p.default)(n),role:"tablist"}),t)},t}(u.Component);d.defaultProps={className:"react-tabs__tab-list"},t.default=d,d.propTypes={}},function(e,t,n){"use strict";function r(){return"react-tabs-"+a++}function o(){a=0}t.__esModule=!0,t.default=r,t.reset=o;var a=0},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){return e.type===f.default||e.type===d.default||e.type===h.default}function a(e,t){return u.Children.map(e,function(e){return null===e?null:o(e)?t(e):e.props&&e.props.children&&"object"===c(e.props.children)?(0,u.cloneElement)(e,l({},e.props,{children:a(e.props.children,t)})):e})}function s(e,t){return u.Children.forEach(e,function(e){null!==e&&(e.type===f.default||e.type===h.default?t(e):e.props&&e.props.children&&"object"===c(e.props.children)&&(e.type===d.default&&t(e),s(e.props.children,t)))})}t.__esModule=!0;var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.deepMap=a,t.deepForEach=s;var u=n(0),i=n(1),f=r(i),p=n(4),d=r(p),b=n(2),h=r(b)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=0;return(0,s.deepForEach)(e,function(e){e.type===c.default&&t++}),t}function a(e){var t=0;return(0,s.deepForEach)(e,function(e){e.type===i.default&&t++}),t}t.__esModule=!0,t.getTabsCount=o,t.getPanelsCount=a;var s=n(6),l=n(1),c=r(l),u=n(2),i=r(u)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var c=n(0),u=r(c),i=n(9),f=r(i),p=n(7),d=function(e){function t(n){a(this,t);var r=s(this,e.call(this,n));return r.handleSelected=function(e,n,o){if("function"!=typeof r.props.onSelect||!1!==r.props.onSelect(e,n,o)){var a={focus:"keydown"===o.type};t.inUncontrolledMode(r.props)&&(a.selectedIndex=e),r.setState(a)}},r.state=t.copyPropsToState(r.props,{},r.props.defaultFocus),r}return l(t,e),t.prototype.componentWillReceiveProps=function(e){this.setState(function(n){return t.copyPropsToState(e,n)})},t.inUncontrolledMode=function(e){return null===e.selectedIndex},t.copyPropsToState=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o={focus:r};if(t.inUncontrolledMode(e)){var a=(0,p.getTabsCount)(e.children)-1,s=null;s=null!=n.selectedIndex?Math.min(n.selectedIndex,a):e.defaultIndex||0,o.selectedIndex=s}return o},t.prototype.render=function(){var e=this.props,t=e.children,n=(e.defaultIndex,e.defaultFocus,o(e,["children","defaultIndex","defaultFocus"]));return n.focus=this.state.focus,n.onSelect=this.handleSelected,null!=this.state.selectedIndex&&(n.selectedIndex=this.state.selectedIndex),u.default.createElement(f.default,n,t)},t}(c.Component);d.defaultProps={defaultFocus:!1,forceRenderTabPanel:!1,selectedIndex:null,defaultIndex:null},t.default=d,d.propTypes={}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function c(e){return"LI"===e.nodeName&&"tab"===e.getAttribute("role")}function u(e){return"true"===e.getAttribute("aria-disabled")}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f=n(0),p=r(f),d=n(3),b=r(d),h=n(5),y=r(h),m=n(1),v=r(m),_=n(4),T=r(_),C=n(2),O=r(C),w=n(7),g=n(6),N=!("undefined"==typeof window||!window.document||!window.document.activeElement),P=function(e){function t(){var n,r,o;a(this,t);for(var l=arguments.length,i=Array(l),f=0;f<l;f++)i[f]=arguments[f];return n=r=s(this,e.call.apply(e,[this].concat(i))),r.tabNodes=[],r.handleKeyDown=function(e){if(r.isTabFromContainer(e.target)){var t=r.props.selectedIndex,n=!1;37===e.keyCode||38===e.keyCode?(t=r.getPrevTab(t),n=!0):39!==e.keyCode&&40!==e.keyCode||(t=r.getNextTab(t),n=!0),n&&e.preventDefault(),r.setSelected(t,e)}},r.handleClick=function(e){var t=e.target;do{if(r.isTabFromContainer(t)){if(u(t))return;var n=[].slice.call(t.parentNode.children).filter(c).indexOf(t);return void r.setSelected(n,e)}}while(null!==(t=t.parentNode))},o=n,s(r,o)}return l(t,e),t.prototype.setSelected=function(e,t){e!==this.props.selectedIndex&&(e<0||e>=this.getTabsCount()||this.props.onSelect(e,this.props.selectedIndex,t))},t.prototype.getNextTab=function(e){for(var t=this.getTabsCount(),n=e+1;n<t;n++)if(!u(this.getTab(n)))return n;for(var r=0;r<e;r++)if(!u(this.getTab(r)))return r;return e},t.prototype.getPrevTab=function(e){for(var t=e;t--;)if(!u(this.getTab(t)))return t;for(t=this.getTabsCount();t-- >e;)if(!u(this.getTab(t)))return t;return e},t.prototype.getTabsCount=function(){return(0,w.getTabsCount)(this.props.children)},t.prototype.getPanelsCount=function(){return(0,w.getPanelsCount)(this.props.children)},t.prototype.getTab=function(e){return this.tabNodes["tabs-"+e]},t.prototype.getChildren=function(){var e=this,t=0,n=this.props,r=n.children,o=n.disabledTabClassName,a=n.focus,s=n.forceRenderTabPanel,l=n.selectedIndex,c=n.selectedTabClassName,u=n.selectedTabPanelClassName;this.tabIds=this.tabIds||[],this.panelIds=this.panelIds||[];for(var i=this.tabIds.length-this.getTabsCount();i++<0;)this.tabIds.push((0,y.default)()),this.panelIds.push((0,y.default)());return(0,g.deepMap)(r,function(n){var r=n;if(n.type===T.default){var i=0,d=!1;N&&(d=p.default.Children.toArray(n.props.children).filter(function(e){return e.type===v.default}).some(function(t,n){return document.activeElement===e.getTab(n)})),r=(0,f.cloneElement)(n,{children:(0,g.deepMap)(n.props.children,function(t){var n="tabs-"+i,r=l===i,s={tabRef:function(t){e.tabNodes[n]=t},id:e.tabIds[i],panelId:e.panelIds[i],selected:r,focus:r&&(a||d)};return c&&(s.selectedClassName=c),o&&(s.disabledClassName=o),i++,(0,f.cloneElement)(t,s)})})}else if(n.type===O.default){var b={id:e.panelIds[t],tabId:e.tabIds[t],selected:l===t};s&&(b.forceRender=s),u&&(b.selectedClassName=u),t++,r=(0,f.cloneElement)(n,b)}return r})},t.prototype.isTabFromContainer=function(e){if(!c(e))return!1;var t=e.parentElement;do{if(t===this.node)return!0;if(t.getAttribute("data-tabs"))break;t=t.parentElement}while(t);return!1},t.prototype.render=function(){var e=this,t=this.props,n=(t.children,t.className),r=(t.disabledTabClassName,t.focus,t.forceRenderTabPanel,t.onSelect,t.selectedIndex,t.selectedTabClassName,t.selectedTabPanelClassName,o(t,["children","className","disabledTabClassName","focus","forceRenderTabPanel","onSelect","selectedIndex","selectedTabClassName","selectedTabPanelClassName"]));return p.default.createElement("div",i({},r,{className:(0,b.default)(n),onClick:this.handleClick,onKeyDown:this.handleKeyDown,ref:function(t){e.node=t},"data-tabs":!0}),this.getChildren())},t}(f.Component);P.defaultProps={className:"react-tabs",focus:!1},t.default=P,P.propTypes={}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.resetIdCounter=t.Tabs=t.TabPanel=t.TabList=t.Tab=void 0;var o=n(8),a=r(o),s=n(4),l=r(s),c=n(1),u=r(c),i=n(2),f=r(i),p=n(5);t.Tab=u.default,t.TabList=l.default,t.TabPanel=f.default,t.Tabs=a.default,t.resetIdCounter=p.reset}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("classnames")):"function"==typeof define&&define.amd?define(["react","classnames"],t):"object"==typeof exports?exports.ReactTabs=t(require("react"),require("classnames")):e.ReactTabs=t(e.React,e.classNames)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=11)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";function r(e){return"Tab"===e.type.tabsRole}function o(e){return"TabPanel"===e.type.tabsRole}function a(e){return"TabList"===e.type.tabsRole}t.__esModule=!0,t.isTab=r,t.isTabPanel=o,t.isTabList=a},function(e,t,n){"use strict";function r(){return"react-tabs-"+a++}function o(){a=0}t.__esModule=!0,t.default=r,t.reset=o;var a=0},function(e,t,n){"use strict";function r(e){return(0,c.isTab)(e)||(0,c.isTabList)(e)||(0,c.isTabPanel)(e)}function o(e,t){return i.Children.map(e,function(e){return null===e?null:r(e)?t(e):e.props&&e.props.children&&"object"===l(e.props.children)?(0,i.cloneElement)(e,s({},e.props,{children:o(e.props.children,t)})):e})}function a(e,t){return i.Children.forEach(e,function(e){null!==e&&((0,c.isTab)(e)||(0,c.isTabPanel)(e)?t(e):e.props&&e.props.children&&"object"===l(e.props.children)&&((0,c.isTabList)(e)&&t(e),a(e.props.children,t)))})}t.__esModule=!0;var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.deepMap=o,t.deepForEach=a;var i=n(0),c=n(2)},function(e,t,n){"use strict";function r(e){var t=0;return(0,a.deepForEach)(e,function(e){(0,s.isTab)(e)&&t++}),t}function o(e){var t=0;return(0,a.deepForEach)(e,function(e){(0,s.isTabPanel)(e)&&t++}),t}t.__esModule=!0,t.getTabsCount=r,t.getPanelsCount=o;var a=n(4),s=n(2)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=n(0),u=r(c),f=n(1),p=r(f),d=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return l(t,e),t.prototype.componentDidMount=function(){this.checkFocus()},t.prototype.componentDidUpdate=function(){this.checkFocus()},t.prototype.checkFocus=function(){this.props.selected&&this.props.focus&&this.node.focus()},t.prototype.render=function(){var e,t=this,n=this.props,r=n.children,a=n.className,s=n.disabled,l=n.disabledClassName,c=(n.focus,n.id),f=n.panelId,d=n.selected,b=n.selectedClassName,h=n.tabRef,y=o(n,["children","className","disabled","disabledClassName","focus","id","panelId","selected","selectedClassName","tabRef"]);return u.default.createElement("li",i({},y,{className:(0,p.default)(a,(e={},e[b]=d,e[l]=s,e)),ref:function(e){t.node=e,h&&h(e)},role:"tab",id:c,"aria-selected":d?"true":"false","aria-disabled":s?"true":"false","aria-controls":f,tabIndex:d?"0":null}),r)},t}(c.Component);d.defaultProps={className:"react-tabs__tab",disabledClassName:"react-tabs__tab--disabled",focus:!1,id:null,panelId:null,selected:!1,selectedClassName:"react-tabs__tab--selected"},t.default=d,d.propTypes={},d.tabsRole="Tab"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=n(0),u=r(c),f=n(1),p=r(f),d=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return l(t,e),t.prototype.render=function(){var e=this.props,t=e.children,n=e.className,r=o(e,["children","className"]);return u.default.createElement("ul",i({},r,{className:(0,p.default)(n),role:"tablist"}),t)},t}(c.Component);d.defaultProps={className:"react-tabs__tab-list"},t.default=d,d.propTypes={},d.tabsRole="TabList"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=n(0),u=r(c),f=n(1),p=r(f),d=function(e){function t(){return a(this,t),s(this,e.apply(this,arguments))}return l(t,e),t.prototype.render=function(){var e,t=this.props,n=t.children,r=t.className,a=t.forceRender,s=t.id,l=t.selected,c=t.selectedClassName,f=t.tabId,d=o(t,["children","className","forceRender","id","selected","selectedClassName","tabId"]);return u.default.createElement("div",i({},d,{className:(0,p.default)(r,(e={},e[c]=l,e)),role:"tabpanel",id:s,"aria-labelledby":f}),a||l?n:null)},t}(c.Component);d.defaultProps={className:"react-tabs__tab-panel",forceRender:!1,selectedClassName:"react-tabs__tab-panel--selected",style:{}},t.default=d,d.propTypes={},d.tabsRole="TabPanel"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var i=n(0),c=r(i),u=n(10),f=r(u),p=n(5),d=function(e){function t(n){a(this,t);var r=s(this,e.call(this,n));return r.handleSelected=function(e,n,o){if("function"!=typeof r.props.onSelect||!1!==r.props.onSelect(e,n,o)){var a={focus:"keydown"===o.type};t.inUncontrolledMode(r.props)&&(a.selectedIndex=e),r.setState(a)}},r.state=t.copyPropsToState(r.props,{},r.props.defaultFocus),r}return l(t,e),t.prototype.componentWillReceiveProps=function(e){this.setState(function(n){return t.copyPropsToState(e,n)})},t.inUncontrolledMode=function(e){return null===e.selectedIndex},t.copyPropsToState=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o={focus:r};if(t.inUncontrolledMode(e)){var a=(0,p.getTabsCount)(e.children)-1,s=null;s=null!=n.selectedIndex?Math.min(n.selectedIndex,a):e.defaultIndex||0,o.selectedIndex=s}return o},t.prototype.render=function(){var e=this.props,t=e.children,n=(e.defaultIndex,e.defaultFocus,o(e,["children","defaultIndex","defaultFocus"]));return n.focus=this.state.focus,n.onSelect=this.handleSelected,null!=this.state.selectedIndex&&(n.selectedIndex=this.state.selectedIndex),c.default.createElement(f.default,n,t)},t}(i.Component);d.defaultProps={defaultFocus:!1,forceRenderTabPanel:!1,selectedIndex:null,defaultIndex:null},t.default=d,d.propTypes={},d.tabsRole="Tabs"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e){return"LI"===e.nodeName&&"tab"===e.getAttribute("role")}function c(e){return"true"===e.getAttribute("aria-disabled")}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f=n(0),p=r(f),d=n(1),b=r(d),h=n(3),y=r(h),m=n(5),T=n(4),v=n(2),_=void 0;try{_=!("undefined"==typeof window||!window.document||!window.document.activeElement)}catch(e){_=!1}var C=function(e){function t(){var n,r,o;a(this,t);for(var l=arguments.length,u=Array(l),f=0;f<l;f++)u[f]=arguments[f];return n=r=s(this,e.call.apply(e,[this].concat(u))),r.tabNodes=[],r.handleKeyDown=function(e){if(r.isTabFromContainer(e.target)){var t=r.props.selectedIndex,n=!1;37===e.keyCode||38===e.keyCode?(t=r.getPrevTab(t),n=!0):39!==e.keyCode&&40!==e.keyCode||(t=r.getNextTab(t),n=!0),n&&e.preventDefault(),r.setSelected(t,e)}},r.handleClick=function(e){var t=e.target;do{if(r.isTabFromContainer(t)){if(c(t))return;var n=[].slice.call(t.parentNode.children).filter(i).indexOf(t);return void r.setSelected(n,e)}}while(null!==(t=t.parentNode))},o=n,s(r,o)}return l(t,e),t.prototype.setSelected=function(e,t){e<0||e>=this.getTabsCount()||this.props.onSelect(e,this.props.selectedIndex,t)},t.prototype.getNextTab=function(e){for(var t=this.getTabsCount(),n=e+1;n<t;n++)if(!c(this.getTab(n)))return n;for(var r=0;r<e;r++)if(!c(this.getTab(r)))return r;return e},t.prototype.getPrevTab=function(e){for(var t=e;t--;)if(!c(this.getTab(t)))return t;for(t=this.getTabsCount();t-- >e;)if(!c(this.getTab(t)))return t;return e},t.prototype.getTabsCount=function(){return(0,m.getTabsCount)(this.props.children)},t.prototype.getPanelsCount=function(){return(0,m.getPanelsCount)(this.props.children)},t.prototype.getTab=function(e){return this.tabNodes["tabs-"+e]},t.prototype.getChildren=function(){var e=this,t=0,n=this.props,r=n.children,o=n.disabledTabClassName,a=n.focus,s=n.forceRenderTabPanel,l=n.selectedIndex,i=n.selectedTabClassName,c=n.selectedTabPanelClassName;this.tabIds=this.tabIds||[],this.panelIds=this.panelIds||[];for(var u=this.tabIds.length-this.getTabsCount();u++<0;)this.tabIds.push((0,y.default)()),this.panelIds.push((0,y.default)());return(0,T.deepMap)(r,function(n){var r=n;if((0,v.isTabList)(n)){var u=0,d=!1;_&&(d=p.default.Children.toArray(n.props.children).filter(v.isTab).some(function(t,n){return document.activeElement===e.getTab(n)})),r=(0,f.cloneElement)(n,{children:(0,T.deepMap)(n.props.children,function(t){var n="tabs-"+u,r=l===u,s={tabRef:function(t){e.tabNodes[n]=t},id:e.tabIds[u],panelId:e.panelIds[u],selected:r,focus:r&&(a||d)};return i&&(s.selectedClassName=i),o&&(s.disabledClassName=o),u++,(0,f.cloneElement)(t,s)})})}else if((0,v.isTabPanel)(n)){var b={id:e.panelIds[t],tabId:e.tabIds[t],selected:l===t};s&&(b.forceRender=s),c&&(b.selectedClassName=c),t++,r=(0,f.cloneElement)(n,b)}return r})},t.prototype.isTabFromContainer=function(e){if(!i(e))return!1;var t=e.parentElement;do{if(t===this.node)return!0;if(t.getAttribute("data-tabs"))break;t=t.parentElement}while(t);return!1},t.prototype.render=function(){var e=this,t=this.props,n=(t.children,t.className),r=(t.disabledTabClassName,t.focus,t.forceRenderTabPanel,t.onSelect,t.selectedIndex,t.selectedTabClassName,t.selectedTabPanelClassName,o(t,["children","className","disabledTabClassName","focus","forceRenderTabPanel","onSelect","selectedIndex","selectedTabClassName","selectedTabPanelClassName"]));return p.default.createElement("div",u({},r,{className:(0,b.default)(n),onClick:this.handleClick,onKeyDown:this.handleKeyDown,ref:function(t){e.node=t},"data-tabs":!0}),this.getChildren())},t}(f.Component);C.defaultProps={className:"react-tabs",focus:!1},t.default=C,C.propTypes={}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.resetIdCounter=t.Tabs=t.TabPanel=t.TabList=t.Tab=void 0;var o=n(9),a=r(o),s=n(7),l=r(s),i=n(6),c=r(i),u=n(8),f=r(u),p=n(3);t.Tab=c.default,t.TabList=l.default,t.TabPanel=f.default,t.Tabs=a.default,t.resetIdCounter=p.reset}])}); | ||
//# sourceMappingURL=react-tabs.min.js.map |
@@ -114,2 +114,5 @@ 'use strict'; | ||
tabRef: _propTypes2.default.func // private | ||
} : {}; | ||
} : {}; | ||
Tab.tabsRole = 'Tab'; |
@@ -61,2 +61,5 @@ 'use strict'; | ||
className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.array, _propTypes2.default.object]) | ||
} : {}; | ||
} : {}; | ||
TabList.tabsRole = 'TabList'; |
@@ -83,2 +83,5 @@ 'use strict'; | ||
tabId: _propTypes2.default.string // private | ||
} : {}; | ||
} : {}; | ||
TabPanel.tabsRole = 'TabPanel'; |
@@ -145,2 +145,5 @@ 'use strict'; | ||
selectedTabPanelClassName: _propTypes2.default.string | ||
} : {}; | ||
} : {}; | ||
Tabs.tabsRole = 'Tabs'; |
@@ -25,14 +25,2 @@ 'use strict'; | ||
var _Tab = require('./Tab'); | ||
var _Tab2 = _interopRequireDefault(_Tab); | ||
var _TabList = require('./TabList'); | ||
var _TabList2 = _interopRequireDefault(_TabList); | ||
var _TabPanel = require('./TabPanel'); | ||
var _TabPanel2 = _interopRequireDefault(_TabPanel); | ||
var _count = require('../helpers/count'); | ||
@@ -42,2 +30,4 @@ | ||
var _elementTypes = require('../helpers/elementTypes'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -63,3 +53,12 @@ | ||
var canUseActiveElement = !!(typeof window !== 'undefined' && window.document && window.document.activeElement); | ||
var canUseActiveElement = void 0; | ||
try { | ||
canUseActiveElement = !!(typeof window !== 'undefined' && window.document && window.document.activeElement); | ||
} catch (e) { | ||
// Work around for IE bug when accessing document.activeElement in an iframe | ||
// Refer to the following resources: | ||
// http://stackoverflow.com/a/10982960/369687 | ||
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12733599 | ||
canUseActiveElement = false; | ||
} | ||
@@ -118,4 +117,2 @@ var UncontrolledTabs = function (_Component) { | ||
UncontrolledTabs.prototype.setSelected = function setSelected(index, event) { | ||
// Don't do anything if nothing has changed | ||
if (index === this.props.selectedIndex) return; | ||
// Check index boundary | ||
@@ -214,3 +211,3 @@ if (index < 0 || index >= this.getTabsCount()) return; | ||
// Clone TabList and Tab components to have refs | ||
if (child.type === _TabList2.default) { | ||
if ((0, _elementTypes.isTabList)(child)) { | ||
var listIndex = 0; | ||
@@ -223,5 +220,3 @@ | ||
if (canUseActiveElement) { | ||
wasTabFocused = _react2.default.Children.toArray(child.props.children).filter(function (tab) { | ||
return tab.type === _Tab2.default; | ||
}).some(function (tab, i) { | ||
wasTabFocused = _react2.default.Children.toArray(child.props.children).filter(_elementTypes.isTab).some(function (tab, i) { | ||
return document.activeElement === _this2.getTab(i); | ||
@@ -254,3 +249,3 @@ }); | ||
}); | ||
} else if (child.type === _TabPanel2.default) { | ||
} else if ((0, _elementTypes.isTabPanel)(child)) { | ||
var props = { | ||
@@ -257,0 +252,0 @@ id: _this2.panelIds[index], |
@@ -14,18 +14,6 @@ 'use strict'; | ||
var _Tab = require('../components/Tab'); | ||
var _elementTypes = require('../helpers/elementTypes'); | ||
var _Tab2 = _interopRequireDefault(_Tab); | ||
var _TabList = require('../components/TabList'); | ||
var _TabList2 = _interopRequireDefault(_TabList); | ||
var _TabPanel = require('../components/TabPanel'); | ||
var _TabPanel2 = _interopRequireDefault(_TabPanel); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function isTabChild(child) { | ||
return child.type === _Tab2.default || child.type === _TabList2.default || child.type === _TabPanel2.default; | ||
return (0, _elementTypes.isTab)(child) || (0, _elementTypes.isTabList)(child) || (0, _elementTypes.isTabPanel)(child); | ||
} | ||
@@ -60,6 +48,6 @@ | ||
if (child.type === _Tab2.default || child.type === _TabPanel2.default) { | ||
if ((0, _elementTypes.isTab)(child) || (0, _elementTypes.isTabPanel)(child)) { | ||
callback(child); | ||
} else if (child.props && child.props.children && _typeof(child.props.children) === 'object') { | ||
if (child.type === _TabList2.default) callback(child); | ||
if ((0, _elementTypes.isTabList)(child)) callback(child); | ||
deepForEach(child.props.children, callback); | ||
@@ -66,0 +54,0 @@ } |
@@ -9,16 +9,8 @@ 'use strict'; | ||
var _Tab = require('../components/Tab'); | ||
var _elementTypes = require('./elementTypes'); | ||
var _Tab2 = _interopRequireDefault(_Tab); | ||
var _TabPanel = require('../components/TabPanel'); | ||
var _TabPanel2 = _interopRequireDefault(_TabPanel); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function getTabsCount(children) { | ||
var tabCount = 0; | ||
(0, _childrenDeepMap.deepForEach)(children, function (child) { | ||
if (child.type === _Tab2.default) tabCount++; | ||
if ((0, _elementTypes.isTab)(child)) tabCount++; | ||
}); | ||
@@ -32,3 +24,3 @@ | ||
(0, _childrenDeepMap.deepForEach)(children, function (child) { | ||
if (child.type === _TabPanel2.default) panelCount++; | ||
if ((0, _elementTypes.isTabPanel)(child)) panelCount++; | ||
}); | ||
@@ -35,0 +27,0 @@ |
@@ -13,16 +13,4 @@ 'use strict'; | ||
var _Tab = require('../components/Tab'); | ||
var _elementTypes = require('../helpers/elementTypes'); | ||
var _Tab2 = _interopRequireDefault(_Tab); | ||
var _TabList = require('../components/TabList'); | ||
var _TabList2 = _interopRequireDefault(_TabList); | ||
var _TabPanel = require('../components/TabPanel'); | ||
var _TabPanel2 = _interopRequireDefault(_TabPanel); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function childrenPropType(props, propName, componentName) { | ||
@@ -37,3 +25,3 @@ var error = void 0; | ||
(0, _childrenDeepMap.deepForEach)(children, function (child) { | ||
if (child.type === _TabList2.default) { | ||
if ((0, _elementTypes.isTabList)(child)) { | ||
if (child.props && child.props.children && _typeof(child.props.children) === 'object') { | ||
@@ -50,3 +38,3 @@ (0, _childrenDeepMap.deepForEach)(child.props.children, function (listChild) { | ||
} | ||
if (child.type === _Tab2.default) { | ||
if ((0, _elementTypes.isTab)(child)) { | ||
if (!tabListFound || listTabs.indexOf(child) === -1) { | ||
@@ -56,3 +44,3 @@ error = new Error("Found a 'Tab' component outside of the 'TabList' component. 'Tab' components have to be inside the 'TabList' component."); | ||
tabsCount++; | ||
} else if (child.type === _TabPanel2.default) { | ||
} else if ((0, _elementTypes.isTabPanel)(child)) { | ||
panelsCount++; | ||
@@ -59,0 +47,0 @@ } |
{ | ||
"name": "react-tabs", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "React tabs component", | ||
@@ -8,2 +8,3 @@ "main": "lib/index.js", | ||
"clean": "rimraf lib", | ||
"create-github-release": "conventional-github-releaser -p angular", | ||
"build:commonjs": "babel src/ --out-dir lib/ --ignore __tests__,__mocks__", | ||
@@ -13,8 +14,10 @@ "build:umd": "webpack --config webpack.build.js", | ||
"build": "yarn run clean && yarn run build:commonjs", | ||
"bundle": "mkdir -p dist && yarn run build:umd && yarn run build:umd:min", | ||
"format": "prettier --write --single-quote --print-width 100 --trailing-comma all \"src/**/*.js\"", | ||
"bundle": "mkdir -p dist && run-s build:umd build:umd:min", | ||
"format": "eslint src --fix", | ||
"lint": "eslint src", | ||
"precommit": "lint-staged", | ||
"preversion": "yarn run lint && yarn test && yarn run build && yarn run bundle && git add dist/ && git diff --quiet --exit-code --cached || git commit -n -m 'publish: Distribution'", | ||
"prebump": "run-s lint test", | ||
"prepublish": "yarn run build", | ||
"prerelease": "run-s build bundle", | ||
"release": "git add dist/ && standard-version --sign -a", | ||
"test": "jest", | ||
@@ -58,13 +61,17 @@ "start": "webpack-dev-server --inline --content-base examples/" | ||
"babel-preset-react": "^6.5.0", | ||
"conventional-github-releaser": "^1.1.12", | ||
"cross-env": "^5.0.0", | ||
"css-loader": "^0.28.0", | ||
"enzyme": "^2.3.0", | ||
"eslint": "^3.5.0", | ||
"eslint": "^4.5.0", | ||
"eslint-config-airbnb": "^15.0.1", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^5.0.3", | ||
"eslint-plugin-prettier": "^2.2.0", | ||
"eslint-plugin-react": "^7.0.1", | ||
"husky": "^0.13.3", | ||
"hoist-non-react-statics": "^2.3.1", | ||
"husky": "^0.14.3", | ||
"jest-cli": "^20.0.0", | ||
"lint-staged": "^3.4.0", | ||
"lint-staged": "^4.0.4", | ||
"npm-run-all": "^4.1.1", | ||
"prettier": "^1.2.2", | ||
@@ -77,2 +84,3 @@ "react": "^15.0.0", | ||
"rimraf": "^2.5.2", | ||
"standard-version": "^4.2.0", | ||
"style-loader": "^0.18.1", | ||
@@ -90,7 +98,8 @@ "uglifyjs-webpack-plugin": "^0.4.2", | ||
"src" | ||
] | ||
], | ||
"testRegex": "/__tests__/.+-test\\.js$" | ||
}, | ||
"lint-staged": { | ||
"src/**/*.js": [ | ||
"prettier --single-quote --print-width 100 --trailing-comma all --write", | ||
"eslint --fix", | ||
"git add" | ||
@@ -97,0 +106,0 @@ ] |
@@ -9,2 +9,4 @@ # react-tabs [![Build Status](https://travis-ci.org/reactjs/react-tabs.svg?branch=master)](https://travis-ci.org/reactjs/react-tabs) [![npm version](https://img.shields.io/npm/v/react-tabs.svg)](https://www.npmjs.com/package/react-tabs) | ||
<a href="https://app.codesponsor.io/link/napKqUy7ZTEunMtesQZm9ygE/reactjs/react-tabs" rel="nofollow"><img src="https://app.codesponsor.io/embed/napKqUy7ZTEunMtesQZm9ygE/reactjs/react-tabs.svg" style="width: 888px; height: 68px;" alt="Sponsor" /></a> | ||
## Installing | ||
@@ -11,0 +13,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
245143
22
1698
316
37