UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

31 lines 1.99 kB
import { __assign } from "tslib"; import * as React from 'react'; import CodeBlock from '../../CodeBlock'; export var code = function (_a, storyConfig) { var _b; var source = _a.source, components = _a.components, _c = _a.compact, compact = _c === void 0 ? false : _c, figmaLink = _a.figmaLink, previewProps = _a.previewProps, _d = _a.interactive, interactive = _d === void 0 ? true : _d, autoRender = _a.autoRender, _e = _a.darkBackground, darkBackground = _e === void 0 ? false : _e, _f = _a.noBackground, noBackground = _f === void 0 ? false : _f, _g = _a.initiallyOpen, initiallyOpen = _g === void 0 ? false : _g, title = _a.title, _h = _a.hideCodeEditor, hideCodeEditor = _h === void 0 ? false : _h; var playgroundComponents = storyConfig.config.playgroundComponents || {}; if (interactive) { var LiveCodeExample = React.lazy(function () { return import('../../LiveCodeExample'); }); return (React.createElement(React.Suspense, { fallback: React.createElement("div", null, "Loading...") }, React.createElement(LiveCodeExample, __assign({}, { previewProps: previewProps, compact: compact, figmaLink: figmaLink, autoRender: autoRender, darkBackground: darkBackground, noBackground: noBackground, hideCodeEditor: hideCodeEditor, scope: __assign(__assign({}, components), playgroundComponents), initialCode: source.trim(), initiallyOpen: initiallyOpen, hints: storyConfig.hints, title: title, storyName: storyConfig.storyName, storage: window.sessionStorage, examplesPreviewWrapper: (_b = storyConfig.story) === null || _b === void 0 ? void 0 : _b.examplesPreviewWrapper, })))); } return React.createElement(CodeBlock, { source: source.trim() }); }; //# sourceMappingURL=code.js.map