UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

37 lines 1.64 kB
import * as React from 'react'; import { MethodDocumentation } from './method-documentation'; import { PrimitiveDocumentation } from './primitive-documentation'; export var FieldsDocumentation = function (_a) { var units = _a.units; var typeComponents = { value: PrimitiveDocumentation, function: MethodDocumentation, object: PrimitiveDocumentation, error: PrimitiveDocumentation, }; return (React.createElement("table", { "data-hook": "auto-testkit-driver-fields" }, React.createElement("thead", null, React.createElement("tr", null, React.createElement("th", { "data-hook": "auto-testkit-property-header" }, "Property"), React.createElement("th", { "data-hook": "auto-testkit-description-header" }, "Description"))), React.createElement("tbody", null, units // Filter by type .filter(function (_a) { var type = _a.type; return typeComponents[type]; }) // Filter overridden functions .filter(function (_a, index, arr) { var name = _a.name; var isDuplicate = false; for (var i = index + 1; i < arr.length; i++) { isDuplicate = isDuplicate || name === arr[i].name; } return !isDuplicate; }) .map(function (unit, i) { var Documentation = typeComponents[unit.type]; return (React.createElement(Documentation, { key: i, "data-hook": "auto-testkit-field", unit: unit })); })))); }; //# sourceMappingURL=fields-documentation.js.map