@storybook/nextjs 11.0.0-beta.0 → 11.0.0-beta.2
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/_browser-chunks/{chunk-GNFDJDVJ.js → chunk-TRGJ2EY2.js} +1 -1
- package/dist/_browser-chunks/{chunk-IMSF75WX.js → chunk-UAWMPV5J.js} +0 -7
- package/dist/_browser-chunks/{react-dom-client-W6CPASVV.js → react-dom-client-XW67TVMQ.js} +1 -1
- package/dist/_node-chunks/{chunk-NICCLNVN.js → chunk-PNKOUUKS.js} +6 -9
- package/dist/_node-chunks/{chunk-WMC74MMO.js → chunk-TO52AGCA.js} +6 -6
- package/dist/_node-chunks/{chunk-MHCWNZ2L.js → chunk-UAST6YNJ.js} +7 -7
- package/dist/_node-chunks/{configureNextFont-WESGSBQO.js → configureNextFont-77YFGDA5.js} +6 -6
- package/dist/_node-chunks/{loader-3QUVLJSI.js → loader-GHH6G5OK.js} +8 -8
- package/dist/_node-chunks/{loader-SXD4WC5F.js → loader-RMLCEWHR.js} +8 -8
- package/dist/_node-chunks/{utils-BKGNUKMH.js → utils-ZQCIAVOU.js} +8 -8
- package/dist/_node-chunks/{webpack-TABTUKNA.js → webpack-32ACEVAO.js} +8 -8
- package/dist/_node-chunks/{webpack-YLQW7HPA.js → webpack-4C43NDTO.js} +6 -6
- package/dist/_node-chunks/{webpack-UJCJBSTI.js → webpack-BDNDXLRN.js} +6 -6
- package/dist/_node-chunks/webpack-O2Z2RGEH.js +23 -0
- package/dist/_node-chunks/{webpack-MWVMKIH7.js → webpack-S2D6RM2W.js} +6 -6
- package/dist/_node-chunks/{webpack-WEDVBG5C.js → webpack-SMOGG7O4.js} +6 -6
- package/dist/_node-chunks/{webpack-HWV46HC3.js → webpack-TK2XDCSZ.js} +6 -6
- package/dist/_node-chunks/{webpack-WJ3PLO7C.js → webpack-XCEKQ5NP.js} +6 -6
- package/dist/export-mocks/cache/index.d.ts +8 -10
- package/dist/export-mocks/cache/index.js +1 -1
- package/dist/export-mocks/headers/index.d.ts +17 -17
- package/dist/export-mocks/headers/index.js +4 -12
- package/dist/export-mocks/index.js +7 -7
- package/dist/export-mocks/link/index.d.ts +1 -2
- package/dist/export-mocks/link/index.js +1 -1
- package/dist/export-mocks/navigation/index.js +1 -1
- package/dist/export-mocks/router/index.js +1 -1
- package/dist/font/webpack/loader/storybook-nextjs-font-loader.js +8 -7
- package/dist/image-context.js +1 -1
- package/dist/images/next-image.js +1 -1
- package/dist/images/next-legacy-image.js +1 -1
- package/dist/index.js +30 -16
- package/dist/next-image-loader-stub.js +1 -1
- package/dist/node/index.js +6 -6
- package/dist/preset.js +9 -9
- package/dist/preview.js +2 -2
- package/dist/rsc/server-only.js +1 -1
- package/dist/swc/next-swc-loader-patch.js +6 -6
- package/package.json +17 -5
- package/template/cli/js/Button.stories.js +11 -10
- package/template/cli/js/Header.stories.js +7 -6
- package/template/cli/js/Page.stories.js +6 -5
- package/template/cli/ts/Button.stories.ts +11 -14
- package/template/cli/ts/Header.stories.ts +6 -9
- package/template/cli/ts/Page.stories.ts +6 -9
- package/dist/_node-chunks/webpack-LLTUMDPN.js +0 -23
- package/dist/chunk-Crpg_HiB.d.ts +0 -310
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
preview_exports
|
|
3
|
-
} from "./_browser-chunks/chunk-
|
|
3
|
+
} from "./_browser-chunks/chunk-TRGJ2EY2.js";
|
|
4
4
|
import {
|
|
5
5
|
__commonJS,
|
|
6
6
|
__export,
|
|
7
7
|
__toESM
|
|
8
|
-
} from "./_browser-chunks/chunk-
|
|
8
|
+
} from "./_browser-chunks/chunk-UAWMPV5J.js";
|
|
9
9
|
|
|
10
10
|
// ../../../node_modules/estraverse/estraverse.js
|
|
11
11
|
var require_estraverse = __commonJS({
|
|
@@ -6249,6 +6249,22 @@ function withGlobalActEnvironment(actImplementation) {
|
|
|
6249
6249
|
}
|
|
6250
6250
|
};
|
|
6251
6251
|
}
|
|
6252
|
+
function createEventWrapper(act) {
|
|
6253
|
+
let isInsideAct = !1;
|
|
6254
|
+
return (cb) => {
|
|
6255
|
+
if (isInsideAct)
|
|
6256
|
+
return cb();
|
|
6257
|
+
isInsideAct = !0;
|
|
6258
|
+
try {
|
|
6259
|
+
let result;
|
|
6260
|
+
return act(() => {
|
|
6261
|
+
result = cb();
|
|
6262
|
+
}), result;
|
|
6263
|
+
} finally {
|
|
6264
|
+
isInsideAct = !1;
|
|
6265
|
+
}
|
|
6266
|
+
};
|
|
6267
|
+
}
|
|
6252
6268
|
var getAct = async ({ disableAct = !1 } = {}) => {
|
|
6253
6269
|
if (process.env.NODE_ENV === "production" || disableAct)
|
|
6254
6270
|
return (cb) => cb();
|
|
@@ -6309,7 +6325,7 @@ async function renderToCanvas({
|
|
|
6309
6325
|
showException,
|
|
6310
6326
|
forceRemount
|
|
6311
6327
|
}, canvasElement) {
|
|
6312
|
-
let { renderElement, unmountElement } = await import("./_browser-chunks/react-dom-client-
|
|
6328
|
+
let { renderElement, unmountElement } = await import("./_browser-chunks/react-dom-client-XW67TVMQ.js"), Story = unboundStoryFn, isPortableStory = storyContext.parameters.__isPortableStory;
|
|
6313
6329
|
forceRemount && (isPortableStory ? unmountElement(canvasElement) : remountCounts.set(canvasElement, (remountCounts.get(canvasElement) ?? 0) + 1));
|
|
6314
6330
|
let content = isPortableStory ? React3.createElement(Story, { ...storyContext }) : React3.createElement(
|
|
6315
6331
|
ErrorBoundary,
|
|
@@ -6389,10 +6405,7 @@ var decorators = [
|
|
|
6389
6405
|
setReactActEnvironment(previousActEnvironment);
|
|
6390
6406
|
}
|
|
6391
6407
|
},
|
|
6392
|
-
eventWrapper: (
|
|
6393
|
-
let result;
|
|
6394
|
-
return act(() => (result = cb(), result)), result;
|
|
6395
|
-
}
|
|
6408
|
+
eventWrapper: createEventWrapper(act)
|
|
6396
6409
|
});
|
|
6397
6410
|
} catch {
|
|
6398
6411
|
}
|
|
@@ -6487,22 +6500,23 @@ function generateCode(ast, compact = !1) {
|
|
|
6487
6500
|
return (0, import_escodegen.generate)(ast, compact ? COMPACT_OPTIONS : PRETTY_OPTIONS);
|
|
6488
6501
|
}
|
|
6489
6502
|
function generateObjectCode(ast, compact = !1) {
|
|
6490
|
-
return compact ?
|
|
6491
|
-
}
|
|
6492
|
-
function generateCompactObjectCode(ast) {
|
|
6493
|
-
let result = generateCode(ast, !0);
|
|
6494
|
-
return result.endsWith(" }") || (result = `${result.slice(0, -1)} }`), result;
|
|
6503
|
+
return compact ? generateCompactCode(ast) : generateCode(ast);
|
|
6495
6504
|
}
|
|
6496
6505
|
function generateArrayCode(ast, compact = !1) {
|
|
6497
|
-
return compact ?
|
|
6506
|
+
return compact ? generateCompactCode(ast) : generateMultilineArrayCode(ast);
|
|
6498
6507
|
}
|
|
6499
6508
|
function generateMultilineArrayCode(ast) {
|
|
6500
6509
|
let result = generateCode(ast);
|
|
6501
6510
|
return result.endsWith(" }]") && (result = dedent(result)), result;
|
|
6502
6511
|
}
|
|
6503
|
-
function
|
|
6504
|
-
|
|
6505
|
-
|
|
6512
|
+
function generateCompactCode(ast) {
|
|
6513
|
+
return ast.type === "ArrayExpression" ? `[${ast.elements.map(generateCompactCode).join(", ")}]` : ast.type === "ObjectExpression" ? `{ ${ast.properties.map(generateCompactProperty).join(", ")} }` : generateCode(ast, !0);
|
|
6514
|
+
}
|
|
6515
|
+
function generateCompactProperty(property) {
|
|
6516
|
+
if (property.type !== "Property" || property.kind !== "init" || property.method || property.shorthand)
|
|
6517
|
+
return generateCode(property, !0);
|
|
6518
|
+
let key = generateCode(property.key, !0);
|
|
6519
|
+
return `${property.computed ? `[${key}]` : key}: ${generateCompactCode(property.value)}`;
|
|
6506
6520
|
}
|
|
6507
6521
|
|
|
6508
6522
|
// ../../renderers/react/src/docs/lib/inspection/acornParser.ts
|
package/dist/node/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_rncv7k5a7m from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_rncv7k5a7m from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_rncv7k5a7m from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_rncv7k5a7m.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_rncv7k5a7m.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_rncv7k5a7m.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,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_rncv7k5a7m from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_rncv7k5a7m from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_rncv7k5a7m from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_rncv7k5a7m.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_rncv7k5a7m.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_rncv7k5a7m.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
addScopedAlias,
|
|
14
14
|
isNextVersionGte,
|
|
15
15
|
resolveNextConfig
|
|
16
|
-
} from "./_node-chunks/chunk-
|
|
17
|
-
import "./_node-chunks/chunk-
|
|
16
|
+
} from "./_node-chunks/chunk-UAST6YNJ.js";
|
|
17
|
+
import "./_node-chunks/chunk-PNKOUUKS.js";
|
|
18
18
|
|
|
19
19
|
// src/preset.ts
|
|
20
20
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -553,7 +553,7 @@ var addons = [
|
|
|
553
553
|
baseConfig,
|
|
554
554
|
nextConfigPath,
|
|
555
555
|
webpackInstance
|
|
556
|
-
}), { configureNextFont } = await import("./_node-chunks/configureNextFont-
|
|
556
|
+
}), { configureNextFont } = await import("./_node-chunks/configureNextFont-77YFGDA5.js"), { configureRuntimeNextjsVersionResolution } = await import("./_node-chunks/utils-ZQCIAVOU.js"), { configureImports } = await import("./_node-chunks/webpack-XCEKQ5NP.js"), { configureCss } = await import("./_node-chunks/webpack-SMOGG7O4.js"), { configureImages } = await import("./_node-chunks/webpack-4C43NDTO.js"), { configureStyledJsx } = await import("./_node-chunks/webpack-O2Z2RGEH.js"), { configureNodePolyfills } = await import("./_node-chunks/webpack-TK2XDCSZ.js"), { configureAliases } = await import("./_node-chunks/webpack-32ACEVAO.js"), { configureFastRefresh } = await import("./_node-chunks/webpack-S2D6RM2W.js"), { configureRSC } = await import("./_node-chunks/webpack-BDNDXLRN.js"), { configureSWCLoader } = await import("./_node-chunks/loader-RMLCEWHR.js"), { configureBabelLoader } = await import("./_node-chunks/loader-GHH6G5OK.js"), hasBabelConfig = !!findBabelConfigFile(getProjectRoot()), isDevelopment = options.configType !== "PRODUCTION", useSWC = nextConfig.experimental?.forceSwcTransforms || !hasBabelConfig;
|
|
557
557
|
return configureNextFont(baseConfig, useSWC), configureRuntimeNextjsVersionResolution(baseConfig), configureImports({ baseConfig, configDir: options.configDir }), configureCss(baseConfig, nextConfig), configureImages(baseConfig, nextConfig), configureStyledJsx(baseConfig), configureNodePolyfills(baseConfig, webpackInstance), configureAliases(baseConfig), isDevelopment && configureFastRefresh(baseConfig), options.features?.experimentalRSC && configureRSC(baseConfig), useSWC ? (logger.info("Using SWC as compiler"), await configureSWCLoader(baseConfig, options, nextConfig)) : (logger.info("Using Babel as compiler"), await configureBabelLoader(baseConfig, options, nextConfig)), baseConfig;
|
|
558
558
|
};
|
|
559
559
|
export {
|
package/dist/preview.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
decorators,
|
|
3
3
|
loaders,
|
|
4
4
|
parameters
|
|
5
|
-
} from "./_browser-chunks/chunk-
|
|
6
|
-
import "./_browser-chunks/chunk-
|
|
5
|
+
} from "./_browser-chunks/chunk-TRGJ2EY2.js";
|
|
6
|
+
import "./_browser-chunks/chunk-UAWMPV5J.js";
|
|
7
7
|
export {
|
|
8
8
|
decorators,
|
|
9
9
|
loaders,
|
package/dist/rsc/server-only.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_rncv7k5a7m from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_rncv7k5a7m from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_rncv7k5a7m from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_rncv7k5a7m.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_rncv7k5a7m.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_rncv7k5a7m.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/nextjs",
|
|
3
|
-
"version": "11.0.0-beta.
|
|
3
|
+
"version": "11.0.0-beta.2",
|
|
4
4
|
"description": "Storybook for Next.js: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -101,9 +101,9 @@
|
|
|
101
101
|
"@babel/preset-typescript": "^7.28.5",
|
|
102
102
|
"@babel/runtime": "^7.28.4",
|
|
103
103
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
|
|
104
|
-
"@storybook/builder-webpack5": "11.0.0-beta.
|
|
105
|
-
"@storybook/preset-react-webpack": "11.0.0-beta.
|
|
106
|
-
"@storybook/react": "11.0.0-beta.
|
|
104
|
+
"@storybook/builder-webpack5": "11.0.0-beta.2",
|
|
105
|
+
"@storybook/preset-react-webpack": "11.0.0-beta.2",
|
|
106
|
+
"@storybook/react": "11.0.0-beta.2",
|
|
107
107
|
"@types/semver": "^7.7.1",
|
|
108
108
|
"babel-loader": "^9.1.3",
|
|
109
109
|
"browserify-zlib": "^0.2.0",
|
|
@@ -140,22 +140,34 @@
|
|
|
140
140
|
"webpack": "^5.65.0"
|
|
141
141
|
},
|
|
142
142
|
"peerDependencies": {
|
|
143
|
+
"@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.0c3f3b7.0",
|
|
143
144
|
"@types/react": "^18.0.0 || ^19.0.0",
|
|
144
145
|
"@types/react-dom": "^18.0.0 || ^19.0.0",
|
|
145
146
|
"next": "^15.0.0 || ^16.0.0",
|
|
146
147
|
"react": "^18.0.0 || ^19.0.0",
|
|
148
|
+
"react-docgen": "^8.0.2",
|
|
149
|
+
"react-docgen-typescript": "^2.2.2",
|
|
147
150
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
148
|
-
"storybook": "^11.0.0-beta.
|
|
151
|
+
"storybook": "^11.0.0-beta.2",
|
|
149
152
|
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0",
|
|
150
153
|
"webpack": "^5.0.0"
|
|
151
154
|
},
|
|
152
155
|
"peerDependenciesMeta": {
|
|
156
|
+
"@storybook/react-docgen-typescript-plugin": {
|
|
157
|
+
"optional": true
|
|
158
|
+
},
|
|
153
159
|
"@types/react": {
|
|
154
160
|
"optional": true
|
|
155
161
|
},
|
|
156
162
|
"@types/react-dom": {
|
|
157
163
|
"optional": true
|
|
158
164
|
},
|
|
165
|
+
"react-docgen": {
|
|
166
|
+
"optional": true
|
|
167
|
+
},
|
|
168
|
+
"react-docgen-typescript": {
|
|
169
|
+
"optional": true
|
|
170
|
+
},
|
|
159
171
|
"webpack": {
|
|
160
172
|
"optional": true
|
|
161
173
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
1
2
|
import { fn } from 'storybook/test';
|
|
2
3
|
|
|
3
4
|
import { Button } from './Button';
|
|
4
5
|
|
|
5
6
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
6
|
-
|
|
7
|
+
const meta = preview.meta({
|
|
7
8
|
title: 'Example/Button',
|
|
8
9
|
component: Button,
|
|
9
10
|
parameters: {
|
|
@@ -18,32 +19,32 @@ export default {
|
|
|
18
19
|
},
|
|
19
20
|
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#story-args
|
|
20
21
|
args: { onClick: fn() },
|
|
21
|
-
};
|
|
22
|
+
});
|
|
22
23
|
|
|
23
24
|
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
24
|
-
export const Primary = {
|
|
25
|
+
export const Primary = meta.story({
|
|
25
26
|
args: {
|
|
26
27
|
primary: true,
|
|
27
28
|
label: 'Button',
|
|
28
29
|
},
|
|
29
|
-
};
|
|
30
|
+
});
|
|
30
31
|
|
|
31
|
-
export const Secondary = {
|
|
32
|
+
export const Secondary = meta.story({
|
|
32
33
|
args: {
|
|
33
34
|
label: 'Button',
|
|
34
35
|
},
|
|
35
|
-
};
|
|
36
|
+
});
|
|
36
37
|
|
|
37
|
-
export const Large = {
|
|
38
|
+
export const Large = meta.story({
|
|
38
39
|
args: {
|
|
39
40
|
size: 'large',
|
|
40
41
|
label: 'Button',
|
|
41
42
|
},
|
|
42
|
-
};
|
|
43
|
+
});
|
|
43
44
|
|
|
44
|
-
export const Small = {
|
|
45
|
+
export const Small = meta.story({
|
|
45
46
|
args: {
|
|
46
47
|
size: 'small',
|
|
47
48
|
label: 'Button',
|
|
48
49
|
},
|
|
49
|
-
};
|
|
50
|
+
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
1
2
|
import { fn } from 'storybook/test';
|
|
2
3
|
|
|
3
4
|
import { Header } from './Header';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
const meta = preview.meta({
|
|
6
7
|
title: 'Example/Header',
|
|
7
8
|
component: Header,
|
|
8
9
|
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
@@ -16,15 +17,15 @@ export default {
|
|
|
16
17
|
onLogout: fn(),
|
|
17
18
|
onCreateAccount: fn(),
|
|
18
19
|
},
|
|
19
|
-
};
|
|
20
|
-
export const LoggedIn = {
|
|
20
|
+
});
|
|
21
|
+
export const LoggedIn = meta.story({
|
|
21
22
|
args: {
|
|
22
23
|
user: {
|
|
23
24
|
name: 'Jane Doe',
|
|
24
25
|
},
|
|
25
26
|
},
|
|
26
|
-
};
|
|
27
|
+
});
|
|
27
28
|
|
|
28
|
-
export const LoggedOut = {
|
|
29
|
+
export const LoggedOut = meta.story({
|
|
29
30
|
args: {},
|
|
30
|
-
};
|
|
31
|
+
});
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
1
2
|
import { expect, userEvent, within } from 'storybook/test';
|
|
2
3
|
|
|
3
4
|
import { Page } from './Page';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
const meta = preview.meta({
|
|
6
7
|
title: 'Example/Page',
|
|
7
8
|
component: Page,
|
|
8
9
|
parameters: {
|
|
9
10
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
10
11
|
layout: 'fullscreen',
|
|
11
12
|
},
|
|
12
|
-
};
|
|
13
|
+
});
|
|
13
14
|
|
|
14
|
-
export const LoggedOut =
|
|
15
|
+
export const LoggedOut = meta.story();
|
|
15
16
|
|
|
16
17
|
// More on component testing: https://storybook.js.org/docs/writing-tests/interaction-testing
|
|
17
|
-
export const LoggedIn = {
|
|
18
|
+
export const LoggedIn = meta.story({
|
|
18
19
|
play: async ({ canvasElement }) => {
|
|
19
20
|
const canvas = within(canvasElement);
|
|
20
21
|
const loginButton = canvas.getByRole('button', { name: /Log in/i });
|
|
@@ -25,4 +26,4 @@ export const LoggedIn = {
|
|
|
25
26
|
const logoutButton = canvas.getByRole('button', { name: /Log out/i });
|
|
26
27
|
await expect(logoutButton).toBeInTheDocument();
|
|
27
28
|
},
|
|
28
|
-
};
|
|
29
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
2
2
|
|
|
3
3
|
import { fn } from 'storybook/test';
|
|
4
4
|
|
|
5
5
|
import { Button } from './Button';
|
|
6
6
|
|
|
7
7
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
8
|
-
const meta = {
|
|
8
|
+
const meta = preview.meta({
|
|
9
9
|
title: 'Example/Button',
|
|
10
10
|
component: Button,
|
|
11
11
|
parameters: {
|
|
@@ -20,35 +20,32 @@ const meta = {
|
|
|
20
20
|
},
|
|
21
21
|
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#story-args
|
|
22
22
|
args: { onClick: fn() },
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default meta;
|
|
26
|
-
type Story = StoryObj<typeof meta>;
|
|
23
|
+
});
|
|
27
24
|
|
|
28
25
|
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
29
|
-
export const Primary
|
|
26
|
+
export const Primary = meta.story({
|
|
30
27
|
args: {
|
|
31
28
|
primary: true,
|
|
32
29
|
label: 'Button',
|
|
33
30
|
},
|
|
34
|
-
};
|
|
31
|
+
});
|
|
35
32
|
|
|
36
|
-
export const Secondary
|
|
33
|
+
export const Secondary = meta.story({
|
|
37
34
|
args: {
|
|
38
35
|
label: 'Button',
|
|
39
36
|
},
|
|
40
|
-
};
|
|
37
|
+
});
|
|
41
38
|
|
|
42
|
-
export const Large
|
|
39
|
+
export const Large = meta.story({
|
|
43
40
|
args: {
|
|
44
41
|
size: 'large',
|
|
45
42
|
label: 'Button',
|
|
46
43
|
},
|
|
47
|
-
};
|
|
44
|
+
});
|
|
48
45
|
|
|
49
|
-
export const Small
|
|
46
|
+
export const Small = meta.story({
|
|
50
47
|
args: {
|
|
51
48
|
size: 'small',
|
|
52
49
|
label: 'Button',
|
|
53
50
|
},
|
|
54
|
-
};
|
|
51
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
2
2
|
|
|
3
3
|
import { fn } from 'storybook/test';
|
|
4
4
|
|
|
5
5
|
import { Header } from './Header';
|
|
6
6
|
|
|
7
|
-
const meta = {
|
|
7
|
+
const meta = preview.meta({
|
|
8
8
|
title: 'Example/Header',
|
|
9
9
|
component: Header,
|
|
10
10
|
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
@@ -18,17 +18,14 @@ const meta = {
|
|
|
18
18
|
onLogout: fn(),
|
|
19
19
|
onCreateAccount: fn(),
|
|
20
20
|
},
|
|
21
|
-
}
|
|
21
|
+
});
|
|
22
22
|
|
|
23
|
-
export
|
|
24
|
-
type Story = StoryObj<typeof meta>;
|
|
25
|
-
|
|
26
|
-
export const LoggedIn: Story = {
|
|
23
|
+
export const LoggedIn = meta.story({
|
|
27
24
|
args: {
|
|
28
25
|
user: {
|
|
29
26
|
name: 'Jane Doe',
|
|
30
27
|
},
|
|
31
28
|
},
|
|
32
|
-
};
|
|
29
|
+
});
|
|
33
30
|
|
|
34
|
-
export const LoggedOut
|
|
31
|
+
export const LoggedOut = meta.story();
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
2
2
|
|
|
3
3
|
import { expect, userEvent, within } from 'storybook/test';
|
|
4
4
|
|
|
5
5
|
import { Page } from './Page';
|
|
6
6
|
|
|
7
|
-
const meta = {
|
|
7
|
+
const meta = preview.meta({
|
|
8
8
|
title: 'Example/Page',
|
|
9
9
|
component: Page,
|
|
10
10
|
parameters: {
|
|
11
11
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
12
12
|
layout: 'fullscreen',
|
|
13
13
|
},
|
|
14
|
-
}
|
|
14
|
+
});
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
type Story = StoryObj<typeof meta>;
|
|
18
|
-
|
|
19
|
-
export const LoggedOut: Story = {};
|
|
16
|
+
export const LoggedOut = meta.story();
|
|
20
17
|
|
|
21
18
|
// More on component testing: https://storybook.js.org/docs/writing-tests/interaction-testing
|
|
22
|
-
export const LoggedIn
|
|
19
|
+
export const LoggedIn = meta.story({
|
|
23
20
|
play: async ({ canvasElement }) => {
|
|
24
21
|
const canvas = within(canvasElement);
|
|
25
22
|
const loginButton = canvas.getByRole('button', { name: /Log in/i });
|
|
@@ -30,4 +27,4 @@ export const LoggedIn: Story = {
|
|
|
30
27
|
const logoutButton = canvas.getByRole('button', { name: /Log out/i });
|
|
31
28
|
await expect(logoutButton).toBeInTheDocument();
|
|
32
29
|
},
|
|
33
|
-
};
|
|
30
|
+
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_6xund73j2xn from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_6xund73j2xn from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_6xund73j2xn from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_6xund73j2xn.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_6xund73j2xn.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_6xund73j2xn.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import {
|
|
13
|
-
addScopedAlias
|
|
14
|
-
} from "./chunk-MHCWNZ2L.js";
|
|
15
|
-
import "./chunk-NICCLNVN.js";
|
|
16
|
-
|
|
17
|
-
// src/styledJsx/webpack.ts
|
|
18
|
-
var configureStyledJsx = (baseConfig) => {
|
|
19
|
-
addScopedAlias(baseConfig, "styled-jsx");
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
configureStyledJsx
|
|
23
|
-
};
|