UNPKG

8.88 kBJavaScriptView Raw
1import "core-js/modules/es.object.assign.js";
2import React from 'react';
3import { action } from '@storybook/addon-actions';
4import { ArgRow } from './ArgRow';
5import { TableWrapper } from './ArgsTable';
6import { ResetWrapper } from '../../typography/DocumentFormatting';
7export default {
8 component: ArgRow,
9 title: 'Docs/ArgRow',
10 decorators: [function (getStory) {
11 return /*#__PURE__*/React.createElement(ResetWrapper, null, /*#__PURE__*/React.createElement(TableWrapper, null, /*#__PURE__*/React.createElement("tbody", null, getStory())));
12 }]
13};
14
15var Template = function Template(args) {
16 return /*#__PURE__*/React.createElement(ArgRow, args);
17};
18
19Template.displayName = "Template";
20var baseArgs = {
21 updateArgs: action('updateArgs')
22};
23export var String = Template.bind({});
24String.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});
45export var LongName = Template.bind({});
46LongName.args = Object.assign({}, baseArgs, {
47 row: Object.assign({}, String.args.row, {
48 name: 'Really Long String That Takes Up Space'
49 })
50});
51export var LongDesc = Template.bind({});
52LongDesc.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});
57export var Boolean = Template.bind({});
58Boolean.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});
79export var Color = Template.bind({});
80Color.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});
94export var Date = Template.bind({});
95Date.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});
108export var Number = Template.bind({});
109Number.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});
130export var Range = Template.bind({});
131Range.args = Object.assign({}, baseArgs, {
132 row: Object.assign({}, Number.args.row, {
133 control: {
134 type: 'range'
135 }
136 })
137});
138export var Radio = Template.bind({});
139Radio.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});
150export var InlineRadio = Template.bind({});
151InlineRadio.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});
158export var Check = Template.bind({});
159Check.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});
166export var InlineCheck = Template.bind({});
167InlineCheck.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});
174export var Select = Template.bind({});
175Select.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});
182export var MultiSelect = Template.bind({});
183MultiSelect.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});
190export var ObjectOf = Template.bind({});
191ObjectOf.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});
209export var ArrayOf = Template.bind({});
210ArrayOf.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});
228export var ComplexObject = Template.bind({});
229ComplexObject.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});
249export var Func = Template.bind({});
250Func.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});
282var enumeration = '"search" | "arrow-to-bottom" | "arrow-to-right" | "bell" | "check" | "check-circle"';
283export var Enum = Template.bind({});
284Enum.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});
298var 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"';
299export var LongEnum = Template.bind({});
300LongEnum.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});
314var complexUnion = '((a: string | SVGSVGElement) => void) | RefObject<SVGSVGElement | number> | [a|b] | {a|b}';
315export var ComplexUnion = Template.bind({});
316ComplexUnion.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});
330export var Markdown = Template.bind({});
331Markdown.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});
346export var StringCompact = Template.bind({});
347StringCompact.args = Object.assign({}, String.args, {
348 compact: true
349});
350export var StringNoControls = Template.bind({});
351StringNoControls.args = {
352 row: String.args.row
353};
354export var StringNoControlsCompact = Template.bind({});
355StringNoControlsCompact.args = {
356 row: String.args.row,
357 compact: true
358};
\No newline at end of file