UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

67 lines 3.06 kB
import { __assign } from "tslib"; import { SectionType, } from '../typings/story-section'; // functions exported in this file are used as builders for `sections` array in story config. they are typed // abstractions for consumer, so that they don't need to write all details manually and can also leverage some // autocomplete var base = function (config) { return (__assign({ pretitle: '', title: '', subtitle: '', hidden: false }, config)); }; export var code = function (config) { return base(__assign({ type: SectionType.Code }, (typeof config === 'string' ? { source: config } : config))); }; export var description = function (config) { return base(__assign({ type: SectionType.Description }, (typeof config === 'string' ? { text: config } : config))); }; export var header = function (config) { return base(__assign({ type: SectionType.Header }, config)); }; export var importExample = function (config) { return base(__assign({ type: SectionType.ImportExample, title: 'Import' }, (typeof config === 'string' ? { source: config } : config))); }; export var tab = function (config) { return base(__assign({ type: SectionType.Tab, sections: [] }, config)); }; export var api = function (config) { return base(__assign({ type: SectionType.Api }, config)); }; export var playground = function (config) { return base(__assign({ type: SectionType.Playground }, config)); }; export var testkit = function (config) { return base(__assign({ type: SectionType.Testkit }, config)); }; export var columns = function (config) { return base(__assign({ type: SectionType.Columns }, (Array.isArray(config) ? { items: config } : config))); }; export var tabs = function (config) { return base(__assign({ type: SectionType.Tabs }, (Array.isArray(config) ? { tabs: config } : config))); }; export var table = function (config) { return base(__assign({ type: SectionType.Table }, (Array.isArray(config) ? { rows: config } : config))); }; export var mdx = function (config) { return base(__assign({ type: SectionType.MDX }, config)); }; export var divider = function (config) { return base(__assign({ type: SectionType.Divider }, config)); }; export var title = function (config) { return base(__assign({ type: SectionType.Title }, (typeof config === 'string' ? { title: config } : config))); }; export var plugin = function (config) { return base(__assign({ type: SectionType.Plugin }, config)); }; export var example = function (config) { return base(__assign({ type: SectionType.Example, compact: true }, config)); }; export var doDont = function (config) { return base(__assign({ type: SectionType.DoDont }, config)); }; export var includedComponents = function (config) { return base(__assign({ type: SectionType.IncludedComponents }, config)); }; export var demo = function (config) { return base(__assign({ type: SectionType.Demo }, config)); }; export var storyPage = function (config) { return base(__assign({ type: SectionType.StoryPage }, config)); }; //# sourceMappingURL=index.js.map