mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
67 lines
2.7 KiB
JavaScript
67 lines
2.7 KiB
JavaScript
|
"use strict";
|
||
|
|
||
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
||
|
|
||
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||
|
|
||
|
exports.__esModule = true;
|
||
|
exports.default = void 0;
|
||
|
|
||
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
||
|
|
||
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||
|
|
||
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
||
|
|
||
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
||
|
|
||
|
var _react = _interopRequireWildcard(require("react"));
|
||
|
|
||
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||
|
|
||
|
var _Popover = _interopRequireDefault(require("./Popover"));
|
||
|
|
||
|
var _utils = require("./utils");
|
||
|
|
||
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||
|
|
||
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||
|
|
||
|
var omitKeys = ['defaultOpen'];
|
||
|
|
||
|
var UncontrolledPopover = /*#__PURE__*/function (_Component) {
|
||
|
(0, _inheritsLoose2.default)(UncontrolledPopover, _Component);
|
||
|
|
||
|
function UncontrolledPopover(props) {
|
||
|
var _this;
|
||
|
|
||
|
_this = _Component.call(this, props) || this;
|
||
|
_this.state = {
|
||
|
isOpen: props.defaultOpen || false
|
||
|
};
|
||
|
_this.toggle = _this.toggle.bind((0, _assertThisInitialized2.default)(_this));
|
||
|
return _this;
|
||
|
}
|
||
|
|
||
|
var _proto = UncontrolledPopover.prototype;
|
||
|
|
||
|
_proto.toggle = function toggle() {
|
||
|
this.setState({
|
||
|
isOpen: !this.state.isOpen
|
||
|
});
|
||
|
};
|
||
|
|
||
|
_proto.render = function render() {
|
||
|
return /*#__PURE__*/_react.default.createElement(_Popover.default, (0, _extends2.default)({
|
||
|
isOpen: this.state.isOpen,
|
||
|
toggle: this.toggle
|
||
|
}, (0, _utils.omit)(this.props, omitKeys)));
|
||
|
};
|
||
|
|
||
|
return UncontrolledPopover;
|
||
|
}(_react.Component);
|
||
|
|
||
|
exports.default = UncontrolledPopover;
|
||
|
UncontrolledPopover.propTypes = _objectSpread({
|
||
|
defaultOpen: _propTypes.default.bool
|
||
|
}, _Popover.default.propTypes);
|