@storybook/react 7.0.0-alpha.50 → 7.0.0-alpha.51
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 +17 -17
- package/dist/{types-f5aed487.d.ts → types-7d102855.d.ts} +1 -1
- package/package.json +11 -11
- package/template/cli/js/Button.stories.js +2 -4
- package/template/cli/js/Header.stories.js +2 -2
- package/template/cli/js/Page.stories.js +2 -2
- package/template/cli/ts/Button.stories.ts +2 -5
- package/template/cli/ts/Header.stories.ts +2 -2
- package/template/cli/ts/Page.stories.ts +2 -2
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as lib_docs_tools_dist from 'lib/docs-tools/dist';
|
|
2
|
-
import { R as ReactRenderer, S as StoryFnReactReturnType } from './types-
|
|
2
|
+
import { R as ReactRenderer, S as StoryFnReactReturnType } from './types-7d102855.js';
|
|
3
3
|
import * as lib_types_dist from 'lib/types/dist';
|
|
4
4
|
import { ArgsStoryFn, Store_RenderContext } from '@storybook/types';
|
|
5
5
|
import 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _storybook_types from '@storybook/types';
|
|
2
2
|
import { Addon_ClientStoryApi, Addon_Loadable, Args, ComponentAnnotations, AnnotatedStoryFn, ArgsStoryFn, ArgsFromMeta, StoryAnnotations, DecoratorFunction, StrictArgs, LoaderFunction, StoryContext as StoryContext$1, ProjectAnnotations, Store_ComposedStory, Store_CSFExports, Store_StoriesWithPartialProps } from '@storybook/types';
|
|
3
3
|
export { ArgTypes, Args, Parameters, StrictArgs } from '@storybook/types';
|
|
4
|
-
import { R as ReactRenderer, S as StoryFnReactReturnType } from './types-
|
|
5
|
-
export { R as ReactRenderer } from './types-
|
|
4
|
+
import { R as ReactRenderer, S as StoryFnReactReturnType } from './types-7d102855.js';
|
|
5
|
+
export { R as ReactRenderer } from './types-7d102855.js';
|
|
6
6
|
import { ComponentType, ComponentProps, JSXElementConstructor } from 'react';
|
|
7
7
|
import { Simplify, SetOptional } from 'type-fest';
|
|
8
8
|
|
|
@@ -16,30 +16,30 @@ declare const configure: ClientApi['configure'];
|
|
|
16
16
|
declare const forceReRender: ClientApi['forceReRender'];
|
|
17
17
|
declare const raw: ClientApi['raw'];
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
type JSXElement = keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
|
|
20
20
|
/**
|
|
21
21
|
* Metadata to configure the stories for a component.
|
|
22
22
|
*
|
|
23
23
|
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
type Meta<TCmpOrArgs = Args> = TCmpOrArgs extends ComponentType<any> ? ComponentAnnotations<ReactRenderer, ComponentProps<TCmpOrArgs>> : ComponentAnnotations<ReactRenderer, TCmpOrArgs>;
|
|
26
26
|
/**
|
|
27
27
|
* Story function that represents a CSFv2 component example.
|
|
28
28
|
*
|
|
29
29
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
type StoryFn<TCmpOrArgs = Args> = TCmpOrArgs extends ComponentType<any> ? AnnotatedStoryFn<ReactRenderer, ComponentProps<TCmpOrArgs>> : AnnotatedStoryFn<ReactRenderer, TCmpOrArgs>;
|
|
32
32
|
/**
|
|
33
33
|
* Story function that represents a CSFv3 component example.
|
|
34
34
|
*
|
|
35
35
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
type StoryObj<TMetaOrCmpOrArgs = Args> = TMetaOrCmpOrArgs extends {
|
|
38
38
|
render?: ArgsStoryFn<ReactRenderer, any>;
|
|
39
39
|
component?: infer Component;
|
|
40
40
|
args?: infer DefaultArgs;
|
|
41
41
|
} ? Simplify<(Component extends ComponentType<any> ? ComponentProps<Component> : unknown) & ArgsFromMeta<ReactRenderer, TMetaOrCmpOrArgs>> extends infer TArgs ? StoryAnnotations<ReactRenderer, TArgs, SetOptional<TArgs, keyof TArgs & keyof (DefaultArgs & ActionArgs<TArgs>)>> : never : TMetaOrCmpOrArgs extends ComponentType<any> ? StoryAnnotations<ReactRenderer, ComponentProps<TMetaOrCmpOrArgs>> : StoryAnnotations<ReactRenderer, TMetaOrCmpOrArgs>;
|
|
42
|
-
|
|
42
|
+
type ActionArgs<TArgs> = {
|
|
43
43
|
[P in keyof TArgs as TArgs[P] extends (...args: any[]) => any ? ((...args: any[]) => void) extends TArgs[P] ? P : never : never]: TArgs[P];
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
@@ -51,7 +51,7 @@ declare type ActionArgs<TArgs> = {
|
|
|
51
51
|
* export default { ... } as ComponentMeta<typeof Button>;
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
type ComponentMeta<T extends JSXElement> = Meta<ComponentProps<T>>;
|
|
55
55
|
/**
|
|
56
56
|
* @deprecated Use `StoryFn` instead, e.g. ComponentStoryFn<typeof Button> -> StoryFn<typeof Button>.
|
|
57
57
|
* Use `StoryObj` if you want to migrate to CSF3, which uses objects instead of functions to represent stories.
|
|
@@ -63,7 +63,7 @@ declare type ComponentMeta<T extends JSXElement> = Meta<ComponentProps<T>>;
|
|
|
63
63
|
* const Template: ComponentStoryFn<typeof Button> = (args) => <Button {...args} />
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
|
|
66
|
+
type ComponentStoryFn<T extends JSXElement> = StoryFn<ComponentProps<T>>;
|
|
67
67
|
/**
|
|
68
68
|
* @deprecated Use `StoryObj` instead, e.g. ComponentStoryObj<typeof Button> -> StoryObj<typeof Button>.
|
|
69
69
|
*
|
|
@@ -75,7 +75,7 @@ declare type ComponentStoryFn<T extends JSXElement> = StoryFn<ComponentProps<T>>
|
|
|
75
75
|
* }
|
|
76
76
|
* ```
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
type ComponentStoryObj<T extends JSXElement> = StoryObj<ComponentProps<T>>;
|
|
79
79
|
/**
|
|
80
80
|
* @deprecated Use `StoryFn` instead.
|
|
81
81
|
* Use `StoryObj` if you want to migrate to CSF3, which uses objects instead of functions to represent stories.
|
|
@@ -85,7 +85,7 @@ declare type ComponentStoryObj<T extends JSXElement> = StoryObj<ComponentProps<T
|
|
|
85
85
|
*
|
|
86
86
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
87
87
|
*/
|
|
88
|
-
|
|
88
|
+
type Story<TArgs = Args> = StoryFn<TArgs>;
|
|
89
89
|
/**
|
|
90
90
|
* @deprecated Use `StoryFn` instead, e.g. ComponentStory<typeof Button> -> StoryFn<typeof Button>.
|
|
91
91
|
* Use `StoryObj` if you want to migrate to CSF3, which uses objects instead of functions to represent stories
|
|
@@ -99,14 +99,14 @@ declare type Story<TArgs = Args> = StoryFn<TArgs>;
|
|
|
99
99
|
* }
|
|
100
100
|
* ```
|
|
101
101
|
*/
|
|
102
|
-
|
|
102
|
+
type ComponentStory<T extends JSXElement> = ComponentStoryFn<T>;
|
|
103
103
|
/**
|
|
104
104
|
* @deprecated Use Decorator instead.
|
|
105
105
|
*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
type DecoratorFn = DecoratorFunction<ReactRenderer>;
|
|
107
|
+
type Decorator<TArgs = StrictArgs> = DecoratorFunction<ReactRenderer, TArgs>;
|
|
108
|
+
type Loader<TArgs = StrictArgs> = LoaderFunction<ReactRenderer, TArgs>;
|
|
109
|
+
type StoryContext<TArgs = StrictArgs> = StoryContext$1<ReactRenderer, TArgs>;
|
|
110
110
|
|
|
111
111
|
/** Function that sets the globalConfig of your storybook. The global config is the preview module of your .storybook folder.
|
|
112
112
|
*
|
|
@@ -156,7 +156,7 @@ declare function setGlobalConfig(projectAnnotations: ProjectAnnotations<ReactRen
|
|
|
156
156
|
* @param [projectAnnotations] - e.g. (import * as projectAnnotations from '../.storybook/preview') this can be applied automatically if you use `setProjectAnnotations` in your setup files.
|
|
157
157
|
* @param [exportsName] - in case your story does not contain a name and you want it to have a name.
|
|
158
158
|
*/
|
|
159
|
-
declare function composeStory<TArgs = Args>(story: Store_ComposedStory<ReactRenderer, TArgs>, componentAnnotations: Meta<TArgs | any>, projectAnnotations?: ProjectAnnotations<ReactRenderer>, exportsName?: string): {
|
|
159
|
+
declare function composeStory<TArgs extends Args = Args>(story: Store_ComposedStory<ReactRenderer, TArgs>, componentAnnotations: Meta<TArgs | any>, projectAnnotations?: ProjectAnnotations<ReactRenderer>, exportsName?: string): {
|
|
160
160
|
(extraArgs: Partial<TArgs>): StoryFnReactReturnType;
|
|
161
161
|
storyName: string;
|
|
162
162
|
args: Args;
|
|
@@ -5,6 +5,6 @@ interface ReactRenderer extends WebRenderer {
|
|
|
5
5
|
component: ComponentType<this['T']>;
|
|
6
6
|
storyResult: StoryFnReactReturnType;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
type StoryFnReactReturnType = ReactElement<unknown>;
|
|
9
9
|
|
|
10
10
|
export { ReactRenderer as R, StoryFnReactReturnType as S };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.51",
|
|
4
4
|
"description": "Storybook React renderer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"prep": "../../../scripts/prepare/bundle.ts"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@storybook/addons": "7.0.0-alpha.
|
|
56
|
-
"@storybook/client-logger": "7.0.0-alpha.
|
|
57
|
-
"@storybook/core-client": "7.0.0-alpha.
|
|
58
|
-
"@storybook/docs-tools": "7.0.0-alpha.
|
|
59
|
-
"@storybook/store": "7.0.0-alpha.
|
|
60
|
-
"@storybook/types": "7.0.0-alpha.
|
|
55
|
+
"@storybook/addons": "7.0.0-alpha.51",
|
|
56
|
+
"@storybook/client-logger": "7.0.0-alpha.51",
|
|
57
|
+
"@storybook/core-client": "7.0.0-alpha.51",
|
|
58
|
+
"@storybook/docs-tools": "7.0.0-alpha.51",
|
|
59
|
+
"@storybook/store": "7.0.0-alpha.51",
|
|
60
|
+
"@storybook/types": "7.0.0-alpha.51",
|
|
61
61
|
"@types/estree": "^0.0.51",
|
|
62
|
-
"@types/node": "^16.0.0",
|
|
62
|
+
"@types/node": "^16.0.0 || ^18.0.0",
|
|
63
63
|
"acorn": "^7.4.1",
|
|
64
64
|
"acorn-jsx": "^5.3.1",
|
|
65
65
|
"acorn-walk": "^7.2.0",
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
"util-deprecate": "^1.0.2"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@babel/core": "^7.
|
|
77
|
+
"@babel/core": "^7.20.2",
|
|
78
78
|
"@types/util-deprecate": "^1.0.0",
|
|
79
79
|
"expect-type": "^0.14.2",
|
|
80
80
|
"jest-specific-snapshot": "^6.0.0",
|
|
81
81
|
"require-from-string": "^2.0.2",
|
|
82
|
-
"typescript": "
|
|
82
|
+
"typescript": "^4.9.3"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
],
|
|
104
104
|
"platform": "browser"
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "4fec76c3f5135854d9834ebc1cf2f1f325696ded"
|
|
107
107
|
}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { Button } from './Button';
|
|
2
2
|
|
|
3
|
-
// More on
|
|
3
|
+
// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
|
|
4
4
|
export default {
|
|
5
5
|
title: 'Example/Button',
|
|
6
6
|
component: Button,
|
|
7
|
-
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/react/writing-docs/docs-page
|
|
8
7
|
tags: ['docsPage'],
|
|
9
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
10
8
|
argTypes: {
|
|
11
9
|
backgroundColor: { control: 'color' },
|
|
12
10
|
},
|
|
13
11
|
};
|
|
14
12
|
|
|
15
|
-
// More on
|
|
13
|
+
// More on writing stories with args: https://storybook.js.org/docs/7.0/react/writing-stories/args
|
|
16
14
|
export const Primary = {
|
|
17
15
|
args: {
|
|
18
16
|
primary: true,
|
|
@@ -3,10 +3,10 @@ import { Header } from './Header';
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Example/Header',
|
|
5
5
|
component: Header,
|
|
6
|
-
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/react/writing-docs/docs-page
|
|
6
|
+
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/react/writing-docs/docs-page
|
|
7
7
|
tags: ['docsPage'],
|
|
8
8
|
parameters: {
|
|
9
|
-
// More on
|
|
9
|
+
// More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
|
|
10
10
|
layout: 'fullscreen',
|
|
11
11
|
},
|
|
12
12
|
};
|
|
@@ -6,14 +6,14 @@ export default {
|
|
|
6
6
|
title: 'Example/Page',
|
|
7
7
|
component: Page,
|
|
8
8
|
parameters: {
|
|
9
|
-
// More on
|
|
9
|
+
// More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
|
|
10
10
|
layout: 'fullscreen',
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export const LoggedOut = {};
|
|
15
15
|
|
|
16
|
-
// More on interaction testing: https://storybook.js.org/docs/react/writing-tests/interaction-testing
|
|
16
|
+
// More on interaction testing: https://storybook.js.org/docs/7.0/react/writing-tests/interaction-testing
|
|
17
17
|
export const LoggedIn = {
|
|
18
18
|
play: async ({ canvasElement }) => {
|
|
19
19
|
const canvas = within(canvasElement);
|
|
@@ -2,13 +2,11 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
|
2
2
|
|
|
3
3
|
import { Button } from './Button';
|
|
4
4
|
|
|
5
|
-
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
|
|
6
6
|
const meta: Meta<typeof Button> = {
|
|
7
7
|
title: 'Example/Button',
|
|
8
8
|
component: Button,
|
|
9
|
-
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/react/writing-docs/docs-page
|
|
10
9
|
tags: ['docsPage'],
|
|
11
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
12
10
|
argTypes: {
|
|
13
11
|
backgroundColor: { control: 'color' },
|
|
14
12
|
},
|
|
@@ -17,9 +15,8 @@ const meta: Meta<typeof Button> = {
|
|
|
17
15
|
export default meta;
|
|
18
16
|
type Story = StoryObj<typeof Button>;
|
|
19
17
|
|
|
20
|
-
// More on
|
|
18
|
+
// More on writing stories with args: https://storybook.js.org/docs/7.0/react/writing-stories/args
|
|
21
19
|
export const Primary: Story = {
|
|
22
|
-
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
23
20
|
args: {
|
|
24
21
|
primary: true,
|
|
25
22
|
label: 'Button',
|
|
@@ -4,10 +4,10 @@ import { Header } from './Header';
|
|
|
4
4
|
const meta: Meta<typeof Header> = {
|
|
5
5
|
title: 'Example/Header',
|
|
6
6
|
component: Header,
|
|
7
|
-
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/react/writing-docs/docs-page
|
|
7
|
+
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/react/writing-docs/docs-page
|
|
8
8
|
tags: ['docsPage'],
|
|
9
9
|
parameters: {
|
|
10
|
-
// More on
|
|
10
|
+
// More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
|
|
11
11
|
layout: 'fullscreen',
|
|
12
12
|
},
|
|
13
13
|
};
|
|
@@ -7,7 +7,7 @@ const meta: Meta<typeof Page> = {
|
|
|
7
7
|
title: 'Example/Page',
|
|
8
8
|
component: Page,
|
|
9
9
|
parameters: {
|
|
10
|
-
// More on
|
|
10
|
+
// More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
|
|
11
11
|
layout: 'fullscreen',
|
|
12
12
|
},
|
|
13
13
|
};
|
|
@@ -17,7 +17,7 @@ type Story = StoryObj<typeof Page>;
|
|
|
17
17
|
|
|
18
18
|
export const LoggedOut: Story = {};
|
|
19
19
|
|
|
20
|
-
// More on interaction testing: https://storybook.js.org/docs/react/writing-tests/interaction-testing
|
|
20
|
+
// More on interaction testing: https://storybook.js.org/docs/7.0/react/writing-tests/interaction-testing
|
|
21
21
|
export const LoggedIn: Story = {
|
|
22
22
|
play: async ({ canvasElement }) => {
|
|
23
23
|
const canvas = within(canvasElement);
|