@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.
Files changed (167) hide show
  1. package/dist/config.d.ts +1 -1
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +1 -1
  4. package/dist/index.mjs +1 -1
  5. package/package.json +9 -8
  6. package/template/cli/.eslintrc.json +5 -0
  7. package/template/cli/js/Button.jsx +50 -0
  8. package/template/cli/js/Button.stories.js +41 -0
  9. package/template/cli/js/Header.jsx +59 -0
  10. package/template/cli/js/Header.stories.js +22 -0
  11. package/template/cli/js/Page.jsx +69 -0
  12. package/template/cli/js/Page.stories.js +25 -0
  13. package/template/cli/ts/Button.stories.ts +47 -0
  14. package/template/cli/ts/Button.tsx +48 -0
  15. package/template/cli/ts/Header.stories.ts +26 -0
  16. package/template/cli/ts/Header.tsx +56 -0
  17. package/template/cli/ts/Page.stories.ts +29 -0
  18. package/template/cli/ts/Page.tsx +73 -0
  19. package/template/components/Button.jsx +13 -0
  20. package/template/components/Form.jsx +36 -0
  21. package/template/components/Html.jsx +9 -0
  22. package/template/components/Pre.jsx +20 -0
  23. package/template/components/index.js +9 -0
  24. package/template/stories/decorators.stories.tsx +28 -0
  25. package/template/stories/docgen-components/10017-ts-union/argTypes.snapshot +36 -0
  26. package/template/stories/docgen-components/10017-ts-union/docgen.snapshot +34 -0
  27. package/template/stories/docgen-components/10017-ts-union/input.tsx +12 -0
  28. package/template/stories/docgen-components/10017-ts-union/properties.snapshot +32 -0
  29. package/template/stories/docgen-components/10278-ts-multiple-components/argTypes.snapshot +26 -0
  30. package/template/stories/docgen-components/10278-ts-multiple-components/docgen.snapshot +49 -0
  31. package/template/stories/docgen-components/10278-ts-multiple-components/input.tsx +27 -0
  32. package/template/stories/docgen-components/10278-ts-multiple-components/properties.snapshot +22 -0
  33. package/template/stories/docgen-components/8140-js-prop-types-oneof/argTypes.snapshot +127 -0
  34. package/template/stories/docgen-components/8140-js-prop-types-oneof/docgen.snapshot +97 -0
  35. package/template/stories/docgen-components/8140-js-prop-types-oneof/input.jsx +27 -0
  36. package/template/stories/docgen-components/8140-js-prop-types-oneof/properties.snapshot +89 -0
  37. package/template/stories/docgen-components/8143-ts-imported-types/argTypes.snapshot +27 -0
  38. package/template/stories/docgen-components/8143-ts-imported-types/docgen.snapshot +22 -0
  39. package/template/stories/docgen-components/8143-ts-imported-types/input.tsx +10 -0
  40. package/template/stories/docgen-components/8143-ts-imported-types/properties.snapshot +23 -0
  41. package/template/stories/docgen-components/8143-ts-imported-types/types.ts +3 -0
  42. package/template/stories/docgen-components/8143-ts-react-fc-generics/argTypes.snapshot +27 -0
  43. package/template/stories/docgen-components/8143-ts-react-fc-generics/docgen.snapshot +24 -0
  44. package/template/stories/docgen-components/8143-ts-react-fc-generics/input.tsx +10 -0
  45. package/template/stories/docgen-components/8143-ts-react-fc-generics/properties.snapshot +21 -0
  46. package/template/stories/docgen-components/8428-js-static-prop-types/argTypes.snapshot +25 -0
  47. package/template/stories/docgen-components/8428-js-static-prop-types/docgen.snapshot +37 -0
  48. package/template/stories/docgen-components/8428-js-static-prop-types/input.jsx +20 -0
  49. package/template/stories/docgen-components/8428-js-static-prop-types/properties.snapshot +21 -0
  50. package/template/stories/docgen-components/8740-ts-multi-props/argTypes.snapshot +27 -0
  51. package/template/stories/docgen-components/8740-ts-multi-props/docgen.snapshot +49 -0
  52. package/template/stories/docgen-components/8740-ts-multi-props/input.tsx +23 -0
  53. package/template/stories/docgen-components/8740-ts-multi-props/properties.snapshot +21 -0
  54. package/template/stories/docgen-components/8894-9511-ts-forward-ref/argTypes.snapshot +48 -0
  55. package/template/stories/docgen-components/8894-9511-ts-forward-ref/docgen.snapshot +39 -0
  56. package/template/stories/docgen-components/8894-9511-ts-forward-ref/input.tsx +31 -0
  57. package/template/stories/docgen-components/8894-9511-ts-forward-ref/properties.snapshot +34 -0
  58. package/template/stories/docgen-components/9023-js-hoc/argTypes.snapshot +89 -0
  59. package/template/stories/docgen-components/9023-js-hoc/docgen.snapshot +84 -0
  60. package/template/stories/docgen-components/9023-js-hoc/input.jsx +40 -0
  61. package/template/stories/docgen-components/9023-js-hoc/properties.snapshot +67 -0
  62. package/template/stories/docgen-components/9399-js-proptypes-shape/argTypes.snapshot +39 -0
  63. package/template/stories/docgen-components/9399-js-proptypes-shape/docgen.snapshot +48 -0
  64. package/template/stories/docgen-components/9399-js-proptypes-shape/input.jsx +16 -0
  65. package/template/stories/docgen-components/9399-js-proptypes-shape/properties.snapshot +35 -0
  66. package/template/stories/docgen-components/9465-ts-type-props/argTypes.snapshot +28 -0
  67. package/template/stories/docgen-components/9465-ts-type-props/docgen.snapshot +33 -0
  68. package/template/stories/docgen-components/9465-ts-type-props/input.tsx +12 -0
  69. package/template/stories/docgen-components/9465-ts-type-props/properties.snapshot +24 -0
  70. package/template/stories/docgen-components/9493-ts-display-name/argTypes.snapshot +62 -0
  71. package/template/stories/docgen-components/9493-ts-display-name/docgen.snapshot +50 -0
  72. package/template/stories/docgen-components/9493-ts-display-name/input.tsx +30 -0
  73. package/template/stories/docgen-components/9493-ts-display-name/properties.snapshot +52 -0
  74. package/template/stories/docgen-components/9556-ts-react-default-exports/argTypes.snapshot +28 -0
  75. package/template/stories/docgen-components/9556-ts-react-default-exports/docgen.snapshot +32 -0
  76. package/template/stories/docgen-components/9556-ts-react-default-exports/input.tsx +12 -0
  77. package/template/stories/docgen-components/9556-ts-react-default-exports/properties.snapshot +24 -0
  78. package/template/stories/docgen-components/9575-ts-camel-case/argTypes.snapshot +28 -0
  79. package/template/stories/docgen-components/9575-ts-camel-case/docgen.snapshot +38 -0
  80. package/template/stories/docgen-components/9575-ts-camel-case/input.tsx +26 -0
  81. package/template/stories/docgen-components/9575-ts-camel-case/properties.snapshot +24 -0
  82. package/template/stories/docgen-components/9586-js-react-memo/argTypes.snapshot +41 -0
  83. package/template/stories/docgen-components/9586-js-react-memo/docgen.snapshot +42 -0
  84. package/template/stories/docgen-components/9586-js-react-memo/input.jsx +15 -0
  85. package/template/stories/docgen-components/9586-js-react-memo/properties.snapshot +34 -0
  86. package/template/stories/docgen-components/9591-ts-import-types/Bar.tsx +3 -0
  87. package/template/stories/docgen-components/9591-ts-import-types/argTypes.snapshot +25 -0
  88. package/template/stories/docgen-components/9591-ts-import-types/docgen.snapshot +21 -0
  89. package/template/stories/docgen-components/9591-ts-import-types/input.tsx +10 -0
  90. package/template/stories/docgen-components/9591-ts-import-types/properties.snapshot +21 -0
  91. package/template/stories/docgen-components/9626-js-default-values/argTypes.snapshot +27 -0
  92. package/template/stories/docgen-components/9626-js-default-values/docgen.snapshot +25 -0
  93. package/template/stories/docgen-components/9626-js-default-values/input.jsx +5 -0
  94. package/template/stories/docgen-components/9626-js-default-values/properties.snapshot +21 -0
  95. package/template/stories/docgen-components/9668-js-proptypes-no-jsdoc/argTypes.snapshot +42 -0
  96. package/template/stories/docgen-components/9668-js-proptypes-no-jsdoc/docgen.snapshot +36 -0
  97. package/template/stories/docgen-components/9668-js-proptypes-no-jsdoc/input.jsx +13 -0
  98. package/template/stories/docgen-components/9668-js-proptypes-no-jsdoc/properties.snapshot +35 -0
  99. package/template/stories/docgen-components/9721-ts-deprecated-jsdoc/argTypes.snapshot +53 -0
  100. package/template/stories/docgen-components/9721-ts-deprecated-jsdoc/docgen.snapshot +45 -0
  101. package/template/stories/docgen-components/9721-ts-deprecated-jsdoc/input.tsx +18 -0
  102. package/template/stories/docgen-components/9721-ts-deprecated-jsdoc/properties.snapshot +43 -0
  103. package/template/stories/docgen-components/9764-ts-extend-props/argTypes.snapshot +72 -0
  104. package/template/stories/docgen-components/9764-ts-extend-props/docgen.snapshot +41 -0
  105. package/template/stories/docgen-components/9764-ts-extend-props/input.tsx +17 -0
  106. package/template/stories/docgen-components/9764-ts-extend-props/properties.snapshot +56 -0
  107. package/template/stories/docgen-components/9827-ts-default-values/argTypes.snapshot +72 -0
  108. package/template/stories/docgen-components/9827-ts-default-values/docgen.snapshot +52 -0
  109. package/template/stories/docgen-components/9827-ts-default-values/input.tsx +17 -0
  110. package/template/stories/docgen-components/9827-ts-default-values/properties.snapshot +56 -0
  111. package/template/stories/docgen-components/9832-ts-enum-export/argTypes.snapshot +3 -0
  112. package/template/stories/docgen-components/9832-ts-enum-export/docgen.snapshot +16 -0
  113. package/template/stories/docgen-components/9832-ts-enum-export/input.tsx +8 -0
  114. package/template/stories/docgen-components/9832-ts-enum-export/properties.snapshot +7 -0
  115. package/template/stories/docgen-components/9922-ts-component-props/argTypes.snapshot +25 -0
  116. package/template/stories/docgen-components/9922-ts-component-props/docgen.snapshot +35 -0
  117. package/template/stories/docgen-components/9922-ts-component-props/input.tsx +24 -0
  118. package/template/stories/docgen-components/9922-ts-component-props/properties.snapshot +21 -0
  119. package/template/stories/docgen-components/imported.js +1 -0
  120. package/template/stories/docgen-components/js-class-component/argTypes.snapshot +386 -0
  121. package/template/stories/docgen-components/js-class-component/docgen.snapshot +252 -0
  122. package/template/stories/docgen-components/js-class-component/input.jsx +57 -0
  123. package/template/stories/docgen-components/js-class-component/properties.snapshot +286 -0
  124. package/template/stories/docgen-components/js-function-component/argTypes.snapshot +386 -0
  125. package/template/stories/docgen-components/js-function-component/docgen.snapshot +236 -0
  126. package/template/stories/docgen-components/js-function-component/input.jsx +50 -0
  127. package/template/stories/docgen-components/js-function-component/properties.snapshot +286 -0
  128. package/template/stories/docgen-components/js-function-component-inline-defaults/argTypes.snapshot +386 -0
  129. package/template/stories/docgen-components/js-function-component-inline-defaults/docgen.snapshot +247 -0
  130. package/template/stories/docgen-components/js-function-component-inline-defaults/input.jsx +65 -0
  131. package/template/stories/docgen-components/js-function-component-inline-defaults/properties.snapshot +286 -0
  132. package/template/stories/docgen-components/js-function-component-inline-defaults-no-propTypes/argTypes.snapshot +237 -0
  133. package/template/stories/docgen-components/js-function-component-inline-defaults-no-propTypes/docgen.snapshot +124 -0
  134. package/template/stories/docgen-components/js-function-component-inline-defaults-no-propTypes/input.jsx +41 -0
  135. package/template/stories/docgen-components/js-function-component-inline-defaults-no-propTypes/properties.snapshot +151 -0
  136. package/template/stories/docgen-components/js-proptypes/docgen.snapshot +1770 -0
  137. package/template/stories/docgen-components/js-proptypes/ext.js +13 -0
  138. package/template/stories/docgen-components/js-proptypes/input.jsx +497 -0
  139. package/template/stories/docgen-components/jsdoc/argTypes.snapshot +969 -0
  140. package/template/stories/docgen-components/jsdoc/docgen.snapshot +548 -0
  141. package/template/stories/docgen-components/jsdoc/input.jsx +231 -0
  142. package/template/stories/docgen-components/jsdoc/properties.snapshot +857 -0
  143. package/template/stories/docgen-components/ts-function-component/argTypes.snapshot +396 -0
  144. package/template/stories/docgen-components/ts-function-component/docgen.snapshot +241 -0
  145. package/template/stories/docgen-components/ts-function-component/input.tsx +52 -0
  146. package/template/stories/docgen-components/ts-function-component/properties.snapshot +296 -0
  147. package/template/stories/docgen-components/ts-function-component-inline-defaults/argTypes.snapshot +279 -0
  148. package/template/stories/docgen-components/ts-function-component-inline-defaults/docgen.snapshot +151 -0
  149. package/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx +80 -0
  150. package/template/stories/docgen-components/ts-function-component-inline-defaults/properties.snapshot +177 -0
  151. package/template/stories/docgen-components/ts-html/argTypes.snapshot +3 -0
  152. package/template/stories/docgen-components/ts-html/docgen.snapshot +12 -0
  153. package/template/stories/docgen-components/ts-html/input.tsx +12 -0
  154. package/template/stories/docgen-components/ts-html/properties.snapshot +7 -0
  155. package/template/stories/docgen-components/ts-jsdoc/argTypes.snapshot +3 -0
  156. package/template/stories/docgen-components/ts-jsdoc/docgen.snapshot +21 -0
  157. package/template/stories/docgen-components/ts-jsdoc/input.tsx +27 -0
  158. package/template/stories/docgen-components/ts-jsdoc/properties.snapshot +7 -0
  159. package/template/stories/docgen-components/ts-types/argTypes.snapshot +656 -0
  160. package/template/stories/docgen-components/ts-types/docgen.snapshot +317 -0
  161. package/template/stories/docgen-components/ts-types/input.tsx +130 -0
  162. package/template/stories/docgen-components/ts-types/properties.snapshot +410 -0
  163. package/template/stories/errors.stories.tsx +37 -0
  164. package/template/stories/hooks.stories.tsx +17 -0
  165. package/template/stories/js-argtypes.stories.jsx +91 -0
  166. package/template/stories/react-mdx.stories.mdx +26 -0
  167. package/template/stories/ts-argtypes.stories.tsx +81 -0
@@ -0,0 +1,36 @@
1
+ import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ export const Form = ({ onSuccess }) => {
5
+ const [value, setValue] = useState('');
6
+ const [complete, setComplete] = useState(false);
7
+
8
+ function onSubmit(event) {
9
+ event.preventDefault();
10
+ onSuccess(value);
11
+
12
+ setTimeout(() => setComplete(true), 500);
13
+ setTimeout(() => setComplete(false), 1500);
14
+ }
15
+
16
+ return (
17
+ <form id="interaction-test-form" onSubmit={onSubmit}>
18
+ <label>
19
+ Enter Value
20
+ <input
21
+ type="text"
22
+ data-testid="value"
23
+ value={value}
24
+ required
25
+ onChange={(event) => setValue(event.target.value)}
26
+ />
27
+ </label>
28
+ <button type="submit">Submit</button>
29
+ {complete && <p>Completed!!</p>}
30
+ </form>
31
+ );
32
+ };
33
+
34
+ Form.propTypes = {
35
+ onSuccess: PropTypes.func.isRequired,
36
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ // eslint-disable-next-line react/no-danger
5
+ export const Html = ({ content }) => <div dangerouslySetInnerHTML={{ __html: content }} />;
6
+
7
+ Html.propTypes = {
8
+ content: PropTypes.string.isRequired,
9
+ };
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ export const Pre = ({ style, object, text }) => (
5
+ <pre style={style} data-testid="pre">
6
+ {object ? JSON.stringify(object, null, 2) : text}
7
+ </pre>
8
+ );
9
+
10
+ Pre.propTypes = {
11
+ style: PropTypes.shape({}),
12
+ object: PropTypes.shape({}),
13
+ text: PropTypes.string,
14
+ };
15
+
16
+ Pre.defaultProps = {
17
+ style: {},
18
+ object: null,
19
+ text: '',
20
+ };
@@ -0,0 +1,9 @@
1
+ import globalThis from 'global';
2
+
3
+ import { Button } from './Button.jsx';
4
+ import { Pre } from './Pre.jsx';
5
+ import { Form } from './Form.jsx';
6
+ import { Html } from './Html.jsx';
7
+
8
+ globalThis.Components = { Button, Pre, Form, Html };
9
+ globalThis.storybookRenderer = 'react';
@@ -0,0 +1,28 @@
1
+ import type { FC } from 'react';
2
+ import React from 'react';
3
+ import type { StoryObj, Meta } from '@storybook/react';
4
+
5
+ const Component: FC = () => <p>Story</p>;
6
+
7
+ export default {
8
+ component: Component,
9
+ decorators: [
10
+ (Story) => (
11
+ <>
12
+ <p>Component Decorator</p>
13
+ <Story />
14
+ </>
15
+ ),
16
+ ],
17
+ } as Meta<typeof Component>;
18
+
19
+ export const All: StoryObj<typeof Component> = {
20
+ decorators: [
21
+ (Story) => (
22
+ <>
23
+ <p>Local Decorator</p>
24
+ <Story />
25
+ </>
26
+ ),
27
+ ],
28
+ };
@@ -0,0 +1,36 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`react component properties 10017-ts-union 1`] = `
4
+ Object {
5
+ "icon": Object {
6
+ "control": Object {
7
+ "type": "object",
8
+ },
9
+ "description": "specify icon=\\"search\\" or icon={IconComponent}",
10
+ "name": "icon",
11
+ "table": Object {
12
+ "defaultValue": null,
13
+ "jsDocTags": undefined,
14
+ "type": Object {
15
+ "detail": undefined,
16
+ "summary": "union",
17
+ },
18
+ },
19
+ "type": Object {
20
+ "name": "union",
21
+ "raw": "React.ReactNode | string",
22
+ "required": true,
23
+ "value": Array [
24
+ Object {
25
+ "name": "other",
26
+ "raw": "React.ReactNode",
27
+ "value": "ReactReactNode",
28
+ },
29
+ Object {
30
+ "name": "string",
31
+ },
32
+ ],
33
+ },
34
+ },
35
+ }
36
+ `;
@@ -0,0 +1,34 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`react component properties 10017-ts-union 1`] = `
4
+ "import React from 'react';
5
+ const Avatar = ({
6
+ icon
7
+ }) => {
8
+ return /*#__PURE__*/React.createElement(\\"div\\", {
9
+ className: \\"hello\\"
10
+ }, \\"Hello Component \\", icon);
11
+ };
12
+ export const component = Avatar;
13
+ Avatar.__docgenInfo = {
14
+ \\"description\\": \\"\\",
15
+ \\"methods\\": [],
16
+ \\"displayName\\": \\"Avatar\\",
17
+ \\"props\\": {
18
+ \\"icon\\": {
19
+ \\"required\\": true,
20
+ \\"tsType\\": {
21
+ \\"name\\": \\"union\\",
22
+ \\"raw\\": \\"React.ReactNode | string\\",
23
+ \\"elements\\": [{
24
+ \\"name\\": \\"ReactReactNode\\",
25
+ \\"raw\\": \\"React.ReactNode\\"
26
+ }, {
27
+ \\"name\\": \\"string\\"
28
+ }]
29
+ },
30
+ \\"description\\": \\"specify icon=\\\\\\"search\\\\\\" or icon={IconComponent}\\"
31
+ }
32
+ }
33
+ };"
34
+ `;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+
3
+ interface AvatarProps {
4
+ /** specify icon="search" or icon={IconComponent} */
5
+ icon: React.ReactNode | string;
6
+ }
7
+
8
+ const Avatar = ({ icon }: AvatarProps) => {
9
+ return <div className="hello">Hello Component {icon}</div>;
10
+ };
11
+
12
+ export const component = Avatar;
@@ -0,0 +1,32 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`react component properties 10017-ts-union 1`] = `
4
+ Object {
5
+ "rows": Array [
6
+ Object {
7
+ "defaultValue": null,
8
+ "description": "specify icon=\\"search\\" or icon={IconComponent}",
9
+ "name": "icon",
10
+ "required": true,
11
+ "sbType": Object {
12
+ "name": "union",
13
+ "raw": "React.ReactNode | string",
14
+ "value": Array [
15
+ Object {
16
+ "name": "other",
17
+ "raw": "React.ReactNode",
18
+ "value": "ReactReactNode",
19
+ },
20
+ Object {
21
+ "name": "string",
22
+ },
23
+ ],
24
+ },
25
+ "type": Object {
26
+ "detail": undefined,
27
+ "summary": "union",
28
+ },
29
+ },
30
+ ],
31
+ }
32
+ `;
@@ -0,0 +1,26 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`react component properties 10278-ts-multiple-components 1`] = `
4
+ Object {
5
+ "aProperty": Object {
6
+ "control": Object {
7
+ "type": "object",
8
+ },
9
+ "description": "",
10
+ "name": "aProperty",
11
+ "table": Object {
12
+ "defaultValue": null,
13
+ "jsDocTags": undefined,
14
+ "type": Object {
15
+ "detail": undefined,
16
+ "summary": "any",
17
+ },
18
+ },
19
+ "type": Object {
20
+ "name": "other",
21
+ "required": true,
22
+ "value": "any",
23
+ },
24
+ },
25
+ }
26
+ `;
@@ -0,0 +1,49 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`react component properties 10278-ts-multiple-components 1`] = `
4
+ "/* eslint-disable react/destructuring-assignment */
5
+ import React from 'react';
6
+ /**
7
+ * A component
8
+ */
9
+ const A = props => {
10
+ return /*#__PURE__*/React.createElement(React.Fragment, null, \\"Hi \\", props.aProperty);
11
+ };
12
+
13
+ /**
14
+ * B component
15
+ */
16
+ const B = props => {
17
+ return /*#__PURE__*/React.createElement(React.Fragment, null, \\"Hi \\", props.bProperty);
18
+ };
19
+ A.__docgenInfo = {
20
+ \\"description\\": \\"A component\\",
21
+ \\"methods\\": [],
22
+ \\"displayName\\": \\"A\\",
23
+ \\"props\\": {
24
+ \\"aProperty\\": {
25
+ \\"required\\": true,
26
+ \\"tsType\\": {
27
+ \\"name\\": \\"any\\"
28
+ },
29
+ \\"description\\": \\"\\"
30
+ }
31
+ }
32
+ };
33
+ B.__docgenInfo = {
34
+ \\"description\\": \\"B component\\",
35
+ \\"methods\\": [],
36
+ \\"displayName\\": \\"B\\",
37
+ \\"props\\": {
38
+ \\"bProperty\\": {
39
+ \\"required\\": true,
40
+ \\"tsType\\": {
41
+ \\"name\\": \\"any\\"
42
+ },
43
+ \\"description\\": \\"\\"
44
+ }
45
+ }
46
+ };
47
+ export { A, B };
48
+ export const component = A;"
49
+ `;
@@ -0,0 +1,27 @@
1
+ /* eslint-disable react/destructuring-assignment */
2
+ import React from 'react';
3
+
4
+ interface IAProps {
5
+ aProperty: any;
6
+ }
7
+
8
+ interface IBProps {
9
+ bProperty: any;
10
+ }
11
+
12
+ /**
13
+ * A component
14
+ */
15
+ const A = (props: IAProps): JSX.Element => {
16
+ return <>Hi {props.aProperty}</>;
17
+ };
18
+
19
+ /**
20
+ * B component
21
+ */
22
+ const B = (props: IBProps): JSX.Element => {
23
+ return <>Hi {props.bProperty}</>;
24
+ };
25
+
26
+ export { A, B };
27
+ export const component = A;
@@ -0,0 +1,22 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`react component properties 10278-ts-multiple-components 1`] = `
4
+ Object {
5
+ "rows": Array [
6
+ Object {
7
+ "defaultValue": null,
8
+ "description": "",
9
+ "name": "aProperty",
10
+ "required": true,
11
+ "sbType": Object {
12
+ "name": "other",
13
+ "value": "any",
14
+ },
15
+ "type": Object {
16
+ "detail": undefined,
17
+ "summary": "any",
18
+ },
19
+ },
20
+ ],
21
+ }
22
+ `;
@@ -0,0 +1,127 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`react component properties 8140-js-prop-types-oneof 1`] = `
4
+ Object {
5
+ "blank": Object {
6
+ "control": Object {
7
+ "type": "boolean",
8
+ },
9
+ "description": "No background or border if static alert",
10
+ "name": "blank",
11
+ "table": Object {
12
+ "defaultValue": null,
13
+ "jsDocTags": undefined,
14
+ "type": Object {
15
+ "detail": undefined,
16
+ "summary": "bool",
17
+ },
18
+ },
19
+ "type": Object {
20
+ "name": "boolean",
21
+ "required": false,
22
+ },
23
+ },
24
+ "icon": Object {
25
+ "control": Object {
26
+ "type": "text",
27
+ },
28
+ "description": "Allows icon override, accepts material icon name",
29
+ "name": "icon",
30
+ "table": Object {
31
+ "defaultValue": null,
32
+ "jsDocTags": undefined,
33
+ "type": Object {
34
+ "detail": undefined,
35
+ "summary": "string",
36
+ },
37
+ },
38
+ "type": Object {
39
+ "name": "string",
40
+ "required": false,
41
+ },
42
+ },
43
+ "message": Object {
44
+ "control": Object {
45
+ "type": "text",
46
+ },
47
+ "description": "",
48
+ "name": "message",
49
+ "table": Object {
50
+ "defaultValue": null,
51
+ "jsDocTags": undefined,
52
+ "type": Object {
53
+ "detail": undefined,
54
+ "summary": "string",
55
+ },
56
+ },
57
+ "type": Object {
58
+ "name": "string",
59
+ "required": true,
60
+ },
61
+ },
62
+ "mode": Object {
63
+ "control": Object {
64
+ "type": "radio",
65
+ },
66
+ "description": "",
67
+ "name": "mode",
68
+ "options": Array [
69
+ "static",
70
+ "timed",
71
+ ],
72
+ "table": Object {
73
+ "defaultValue": Object {
74
+ "detail": undefined,
75
+ "summary": "'static'",
76
+ },
77
+ "jsDocTags": undefined,
78
+ "type": Object {
79
+ "detail": undefined,
80
+ "summary": "'static' | 'timed'",
81
+ },
82
+ },
83
+ "type": Object {
84
+ "name": "enum",
85
+ "required": false,
86
+ "value": Array [
87
+ "static",
88
+ "timed",
89
+ ],
90
+ },
91
+ },
92
+ "type": Object {
93
+ "control": Object {
94
+ "type": "radio",
95
+ },
96
+ "description": "",
97
+ "name": "type",
98
+ "options": Array [
99
+ "success",
100
+ "warning",
101
+ "error",
102
+ "primary",
103
+ ],
104
+ "table": Object {
105
+ "defaultValue": Object {
106
+ "detail": undefined,
107
+ "summary": "'warning'",
108
+ },
109
+ "jsDocTags": undefined,
110
+ "type": Object {
111
+ "detail": undefined,
112
+ "summary": "'success' | 'warning' | 'error' | 'primary'",
113
+ },
114
+ },
115
+ "type": Object {
116
+ "name": "enum",
117
+ "required": false,
118
+ "value": Array [
119
+ "success",
120
+ "warning",
121
+ "error",
122
+ "primary",
123
+ ],
124
+ },
125
+ },
126
+ }
127
+ `;
@@ -0,0 +1,97 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`react component properties 8140-js-prop-types-oneof 1`] = `
4
+ "/* eslint-disable react/require-default-props */
5
+ /* eslint-disable react/no-unused-prop-types */
6
+ import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ const Alert = props => /*#__PURE__*/React.createElement(React.Fragment, null, JSON.stringify(props));
9
+ Alert.defaultProps = {
10
+ mode: 'static',
11
+ type: 'warning'
12
+ };
13
+ Alert.propTypes = {
14
+ mode: PropTypes.oneOf(['static', 'timed']),
15
+ type: PropTypes.oneOf(['success', 'warning', 'error', 'primary']),
16
+ message: PropTypes.string.isRequired,
17
+ /**
18
+ * No background or border if static alert
19
+ */
20
+ blank: PropTypes.bool,
21
+ /**
22
+ * Allows icon override, accepts material icon name
23
+ */
24
+ icon: PropTypes.string
25
+ };
26
+ export const component = Alert;
27
+ Alert.__docgenInfo = {
28
+ \\"description\\": \\"\\",
29
+ \\"methods\\": [],
30
+ \\"displayName\\": \\"Alert\\",
31
+ \\"props\\": {
32
+ \\"mode\\": {
33
+ \\"defaultValue\\": {
34
+ \\"value\\": \\"'static'\\",
35
+ \\"computed\\": false
36
+ },
37
+ \\"description\\": \\"\\",
38
+ \\"type\\": {
39
+ \\"name\\": \\"enum\\",
40
+ \\"value\\": [{
41
+ \\"value\\": \\"'static'\\",
42
+ \\"computed\\": false
43
+ }, {
44
+ \\"value\\": \\"'timed'\\",
45
+ \\"computed\\": false
46
+ }]
47
+ },
48
+ \\"required\\": false
49
+ },
50
+ \\"type\\": {
51
+ \\"defaultValue\\": {
52
+ \\"value\\": \\"'warning'\\",
53
+ \\"computed\\": false
54
+ },
55
+ \\"description\\": \\"\\",
56
+ \\"type\\": {
57
+ \\"name\\": \\"enum\\",
58
+ \\"value\\": [{
59
+ \\"value\\": \\"'success'\\",
60
+ \\"computed\\": false
61
+ }, {
62
+ \\"value\\": \\"'warning'\\",
63
+ \\"computed\\": false
64
+ }, {
65
+ \\"value\\": \\"'error'\\",
66
+ \\"computed\\": false
67
+ }, {
68
+ \\"value\\": \\"'primary'\\",
69
+ \\"computed\\": false
70
+ }]
71
+ },
72
+ \\"required\\": false
73
+ },
74
+ \\"message\\": {
75
+ \\"description\\": \\"\\",
76
+ \\"type\\": {
77
+ \\"name\\": \\"string\\"
78
+ },
79
+ \\"required\\": true
80
+ },
81
+ \\"blank\\": {
82
+ \\"description\\": \\"No background or border if static alert\\",
83
+ \\"type\\": {
84
+ \\"name\\": \\"bool\\"
85
+ },
86
+ \\"required\\": false
87
+ },
88
+ \\"icon\\": {
89
+ \\"description\\": \\"Allows icon override, accepts material icon name\\",
90
+ \\"type\\": {
91
+ \\"name\\": \\"string\\"
92
+ },
93
+ \\"required\\": false
94
+ }
95
+ }
96
+ };"
97
+ `;
@@ -0,0 +1,27 @@
1
+ /* eslint-disable react/require-default-props */
2
+ /* eslint-disable react/no-unused-prop-types */
3
+ import React from 'react';
4
+ import PropTypes from 'prop-types';
5
+
6
+ const Alert = (props) => <>{JSON.stringify(props)}</>;
7
+
8
+ Alert.defaultProps = {
9
+ mode: 'static',
10
+ type: 'warning',
11
+ };
12
+
13
+ Alert.propTypes = {
14
+ mode: PropTypes.oneOf(['static', 'timed']),
15
+ type: PropTypes.oneOf(['success', 'warning', 'error', 'primary']),
16
+ message: PropTypes.string.isRequired,
17
+ /**
18
+ * No background or border if static alert
19
+ */
20
+ blank: PropTypes.bool,
21
+ /**
22
+ * Allows icon override, accepts material icon name
23
+ */
24
+ icon: PropTypes.string,
25
+ };
26
+
27
+ export const component = Alert;