1 | import "core-js/modules/es.object.assign.js";
|
2 | import React from 'react';
|
3 | import { action } from '@storybook/addon-actions';
|
4 | import { styled } from '@storybook/theming';
|
5 | import { ArgsTable, ArgsTableError } from './ArgsTable';
|
6 | import { NoControlsWarning } from './NoControlsWarning';
|
7 | import * as ArgRow from './ArgRow.stories';
|
8 | export default {
|
9 | component: ArgsTable,
|
10 | title: 'Docs/ArgsTable',
|
11 | args: {
|
12 | updateArgs: action('updateArgs'),
|
13 | resetArgs: action('resetArgs')
|
14 | }
|
15 | };
|
16 | var propsSection = {
|
17 | category: 'props '
|
18 | };
|
19 | var eventsSection = {
|
20 | category: 'events '
|
21 | };
|
22 | var componentSubsection = {
|
23 | subcategory: 'MyComponent '
|
24 | };
|
25 | var htmlElementSubsection = {
|
26 | subcategory: 'HTMLElement'
|
27 | };
|
28 | var stringType = ArgRow.String.args.row;
|
29 | var numberType = ArgRow.Number.args.row;
|
30 | var longEnumType = ArgRow.LongEnum.args.row;
|
31 |
|
32 | var Template = function Template(args) {
|
33 | return React.createElement(ArgsTable, args);
|
34 | };
|
35 |
|
36 | Template.displayName = "Template";
|
37 | export var Normal = Template.bind({});
|
38 | Normal.args = {
|
39 | rows: {
|
40 | stringType: stringType,
|
41 | numberType: numberType
|
42 | }
|
43 | };
|
44 | export var Compact = Template.bind({});
|
45 | Compact.args = Object.assign({}, Normal.args, {
|
46 | compact: true
|
47 | });
|
48 | var AddonPanelLayout = styled.div(function (_ref) {
|
49 | var theme = _ref.theme;
|
50 | return {
|
51 | fontSize: theme.typography.size.s2 - 1,
|
52 | background: theme.background.content
|
53 | };
|
54 | });
|
55 | export var InAddonPanel = Template.bind({});
|
56 | InAddonPanel.args = Object.assign({}, Normal.args, {
|
57 | inAddonPanel: true
|
58 | });
|
59 | InAddonPanel.decorators = [function (storyFn) {
|
60 | return React.createElement(AddonPanelLayout, null, storyFn());
|
61 | }];
|
62 | export var InAddonPanelWithWarning = function InAddonPanelWithWarning(args) {
|
63 | return React.createElement(React.Fragment, null, React.createElement(NoControlsWarning, null), React.createElement(ArgsTable, args));
|
64 | };
|
65 | InAddonPanelWithWarning.args = Object.assign({}, InAddonPanel.args, {
|
66 | updateArgs: null
|
67 | });
|
68 | InAddonPanelWithWarning.decorators = InAddonPanel.decorators;
|
69 | export var Sections = Template.bind({});
|
70 | Sections.args = {
|
71 | rows: {
|
72 | a: Object.assign({}, stringType, {
|
73 | table: Object.assign({}, stringType.table, propsSection)
|
74 | }),
|
75 | b: Object.assign({}, numberType, {
|
76 | table: Object.assign({}, stringType.table, propsSection)
|
77 | }),
|
78 | c: Object.assign({}, stringType, {
|
79 | table: Object.assign({}, stringType.table, eventsSection)
|
80 | })
|
81 | }
|
82 | };
|
83 | export var SectionsCompact = Template.bind({});
|
84 | SectionsCompact.args = Object.assign({}, Sections.args, {
|
85 | compact: true
|
86 | });
|
87 | export var SectionsAndSubsections = Template.bind({});
|
88 | SectionsAndSubsections.args = {
|
89 | rows: {
|
90 | a: Object.assign({}, stringType, {
|
91 | table: Object.assign({}, stringType.table, propsSection, componentSubsection)
|
92 | }),
|
93 | b: Object.assign({}, numberType, {
|
94 | table: Object.assign({}, stringType.table, propsSection, componentSubsection)
|
95 | }),
|
96 | c: Object.assign({}, stringType, {
|
97 | table: Object.assign({}, stringType.table, eventsSection, componentSubsection)
|
98 | }),
|
99 | d: Object.assign({}, stringType, {
|
100 | table: Object.assign({}, stringType.table, eventsSection, htmlElementSubsection)
|
101 | })
|
102 | }
|
103 | };
|
104 | export var SubsectionsOnly = Template.bind({});
|
105 | SubsectionsOnly.args = {
|
106 | rows: {
|
107 | a: Object.assign({}, stringType, {
|
108 | table: Object.assign({}, stringType.table, componentSubsection)
|
109 | }),
|
110 | b: Object.assign({}, numberType, {
|
111 | table: Object.assign({}, stringType.table, componentSubsection)
|
112 | }),
|
113 | c: Object.assign({}, stringType, {
|
114 | table: Object.assign({}, stringType.table, componentSubsection)
|
115 | }),
|
116 | d: Object.assign({}, stringType, {
|
117 | table: Object.assign({}, stringType.table, htmlElementSubsection)
|
118 | })
|
119 | }
|
120 | };
|
121 | export var AllControls = Template.bind({});
|
122 | AllControls.args = {
|
123 | rows: {
|
124 | array: ArgRow.ArrayOf.args.row,
|
125 | boolean: ArgRow.Boolean.args.row,
|
126 | color: ArgRow.Color.args.row,
|
127 | date: ArgRow.Date.args.row,
|
128 | string: ArgRow.String.args.row,
|
129 | number: ArgRow.Number.args.row,
|
130 | range: ArgRow.Number.args.row,
|
131 | radio: ArgRow.Radio.args.row,
|
132 | inlineRadio: ArgRow.InlineRadio.args.row,
|
133 | check: ArgRow.Check.args.row,
|
134 | inlineCheck: ArgRow.InlineCheck.args.row,
|
135 | select: ArgRow.Select.args.row,
|
136 | multiSelect: ArgRow.MultiSelect.args.row,
|
137 | object: ArgRow.ObjectOf.args.row,
|
138 | func: ArgRow.Func.args.row
|
139 | }
|
140 | };
|
141 | export var Error = Template.bind({});
|
142 | Error.args = {
|
143 | error: ArgsTableError.NO_COMPONENT
|
144 | };
|
145 | export var Empty = Template.bind({});
|
146 | Empty.args = {
|
147 | rows: {}
|
148 | };
|
149 | export var WithDefaultExpandedArgs = Template.bind({});
|
150 | WithDefaultExpandedArgs.args = {
|
151 | rows: {
|
152 | longEnumType: longEnumType
|
153 | },
|
154 | initialExpandedArgs: true
|
155 | }; |
\ | No newline at end of file |