UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

42 lines 1.96 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FieldsDocumentation = void 0; var tslib_1 = require("tslib"); var React = tslib_1.__importStar(require("react")); var method_documentation_1 = require("./method-documentation"); var primitive_documentation_1 = require("./primitive-documentation"); var FieldsDocumentation = function (_a) { var units = _a.units; var typeComponents = { value: primitive_documentation_1.PrimitiveDocumentation, function: method_documentation_1.MethodDocumentation, object: primitive_documentation_1.PrimitiveDocumentation, error: primitive_documentation_1.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 })); })))); }; exports.FieldsDocumentation = FieldsDocumentation; //# sourceMappingURL=fields-documentation.js.map