1 | import "core-js/modules/es.object.assign.js";
|
2 | import React from 'react';
|
3 | import { action } from '@storybook/addon-actions';
|
4 | import { ArgRow } from './ArgRow';
|
5 | import { TableWrapper } from './ArgsTable';
|
6 | import { ResetWrapper } from '../../typography/DocumentFormatting';
|
7 | export default {
|
8 | component: ArgRow,
|
9 | title: 'Docs/ArgRow',
|
10 | decorators: [function (getStory) {
|
11 | return React.createElement(ResetWrapper, null, React.createElement(TableWrapper, null, React.createElement("tbody", null, getStory())));
|
12 | }]
|
13 | };
|
14 |
|
15 | var Template = function Template(args) {
|
16 | return React.createElement(ArgRow, args);
|
17 | };
|
18 |
|
19 | Template.displayName = "Template";
|
20 | var baseArgs = {
|
21 | updateArgs: action('updateArgs')
|
22 | };
|
23 | export var String = Template.bind({});
|
24 | String.args = Object.assign({}, baseArgs, {
|
25 | row: {
|
26 | key: 'someString',
|
27 | name: 'Some String',
|
28 | description: 'someString description',
|
29 | type: {
|
30 | required: true
|
31 | },
|
32 | control: {
|
33 | type: 'text'
|
34 | },
|
35 | table: {
|
36 | type: {
|
37 | summary: 'string'
|
38 | },
|
39 | defaultValue: {
|
40 | summary: 'reallylongstringnospaces'
|
41 | }
|
42 | }
|
43 | }
|
44 | });
|
45 | export var LongName = Template.bind({});
|
46 | LongName.args = Object.assign({}, baseArgs, {
|
47 | row: Object.assign({}, String.args.row, {
|
48 | name: 'Really Long String That Takes Up Space'
|
49 | })
|
50 | });
|
51 | export var LongDesc = Template.bind({});
|
52 | LongDesc.args = Object.assign({}, baseArgs, {
|
53 | row: Object.assign({}, String.args.row, {
|
54 | description: 'really long description that takes up a lot of space. sometimes this happens.'
|
55 | })
|
56 | });
|
57 | export var Boolean = Template.bind({});
|
58 | Boolean.args = Object.assign({}, baseArgs, {
|
59 | row: {
|
60 | key: 'someBoolean',
|
61 | name: 'Some Boolean',
|
62 | description: 'someBoolean description',
|
63 | type: {
|
64 | required: true
|
65 | },
|
66 | control: {
|
67 | type: 'boolean'
|
68 | },
|
69 | table: {
|
70 | type: {
|
71 | summary: 'string'
|
72 | },
|
73 | defaultValue: {
|
74 | summary: 'fixme'
|
75 | }
|
76 | }
|
77 | }
|
78 | });
|
79 | export var Color = Template.bind({});
|
80 | Color.args = Object.assign({}, baseArgs, {
|
81 | row: {
|
82 | key: 'someColor',
|
83 | name: 'Some Color',
|
84 | type: {
|
85 | name: 'string'
|
86 | },
|
87 | description: 'someColor description',
|
88 | defaultValue: '#ff0',
|
89 | control: {
|
90 | type: 'color'
|
91 | }
|
92 | }
|
93 | });
|
94 | export var Date = Template.bind({});
|
95 | Date.args = Object.assign({}, baseArgs, {
|
96 | row: {
|
97 | key: 'someDate',
|
98 | name: 'Some Date',
|
99 | type: {
|
100 | name: 'string'
|
101 | },
|
102 | description: 'someDate description',
|
103 | control: {
|
104 | type: 'date'
|
105 | }
|
106 | }
|
107 | });
|
108 | export var Number = Template.bind({});
|
109 | Number.args = Object.assign({}, baseArgs, {
|
110 | row: {
|
111 | key: 'someNumber',
|
112 | name: 'Some Number',
|
113 | description: 'someNumber description',
|
114 | type: {
|
115 | required: false
|
116 | },
|
117 | table: {
|
118 | type: {
|
119 | summary: 'number'
|
120 | },
|
121 | defaultValue: {
|
122 | summary: '0'
|
123 | }
|
124 | },
|
125 | control: {
|
126 | type: 'number'
|
127 | }
|
128 | }
|
129 | });
|
130 | export var Range = Template.bind({});
|
131 | Range.args = Object.assign({}, baseArgs, {
|
132 | row: Object.assign({}, Number.args.row, {
|
133 | control: {
|
134 | type: 'range'
|
135 | }
|
136 | })
|
137 | });
|
138 | export var Radio = Template.bind({});
|
139 | Radio.args = Object.assign({}, baseArgs, {
|
140 | row: {
|
141 | key: 'someEnum',
|
142 | name: 'Some Enum',
|
143 | description: 'someEnum description',
|
144 | control: {
|
145 | type: 'radio',
|
146 | options: ['a', 'b', 'c']
|
147 | }
|
148 | }
|
149 | });
|
150 | export var InlineRadio = Template.bind({});
|
151 | InlineRadio.args = Object.assign({}, baseArgs, {
|
152 | row: Object.assign({}, Radio.args.row, {
|
153 | control: Object.assign({}, Radio.args.row.control, {
|
154 | type: 'inline-radio'
|
155 | })
|
156 | })
|
157 | });
|
158 | export var Check = Template.bind({});
|
159 | Check.args = Object.assign({}, baseArgs, {
|
160 | row: Object.assign({}, Radio.args.row, {
|
161 | control: Object.assign({}, Radio.args.row.control, {
|
162 | type: 'check'
|
163 | })
|
164 | })
|
165 | });
|
166 | export var InlineCheck = Template.bind({});
|
167 | InlineCheck.args = Object.assign({}, baseArgs, {
|
168 | row: Object.assign({}, Radio.args.row, {
|
169 | control: Object.assign({}, Radio.args.row.control, {
|
170 | type: 'inline-check'
|
171 | })
|
172 | })
|
173 | });
|
174 | export var Select = Template.bind({});
|
175 | Select.args = Object.assign({}, baseArgs, {
|
176 | row: Object.assign({}, Radio.args.row, {
|
177 | control: Object.assign({}, Radio.args.row.control, {
|
178 | type: 'select'
|
179 | })
|
180 | })
|
181 | });
|
182 | export var MultiSelect = Template.bind({});
|
183 | MultiSelect.args = Object.assign({}, baseArgs, {
|
184 | row: Object.assign({}, Radio.args.row, {
|
185 | control: Object.assign({}, Radio.args.row.control, {
|
186 | type: 'multi-select'
|
187 | })
|
188 | })
|
189 | });
|
190 | export var ObjectOf = Template.bind({});
|
191 | ObjectOf.args = Object.assign({}, baseArgs, {
|
192 | row: {
|
193 | key: 'someObject',
|
194 | name: 'Some Object',
|
195 | description: 'A simple `objectOf` propType.',
|
196 | table: {
|
197 | type: {
|
198 | summary: 'objectOf(number)'
|
199 | },
|
200 | defaultValue: {
|
201 | summary: '{ key: 1 }'
|
202 | }
|
203 | },
|
204 | control: {
|
205 | type: 'object'
|
206 | }
|
207 | }
|
208 | });
|
209 | export var ArrayOf = Template.bind({});
|
210 | ArrayOf.args = Object.assign({}, baseArgs, {
|
211 | row: {
|
212 | key: 'someArray',
|
213 | name: 'Some Array',
|
214 | description: 'array of a certain type',
|
215 | table: {
|
216 | type: {
|
217 | summary: 'number[]'
|
218 | },
|
219 | defaultValue: {
|
220 | summary: '[1, 2, 3]'
|
221 | }
|
222 | },
|
223 | control: {
|
224 | type: 'array'
|
225 | }
|
226 | }
|
227 | });
|
228 | export var ComplexObject = Template.bind({});
|
229 | ComplexObject.args = Object.assign({}, baseArgs, {
|
230 | row: {
|
231 | key: 'someComplex',
|
232 | name: 'Some Complex',
|
233 | description: 'A very complex `objectOf` propType.',
|
234 | table: {
|
235 | type: {
|
236 | summary: 'object',
|
237 | detail: "[{\n id: number,\n func: func,\n arr: [{ index: number }]\n }]"
|
238 | },
|
239 | defaultValue: {
|
240 | summary: 'object',
|
241 | detail: "[{\n id: 1,\n func: () => {},\n arr: [{ index: 1 }]\n }]"
|
242 | }
|
243 | },
|
244 | control: {
|
245 | type: 'object'
|
246 | }
|
247 | }
|
248 | });
|
249 | export var Func = Template.bind({});
|
250 | Func.args = Object.assign({}, baseArgs, {
|
251 | row: {
|
252 | key: 'concat',
|
253 | name: 'Concat',
|
254 | description: 'concat 2 string values.',
|
255 | type: {
|
256 | required: true
|
257 | },
|
258 | table: {
|
259 | type: {
|
260 | summary: '(a: string, b: string) => string'
|
261 | },
|
262 | defaultValue: {
|
263 | summary: 'func',
|
264 | detail: '(a, b) => { return a + b; }'
|
265 | },
|
266 | jsDocTags: {
|
267 | params: [{
|
268 | name: 'a',
|
269 | description: 'The first string'
|
270 | }, {
|
271 | name: 'b',
|
272 | description: 'The second string'
|
273 | }],
|
274 | returns: {
|
275 | description: 'The concatenation of both strings'
|
276 | }
|
277 | }
|
278 | },
|
279 | control: false
|
280 | }
|
281 | });
|
282 | var enumeration = '"search" | "arrow-to-bottom" | "arrow-to-right" | "bell" | "check" | "check-circle"';
|
283 | export var Enum = Template.bind({});
|
284 | Enum.args = Object.assign({}, baseArgs, {
|
285 | row: {
|
286 | key: 'enum',
|
287 | name: 'Some enum',
|
288 | type: {
|
289 | required: true
|
290 | },
|
291 | table: {
|
292 | type: {
|
293 | summary: enumeration
|
294 | }
|
295 | }
|
296 | }
|
297 | });
|
298 | var long_enumeration = '"search" | "arrow-to-bottom" | "arrow-to-right" | "bell" | "check" | "check-circle" | "chevron-up" | "chevron-down" | "chevron-left" | "chevron-right" | "envelope" | "exchange" | "file" | "file-check" | "file-import" | "file-pdf" | "file-times" | "pencil" | "question" | "question-circle" | "sitemap" | "user" | "times" | "plus" | "exclamation-triangle" | "trash-alt" | "long-arrow-up" | "long-arrow-down" | "long-arrow-left" | "long-arrow-right" | "external-link-alt" | "sticky-note" | "chart-line" | "spinner-third"';
|
299 | export var LongEnum = Template.bind({});
|
300 | LongEnum.args = Object.assign({}, baseArgs, {
|
301 | row: {
|
302 | key: 'longEnum',
|
303 | name: 'Long enum',
|
304 | type: {
|
305 | required: true
|
306 | },
|
307 | table: {
|
308 | type: {
|
309 | summary: long_enumeration
|
310 | }
|
311 | }
|
312 | }
|
313 | });
|
314 | var complexUnion = '((a: string | SVGSVGElement) => void) | RefObject<SVGSVGElement | number> | [a|b] | {a|b}';
|
315 | export var ComplexUnion = Template.bind({});
|
316 | ComplexUnion.args = Object.assign({}, baseArgs, {
|
317 | row: {
|
318 | key: 'complexUnion',
|
319 | name: 'Complex',
|
320 | type: {
|
321 | required: true
|
322 | },
|
323 | table: {
|
324 | type: {
|
325 | summary: complexUnion
|
326 | }
|
327 | }
|
328 | }
|
329 | });
|
330 | export var Markdown = Template.bind({});
|
331 | Markdown.args = Object.assign({}, baseArgs, {
|
332 | row: {
|
333 | key: 'someString',
|
334 | name: 'Some String',
|
335 | description: 'A `prop` can *support* __markdown__ syntax. This was ship in ~~5.2~~ 5.3. [Find more info in the storybook docs.](https://storybook.js.org/)',
|
336 | table: {
|
337 | type: {
|
338 | summary: 'string'
|
339 | }
|
340 | },
|
341 | control: {
|
342 | type: 'text'
|
343 | }
|
344 | }
|
345 | });
|
346 | export var StringCompact = Template.bind({});
|
347 | StringCompact.args = Object.assign({}, String.args, {
|
348 | compact: true
|
349 | });
|
350 | export var StringNoControls = Template.bind({});
|
351 | StringNoControls.args = {
|
352 | row: String.args.row
|
353 | };
|
354 | export var StringNoControlsCompact = Template.bind({});
|
355 | StringNoControlsCompact.args = {
|
356 | row: String.args.row,
|
357 | compact: true
|
358 | }; |
\ | No newline at end of file |