@storybook/react 7.0.0-alpha.46 → 7.0.0-alpha.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +9 -8
- package/template/cli/.eslintrc.json +5 -0
- package/template/cli/js/Button.jsx +50 -0
- package/template/cli/js/Button.stories.js +41 -0
- package/template/cli/js/Header.jsx +59 -0
- package/template/cli/js/Header.stories.js +22 -0
- package/template/cli/js/Page.jsx +69 -0
- package/template/cli/js/Page.stories.js +25 -0
- package/template/cli/ts/Button.stories.ts +47 -0
- package/template/cli/ts/Button.tsx +48 -0
- package/template/cli/ts/Header.stories.ts +26 -0
- package/template/cli/ts/Header.tsx +56 -0
- package/template/cli/ts/Page.stories.ts +29 -0
- package/template/cli/ts/Page.tsx +73 -0
- package/template/components/Button.jsx +13 -0
- package/template/components/Form.jsx +36 -0
- package/template/components/Html.jsx +9 -0
- package/template/components/Pre.jsx +20 -0
- package/template/components/index.js +9 -0
- package/template/stories/decorators.stories.tsx +28 -0
- package/template/stories/docgen-components/10017-ts-union/argTypes.snapshot +36 -0
- package/template/stories/docgen-components/10017-ts-union/docgen.snapshot +34 -0
- package/template/stories/docgen-components/10017-ts-union/input.tsx +12 -0
- package/template/stories/docgen-components/10017-ts-union/properties.snapshot +32 -0
- package/template/stories/docgen-components/10278-ts-multiple-components/argTypes.snapshot +26 -0
- package/template/stories/docgen-components/10278-ts-multiple-components/docgen.snapshot +49 -0
- package/template/stories/docgen-components/10278-ts-multiple-components/input.tsx +27 -0
- package/template/stories/docgen-components/10278-ts-multiple-components/properties.snapshot +22 -0
- package/template/stories/docgen-components/8140-js-prop-types-oneof/argTypes.snapshot +127 -0
- package/template/stories/docgen-components/8140-js-prop-types-oneof/docgen.snapshot +97 -0
- package/template/stories/docgen-components/8140-js-prop-types-oneof/input.jsx +27 -0
- package/template/stories/docgen-components/8140-js-prop-types-oneof/properties.snapshot +89 -0
- package/template/stories/docgen-components/8143-ts-imported-types/argTypes.snapshot +27 -0
- package/template/stories/docgen-components/8143-ts-imported-types/docgen.snapshot +22 -0
- package/template/stories/docgen-components/8143-ts-imported-types/input.tsx +10 -0
- package/template/stories/docgen-components/8143-ts-imported-types/properties.snapshot +23 -0
- package/template/stories/docgen-components/8143-ts-imported-types/types.ts +3 -0
- package/template/stories/docgen-components/8143-ts-react-fc-generics/argTypes.snapshot +27 -0
- package/template/stories/docgen-components/8143-ts-react-fc-generics/docgen.snapshot +24 -0
- package/template/stories/docgen-components/8143-ts-react-fc-generics/input.tsx +10 -0
- package/template/stories/docgen-components/8143-ts-react-fc-generics/properties.snapshot +21 -0
- package/template/stories/docgen-components/8428-js-static-prop-types/argTypes.snapshot +25 -0
- package/template/stories/docgen-components/8428-js-static-prop-types/docgen.snapshot +37 -0
- package/template/stories/docgen-components/8428-js-static-prop-types/input.jsx +20 -0
- package/template/stories/docgen-components/8428-js-static-prop-types/properties.snapshot +21 -0
- package/template/stories/docgen-components/8740-ts-multi-props/argTypes.snapshot +27 -0
- package/template/stories/docgen-components/8740-ts-multi-props/docgen.snapshot +49 -0
- package/template/stories/docgen-components/8740-ts-multi-props/input.tsx +23 -0
- package/template/stories/docgen-components/8740-ts-multi-props/properties.snapshot +21 -0
- package/template/stories/docgen-components/8894-9511-ts-forward-ref/argTypes.snapshot +48 -0
- package/template/stories/docgen-components/8894-9511-ts-forward-ref/docgen.snapshot +39 -0
- package/template/stories/docgen-components/8894-9511-ts-forward-ref/input.tsx +31 -0
- package/template/stories/docgen-components/8894-9511-ts-forward-ref/properties.snapshot +34 -0
- package/template/stories/docgen-components/9023-js-hoc/argTypes.snapshot +89 -0
- package/template/stories/docgen-components/9023-js-hoc/docgen.snapshot +84 -0
- package/template/stories/docgen-components/9023-js-hoc/input.jsx +40 -0
- package/template/stories/docgen-components/9023-js-hoc/properties.snapshot +67 -0
- package/template/stories/docgen-components/9399-js-proptypes-shape/argTypes.snapshot +39 -0
- package/template/stories/docgen-components/9399-js-proptypes-shape/docgen.snapshot +48 -0
- package/template/stories/docgen-components/9399-js-proptypes-shape/input.jsx +16 -0
- package/template/stories/docgen-components/9399-js-proptypes-shape/properties.snapshot +35 -0
- package/template/stories/docgen-components/9465-ts-type-props/argTypes.snapshot +28 -0
- package/template/stories/docgen-components/9465-ts-type-props/docgen.snapshot +33 -0
- package/template/stories/docgen-components/9465-ts-type-props/input.tsx +12 -0
- package/template/stories/docgen-components/9465-ts-type-props/properties.snapshot +24 -0
- package/template/stories/docgen-components/9493-ts-display-name/argTypes.snapshot +62 -0
- package/template/stories/docgen-components/9493-ts-display-name/docgen.snapshot +50 -0
- package/template/stories/docgen-components/9493-ts-display-name/input.tsx +30 -0
- package/template/stories/docgen-components/9493-ts-display-name/properties.snapshot +52 -0
- package/template/stories/docgen-components/9556-ts-react-default-exports/argTypes.snapshot +28 -0
- package/template/stories/docgen-components/9556-ts-react-default-exports/docgen.snapshot +32 -0
- package/template/stories/docgen-components/9556-ts-react-default-exports/input.tsx +12 -0
- package/template/stories/docgen-components/9556-ts-react-default-exports/properties.snapshot +24 -0
- package/template/stories/docgen-components/9575-ts-camel-case/argTypes.snapshot +28 -0
- package/template/stories/docgen-components/9575-ts-camel-case/docgen.snapshot +38 -0
- package/template/stories/docgen-components/9575-ts-camel-case/input.tsx +26 -0
- package/template/stories/docgen-components/9575-ts-camel-case/properties.snapshot +24 -0
- package/template/stories/docgen-components/9586-js-react-memo/argTypes.snapshot +41 -0
- package/template/stories/docgen-components/9586-js-react-memo/docgen.snapshot +42 -0
- package/template/stories/docgen-components/9586-js-react-memo/input.jsx +15 -0
- package/template/stories/docgen-components/9586-js-react-memo/properties.snapshot +34 -0
- package/template/stories/docgen-components/9591-ts-import-types/Bar.tsx +3 -0
- package/template/stories/docgen-components/9591-ts-import-types/argTypes.snapshot +25 -0
- package/template/stories/docgen-components/9591-ts-import-types/docgen.snapshot +21 -0
- package/template/stories/docgen-components/9591-ts-import-types/input.tsx +10 -0
- package/template/stories/docgen-components/9591-ts-import-types/properties.snapshot +21 -0
- package/template/stories/docgen-components/9626-js-default-values/argTypes.snapshot +27 -0
- package/template/stories/docgen-components/9626-js-default-values/docgen.snapshot +25 -0
- package/template/stories/docgen-components/9626-js-default-values/input.jsx +5 -0
- package/template/stories/docgen-components/9626-js-default-values/properties.snapshot +21 -0
- package/template/stories/docgen-components/9668-js-proptypes-no-jsdoc/argTypes.snapshot +42 -0
- package/template/stories/docgen-components/9668-js-proptypes-no-jsdoc/docgen.snapshot +36 -0
- package/template/stories/docgen-components/9668-js-proptypes-no-jsdoc/input.jsx +13 -0
- package/template/stories/docgen-components/9668-js-proptypes-no-jsdoc/properties.snapshot +35 -0
- package/template/stories/docgen-components/9721-ts-deprecated-jsdoc/argTypes.snapshot +53 -0
- package/template/stories/docgen-components/9721-ts-deprecated-jsdoc/docgen.snapshot +45 -0
- package/template/stories/docgen-components/9721-ts-deprecated-jsdoc/input.tsx +18 -0
- package/template/stories/docgen-components/9721-ts-deprecated-jsdoc/properties.snapshot +43 -0
- package/template/stories/docgen-components/9764-ts-extend-props/argTypes.snapshot +72 -0
- package/template/stories/docgen-components/9764-ts-extend-props/docgen.snapshot +41 -0
- package/template/stories/docgen-components/9764-ts-extend-props/input.tsx +17 -0
- package/template/stories/docgen-components/9764-ts-extend-props/properties.snapshot +56 -0
- package/template/stories/docgen-components/9827-ts-default-values/argTypes.snapshot +72 -0
- package/template/stories/docgen-components/9827-ts-default-values/docgen.snapshot +52 -0
- package/template/stories/docgen-components/9827-ts-default-values/input.tsx +17 -0
- package/template/stories/docgen-components/9827-ts-default-values/properties.snapshot +56 -0
- package/template/stories/docgen-components/9832-ts-enum-export/argTypes.snapshot +3 -0
- package/template/stories/docgen-components/9832-ts-enum-export/docgen.snapshot +16 -0
- package/template/stories/docgen-components/9832-ts-enum-export/input.tsx +8 -0
- package/template/stories/docgen-components/9832-ts-enum-export/properties.snapshot +7 -0
- package/template/stories/docgen-components/9922-ts-component-props/argTypes.snapshot +25 -0
- package/template/stories/docgen-components/9922-ts-component-props/docgen.snapshot +35 -0
- package/template/stories/docgen-components/9922-ts-component-props/input.tsx +24 -0
- package/template/stories/docgen-components/9922-ts-component-props/properties.snapshot +21 -0
- package/template/stories/docgen-components/imported.js +1 -0
- package/template/stories/docgen-components/js-class-component/argTypes.snapshot +386 -0
- package/template/stories/docgen-components/js-class-component/docgen.snapshot +252 -0
- package/template/stories/docgen-components/js-class-component/input.jsx +57 -0
- package/template/stories/docgen-components/js-class-component/properties.snapshot +286 -0
- package/template/stories/docgen-components/js-function-component/argTypes.snapshot +386 -0
- package/template/stories/docgen-components/js-function-component/docgen.snapshot +236 -0
- package/template/stories/docgen-components/js-function-component/input.jsx +50 -0
- package/template/stories/docgen-components/js-function-component/properties.snapshot +286 -0
- package/template/stories/docgen-components/js-function-component-inline-defaults/argTypes.snapshot +386 -0
- package/template/stories/docgen-components/js-function-component-inline-defaults/docgen.snapshot +247 -0
- package/template/stories/docgen-components/js-function-component-inline-defaults/input.jsx +65 -0
- package/template/stories/docgen-components/js-function-component-inline-defaults/properties.snapshot +286 -0
- package/template/stories/docgen-components/js-function-component-inline-defaults-no-propTypes/argTypes.snapshot +237 -0
- package/template/stories/docgen-components/js-function-component-inline-defaults-no-propTypes/docgen.snapshot +124 -0
- package/template/stories/docgen-components/js-function-component-inline-defaults-no-propTypes/input.jsx +41 -0
- package/template/stories/docgen-components/js-function-component-inline-defaults-no-propTypes/properties.snapshot +151 -0
- package/template/stories/docgen-components/js-proptypes/docgen.snapshot +1770 -0
- package/template/stories/docgen-components/js-proptypes/ext.js +13 -0
- package/template/stories/docgen-components/js-proptypes/input.jsx +497 -0
- package/template/stories/docgen-components/jsdoc/argTypes.snapshot +969 -0
- package/template/stories/docgen-components/jsdoc/docgen.snapshot +548 -0
- package/template/stories/docgen-components/jsdoc/input.jsx +231 -0
- package/template/stories/docgen-components/jsdoc/properties.snapshot +857 -0
- package/template/stories/docgen-components/ts-function-component/argTypes.snapshot +396 -0
- package/template/stories/docgen-components/ts-function-component/docgen.snapshot +241 -0
- package/template/stories/docgen-components/ts-function-component/input.tsx +52 -0
- package/template/stories/docgen-components/ts-function-component/properties.snapshot +296 -0
- package/template/stories/docgen-components/ts-function-component-inline-defaults/argTypes.snapshot +279 -0
- package/template/stories/docgen-components/ts-function-component-inline-defaults/docgen.snapshot +151 -0
- package/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx +80 -0
- package/template/stories/docgen-components/ts-function-component-inline-defaults/properties.snapshot +177 -0
- package/template/stories/docgen-components/ts-html/argTypes.snapshot +3 -0
- package/template/stories/docgen-components/ts-html/docgen.snapshot +12 -0
- package/template/stories/docgen-components/ts-html/input.tsx +12 -0
- package/template/stories/docgen-components/ts-html/properties.snapshot +7 -0
- package/template/stories/docgen-components/ts-jsdoc/argTypes.snapshot +3 -0
- package/template/stories/docgen-components/ts-jsdoc/docgen.snapshot +21 -0
- package/template/stories/docgen-components/ts-jsdoc/input.tsx +27 -0
- package/template/stories/docgen-components/ts-jsdoc/properties.snapshot +7 -0
- package/template/stories/docgen-components/ts-types/argTypes.snapshot +656 -0
- package/template/stories/docgen-components/ts-types/docgen.snapshot +317 -0
- package/template/stories/docgen-components/ts-types/input.tsx +130 -0
- package/template/stories/docgen-components/ts-types/properties.snapshot +410 -0
- package/template/stories/errors.stories.tsx +37 -0
- package/template/stories/hooks.stories.tsx +17 -0
- package/template/stories/js-argtypes.stories.jsx +91 -0
- package/template/stories/react-mdx.stories.mdx +26 -0
- package/template/stories/ts-argtypes.stories.tsx +81 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`react component properties ts-types 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"rows": Array [
|
|
6
|
+
Object {
|
|
7
|
+
"defaultValue": Object {
|
|
8
|
+
"detail": undefined,
|
|
9
|
+
"summary": "'Any value'",
|
|
10
|
+
},
|
|
11
|
+
"description": undefined,
|
|
12
|
+
"name": "any",
|
|
13
|
+
"required": false,
|
|
14
|
+
"type": Object {
|
|
15
|
+
"detail": undefined,
|
|
16
|
+
"summary": "unknown",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
Object {
|
|
20
|
+
"defaultValue": Object {
|
|
21
|
+
"detail": undefined,
|
|
22
|
+
"summary": "'A string value'",
|
|
23
|
+
},
|
|
24
|
+
"description": undefined,
|
|
25
|
+
"name": "string",
|
|
26
|
+
"required": false,
|
|
27
|
+
"type": Object {
|
|
28
|
+
"detail": undefined,
|
|
29
|
+
"summary": "unknown",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
Object {
|
|
33
|
+
"defaultValue": Object {
|
|
34
|
+
"detail": undefined,
|
|
35
|
+
"summary": "true",
|
|
36
|
+
},
|
|
37
|
+
"description": undefined,
|
|
38
|
+
"name": "bool",
|
|
39
|
+
"required": false,
|
|
40
|
+
"type": Object {
|
|
41
|
+
"detail": undefined,
|
|
42
|
+
"summary": "unknown",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
Object {
|
|
46
|
+
"defaultValue": Object {
|
|
47
|
+
"detail": undefined,
|
|
48
|
+
"summary": "5",
|
|
49
|
+
},
|
|
50
|
+
"description": undefined,
|
|
51
|
+
"name": "number",
|
|
52
|
+
"required": false,
|
|
53
|
+
"type": Object {
|
|
54
|
+
"detail": undefined,
|
|
55
|
+
"summary": "unknown",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
Object {
|
|
59
|
+
"defaultValue": Object {
|
|
60
|
+
"detail": undefined,
|
|
61
|
+
"summary": "() => {}",
|
|
62
|
+
},
|
|
63
|
+
"description": undefined,
|
|
64
|
+
"name": "voidFunc",
|
|
65
|
+
"required": false,
|
|
66
|
+
"type": Object {
|
|
67
|
+
"detail": undefined,
|
|
68
|
+
"summary": "unknown",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
Object {
|
|
72
|
+
"defaultValue": Object {
|
|
73
|
+
"detail": undefined,
|
|
74
|
+
"summary": "function concat(a: string, b: string): string {
|
|
75
|
+
return a + b;
|
|
76
|
+
}",
|
|
77
|
+
},
|
|
78
|
+
"description": undefined,
|
|
79
|
+
"name": "funcWithArgsAndReturns",
|
|
80
|
+
"required": false,
|
|
81
|
+
"type": Object {
|
|
82
|
+
"detail": undefined,
|
|
83
|
+
"summary": "unknown",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
Object {
|
|
87
|
+
"defaultValue": Object {
|
|
88
|
+
"detail": undefined,
|
|
89
|
+
"summary": "Symbol('Default symbol')",
|
|
90
|
+
},
|
|
91
|
+
"description": undefined,
|
|
92
|
+
"name": "symbol",
|
|
93
|
+
"required": false,
|
|
94
|
+
"type": Object {
|
|
95
|
+
"detail": undefined,
|
|
96
|
+
"summary": "unknown",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
Object {
|
|
100
|
+
"defaultValue": Object {
|
|
101
|
+
"detail": undefined,
|
|
102
|
+
"summary": "{ text: 'foo', value: 'bar' }",
|
|
103
|
+
},
|
|
104
|
+
"description": undefined,
|
|
105
|
+
"name": "interface",
|
|
106
|
+
"required": false,
|
|
107
|
+
"type": Object {
|
|
108
|
+
"detail": undefined,
|
|
109
|
+
"summary": "unknown",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
Object {
|
|
113
|
+
"defaultValue": Object {
|
|
114
|
+
"detail": undefined,
|
|
115
|
+
"summary": "{ value: 'A string value' }",
|
|
116
|
+
},
|
|
117
|
+
"description": undefined,
|
|
118
|
+
"name": "genericInterface",
|
|
119
|
+
"required": false,
|
|
120
|
+
"type": Object {
|
|
121
|
+
"detail": undefined,
|
|
122
|
+
"summary": "unknown",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
Object {
|
|
126
|
+
"defaultValue": Object {
|
|
127
|
+
"detail": undefined,
|
|
128
|
+
"summary": "['foo', 'bar']",
|
|
129
|
+
},
|
|
130
|
+
"description": undefined,
|
|
131
|
+
"name": "arrayOfPrimitive",
|
|
132
|
+
"required": false,
|
|
133
|
+
"type": Object {
|
|
134
|
+
"detail": undefined,
|
|
135
|
+
"summary": "unknown",
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
Object {
|
|
139
|
+
"defaultValue": Object {
|
|
140
|
+
"detail": undefined,
|
|
141
|
+
"summary": "[{ text: 'foo', value: 'bar' }]",
|
|
142
|
+
},
|
|
143
|
+
"description": undefined,
|
|
144
|
+
"name": "arrayOfComplexObject",
|
|
145
|
+
"required": false,
|
|
146
|
+
"type": Object {
|
|
147
|
+
"detail": undefined,
|
|
148
|
+
"summary": "unknown",
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
Object {
|
|
152
|
+
"defaultValue": Object {
|
|
153
|
+
"detail": undefined,
|
|
154
|
+
"summary": "['string value', 5]",
|
|
155
|
+
},
|
|
156
|
+
"description": undefined,
|
|
157
|
+
"name": "tupleOfPrimitive",
|
|
158
|
+
"required": false,
|
|
159
|
+
"type": Object {
|
|
160
|
+
"detail": undefined,
|
|
161
|
+
"summary": "unknown",
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
Object {
|
|
165
|
+
"defaultValue": Object {
|
|
166
|
+
"detail": undefined,
|
|
167
|
+
"summary": "['string value', { text: 'foo', value: 'bar' }]",
|
|
168
|
+
},
|
|
169
|
+
"description": undefined,
|
|
170
|
+
"name": "tupleWithComplexType",
|
|
171
|
+
"required": false,
|
|
172
|
+
"type": Object {
|
|
173
|
+
"detail": undefined,
|
|
174
|
+
"summary": "unknown",
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
Object {
|
|
178
|
+
"defaultValue": Object {
|
|
179
|
+
"detail": undefined,
|
|
180
|
+
"summary": "DefaultEnum.TopRight",
|
|
181
|
+
},
|
|
182
|
+
"description": undefined,
|
|
183
|
+
"name": "defaultEnum",
|
|
184
|
+
"required": false,
|
|
185
|
+
"type": Object {
|
|
186
|
+
"detail": undefined,
|
|
187
|
+
"summary": "unknown",
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
Object {
|
|
191
|
+
"defaultValue": Object {
|
|
192
|
+
"detail": undefined,
|
|
193
|
+
"summary": "NumericEnum.TopRight",
|
|
194
|
+
},
|
|
195
|
+
"description": undefined,
|
|
196
|
+
"name": "numericEnum",
|
|
197
|
+
"required": false,
|
|
198
|
+
"type": Object {
|
|
199
|
+
"detail": undefined,
|
|
200
|
+
"summary": "unknown",
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
Object {
|
|
204
|
+
"defaultValue": Object {
|
|
205
|
+
"detail": undefined,
|
|
206
|
+
"summary": "StringEnum.TopRight",
|
|
207
|
+
},
|
|
208
|
+
"description": undefined,
|
|
209
|
+
"name": "stringEnum",
|
|
210
|
+
"required": false,
|
|
211
|
+
"type": Object {
|
|
212
|
+
"detail": undefined,
|
|
213
|
+
"summary": "unknown",
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
Object {
|
|
217
|
+
"defaultValue": Object {
|
|
218
|
+
"detail": undefined,
|
|
219
|
+
"summary": "DefaultEnum.TopLeft",
|
|
220
|
+
},
|
|
221
|
+
"description": undefined,
|
|
222
|
+
"name": "enumUnion",
|
|
223
|
+
"required": false,
|
|
224
|
+
"type": Object {
|
|
225
|
+
"detail": undefined,
|
|
226
|
+
"summary": "unknown",
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
Object {
|
|
230
|
+
"defaultValue": Object {
|
|
231
|
+
"detail": undefined,
|
|
232
|
+
"summary": "{ foo: 1, bar: 2 }",
|
|
233
|
+
},
|
|
234
|
+
"description": undefined,
|
|
235
|
+
"name": "recordOfPrimitive",
|
|
236
|
+
"required": false,
|
|
237
|
+
"type": Object {
|
|
238
|
+
"detail": undefined,
|
|
239
|
+
"summary": "unknown",
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
Object {
|
|
243
|
+
"defaultValue": Object {
|
|
244
|
+
"detail": undefined,
|
|
245
|
+
"summary": "{ foo: { text: 'bar', value: 'bar2' } }",
|
|
246
|
+
},
|
|
247
|
+
"description": undefined,
|
|
248
|
+
"name": "recordOfComplexObject",
|
|
249
|
+
"required": false,
|
|
250
|
+
"type": Object {
|
|
251
|
+
"detail": undefined,
|
|
252
|
+
"summary": "unknown",
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
Object {
|
|
256
|
+
"defaultValue": Object {
|
|
257
|
+
"detail": undefined,
|
|
258
|
+
"summary": "{ text: 'foo', value: 'bar', name: 'foo-bar' }",
|
|
259
|
+
},
|
|
260
|
+
"description": undefined,
|
|
261
|
+
"name": "intersectionType",
|
|
262
|
+
"required": false,
|
|
263
|
+
"type": Object {
|
|
264
|
+
"detail": undefined,
|
|
265
|
+
"summary": "unknown",
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
Object {
|
|
269
|
+
"defaultValue": Object {
|
|
270
|
+
"detail": undefined,
|
|
271
|
+
"summary": "{ text: 'foo', value: 'bar', inlineValue: 'this is inlined' }",
|
|
272
|
+
},
|
|
273
|
+
"description": undefined,
|
|
274
|
+
"name": "intersectionWithInlineType",
|
|
275
|
+
"required": false,
|
|
276
|
+
"type": Object {
|
|
277
|
+
"detail": undefined,
|
|
278
|
+
"summary": "unknown",
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
Object {
|
|
282
|
+
"defaultValue": Object {
|
|
283
|
+
"detail": undefined,
|
|
284
|
+
"summary": "'A string value'",
|
|
285
|
+
},
|
|
286
|
+
"description": undefined,
|
|
287
|
+
"name": "unionOfPrimitive",
|
|
288
|
+
"required": false,
|
|
289
|
+
"type": Object {
|
|
290
|
+
"detail": undefined,
|
|
291
|
+
"summary": "unknown",
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
Object {
|
|
295
|
+
"defaultValue": Object {
|
|
296
|
+
"detail": undefined,
|
|
297
|
+
"summary": "{ text: 'foo', value: 'bar' }",
|
|
298
|
+
},
|
|
299
|
+
"description": undefined,
|
|
300
|
+
"name": "unionOfComplexType",
|
|
301
|
+
"required": false,
|
|
302
|
+
"type": Object {
|
|
303
|
+
"detail": undefined,
|
|
304
|
+
"summary": "unknown",
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
Object {
|
|
308
|
+
"defaultValue": null,
|
|
309
|
+
"description": undefined,
|
|
310
|
+
"name": "nullableComplexTypeUndefinedDefaultValue",
|
|
311
|
+
"required": false,
|
|
312
|
+
"type": Object {
|
|
313
|
+
"detail": undefined,
|
|
314
|
+
"summary": "unknown",
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
Object {
|
|
318
|
+
"defaultValue": Object {
|
|
319
|
+
"detail": undefined,
|
|
320
|
+
"summary": "'foo'",
|
|
321
|
+
},
|
|
322
|
+
"description": undefined,
|
|
323
|
+
"name": "typeAlias",
|
|
324
|
+
"required": false,
|
|
325
|
+
"type": Object {
|
|
326
|
+
"detail": undefined,
|
|
327
|
+
"summary": "unknown",
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
Object {
|
|
331
|
+
"defaultValue": Object {
|
|
332
|
+
"detail": undefined,
|
|
333
|
+
"summary": "'foo'",
|
|
334
|
+
},
|
|
335
|
+
"description": undefined,
|
|
336
|
+
"name": "aliasesUnion",
|
|
337
|
+
"required": false,
|
|
338
|
+
"type": Object {
|
|
339
|
+
"detail": undefined,
|
|
340
|
+
"summary": "unknown",
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
Object {
|
|
344
|
+
"defaultValue": Object {
|
|
345
|
+
"detail": undefined,
|
|
346
|
+
"summary": "{ value: 'foo' }",
|
|
347
|
+
},
|
|
348
|
+
"description": undefined,
|
|
349
|
+
"name": "genericAlias",
|
|
350
|
+
"required": false,
|
|
351
|
+
"type": Object {
|
|
352
|
+
"detail": undefined,
|
|
353
|
+
"summary": "unknown",
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
Object {
|
|
357
|
+
"defaultValue": Object {
|
|
358
|
+
"detail": undefined,
|
|
359
|
+
"summary": "'top-right'",
|
|
360
|
+
},
|
|
361
|
+
"description": undefined,
|
|
362
|
+
"name": "namedStringLiteralUnion",
|
|
363
|
+
"required": false,
|
|
364
|
+
"type": Object {
|
|
365
|
+
"detail": undefined,
|
|
366
|
+
"summary": "unknown",
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
Object {
|
|
370
|
+
"defaultValue": Object {
|
|
371
|
+
"detail": undefined,
|
|
372
|
+
"summary": "'bottom-right'",
|
|
373
|
+
},
|
|
374
|
+
"description": undefined,
|
|
375
|
+
"name": "inlinedStringLiteralUnion",
|
|
376
|
+
"required": false,
|
|
377
|
+
"type": Object {
|
|
378
|
+
"detail": undefined,
|
|
379
|
+
"summary": "unknown",
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
Object {
|
|
383
|
+
"defaultValue": Object {
|
|
384
|
+
"detail": undefined,
|
|
385
|
+
"summary": "0",
|
|
386
|
+
},
|
|
387
|
+
"description": undefined,
|
|
388
|
+
"name": "namedNumericLiteralUnion",
|
|
389
|
+
"required": false,
|
|
390
|
+
"type": Object {
|
|
391
|
+
"detail": undefined,
|
|
392
|
+
"summary": "unknown",
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
Object {
|
|
396
|
+
"defaultValue": Object {
|
|
397
|
+
"detail": undefined,
|
|
398
|
+
"summary": "1",
|
|
399
|
+
},
|
|
400
|
+
"description": undefined,
|
|
401
|
+
"name": "inlinedNumericLiteralUnion",
|
|
402
|
+
"required": false,
|
|
403
|
+
"type": Object {
|
|
404
|
+
"detail": undefined,
|
|
405
|
+
"summary": "unknown",
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
}
|
|
410
|
+
`;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const badOutput = { renderable: 'no, react can not render objects' };
|
|
4
|
+
const BadComponent = () => badOutput;
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: BadComponent,
|
|
8
|
+
parameters: {
|
|
9
|
+
storyshots: { disable: true },
|
|
10
|
+
chromatic: { disable: true },
|
|
11
|
+
},
|
|
12
|
+
decorators: [
|
|
13
|
+
// Skip errors if we are running in the test runner
|
|
14
|
+
(storyFn: any) => window?.navigator?.userAgent?.match(/StorybookTestRunner/) || storyFn(),
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const RenderThrows = {
|
|
19
|
+
render() {
|
|
20
|
+
throw new Error('storyFn threw an error! WHOOPS');
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const ComponentIsUnrenderable = {};
|
|
25
|
+
|
|
26
|
+
export const StoryIsUnrenderable = {
|
|
27
|
+
render: () => badOutput,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const StoryContainsUnrenderable = {
|
|
31
|
+
render: () => (
|
|
32
|
+
<div>
|
|
33
|
+
{/* @ts-expect-error we're doing it wrong here on purpose */}
|
|
34
|
+
<BadComponent />
|
|
35
|
+
</div>
|
|
36
|
+
),
|
|
37
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
|
|
4
|
+
const ButtonWithState: FC = () => {
|
|
5
|
+
const [count, setCount] = useState(0);
|
|
6
|
+
return (
|
|
7
|
+
<button type="button" onClick={() => setCount(count + 1)}>
|
|
8
|
+
{`count: ${count}`}
|
|
9
|
+
</button>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
component: ButtonWithState,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Basic = {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import mapValues from 'lodash/mapValues';
|
|
4
|
+
import { PureArgsTable as ArgsTable } from '@storybook/blocks';
|
|
5
|
+
import { inferControls } from '@storybook/store';
|
|
6
|
+
import { ThemeProvider, themes, convert } from '@storybook/theming';
|
|
7
|
+
|
|
8
|
+
import { component as JsClassComponentComponent } from './docgen-components/js-class-component/input.jsx';
|
|
9
|
+
import { component as JsFunctionComponentComponent } from './docgen-components/js-function-component/input.jsx';
|
|
10
|
+
import { component as JsFunctionComponentInlineDefaultsComponent } from './docgen-components/js-function-component-inline-defaults/input.jsx';
|
|
11
|
+
import { component as JsFunctionComponentInlineDefaultsNoPropTypesComponent } from './docgen-components/js-function-component-inline-defaults-no-propTypes/input.jsx';
|
|
12
|
+
import { component as JsProptypesShapeComponent } from './docgen-components/9399-js-proptypes-shape/input.jsx';
|
|
13
|
+
// import { component as JsStyledComponentsComponent } from './__testfixtures__/8663-js-styled-components/input';
|
|
14
|
+
import { component as JsDefaultValuesComponent } from './docgen-components/9626-js-default-values/input.jsx';
|
|
15
|
+
import { component as JsProptypesNoJsdocComponent } from './docgen-components/9668-js-proptypes-no-jsdoc/input.jsx';
|
|
16
|
+
// import { component as JsStyledDocgenComponent } from './__testfixtures__/8279-js-styled-docgen/input';
|
|
17
|
+
import { component as JsPropTypesOneofComponent } from './docgen-components/8140-js-prop-types-oneof/input.jsx';
|
|
18
|
+
import { component as JsHocComponent } from './docgen-components/9023-js-hoc/input.jsx';
|
|
19
|
+
import { component as JsReactMemoComponent } from './docgen-components/9586-js-react-memo/input.jsx';
|
|
20
|
+
import { component as JsStaticPropTypesComponent } from './docgen-components/8428-js-static-prop-types/input.jsx';
|
|
21
|
+
import { component as JsdocComponent } from './docgen-components/jsdoc/input.jsx';
|
|
22
|
+
import { component as JsProptypesComponent } from './docgen-components/js-proptypes/input.jsx';
|
|
23
|
+
|
|
24
|
+
// Detect if we are running in vite in a hacky way for now
|
|
25
|
+
const isVite = typeof require === 'undefined';
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
component: {},
|
|
29
|
+
render: (_, context) => <ArgsStory parameters={context.parameters} />,
|
|
30
|
+
parameters: {
|
|
31
|
+
chromatic: {
|
|
32
|
+
disableSnapshot: isVite,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const ArgsStory = ({ parameters }) => {
|
|
38
|
+
const argTypes = parameters.docs.extractArgTypes(parameters.component);
|
|
39
|
+
const rows = inferControls({ argTypes, parameters: { __isArgsStory: true } });
|
|
40
|
+
const initialArgs = mapValues(rows, (argType) => argType.defaultValue);
|
|
41
|
+
const [args, setArgs] = useState(initialArgs);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<ThemeProvider theme={convert(themes.light)}>
|
|
45
|
+
<ArgsTable rows={rows} args={args} updateArgs={(val) => setArgs({ ...args, ...val })} />
|
|
46
|
+
</ThemeProvider>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
ArgsStory.propTypes = {
|
|
51
|
+
parameters: PropTypes.shape({
|
|
52
|
+
component: PropTypes.elementType.isRequired,
|
|
53
|
+
docs: PropTypes.shape({
|
|
54
|
+
extractArgTypes: PropTypes.func.isRequired,
|
|
55
|
+
}).isRequired,
|
|
56
|
+
}).isRequired,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const JsClassComponent = { parameters: { component: JsClassComponentComponent } };
|
|
60
|
+
|
|
61
|
+
export const JsFunctionComponent = { parameters: { component: JsFunctionComponentComponent } };
|
|
62
|
+
|
|
63
|
+
export const JsFunctionComponentInlineDefaults = {
|
|
64
|
+
parameters: { component: JsFunctionComponentInlineDefaultsComponent },
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const JsFunctionComponentInlineDefaultsNoPropTypes = {
|
|
68
|
+
parameters: { component: JsFunctionComponentInlineDefaultsNoPropTypesComponent },
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const JsProptypesShape = { parameters: { component: JsProptypesShapeComponent } };
|
|
72
|
+
|
|
73
|
+
// export const JsStyledComponents = { parameters: { component: JsStyledComponentsComponent } };
|
|
74
|
+
|
|
75
|
+
export const JsDefaultValues = { parameters: { component: JsDefaultValuesComponent } };
|
|
76
|
+
|
|
77
|
+
export const JsProptypesNoJsdoc = { parameters: { component: JsProptypesNoJsdocComponent } };
|
|
78
|
+
|
|
79
|
+
// export const JsStyledDocgen = { parameters: { component: JsStyledDocgenComponent } };
|
|
80
|
+
|
|
81
|
+
export const JsPropTypesOneof = { parameters: { component: JsPropTypesOneofComponent } };
|
|
82
|
+
|
|
83
|
+
export const JsHoc = { parameters: { component: JsHocComponent } };
|
|
84
|
+
|
|
85
|
+
export const JsReactMemo = { parameters: { component: JsReactMemoComponent } };
|
|
86
|
+
|
|
87
|
+
export const JsStaticPropTypes = { parameters: { component: JsStaticPropTypesComponent } };
|
|
88
|
+
|
|
89
|
+
export const Jsdoc = { parameters: { component: JsdocComponent } };
|
|
90
|
+
|
|
91
|
+
export const JsProptypes = { parameters: { component: JsProptypesComponent } };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import globalThis from 'global';
|
|
2
|
+
import { Meta, Story, Canvas } from '@storybook/addon-docs';
|
|
3
|
+
|
|
4
|
+
<Meta title="stories/renderers/react/react-mdx" />
|
|
5
|
+
|
|
6
|
+
# React-specific MDX Stories
|
|
7
|
+
|
|
8
|
+
export const Button = globalThis.Components.Button;
|
|
9
|
+
|
|
10
|
+
export const Template = (args) => <Button label="From template" />;
|
|
11
|
+
|
|
12
|
+
<Canvas>
|
|
13
|
+
<Story name="Primary">
|
|
14
|
+
<Button label="Primary" />
|
|
15
|
+
</Story>
|
|
16
|
+
</Canvas>
|
|
17
|
+
|
|
18
|
+
<Canvas>
|
|
19
|
+
<Story name="Secondary">
|
|
20
|
+
<Button label="Secondary" />
|
|
21
|
+
</Story>
|
|
22
|
+
</Canvas>
|
|
23
|
+
|
|
24
|
+
<Canvas>
|
|
25
|
+
<Story name="From Template">{Template.bind({})}</Story>
|
|
26
|
+
</Canvas>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import mapValues from 'lodash/mapValues';
|
|
3
|
+
import { PureArgsTable as ArgsTable } from '@storybook/blocks';
|
|
4
|
+
import type { Args, Parameters, StoryContext } from '@storybook/types';
|
|
5
|
+
import { inferControls } from '@storybook/store';
|
|
6
|
+
import { ThemeProvider, themes, convert } from '@storybook/theming';
|
|
7
|
+
|
|
8
|
+
import { component as TsFunctionComponentComponent } from './docgen-components/ts-function-component/input';
|
|
9
|
+
import { component as TsFunctionComponentInlineDefaultsComponent } from './docgen-components/ts-function-component-inline-defaults/input';
|
|
10
|
+
import { component as TsReactFcGenericsComponent } from './docgen-components/8143-ts-react-fc-generics/input';
|
|
11
|
+
import { component as TsImportedTypesComponent } from './docgen-components/8143-ts-imported-types/input';
|
|
12
|
+
import { component as TsMultiPropsComponent } from './docgen-components/8740-ts-multi-props/input';
|
|
13
|
+
import { component as TsReactDefaultExportsComponent } from './docgen-components/9556-ts-react-default-exports/input';
|
|
14
|
+
import { component as TsImportTypesComponent } from './docgen-components/9591-ts-import-types/input';
|
|
15
|
+
import { component as TsDeprecatedJsdocComponent } from './docgen-components/9721-ts-deprecated-jsdoc/input';
|
|
16
|
+
import { component as TsDefaultValuesComponent } from './docgen-components/9827-ts-default-values/input';
|
|
17
|
+
import { component as TsCamelCaseComponent } from './docgen-components/9575-ts-camel-case/input';
|
|
18
|
+
import { component as TsDisplayNameComponent } from './docgen-components/9493-ts-display-name/input';
|
|
19
|
+
import { component as TsForwardRefComponent } from './docgen-components/8894-9511-ts-forward-ref/input';
|
|
20
|
+
import { component as TsTypePropsComponent } from './docgen-components/9465-ts-type-props/input';
|
|
21
|
+
import { component as TsExtendPropsComponent } from './docgen-components/9764-ts-extend-props/input';
|
|
22
|
+
import { component as TsComponentPropsComponent } from './docgen-components/9922-ts-component-props/input';
|
|
23
|
+
import { component as TsJsdocComponent } from './docgen-components/ts-jsdoc/input';
|
|
24
|
+
import { component as TsTypesComponent } from './docgen-components/ts-types/input';
|
|
25
|
+
import { component as TsHtmlComponent } from './docgen-components/ts-html/input';
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
component: {},
|
|
29
|
+
render: (_: Args, context: StoryContext) => <ArgsStory parameters={context.parameters} />,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const ArgsStory = ({ parameters }: { parameters: Parameters }) => {
|
|
33
|
+
const argTypes = parameters.docs.extractArgTypes(parameters.component);
|
|
34
|
+
const rows = inferControls({ argTypes, parameters: { __isArgsStory: true } } as any);
|
|
35
|
+
const initialArgs = mapValues(rows, (argType) => argType.defaultValue);
|
|
36
|
+
const [args, setArgs] = useState(initialArgs);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<ThemeProvider theme={convert(themes.light)}>
|
|
40
|
+
<ArgsTable rows={rows} args={args} updateArgs={(val) => setArgs({ ...args, ...val })} />
|
|
41
|
+
</ThemeProvider>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const TsFunctionComponent = { parameters: { component: TsFunctionComponentComponent } };
|
|
46
|
+
|
|
47
|
+
export const TsFunctionComponentInlineDefaults = {
|
|
48
|
+
parameters: { component: TsFunctionComponentInlineDefaultsComponent },
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const TsReactFcGenerics = { parameters: { component: TsReactFcGenericsComponent } };
|
|
52
|
+
|
|
53
|
+
export const TsImportedTypes = { parameters: { component: TsImportedTypesComponent } };
|
|
54
|
+
|
|
55
|
+
export const TsMultiProps = { parameters: { component: TsMultiPropsComponent } };
|
|
56
|
+
|
|
57
|
+
export const TsReactDefaultExports = { parameters: { component: TsReactDefaultExportsComponent } };
|
|
58
|
+
|
|
59
|
+
export const TsImportTypes = { parameters: { component: TsImportTypesComponent } };
|
|
60
|
+
|
|
61
|
+
export const TsDeprecatedJsdoc = { parameters: { component: TsDeprecatedJsdocComponent } };
|
|
62
|
+
|
|
63
|
+
export const TsDefaultValues = { parameters: { component: TsDefaultValuesComponent } };
|
|
64
|
+
|
|
65
|
+
export const TsCamelCase = { parameters: { component: TsCamelCaseComponent } };
|
|
66
|
+
|
|
67
|
+
export const TsDisplayName = { parameters: { component: TsDisplayNameComponent } };
|
|
68
|
+
|
|
69
|
+
export const TsForwardRef = { parameters: { component: TsForwardRefComponent } };
|
|
70
|
+
|
|
71
|
+
export const TsTypeProps = { parameters: { component: TsTypePropsComponent } };
|
|
72
|
+
|
|
73
|
+
export const TsExtendProps = { parameters: { component: TsExtendPropsComponent } };
|
|
74
|
+
|
|
75
|
+
export const TsComponentProps = { parameters: { component: TsComponentPropsComponent } };
|
|
76
|
+
|
|
77
|
+
export const TsJsdoc = { parameters: { component: TsJsdocComponent } };
|
|
78
|
+
|
|
79
|
+
export const TsTypes = { parameters: { component: TsTypesComponent } };
|
|
80
|
+
|
|
81
|
+
export const TsHtml = { parameters: { component: TsHtmlComponent } };
|