mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
51 lines
2.2 KiB
JavaScript
51 lines
2.2 KiB
JavaScript
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
||
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
||
|
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
||
|
import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
||
|
|
||
|
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) { _defineProperty(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; }
|
||
|
|
||
|
import React, { Component } from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import Tooltip from './Tooltip';
|
||
|
import { omit } from './utils';
|
||
|
var omitKeys = ['defaultOpen'];
|
||
|
|
||
|
var UncontrolledTooltip = /*#__PURE__*/function (_Component) {
|
||
|
_inheritsLoose(UncontrolledTooltip, _Component);
|
||
|
|
||
|
function UncontrolledTooltip(props) {
|
||
|
var _this;
|
||
|
|
||
|
_this = _Component.call(this, props) || this;
|
||
|
_this.state = {
|
||
|
isOpen: props.defaultOpen || false
|
||
|
};
|
||
|
_this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
|
||
|
return _this;
|
||
|
}
|
||
|
|
||
|
var _proto = UncontrolledTooltip.prototype;
|
||
|
|
||
|
_proto.toggle = function toggle() {
|
||
|
this.setState({
|
||
|
isOpen: !this.state.isOpen
|
||
|
});
|
||
|
};
|
||
|
|
||
|
_proto.render = function render() {
|
||
|
return /*#__PURE__*/React.createElement(Tooltip, _extends({
|
||
|
isOpen: this.state.isOpen,
|
||
|
toggle: this.toggle
|
||
|
}, omit(this.props, omitKeys)));
|
||
|
};
|
||
|
|
||
|
return UncontrolledTooltip;
|
||
|
}(Component);
|
||
|
|
||
|
export { UncontrolledTooltip as default };
|
||
|
UncontrolledTooltip.propTypes = _objectSpread({
|
||
|
defaultOpen: PropTypes.bool
|
||
|
}, Tooltip.propTypes);
|