@storybook/experimental-nextjs-vite 0.0.0-pr-28920-sha-480f404a → 0.0.0-pr-28882-sha-441ae2cd
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/export-mocks/navigation/index.d.ts +1 -2
- package/dist/export-mocks/router/index.d.ts +1 -2
- package/dist/index.d.ts +24 -30
- package/package.json +5 -5
- package/template/cli/.eslintrc.json +1 -0
- package/template/cli/js/Button.jsx +18 -6
- package/template/cli/ts-3-8/Button.tsx +18 -6
- package/template/cli/ts-4-9/Button.tsx +18 -6
@@ -5,10 +5,9 @@ export * from 'next/dist/client/components/navigation';
|
|
5
5
|
|
6
6
|
/**
|
7
7
|
* Creates a next/navigation router API mock. Used internally.
|
8
|
-
*
|
9
8
|
* @ignore
|
10
9
|
* @internal
|
11
|
-
*/
|
10
|
+
* */
|
12
11
|
declare const createNavigation: (overrides: any) => {
|
13
12
|
push: Mock;
|
14
13
|
replace: Mock;
|
@@ -11,10 +11,9 @@ import { NextRouter } from 'next/router';
|
|
11
11
|
|
12
12
|
/**
|
13
13
|
* Creates a next/router router API mock. Used internally.
|
14
|
-
*
|
15
14
|
* @ignore
|
16
15
|
* @internal
|
17
|
-
*/
|
16
|
+
* */
|
18
17
|
declare const createRouter: (overrides: Partial<NextRouter>) => originalRouter.NextRouter;
|
19
18
|
declare const getRouter: () => {
|
20
19
|
push: Mock;
|
package/dist/index.d.ts
CHANGED
@@ -7,7 +7,6 @@ type BuilderName = CompatibleString<'@storybook/builder-vite'>;
|
|
7
7
|
type FrameworkOptions = {
|
8
8
|
/**
|
9
9
|
* The directory where the Next.js app is located.
|
10
|
-
*
|
11
10
|
* @default process.cwd()
|
12
11
|
*/
|
13
12
|
nextAppDir?: string;
|
@@ -25,39 +24,37 @@ type StorybookConfigFramework = {
|
|
25
24
|
};
|
26
25
|
};
|
27
26
|
};
|
28
|
-
/**
|
27
|
+
/**
|
28
|
+
* The interface for Storybook configuration in `main.ts` files.
|
29
|
+
*/
|
29
30
|
type StorybookConfig = Omit<StorybookConfig$1, keyof StorybookConfigVite | keyof StorybookConfigFramework> & StorybookConfigVite & StorybookConfigFramework & {};
|
30
31
|
|
31
|
-
/**
|
32
|
-
* Function that sets the globalConfig of your storybook. The global config is the preview module of
|
33
|
-
* your .storybook folder.
|
32
|
+
/** Function that sets the globalConfig of your storybook. The global config is the preview module of your .storybook folder.
|
34
33
|
*
|
35
|
-
* It should be run a single time, so that your global config (e.g. decorators) is applied to your
|
36
|
-
* stories when using `composeStories` or `composeStory`.
|
34
|
+
* It should be run a single time, so that your global config (e.g. decorators) is applied to your stories when using `composeStories` or `composeStory`.
|
37
35
|
*
|
38
36
|
* Example:
|
39
|
-
|
40
|
-
* ```jsx
|
37
|
+
*```jsx
|
41
38
|
* // setup.js (for jest)
|
42
39
|
* import { setProjectAnnotations } from '@storybook/experimental-nextjs-vite';
|
43
40
|
* import projectAnnotations from './.storybook/preview';
|
44
41
|
*
|
45
42
|
* setProjectAnnotations(projectAnnotations);
|
46
|
-
|
43
|
+
*```
|
47
44
|
*
|
48
|
-
* @param projectAnnotations -
|
45
|
+
* @param projectAnnotations - e.g. (import projectAnnotations from '../.storybook/preview')
|
49
46
|
*/
|
50
|
-
declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations
|
47
|
+
declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations | NamedOrDefaultProjectAnnotations[]): NormalizedProjectAnnotations<ReactRenderer>;
|
51
48
|
/**
|
52
49
|
* Function that will receive a story along with meta (e.g. a default export from a .stories file)
|
53
|
-
* and optionally projectAnnotations e.g. (import * from '../.storybook/preview)
|
54
|
-
* composed component that has all args/parameters/decorators/etc combined and applied to it.
|
50
|
+
* and optionally projectAnnotations e.g. (import * from '../.storybook/preview)
|
51
|
+
* and will return a composed component that has all args/parameters/decorators/etc combined and applied to it.
|
52
|
+
*
|
55
53
|
*
|
56
54
|
* It's very useful for reusing a story in scenarios outside of Storybook like unit testing.
|
57
55
|
*
|
58
56
|
* Example:
|
59
|
-
|
60
|
-
* ```jsx
|
57
|
+
*```jsx
|
61
58
|
* import { render } from '@testing-library/react';
|
62
59
|
* import { composeStory } from '@storybook/experimental-nextjs-vite';
|
63
60
|
* import Meta, { Primary as PrimaryStory } from './Button.stories';
|
@@ -68,26 +65,24 @@ declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProject
|
|
68
65
|
* const { getByText } = render(<Primary>Hello world</Primary>);
|
69
66
|
* expect(getByText(/Hello world/i)).not.toBeNull();
|
70
67
|
* });
|
71
|
-
|
68
|
+
*```
|
72
69
|
*
|
73
70
|
* @param story
|
74
|
-
* @param componentAnnotations -
|
75
|
-
* @param [projectAnnotations] -
|
76
|
-
*
|
77
|
-
* @param [exportsName] - In case your story does not contain a name and you want it to have a name.
|
71
|
+
* @param componentAnnotations - e.g. (import Meta from './Button.stories')
|
72
|
+
* @param [projectAnnotations] - e.g. (import * as projectAnnotations from '../.storybook/preview') this can be applied automatically if you use `setProjectAnnotations` in your setup files.
|
73
|
+
* @param [exportsName] - in case your story does not contain a name and you want it to have a name.
|
78
74
|
*/
|
79
75
|
declare function composeStory<TArgs extends Args = Args>(story: StoryAnnotationsOrFn<ReactRenderer, TArgs>, componentAnnotations: Meta<TArgs | any>, projectAnnotations?: ProjectAnnotations<ReactRenderer>, exportsName?: string): ComposedStoryFn<ReactRenderer, Partial<TArgs>>;
|
80
76
|
/**
|
81
77
|
* Function that will receive a stories import (e.g. `import * as stories from './Button.stories'`)
|
82
|
-
* and optionally projectAnnotations (e.g. `import * from '../.storybook/preview`)
|
83
|
-
* an object containing all the stories passed, but now as a composed component that has all
|
84
|
-
*
|
78
|
+
* and optionally projectAnnotations (e.g. `import * from '../.storybook/preview`)
|
79
|
+
* and will return an object containing all the stories passed, but now as a composed component that has all args/parameters/decorators/etc combined and applied to it.
|
80
|
+
*
|
85
81
|
*
|
86
82
|
* It's very useful for reusing stories in scenarios outside of Storybook like unit testing.
|
87
83
|
*
|
88
84
|
* Example:
|
89
|
-
|
90
|
-
* ```jsx
|
85
|
+
*```jsx
|
91
86
|
* import { render } from '@testing-library/react';
|
92
87
|
* import { composeStories } from '@storybook/experimental-nextjs-vite';
|
93
88
|
* import * as stories from './Button.stories';
|
@@ -98,11 +93,10 @@ declare function composeStory<TArgs extends Args = Args>(story: StoryAnnotations
|
|
98
93
|
* const { getByText } = render(<Primary>Hello world</Primary>);
|
99
94
|
* expect(getByText(/Hello world/i)).not.toBeNull();
|
100
95
|
* });
|
101
|
-
|
96
|
+
*```
|
102
97
|
*
|
103
|
-
* @param csfExports -
|
104
|
-
* @param [projectAnnotations] -
|
105
|
-
* this can be applied automatically if you use `setProjectAnnotations` in your setup files.
|
98
|
+
* @param csfExports - e.g. (import * as stories from './Button.stories')
|
99
|
+
* @param [projectAnnotations] - e.g. (import * as projectAnnotations from '../.storybook/preview') this can be applied automatically if you use `setProjectAnnotations` in your setup files.
|
106
100
|
*/
|
107
101
|
declare function composeStories<TModule extends Store_CSFExports<ReactRenderer, any>>(csfExports: TModule, projectAnnotations?: ProjectAnnotations<ReactRenderer>): Omit<StoriesWithPartialProps<ReactRenderer, TModule>, keyof Store_CSFExports>;
|
108
102
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@storybook/experimental-nextjs-vite",
|
3
|
-
"version": "0.0.0-pr-
|
3
|
+
"version": "0.0.0-pr-28882-sha-441ae2cd",
|
4
4
|
"description": "Storybook for Next.js and Vite",
|
5
5
|
"keywords": [
|
6
6
|
"storybook",
|
@@ -90,9 +90,9 @@
|
|
90
90
|
"prep": "jiti ../../../scripts/prepare/bundle.ts"
|
91
91
|
},
|
92
92
|
"dependencies": {
|
93
|
-
"@storybook/builder-vite": "0.0.0-pr-
|
94
|
-
"@storybook/react": "0.0.0-pr-
|
95
|
-
"@storybook/test": "0.0.0-pr-
|
93
|
+
"@storybook/builder-vite": "0.0.0-pr-28882-sha-441ae2cd",
|
94
|
+
"@storybook/react": "0.0.0-pr-28882-sha-441ae2cd",
|
95
|
+
"@storybook/test": "0.0.0-pr-28882-sha-441ae2cd",
|
96
96
|
"styled-jsx": "5.1.6"
|
97
97
|
},
|
98
98
|
"devDependencies": {
|
@@ -105,7 +105,7 @@
|
|
105
105
|
"next": "^14.2.5",
|
106
106
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
|
107
107
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
|
108
|
-
"storybook": "^0.0.0-pr-
|
108
|
+
"storybook": "^0.0.0-pr-28882-sha-441ae2cd",
|
109
109
|
"vite": "^5.0.0",
|
110
110
|
"vite-plugin-storybook-nextjs": "^1.0.0"
|
111
111
|
},
|
@@ -4,7 +4,9 @@ import PropTypes from 'prop-types';
|
|
4
4
|
|
5
5
|
import './button.css';
|
6
6
|
|
7
|
-
/**
|
7
|
+
/**
|
8
|
+
* Primary UI component for user interaction
|
9
|
+
*/
|
8
10
|
export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
|
9
11
|
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
10
12
|
return (
|
@@ -24,15 +26,25 @@ export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
|
|
24
26
|
};
|
25
27
|
|
26
28
|
Button.propTypes = {
|
27
|
-
/**
|
29
|
+
/**
|
30
|
+
* Is this the principal call to action on the page?
|
31
|
+
*/
|
28
32
|
primary: PropTypes.bool,
|
29
|
-
/**
|
33
|
+
/**
|
34
|
+
* What background color to use
|
35
|
+
*/
|
30
36
|
backgroundColor: PropTypes.string,
|
31
|
-
/**
|
37
|
+
/**
|
38
|
+
* How large should the button be?
|
39
|
+
*/
|
32
40
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
33
|
-
/**
|
41
|
+
/**
|
42
|
+
* Button contents
|
43
|
+
*/
|
34
44
|
label: PropTypes.string.isRequired,
|
35
|
-
/**
|
45
|
+
/**
|
46
|
+
* Optional click handler
|
47
|
+
*/
|
36
48
|
onClick: PropTypes.func,
|
37
49
|
};
|
38
50
|
|
@@ -3,19 +3,31 @@ import React from 'react';
|
|
3
3
|
import './button.css';
|
4
4
|
|
5
5
|
export interface ButtonProps {
|
6
|
-
/**
|
6
|
+
/**
|
7
|
+
* Is this the principal call to action on the page?
|
8
|
+
*/
|
7
9
|
primary?: boolean;
|
8
|
-
/**
|
10
|
+
/**
|
11
|
+
* What background color to use
|
12
|
+
*/
|
9
13
|
backgroundColor?: string;
|
10
|
-
/**
|
14
|
+
/**
|
15
|
+
* How large should the button be?
|
16
|
+
*/
|
11
17
|
size?: 'small' | 'medium' | 'large';
|
12
|
-
/**
|
18
|
+
/**
|
19
|
+
* Button contents
|
20
|
+
*/
|
13
21
|
label: string;
|
14
|
-
/**
|
22
|
+
/**
|
23
|
+
* Optional click handler
|
24
|
+
*/
|
15
25
|
onClick?: () => void;
|
16
26
|
}
|
17
27
|
|
18
|
-
/**
|
28
|
+
/**
|
29
|
+
* Primary UI component for user interaction
|
30
|
+
*/
|
19
31
|
export const Button = ({
|
20
32
|
primary = false,
|
21
33
|
size = 'medium',
|
@@ -3,19 +3,31 @@ import React from 'react';
|
|
3
3
|
import './button.css';
|
4
4
|
|
5
5
|
export interface ButtonProps {
|
6
|
-
/**
|
6
|
+
/**
|
7
|
+
* Is this the principal call to action on the page?
|
8
|
+
*/
|
7
9
|
primary?: boolean;
|
8
|
-
/**
|
10
|
+
/**
|
11
|
+
* What background color to use
|
12
|
+
*/
|
9
13
|
backgroundColor?: string;
|
10
|
-
/**
|
14
|
+
/**
|
15
|
+
* How large should the button be?
|
16
|
+
*/
|
11
17
|
size?: 'small' | 'medium' | 'large';
|
12
|
-
/**
|
18
|
+
/**
|
19
|
+
* Button contents
|
20
|
+
*/
|
13
21
|
label: string;
|
14
|
-
/**
|
22
|
+
/**
|
23
|
+
* Optional click handler
|
24
|
+
*/
|
15
25
|
onClick?: () => void;
|
16
26
|
}
|
17
27
|
|
18
|
-
/**
|
28
|
+
/**
|
29
|
+
* Primary UI component for user interaction
|
30
|
+
*/
|
19
31
|
export const Button = ({
|
20
32
|
primary = false,
|
21
33
|
size = 'medium',
|