@storybook/codemod 7.0.0-alpha.5 → 7.0.0-alpha.50

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. package/README.md +0 -36
  2. package/dist/index.d.ts +261 -0
  3. package/dist/index.js +1 -0
  4. package/dist/index.mjs +1 -0
  5. package/jest.config.js +7 -0
  6. package/package.json +31 -28
  7. package/src/index.js +77 -0
  8. package/src/lib/utils.test.js +9 -0
  9. package/{dist/esm/lib/utils.js → src/lib/utils.ts} +10 -11
  10. package/src/transforms/__testfixtures__/add-component-parameters/add-component-parameters.input.js +44 -0
  11. package/src/transforms/__testfixtures__/add-component-parameters/add-component-parameters.output.snapshot +68 -0
  12. package/src/transforms/__testfixtures__/csf-hoist-story-annotations/basic.input.js +25 -0
  13. package/src/transforms/__testfixtures__/csf-hoist-story-annotations/basic.output.snapshot +27 -0
  14. package/src/transforms/__testfixtures__/csf-hoist-story-annotations/overrides.input.js +25 -0
  15. package/src/transforms/__testfixtures__/csf-hoist-story-annotations/overrides.output.snapshot +28 -0
  16. package/src/transforms/__testfixtures__/csf-hoist-story-annotations/variable.input.js +13 -0
  17. package/src/transforms/__testfixtures__/csf-hoist-story-annotations/variable.output.snapshot +17 -0
  18. package/src/transforms/__testfixtures__/csf-to-mdx/basic.input.js +20 -0
  19. package/src/transforms/__testfixtures__/csf-to-mdx/basic.output.snapshot +18 -0
  20. package/src/transforms/__testfixtures__/csf-to-mdx/component-id.input.js +9 -0
  21. package/src/transforms/__testfixtures__/csf-to-mdx/component-id.output.snapshot +10 -0
  22. package/src/transforms/__testfixtures__/csf-to-mdx/decorators.input.js +13 -0
  23. package/src/transforms/__testfixtures__/csf-to-mdx/decorators.output.snapshot +12 -0
  24. package/src/transforms/__testfixtures__/csf-to-mdx/exclude-stories.input.js +23 -0
  25. package/src/transforms/__testfixtures__/csf-to-mdx/exclude-stories.output.snapshot +22 -0
  26. package/src/transforms/__testfixtures__/csf-to-mdx/parameters.input.js +16 -0
  27. package/src/transforms/__testfixtures__/csf-to-mdx/parameters.output.snapshot +17 -0
  28. package/src/transforms/__testfixtures__/csf-to-mdx/story-function.input.js +19 -0
  29. package/src/transforms/__testfixtures__/csf-to-mdx/story-function.output.snapshot +18 -0
  30. package/src/transforms/__testfixtures__/csf-to-mdx/story-parameters.input.js +24 -0
  31. package/src/transforms/__testfixtures__/csf-to-mdx/story-parameters.output.snapshot +22 -0
  32. package/src/transforms/__testfixtures__/mdx-to-csf/basic.input.js +18 -0
  33. package/src/transforms/__testfixtures__/mdx-to-csf/basic.output.snapshot +40 -0
  34. package/src/transforms/__testfixtures__/mdx-to-csf/component-id.input.js +6 -0
  35. package/src/transforms/__testfixtures__/mdx-to-csf/component-id.output.snapshot +17 -0
  36. package/src/transforms/__testfixtures__/mdx-to-csf/decorators.input.js +8 -0
  37. package/src/transforms/__testfixtures__/mdx-to-csf/decorators.output.snapshot +18 -0
  38. package/src/transforms/__testfixtures__/mdx-to-csf/exclude-stories.input.js +19 -0
  39. package/src/transforms/__testfixtures__/mdx-to-csf/exclude-stories.output.snapshot +39 -0
  40. package/src/transforms/__testfixtures__/mdx-to-csf/parameters.input.js +14 -0
  41. package/src/transforms/__testfixtures__/mdx-to-csf/parameters.output.snapshot +23 -0
  42. package/src/transforms/__testfixtures__/mdx-to-csf/plaintext.input.js +3 -0
  43. package/src/transforms/__testfixtures__/mdx-to-csf/plaintext.output.snapshot +11 -0
  44. package/src/transforms/__testfixtures__/mdx-to-csf/story-function.input.js +10 -0
  45. package/src/transforms/__testfixtures__/mdx-to-csf/story-function.output.snapshot +18 -0
  46. package/src/transforms/__testfixtures__/mdx-to-csf/story-parameters.input.js +18 -0
  47. package/src/transforms/__testfixtures__/mdx-to-csf/story-parameters.output.snapshot +32 -0
  48. package/src/transforms/__testfixtures__/mdx-to-csf/story-refs.input.js +22 -0
  49. package/src/transforms/__testfixtures__/mdx-to-csf/story-refs.output.snapshot +34 -0
  50. package/src/transforms/__testfixtures__/move-builtin-addons/default.input.js +2 -0
  51. package/src/transforms/__testfixtures__/move-builtin-addons/default.output.snapshot +8 -0
  52. package/src/transforms/__testfixtures__/move-builtin-addons/with-no-change.input.js +3 -0
  53. package/src/transforms/__testfixtures__/move-builtin-addons/with-no-change.output.snapshot +7 -0
  54. package/src/transforms/__testfixtures__/storiesof-to-csf/basic.input.js +18 -0
  55. package/src/transforms/__testfixtures__/storiesof-to-csf/basic.output.snapshot +45 -0
  56. package/src/transforms/__testfixtures__/storiesof-to-csf/collision.input.js +11 -0
  57. package/src/transforms/__testfixtures__/storiesof-to-csf/collision.output.snapshot +38 -0
  58. package/src/transforms/__testfixtures__/storiesof-to-csf/const.input.js +1 -0
  59. package/src/transforms/__testfixtures__/storiesof-to-csf/const.output.snapshot +13 -0
  60. package/src/transforms/__testfixtures__/storiesof-to-csf/decorators.input.js +9 -0
  61. package/src/transforms/__testfixtures__/storiesof-to-csf/decorators.output.snapshot +18 -0
  62. package/src/transforms/__testfixtures__/storiesof-to-csf/default.input.js +7 -0
  63. package/src/transforms/__testfixtures__/storiesof-to-csf/default.output.snapshot +17 -0
  64. package/src/transforms/__testfixtures__/storiesof-to-csf/digit.input.js +1 -0
  65. package/src/transforms/__testfixtures__/storiesof-to-csf/digit.output.js +5 -0
  66. package/src/transforms/__testfixtures__/storiesof-to-csf/digit.output.snapshot +9 -0
  67. package/src/transforms/__testfixtures__/storiesof-to-csf/export-destructuring.input.js +11 -0
  68. package/src/transforms/__testfixtures__/storiesof-to-csf/export-destructuring.output.snapshot +23 -0
  69. package/src/transforms/__testfixtures__/storiesof-to-csf/export-function.input.js +12 -0
  70. package/src/transforms/__testfixtures__/storiesof-to-csf/export-function.output.snapshot +23 -0
  71. package/src/transforms/__testfixtures__/storiesof-to-csf/export-names.input.js +14 -0
  72. package/src/transforms/__testfixtures__/storiesof-to-csf/export-names.output.snapshot +26 -0
  73. package/src/transforms/__testfixtures__/storiesof-to-csf/exports.input.js +2 -0
  74. package/src/transforms/__testfixtures__/storiesof-to-csf/exports.output.snapshot +16 -0
  75. package/src/transforms/__testfixtures__/storiesof-to-csf/module.input.js +12 -0
  76. package/src/transforms/__testfixtures__/storiesof-to-csf/module.output.snapshot +16 -0
  77. package/src/transforms/__testfixtures__/storiesof-to-csf/multi.input.js +14 -0
  78. package/src/transforms/__testfixtures__/storiesof-to-csf/multi.output.snapshot +39 -0
  79. package/src/transforms/__testfixtures__/storiesof-to-csf/parameters-as-var.input.js +8 -0
  80. package/src/transforms/__testfixtures__/storiesof-to-csf/parameters-as-var.output.snapshot +20 -0
  81. package/src/transforms/__testfixtures__/storiesof-to-csf/parameters.input.js +10 -0
  82. package/src/transforms/__testfixtures__/storiesof-to-csf/parameters.output.snapshot +23 -0
  83. package/src/transforms/__testfixtures__/storiesof-to-csf/storiesof-var.input.js +11 -0
  84. package/src/transforms/__testfixtures__/storiesof-to-csf/storiesof-var.output.snapshot +23 -0
  85. package/src/transforms/__testfixtures__/storiesof-to-csf/story-decorators.input.js +11 -0
  86. package/src/transforms/__testfixtures__/storiesof-to-csf/story-decorators.output.snapshot +29 -0
  87. package/src/transforms/__testfixtures__/storiesof-to-csf/story-parameters.input.js +14 -0
  88. package/src/transforms/__testfixtures__/storiesof-to-csf/story-parameters.output.snapshot +32 -0
  89. package/src/transforms/__testfixtures__/update-addon-info/update-addon-info.input.js +198 -0
  90. package/src/transforms/__testfixtures__/update-addon-info/update-addon-info.output.snapshot +198 -0
  91. package/src/transforms/__testfixtures__/update-organisation-name/update-organisation-name.input.js +19 -0
  92. package/src/transforms/__testfixtures__/update-organisation-name/update-organisation-name.output.snapshot +23 -0
  93. package/src/transforms/__testfixtures__/upgrade-hierarchy-separators/csf.input.js +3 -0
  94. package/src/transforms/__testfixtures__/upgrade-hierarchy-separators/csf.output.snapshot +7 -0
  95. package/src/transforms/__testfixtures__/upgrade-hierarchy-separators/dynamic-storiesof.input.js +5 -0
  96. package/src/transforms/__testfixtures__/upgrade-hierarchy-separators/dynamic-storiesof.output.snapshot +9 -0
  97. package/src/transforms/__testfixtures__/upgrade-hierarchy-separators/storiesof.input.js +8 -0
  98. package/src/transforms/__testfixtures__/upgrade-hierarchy-separators/storiesof.output.snapshot +12 -0
  99. package/src/transforms/__tests__/csf-2-to-3.test.ts +250 -0
  100. package/src/transforms/__tests__/transforms.tests.js +32 -0
  101. package/{dist/esm → src}/transforms/add-component-parameters.js +26 -21
  102. package/src/transforms/csf-2-to-3.ts +184 -0
  103. package/src/transforms/csf-hoist-story-annotations.js +97 -0
  104. package/src/transforms/csf-to-mdx.js +190 -0
  105. package/src/transforms/move-builtin-addons.js +32 -0
  106. package/src/transforms/storiesof-to-csf.js +277 -0
  107. package/{dist/esm → src}/transforms/update-addon-info.js +44 -24
  108. package/{dist/esm → src}/transforms/update-organisation-name.js +20 -23
  109. package/src/transforms/upgrade-hierarchy-separators.js +39 -0
  110. package/tsconfig.json +7 -0
  111. package/LICENSE +0 -21
  112. package/dist/cjs/index.js +0 -142
  113. package/dist/cjs/lib/utils.js +0 -45
  114. package/dist/cjs/transforms/add-component-parameters.js +0 -64
  115. package/dist/cjs/transforms/csf-2-to-3.js +0 -180
  116. package/dist/cjs/transforms/csf-hoist-story-annotations.js +0 -93
  117. package/dist/cjs/transforms/csf-to-mdx.js +0 -196
  118. package/dist/cjs/transforms/mdx-to-csf.js +0 -153
  119. package/dist/cjs/transforms/move-builtin-addons.js +0 -57
  120. package/dist/cjs/transforms/storiesof-to-csf.js +0 -300
  121. package/dist/cjs/transforms/update-addon-info.js +0 -101
  122. package/dist/cjs/transforms/update-organisation-name.js +0 -83
  123. package/dist/cjs/transforms/upgrade-hierarchy-separators.js +0 -42
  124. package/dist/esm/index.js +0 -99
  125. package/dist/esm/transforms/csf-2-to-3.js +0 -163
  126. package/dist/esm/transforms/csf-hoist-story-annotations.js +0 -86
  127. package/dist/esm/transforms/csf-to-mdx.js +0 -188
  128. package/dist/esm/transforms/mdx-to-csf.js +0 -139
  129. package/dist/esm/transforms/move-builtin-addons.js +0 -50
  130. package/dist/esm/transforms/storiesof-to-csf.js +0 -287
  131. package/dist/esm/transforms/upgrade-hierarchy-separators.js +0 -35
  132. package/dist/types/lib/utils.d.ts +0 -2
  133. package/dist/types/transforms/csf-2-to-3.d.ts +0 -6
@@ -0,0 +1,23 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`storiesof-to-csf transforms correctly using "parameters.input.js" data 1`] = `
4
+ "/* eslint-disable */
5
+ import React from 'react';
6
+ import Button from './Button';
7
+
8
+ export default {
9
+ title: 'Button',
10
+
11
+ parameters: {
12
+ component: Button,
13
+ foo: 1,
14
+ bar: 2,
15
+ },
16
+ };
17
+
18
+ export const WithKindParameters = () => <Button label=\\"The Button\\" />;
19
+
20
+ WithKindParameters.story = {
21
+ name: 'with kind parameters',
22
+ };"
23
+ `;
@@ -0,0 +1,11 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import React from 'react';
3
+ import { storiesOf } from '@storybook/react';
4
+ import Hero from './Hero';
5
+
6
+ const chapter = storiesOf('Webapp screens/Marketing/LandingScreen/Hero', module).add(
7
+ 'default',
8
+ () => <Hero />
9
+ );
10
+
11
+ chapter.add('loading', () => <Hero loading />);
@@ -0,0 +1,23 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`storiesof-to-csf transforms correctly using "storiesof-var.input.js" data 1`] = `
4
+ "/* eslint-disable import/no-extraneous-dependencies */
5
+ import React from 'react';
6
+ import Hero from './Hero';
7
+
8
+ export default {
9
+ title: 'Webapp screens/Marketing/LandingScreen/Hero',
10
+ };
11
+
12
+ export const Default = () => <Hero />;
13
+
14
+ Default.story = {
15
+ name: 'default',
16
+ };
17
+
18
+ export const Loading = () => <Hero loading />;
19
+
20
+ Loading.story = {
21
+ name: 'loading',
22
+ };"
23
+ `;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import Button from './Button';
3
+
4
+ storiesOf('Some.Button', module)
5
+ .add('with story params and decorators', () => <Button label="The Button" />, {
6
+ bar: 1,
7
+ decorators: [withKnobs, storyFn => <div className="foo">{storyFn}</div>],
8
+ })
9
+ .add('with story decorators', () => <Button label="The Button" />, {
10
+ decorators: [withKnobs],
11
+ });
@@ -0,0 +1,29 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`storiesof-to-csf transforms correctly using "story-decorators.input.js" data 1`] = `
4
+ "import React from 'react';
5
+ import Button from './Button';
6
+
7
+ export default {
8
+ title: 'Some.Button',
9
+ };
10
+
11
+ export const WithStoryParamsAndDecorators = () => <Button label=\\"The Button\\" />;
12
+
13
+ WithStoryParamsAndDecorators.story = {
14
+ name: 'with story params and decorators',
15
+
16
+ parameters: {
17
+ bar: 1,
18
+ },
19
+
20
+ decorators: [withKnobs, (storyFn) => <div className=\\"foo\\">{storyFn}</div>],
21
+ };
22
+
23
+ export const WithStoryDecorators = () => <Button label=\\"The Button\\" />;
24
+
25
+ WithStoryDecorators.story = {
26
+ name: 'with story decorators',
27
+ decorators: [withKnobs],
28
+ };"
29
+ `;
@@ -0,0 +1,14 @@
1
+ /* eslint-disable */
2
+ import React from 'react';
3
+ import Button from './Button';
4
+
5
+ import { storiesOf } from '@storybook/react';
6
+
7
+ storiesOf('Button', module)
8
+ .add('with story parameters', () => <Button label="The Button" />, {
9
+ header: false,
10
+ inline: true,
11
+ })
12
+ .add('foo', () => <Button label="Foo" />, {
13
+ bar: 1,
14
+ });
@@ -0,0 +1,32 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`storiesof-to-csf transforms correctly using "story-parameters.input.js" data 1`] = `
4
+ "/* eslint-disable */
5
+ import React from 'react';
6
+ import Button from './Button';
7
+
8
+ export default {
9
+ title: 'Button',
10
+ };
11
+
12
+ export const WithStoryParameters = () => <Button label=\\"The Button\\" />;
13
+
14
+ WithStoryParameters.story = {
15
+ name: 'with story parameters',
16
+
17
+ parameters: {
18
+ header: false,
19
+ inline: true,
20
+ },
21
+ };
22
+
23
+ export const Foo = () => <Button label=\\"Foo\\" />;
24
+
25
+ Foo.story = {
26
+ name: 'foo',
27
+
28
+ parameters: {
29
+ bar: 1,
30
+ },
31
+ };"
32
+ `;
@@ -0,0 +1,198 @@
1
+ /* eslint-disable */
2
+ import React from 'react'
3
+ import Button from './Button'
4
+
5
+ import { storiesOf } from '@storybook/react'
6
+ import { action } from '@storybook/addon-actions'
7
+
8
+ storiesOf(
9
+ 'Button'
10
+ ).addWithInfo(
11
+ 'simple usage',
12
+ 'This is the basic usage with the button with providing a label to show the text.',
13
+ () => (
14
+ <div>
15
+ <Button label="The Button" onClick={action('onClick')} />
16
+ <br />
17
+ <p>
18
+ Click the "?" mark at top-right to view the info.
19
+ </p>
20
+ </div>
21
+ )
22
+ )
23
+
24
+ storiesOf('Button').addWithInfo(
25
+ 'simple usage (inline info)',
26
+ `
27
+ This is the basic usage with the button with providing a label to show the text.
28
+ `,
29
+ () => <Button label="The Button" onClick={action('onClick')} />,
30
+ { inline: true }
31
+ )
32
+
33
+ storiesOf('Button').addWithInfo(
34
+ 'simple usage (disable source)',
35
+ `
36
+ This is the basic usage with the button with providing a label to show the text.
37
+ `,
38
+ () => <Button label="The Button" onClick={action('onClick')} />,
39
+ { source: false, inline: true }
40
+ )
41
+
42
+ storiesOf('Button').addWithInfo(
43
+ 'simple usage (no header)',
44
+ `
45
+ This is the basic usage with the button with providing a label to show the text.
46
+ `,
47
+ () => <Button label="The Button" onClick={action('onClick')} />,
48
+ { header: false, inline: true }
49
+ )
50
+
51
+ storiesOf('Button').addWithInfo(
52
+ 'simple usage (no prop tables)',
53
+ `
54
+ This is the basic usage with the button with providing a label to show the text.
55
+ `,
56
+ () => <Button label="The Button" onClick={action('onClick')} />,
57
+ { propTables: false, inline: true }
58
+ )
59
+
60
+ storiesOf('Button').addWithInfo(
61
+ 'simple usage (custom propTables)',
62
+ `
63
+ This is the basic usage with the button with providing a label to show the text.
64
+ Since, the story source code is wrapped inside a div, info addon can't figure out propTypes on it's own.
65
+ So, we need to give relevant React component classes manually using \`propTypes\` option as shown below:
66
+ ~~~js
67
+ storiesOf('Button')
68
+ .addWithInfo(
69
+ 'simple usage (custom propTables)',
70
+ <info>,
71
+ <storyFn>,
72
+ { inline: true, propTables: [Button]}
73
+ );
74
+ ~~~
75
+ `,
76
+ () => (
77
+ <div>
78
+ <Button label="The Button" onClick={action('onClick')} />
79
+ <br />
80
+ </div>
81
+ ),
82
+ { inline: true, propTables: [Button] }
83
+ )
84
+
85
+ storiesOf('Button').addWithInfo(
86
+ 'simple usage (JSX description)',
87
+ <div>
88
+ <h2>This is a JSX info section</h2>
89
+ <p>
90
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
91
+ Sed ornare massa rutrum metus commodo, a mattis velit dignissim.
92
+ Fusce vestibulum turpis sed massa egestas pharetra. Sed at libero
93
+ nulla.
94
+ </p>
95
+ <p>
96
+ <a href="https://github.com/storybookjs/react-storybook-addon-info">
97
+ This is a link
98
+ </a>
99
+ </p>
100
+ <p>
101
+ <img src="https://storybook.js.org/images/placeholders/350x150.png" />
102
+ </p>
103
+ </div>,
104
+ () => (
105
+ <div>
106
+ <Button label="The Button" onClick={action('onClick')} />
107
+ <br />
108
+ <p>
109
+ Click the "?" mark at top-right to view the info.
110
+ </p>
111
+ </div>
112
+ )
113
+ )
114
+
115
+ storiesOf('Button').addWithInfo(
116
+ 'simple usage (inline JSX description)',
117
+ <div>
118
+ <h2>This is a JSX info section</h2>
119
+ <p>
120
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
121
+ Sed ornare massa rutrum metus commodo, a mattis velit dignissim.
122
+ Fusce vestibulum turpis sed massa egestas pharetra. Sed at libero
123
+ nulla.
124
+ </p>
125
+ <p>
126
+ <a href="https://github.com/storybookjs/react-storybook-addon-info">
127
+ This is a link
128
+ </a>
129
+ </p>
130
+ <p>
131
+ <img src="https://storybook.js.org/images/placeholders/350x150.png" />
132
+ </p>
133
+ </div>,
134
+ () => <Button label="The Button" onClick={action('onClick')} />,
135
+ { inline: true }
136
+ )
137
+
138
+ storiesOf('Button').addWithInfo(
139
+ 'simple usage (maxPropsInLine === 1)',
140
+ `
141
+ This is the basic usage with the button with providing a label to show the text.
142
+ `,
143
+ () => <Button label="The Button" onClick={action('onClick')} />,
144
+ { inline: true, maxPropsIntoLine: 1 }
145
+ )
146
+
147
+ storiesOf('Button').addWithInfo(
148
+ 'simple usage (maxPropObjectKeys === 5)',
149
+ `
150
+ This is the basic usage with the button with providing a label to show the text.
151
+ `,
152
+ () => <Button label="The Button" object={{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }} />,
153
+ { inline: true, maxPropObjectKeys: 5 }
154
+ )
155
+
156
+ storiesOf('Button').addWithInfo(
157
+ 'simple usage (maxPropArrayLength === 8)',
158
+ `
159
+ This is the basic usage with the button with providing a label to show the text.
160
+ `,
161
+ () => <Button label="The Button" array={[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]} />,
162
+ { inline: true, maxPropArrayLength: 8 }
163
+ )
164
+
165
+ storiesOf('Button').addWithInfo(
166
+ 'simple usage (maxPropStringLength === 10)',
167
+ `
168
+ This is the basic usage with the button with providing a label to show the text.
169
+ `,
170
+ () => <Button label="The Button" string="1 2 3 4 5 6 7 8" />,
171
+ { inline: true, maxPropStringLength: 5 }
172
+ )
173
+
174
+ storiesOf('Button').addWithInfo(
175
+ 'with custom styles',
176
+ `
177
+ This is an example of how to customize the styles of the info components.
178
+ For the full styles available, see \`./src/components/Story.js\`
179
+ `,
180
+ () => <Button label="The Button" onClick={action('onClick')} />,
181
+ {
182
+ inline: true,
183
+ styles: stylesheet => {
184
+ stylesheet.infoPage = {
185
+ backgroundColor: '#ccc'
186
+ }
187
+ return stylesheet
188
+ }
189
+ }
190
+ )
191
+
192
+ storiesOf('shared/ProgressBar', module)
193
+ .addDecorator(withKnobs)
194
+ .addWithInfo('default style', () => (
195
+ <ProgressBar progress={number('progress', 25)}
196
+ delay={number('delay', 500)}
197
+ />
198
+ ));
@@ -0,0 +1,198 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`update-addon-info transforms correctly using "update-addon-info.input.js" data 1`] = `
4
+ "/* eslint-disable */
5
+ import React from 'react'
6
+ import Button from './Button'
7
+
8
+ import { storiesOf } from '@storybook/react'
9
+ import { action } from '@storybook/addon-actions'
10
+
11
+ import { withInfo } from \\"@storybook/addon-info\\";
12
+
13
+ storiesOf(
14
+ 'Button'
15
+ ).add('simple usage', withInfo(
16
+ 'This is the basic usage with the button with providing a label to show the text.'
17
+ )(() => (
18
+ <div>
19
+ <Button label=\\"The Button\\" onClick={action('onClick')} />
20
+ <br />
21
+ <p>
22
+ Click the \\"?\\" mark at top-right to view the info.
23
+ </p>
24
+ </div>
25
+ )))
26
+
27
+ storiesOf('Button').add('simple usage (inline info)', withInfo({
28
+ text: \`
29
+ This is the basic usage with the button with providing a label to show the text.
30
+ \`,
31
+
32
+ inline: true
33
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
34
+
35
+ storiesOf('Button').add('simple usage (disable source)', withInfo({
36
+ text: \`
37
+ This is the basic usage with the button with providing a label to show the text.
38
+ \`,
39
+
40
+ source: false,
41
+ inline: true
42
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
43
+
44
+ storiesOf('Button').add('simple usage (no header)', withInfo({
45
+ text: \`
46
+ This is the basic usage with the button with providing a label to show the text.
47
+ \`,
48
+
49
+ header: false,
50
+ inline: true
51
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
52
+
53
+ storiesOf('Button').add('simple usage (no prop tables)', withInfo({
54
+ text: \`
55
+ This is the basic usage with the button with providing a label to show the text.
56
+ \`,
57
+
58
+ propTables: false,
59
+ inline: true
60
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
61
+
62
+ storiesOf('Button').add('simple usage (custom propTables)', withInfo({
63
+ text: \`
64
+ This is the basic usage with the button with providing a label to show the text.
65
+ Since, the story source code is wrapped inside a div, info addon can't figure out propTypes on it's own.
66
+ So, we need to give relevant React component classes manually using \\\\\`propTypes\\\\\` option as shown below:
67
+ ~~~js
68
+ storiesOf('Button')
69
+ .addWithInfo(
70
+ 'simple usage (custom propTables)',
71
+ <info>,
72
+ <storyFn>,
73
+ { inline: true, propTables: [Button]}
74
+ );
75
+ ~~~
76
+ \`,
77
+
78
+ inline: true,
79
+ propTables: [Button]
80
+ })(() => (
81
+ <div>
82
+ <Button label=\\"The Button\\" onClick={action('onClick')} />
83
+ <br />
84
+ </div>
85
+ )))
86
+
87
+ storiesOf('Button').add('simple usage (JSX description)', withInfo(<div>
88
+ <h2>This is a JSX info section</h2>
89
+ <p>
90
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
91
+ Sed ornare massa rutrum metus commodo, a mattis velit dignissim.
92
+ Fusce vestibulum turpis sed massa egestas pharetra. Sed at libero
93
+ nulla.
94
+ </p>
95
+ <p>
96
+ <a href=\\"https://github.com/storybookjs/react-storybook-addon-info\\">
97
+ This is a link
98
+ </a>
99
+ </p>
100
+ <p>
101
+ <img src=\\"https://storybook.js.org/images/placeholders/350x150.png\\" />
102
+ </p>
103
+ </div>)(() => (
104
+ <div>
105
+ <Button label=\\"The Button\\" onClick={action('onClick')} />
106
+ <br />
107
+ <p>
108
+ Click the \\"?\\" mark at top-right to view the info.
109
+ </p>
110
+ </div>
111
+ )))
112
+
113
+ storiesOf('Button').add('simple usage (inline JSX description)', withInfo({
114
+ text: <div>
115
+ <h2>This is a JSX info section</h2>
116
+ <p>
117
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
118
+ Sed ornare massa rutrum metus commodo, a mattis velit dignissim.
119
+ Fusce vestibulum turpis sed massa egestas pharetra. Sed at libero
120
+ nulla.
121
+ </p>
122
+ <p>
123
+ <a href=\\"https://github.com/storybookjs/react-storybook-addon-info\\">
124
+ This is a link
125
+ </a>
126
+ </p>
127
+ <p>
128
+ <img src=\\"https://storybook.js.org/images/placeholders/350x150.png\\" />
129
+ </p>
130
+ </div>,
131
+
132
+ inline: true
133
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
134
+
135
+ storiesOf('Button').add('simple usage (maxPropsInLine === 1)', withInfo({
136
+ text: \`
137
+ This is the basic usage with the button with providing a label to show the text.
138
+ \`,
139
+
140
+ inline: true,
141
+ maxPropsIntoLine: 1
142
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
143
+
144
+ storiesOf('Button').add('simple usage (maxPropObjectKeys === 5)', withInfo({
145
+ text: \`
146
+ This is the basic usage with the button with providing a label to show the text.
147
+ \`,
148
+
149
+ inline: true,
150
+ maxPropObjectKeys: 5
151
+ })(
152
+ () => <Button label=\\"The Button\\" object={{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }} />
153
+ ))
154
+
155
+ storiesOf('Button').add('simple usage (maxPropArrayLength === 8)', withInfo({
156
+ text: \`
157
+ This is the basic usage with the button with providing a label to show the text.
158
+ \`,
159
+
160
+ inline: true,
161
+ maxPropArrayLength: 8
162
+ })(
163
+ () => <Button label=\\"The Button\\" array={[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]} />
164
+ ))
165
+
166
+ storiesOf('Button').add('simple usage (maxPropStringLength === 10)', withInfo({
167
+ text: \`
168
+ This is the basic usage with the button with providing a label to show the text.
169
+ \`,
170
+
171
+ inline: true,
172
+ maxPropStringLength: 5
173
+ })(() => <Button label=\\"The Button\\" string=\\"1 2 3 4 5 6 7 8\\" />))
174
+
175
+ storiesOf('Button').add('with custom styles', withInfo({
176
+ text: \`
177
+ This is an example of how to customize the styles of the info components.
178
+ For the full styles available, see \\\\\`./src/components/Story.js\\\\\`
179
+ \`,
180
+
181
+ inline: true,
182
+
183
+ styles: stylesheet => {
184
+ stylesheet.infoPage = {
185
+ backgroundColor: '#ccc'
186
+ }
187
+ return stylesheet
188
+ }
189
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
190
+
191
+ storiesOf('shared/ProgressBar', module)
192
+ .addDecorator(withKnobs)
193
+ .add('default style', withInfo('default style')(() => (
194
+ <ProgressBar progress={number('progress', 25)}
195
+ delay={number('delay', 500)}
196
+ />
197
+ )));"
198
+ `;
@@ -0,0 +1,19 @@
1
+ /* eslint-disable */
2
+ import '@kadira/storybook-addons';
3
+ import '@kadira/storybook-addon-comments';
4
+ import '@kadira/react-storybook-decorator-centered';
5
+ import '@kadira/storybook-addon-graphql';
6
+ import '@kadira/storybook-addon-info';
7
+ import '@kadira/storybook-addon-knobs';
8
+ import '@kadira/storybook-addon-links';
9
+ import '@kadira/storybook-addon-notes';
10
+ import '@kadira/storybook-addon-options';
11
+ import 'storyshots';
12
+ import '@kadira/storybook-channels';
13
+ import '@kadira/storybook-channel-postmsg';
14
+ import '@kadira/storybook-channel-websocket';
15
+ import '@kadira/getstorybook';
16
+ import '@kadira/react-storybook';
17
+ import '@kadira/react-native-storybook';
18
+ import '@kadira/storybook-ui';
19
+ import { storiesOf } from '@kadira/react-storybook';
@@ -0,0 +1,23 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`update-organisation-name transforms correctly using "update-organisation-name.input.js" data 1`] = `
4
+ "/* eslint-disable */
5
+ import '@storybook/addons';
6
+ import '@storybook/addon-comments';
7
+ import '@storybook/addon-centered';
8
+ import '@storybook/addon-graphql';
9
+ import '@storybook/addon-info';
10
+ import '@storybook/addon-knobs';
11
+ import '@storybook/addon-links';
12
+ import '@storybook/addon-notes';
13
+ import '@storybook/addon-options';
14
+ import '@storybook/addon-storyshots';
15
+ import '@storybook/channels';
16
+ import '@storybook/channel-postmessage';
17
+ import '@storybook/channel-websocket';
18
+ import '@storybook/cli';
19
+ import '@storybook/react';
20
+ import '@storybook/react-native';
21
+ import '@storybook/manager';
22
+ import { storiesOf } from '@storybook/react';"
23
+ `;
@@ -0,0 +1,3 @@
1
+ export default {
2
+ title: 'Foo|Bar/baz.whatever',
3
+ };
@@ -0,0 +1,7 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`upgrade-hierarchy-separators transforms correctly using "csf.input.js" data 1`] = `
4
+ "export default {
5
+ title: 'Foo/Bar/baz/whatever',
6
+ };"
7
+ `;
@@ -0,0 +1,5 @@
1
+ import { storiesOf } from '@storybook/react';
2
+
3
+ const foo = 'some|generated/path';
4
+
5
+ storiesOf(foo, module).add('foobar', () => <>hmm</>);
@@ -0,0 +1,9 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`upgrade-hierarchy-separators transforms correctly using "dynamic-storiesof.input.js" data 1`] = `
4
+ "import { storiesOf } from '@storybook/react';
5
+
6
+ const foo = 'some|generated/path';
7
+
8
+ storiesOf(foo, module).add('foobar', () => <>hmm</>);"
9
+ `;
@@ -0,0 +1,8 @@
1
+ import { storiesOf } from '@storybook/react';
2
+
3
+ storiesOf('A/B/C', module).add('abc', () => <div>hello</div>);
4
+ storiesOf('D|E/f', module).add('def', () => <div>hello</div>);
5
+
6
+ storiesOf('G|h/i.jkl', module)
7
+ .add('hijkl', () => <div>hello</div>)
8
+ .add('whatever', () => <div>goodbye!</div>);
@@ -0,0 +1,12 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`upgrade-hierarchy-separators transforms correctly using "storiesof.input.js" data 1`] = `
4
+ "import { storiesOf } from '@storybook/react';
5
+
6
+ storiesOf('A/B/C', module).add('abc', () => <div>hello</div>);
7
+ storiesOf('D/E/f', module).add('def', () => <div>hello</div>);
8
+
9
+ storiesOf('G/h/i/jkl', module)
10
+ .add('hijkl', () => <div>hello</div>)
11
+ .add('whatever', () => <div>goodbye!</div>);"
12
+ `;