UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

34 lines 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var react_1 = tslib_1.__importDefault(require("react")); var prop_types_1 = tslib_1.__importDefault(require("prop-types")); var default_1 = /** @class */ (function (_super) { tslib_1.__extends(default_1, _super); function default_1() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.state = { visible: true, }; _this.remount = function () { return new Promise(function (resolve) { return _this.setState({ visible: false }, function () { return _this.setState({ visible: true }, resolve); }); }); }; return _this; } default_1.prototype.componentDidMount = function () { window.story = this; }; default_1.prototype.render = function () { return this.state.visible ? this.props.children : null; }; default_1.propTypes = { children: prop_types_1.default.node, }; return default_1; }(react_1.default.Component)); exports.default = default_1; //# sourceMappingURL=RemountHoc.js.map