1 line
1.9 KiB
JSON
1 line
1.9 KiB
JSON
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport React, { Component } from 'react';\nimport { polyfill } from 'react-lifecycles-compat';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { TabContext } from './TabContext';\nimport { mapToCssModules, omit, tagPropType } from './utils';\nvar propTypes = {\n tag: tagPropType,\n activeTab: PropTypes.any,\n className: PropTypes.string,\n cssModule: PropTypes.object\n};\nvar defaultProps = {\n tag: 'div'\n};\n\nvar TabContent = /*#__PURE__*/function (_Component) {\n _inheritsLoose(TabContent, _Component);\n\n TabContent.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {\n if (prevState.activeTab !== nextProps.activeTab) {\n return {\n activeTab: nextProps.activeTab\n };\n }\n\n return null;\n };\n\n function TabContent(props) {\n var _this;\n\n _this = _Component.call(this, props) || this;\n _this.state = {\n activeTab: _this.props.activeTab\n };\n return _this;\n }\n\n var _proto = TabContent.prototype;\n\n _proto.render = function render() {\n var _this$props = this.props,\n className = _this$props.className,\n cssModule = _this$props.cssModule,\n Tag = _this$props.tag;\n var attributes = omit(this.props, Object.keys(propTypes));\n var classes = mapToCssModules(classNames('tab-content', className), cssModule);\n return React.createElement(TabContext.Provider, {\n value: {\n activeTabId: this.state.activeTab\n }\n }, React.createElement(Tag, _extends({}, attributes, {\n className: classes\n })));\n };\n\n return TabContent;\n}(Component);\n\npolyfill(TabContent);\nexport default TabContent;\nTabContent.propTypes = propTypes;\nTabContent.defaultProps = defaultProps;","map":null,"metadata":{},"sourceType":"module"} |