1 line
1.6 KiB
JSON
1 line
1.6 KiB
JSON
{"ast":null,"code":"import _objectSpread2 from \"@babel/runtime/helpers/esm/objectSpread\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport Dropdown from './Dropdown';\nimport { omit } from './utils';\nvar omitKeys = ['defaultOpen'];\n\nvar UncontrolledDropdown = /*#__PURE__*/function (_Component) {\n _inheritsLoose(UncontrolledDropdown, _Component);\n\n function UncontrolledDropdown(props) {\n var _this;\n\n _this = _Component.call(this, props) || this;\n _this.state = {\n isOpen: props.defaultOpen || false\n };\n _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n var _proto = UncontrolledDropdown.prototype;\n\n _proto.toggle = function toggle(e) {\n this.setState({\n isOpen: !this.state.isOpen\n });\n\n if (this.props.onToggle) {\n this.props.onToggle(e, !this.state.isOpen);\n }\n };\n\n _proto.render = function render() {\n return React.createElement(Dropdown, _extends({\n isOpen: this.state.isOpen,\n toggle: this.toggle\n }, omit(this.props, omitKeys)));\n };\n\n return UncontrolledDropdown;\n}(Component);\n\nexport { UncontrolledDropdown as default };\nUncontrolledDropdown.propTypes = _objectSpread2({\n defaultOpen: PropTypes.bool,\n onToggle: PropTypes.func\n}, Dropdown.propTypes);","map":null,"metadata":{},"sourceType":"module"} |