UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

28 lines 1.25 kB
import { __assign } from "tslib"; import * as React from 'react'; import AutoExample from '../../../AutoExample'; var filterDeprecatedProps = function (metadata) { return (__assign(__assign({}, metadata), { props: Object.entries(metadata.props) .filter(function (_a) { var name = _a[0], prop = _a[1]; return !(prop.tags || []).some(function (_a) { var title = _a.title; return title === 'deprecated'; }); }) .reduce(function (props, _a) { var _b; var name = _a[0], prop = _a[1]; return (__assign(__assign({}, props), (_b = {}, _b[name] = prop, _b))); }, {}) })); }; export var playground = function (section, _a) { var metadata = _a.metadata, component = _a.component, componentProps = _a.componentProps, componentWrapper = _a.componentWrapper, exampleProps = _a.exampleProps, codeExample = _a.codeExample; return (React.createElement(AutoExample, __assign({}, { parsedSource: filterDeprecatedProps(metadata), component: component, componentProps: componentProps, componentWrapper: componentWrapper, exampleProps: exampleProps, codeExample: codeExample, }))); }; //# sourceMappingURL=index.js.map