1 | import "core-js/modules/es.symbol.js";
|
2 | import "core-js/modules/es.symbol.description.js";
|
3 | import "core-js/modules/es.array.filter.js";
|
4 | import "core-js/modules/es.array.map.js";
|
5 | import "core-js/modules/es.function.name.js";
|
6 | import React from 'react';
|
7 | import { styled } from '@storybook/theming';
|
8 | import { codeCommon } from '../../typography/shared';
|
9 | export var Table = styled.table(function (_ref) {
|
10 | var theme = _ref.theme;
|
11 | return {
|
12 | '&&': {
|
13 |
|
14 | borderCollapse: 'collapse',
|
15 | borderSpacing: 0,
|
16 | border: 'none',
|
17 | tr: {
|
18 | border: 'none !important',
|
19 | background: 'none'
|
20 | },
|
21 | 'td, th': {
|
22 | padding: 0,
|
23 | border: 'none',
|
24 | width: 'auto!important'
|
25 | },
|
26 |
|
27 | marginTop: 0,
|
28 | marginBottom: 0,
|
29 | 'th:first-of-type, td:first-of-type': {
|
30 | paddingLeft: 0
|
31 | },
|
32 | 'th:last-of-type, td:last-of-type': {
|
33 | paddingRight: 0
|
34 | },
|
35 | td: {
|
36 | paddingTop: 0,
|
37 | paddingBottom: 4,
|
38 | '&:not(:first-of-type)': {
|
39 | paddingLeft: 10,
|
40 | paddingRight: 0
|
41 | }
|
42 | },
|
43 | tbody: {
|
44 | boxShadow: 'none',
|
45 | border: 'none'
|
46 | },
|
47 | code: codeCommon({
|
48 | theme: theme
|
49 | }),
|
50 | '& code': {
|
51 | margin: 0,
|
52 | display: 'inline-block',
|
53 | fontSize: theme.typography.size.s1
|
54 | }
|
55 | }
|
56 | };
|
57 | });
|
58 | export var ArgJsDoc = function ArgJsDoc(_ref2) {
|
59 | var tags = _ref2.tags;
|
60 | var params = (tags.params || []).filter(function (x) {
|
61 | return x.description;
|
62 | });
|
63 | var hasDisplayableParams = params.length !== 0;
|
64 | var hasDisplayableReturns = tags.returns != null && tags.returns.description != null;
|
65 |
|
66 | if (!hasDisplayableParams && !hasDisplayableReturns) {
|
67 | return null;
|
68 | }
|
69 |
|
70 | return React.createElement(Table, null, React.createElement("tbody", null, hasDisplayableParams && params.map(function (x) {
|
71 | return React.createElement("tr", {
|
72 | key: x.name
|
73 | }, React.createElement("td", null, React.createElement("code", null, x.name)), React.createElement("td", null, x.description));
|
74 | }), hasDisplayableReturns && React.createElement("tr", {
|
75 | key: "returns"
|
76 | }, React.createElement("td", null, React.createElement("code", null, "Returns")), React.createElement("td", null, tags.returns.description))));
|
77 | };
|
78 | ArgJsDoc.displayName = "ArgJsDoc"; |
\ | No newline at end of file |