UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

23 lines 1.47 kB
import { __assign, __rest } from "tslib"; import React from 'react'; import * as queryString from 'query-string'; import AutoExample from '../AutoExample'; import StoryPage from '../StoryPage'; import Remount from './RemountHoc'; import { isE2E, getComponentsHints } from '../utils'; import { scrollToElementByHash } from './utils'; scrollToElementByHash(); export default (function (_a) { var _config = _a._config, _metadata = _a._metadata, storyConfig = __rest(_a, ["_config", "_metadata"]); return _config .storiesOf(storyConfig.category, module) .addParameters(storyConfig.parameters || {}) .add(storyConfig.storyName || _metadata.displayName, function () { return isE2E ? (React.createElement("div", null, React.createElement(Remount, null, React.createElement(AutoExample, { isInteractive: false, ref: function (ref) { return (global.autoexample = ref); }, component: storyConfig.component, componentWrapper: storyConfig.componentWrapper, componentProps: storyConfig.componentProps, parsedSource: _metadata })), queryString.parse(window.location.search).withExamples !== undefined && storyConfig.examples)) : (React.createElement(StoryPage, __assign({}, __assign(__assign({}, __assign(__assign({}, storyConfig), { hints: getComponentsHints(_config.playgroundComponents) })), { metadata: _metadata, config: _config })))); }); }); //# sourceMappingURL=index.js.map