@storybook/react-vite 11.0.0-alpha.8 → 11.0.0-alpha.9
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.
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_4dr3vpsyiyp from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_4dr3vpsyiyp from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_4dr3vpsyiyp from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_4dr3vpsyiyp.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_4dr3vpsyiyp.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_4dr3vpsyiyp.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
package/dist/node/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_4dr3vpsyiyp from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_4dr3vpsyiyp from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_4dr3vpsyiyp from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_4dr3vpsyiyp.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_4dr3vpsyiyp.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_4dr3vpsyiyp.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
package/dist/preset.js
CHANGED
|
@@ -1,46 +1,50 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_4dr3vpsyiyp from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_4dr3vpsyiyp from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_4dr3vpsyiyp from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_4dr3vpsyiyp.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_4dr3vpsyiyp.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_4dr3vpsyiyp.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
|
|
13
13
|
// src/preset.ts
|
|
14
|
+
import {
|
|
15
|
+
getTypeScriptForDocgenError,
|
|
16
|
+
isDocgenServerDisabledInMainConfig
|
|
17
|
+
} from "storybook/internal/common";
|
|
14
18
|
import { deprecate } from "storybook/internal/node-logger";
|
|
15
19
|
var core = {
|
|
16
20
|
builder: import.meta.resolve("@storybook/builder-vite"),
|
|
17
21
|
renderer: import.meta.resolve("@storybook/react/preset")
|
|
18
|
-
}, viteFinal = async (config,
|
|
22
|
+
}, viteFinal = async (config, options) => {
|
|
23
|
+
let { presets } = options;
|
|
19
24
|
if ((await presets.apply("features", {}))?.docgenServer)
|
|
20
25
|
return config;
|
|
21
26
|
let plugins = [...config?.plugins ?? []], { reactDocgen: reactDocgenOption, reactDocgenTypescriptOptions } = await presets.apply(
|
|
22
27
|
"typescript",
|
|
23
28
|
{}
|
|
24
|
-
),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
), reactDocgenOption === "react-docgen-typescript" && typescriptPresent && plugins.push(
|
|
29
|
+
), typescriptUsable = !getTypeScriptForDocgenError(
|
|
30
|
+
(specifier) => import.meta.resolve(specifier)
|
|
31
|
+
);
|
|
32
|
+
typeof reactDocgenOption == "string" && await isDocgenServerDisabledInMainConfig(options) && deprecate(
|
|
33
|
+
`Builder docgen (\`typescript.reactDocgen: '${reactDocgenOption}'\`) is deprecated and will be removed in Storybook 12. It runs because your Storybook main config sets \`features.docgenServer: false\`. Remove that setting to use server-side docgen.`
|
|
34
|
+
);
|
|
35
|
+
let useReactDocgenTypescript = reactDocgenOption === "react-docgen-typescript" && typescriptUsable;
|
|
36
|
+
if (useReactDocgenTypescript && plugins.push(
|
|
33
37
|
(await import("@joshwooding/vite-plugin-react-docgen-typescript")).default({
|
|
34
38
|
...reactDocgenTypescriptOptions,
|
|
35
39
|
// We *need* this set so that RDT returns default values in the same format as react-docgen
|
|
36
40
|
savePropValueAsString: !0
|
|
37
41
|
})
|
|
38
42
|
), typeof reactDocgenOption == "string") {
|
|
39
|
-
let { reactDocgen } = await import("./_node-chunks/react-docgen-
|
|
43
|
+
let { reactDocgen } = await import("./_node-chunks/react-docgen-P77WTWDA.js");
|
|
40
44
|
plugins.unshift(
|
|
41
|
-
//
|
|
45
|
+
// react-docgen reads every file, except TypeScript files when react-docgen-typescript reads them
|
|
42
46
|
await reactDocgen({
|
|
43
|
-
include:
|
|
47
|
+
include: useReactDocgenTypescript ? /\.(mjs|jsx?)$/ : /\.(mjs|tsx?|jsx?)$/
|
|
44
48
|
})
|
|
45
49
|
);
|
|
46
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-vite",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.9",
|
|
4
4
|
"description": "Storybook for React and Vite: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@joshwooding/vite-plugin-react-docgen-typescript": "^0.7.0",
|
|
56
56
|
"@rollup/pluginutils": "^5.0.2",
|
|
57
|
-
"@storybook/builder-vite": "11.0.0-alpha.
|
|
58
|
-
"@storybook/react": "11.0.0-alpha.
|
|
57
|
+
"@storybook/builder-vite": "11.0.0-alpha.9",
|
|
58
|
+
"@storybook/react": "11.0.0-alpha.9",
|
|
59
59
|
"empathic": "^2.0.0",
|
|
60
60
|
"magic-string": "^1.1.0",
|
|
61
61
|
"react-docgen": "^8.0.2",
|
|
@@ -70,15 +70,10 @@
|
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"react": "^18.0.0 || ^19.0.0",
|
|
72
72
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
73
|
-
"storybook": "^11.0.0-alpha.
|
|
73
|
+
"storybook": "^11.0.0-alpha.9",
|
|
74
74
|
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0",
|
|
75
75
|
"vite": "^6.3.0 || ^7.0.0 || ^8.0.0"
|
|
76
76
|
},
|
|
77
|
-
"peerDependenciesMeta": {
|
|
78
|
-
"typescript": {
|
|
79
|
-
"optional": true
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
77
|
"publishConfig": {
|
|
83
78
|
"access": "public"
|
|
84
79
|
},
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
3
|
import './button.css';
|
|
6
4
|
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
5
|
+
/**
|
|
6
|
+
* Primary UI component for user interaction
|
|
7
|
+
*
|
|
8
|
+
* @param {object} props
|
|
9
|
+
* @param {boolean} [props.primary=false] Is this the principal call to action on the page?
|
|
10
|
+
* @param {string} [props.backgroundColor] What background color to use
|
|
11
|
+
* @param {'small' | 'medium' | 'large'} [props.size='medium'] How large should the button be?
|
|
12
|
+
* @param {string} props.label Button contents
|
|
13
|
+
* @param {() => void} [props.onClick] Optional click handler
|
|
14
|
+
*/
|
|
15
|
+
export const Button = ({ primary = false, backgroundColor, size = 'medium', label, ...props }) => {
|
|
15
16
|
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
16
17
|
return (
|
|
17
18
|
<button
|
|
@@ -24,16 +25,3 @@ export const Button = ({
|
|
|
24
25
|
</button>
|
|
25
26
|
);
|
|
26
27
|
};
|
|
27
|
-
|
|
28
|
-
Button.propTypes = {
|
|
29
|
-
/** Is this the principal call to action on the page? */
|
|
30
|
-
primary: PropTypes.bool,
|
|
31
|
-
/** What background color to use */
|
|
32
|
-
backgroundColor: PropTypes.string,
|
|
33
|
-
/** How large should the button be? */
|
|
34
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
35
|
-
/** Button contents */
|
|
36
|
-
label: PropTypes.string.isRequired,
|
|
37
|
-
/** Optional click handler */
|
|
38
|
-
onClick: PropTypes.func,
|
|
39
|
-
};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
3
|
import { Button } from './Button';
|
|
6
4
|
import './header.css';
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @param {object} props
|
|
8
|
+
* @param {{ name: string }} [props.user] The signed-in user, if any
|
|
9
|
+
* @param {() => void} props.onLogin Called when the user clicks Log in
|
|
10
|
+
* @param {() => void} props.onLogout Called when the user clicks Log out
|
|
11
|
+
* @param {() => void} props.onCreateAccount Called when the user clicks Sign up
|
|
12
|
+
*/
|
|
13
|
+
export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (
|
|
9
14
|
<header>
|
|
10
15
|
<div className="storybook-header">
|
|
11
16
|
<div>
|
|
@@ -45,12 +50,3 @@ export const Header = ({ user = null, onLogin, onLogout, onCreateAccount }) => (
|
|
|
45
50
|
</div>
|
|
46
51
|
</header>
|
|
47
52
|
);
|
|
48
|
-
|
|
49
|
-
Header.propTypes = {
|
|
50
|
-
user: PropTypes.shape({
|
|
51
|
-
name: PropTypes.string.isRequired,
|
|
52
|
-
}),
|
|
53
|
-
onLogin: PropTypes.func.isRequired,
|
|
54
|
-
onLogout: PropTypes.func.isRequired,
|
|
55
|
-
onCreateAccount: PropTypes.func.isRequired,
|
|
56
|
-
};
|