@storybook/react 10.4.2 → 10.4.3

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.
@@ -50,7 +50,29 @@ var renderJsx = (code, options) => {
50
50
  let displayNameDefaults;
51
51
  typeof options?.displayName == "string" ? displayNameDefaults = { showFunctions: !0, displayName: () => options.displayName } : displayNameDefaults = {
52
52
  // To get exotic component names resolving properly
53
- displayName: (el) => el.type.displayName ? el.type.displayName : getDocgenSection(el.type, "displayName") ? getDocgenSection(el.type, "displayName") : el.type.render?.displayName ? el.type.render.displayName : typeof el.type == "symbol" || el.type.$$typeof && typeof el.type.$$typeof == "symbol" ? getReactSymbolName(el.type) : el.type.name && el.type.name !== "_default" ? el.type.name : typeof el.type == "function" ? "No Display Name" : isForwardRef(el.type) ? el.type.render.name : isMemo(el.type) ? el.type.type.name : el.type
53
+ displayName: (el) => {
54
+ if (el.type.displayName)
55
+ return el.type.displayName;
56
+ if (getDocgenSection(el.type, "displayName"))
57
+ return getDocgenSection(el.type, "displayName");
58
+ if (el.type.render?.displayName)
59
+ return el.type.render.displayName;
60
+ if (typeof el.type == "symbol" || el.type.$$typeof && typeof el.type.$$typeof == "symbol")
61
+ return getReactSymbolName(el.type);
62
+ if (el.type.name && el.type.name !== "_default")
63
+ return el.type.name;
64
+ if (typeof el.type == "function") {
65
+ let parent = options?.parentComponent;
66
+ if (parent) {
67
+ for (let key of Object.keys(parent))
68
+ if (/^[A-Z]/.test(key) && parent[key] === el.type) {
69
+ let parentName = parent.displayName || parent.name || "";
70
+ return parentName ? `${parentName}.${key}` : key;
71
+ }
72
+ }
73
+ return "No Display Name";
74
+ } else return isForwardRef(el.type) ? el.type.render.name : isMemo(el.type) ? el.type.type.name : el.type;
75
+ }
54
76
  };
55
77
  let opts = {
56
78
  ...displayNameDefaults,
@@ -89,7 +111,8 @@ var renderJsx = (code, options) => {
89
111
  }, jsxDecorator = (storyFn, context) => {
90
112
  let jsx = useRef(void 0), story = storyFn(), skip = skipJsxRender(context), options = {
91
113
  ...defaultOpts,
92
- ...context?.parameters.jsx || {}
114
+ ...context?.parameters.jsx || {},
115
+ parentComponent: context?.component
93
116
  }, storyJsx = context.originalStoryFn(context.args, context);
94
117
  return useEffect(() => {
95
118
  if (skip)
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-77RIPXG7.js";
7
7
  import {
8
8
  entry_preview_docs_exports
9
- } from "./chunk-CMP5DLKH.js";
9
+ } from "./chunk-2AEMMVD7.js";
10
10
 
11
11
  // src/preview.tsx
12
12
  import { definePreview as definePreviewBase } from "storybook/internal/csf";
@@ -2,7 +2,7 @@ import {
2
2
  applyDecorators,
3
3
  decorators,
4
4
  parameters
5
- } from "./_browser-chunks/chunk-CMP5DLKH.js";
5
+ } from "./_browser-chunks/chunk-2AEMMVD7.js";
6
6
  import "./_browser-chunks/chunk-DDIRQRCA.js";
7
7
  import "./_browser-chunks/chunk-E4YOXNOQ.js";
8
8
  import "./_browser-chunks/chunk-SL3VIQZ3.js";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __definePreview
3
- } from "./_browser-chunks/chunk-GUVY6QMW.js";
3
+ } from "./_browser-chunks/chunk-G4UOHMOB.js";
4
4
  import {
5
5
  entry_preview_exports,
6
6
  renderToCanvas
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  entry_preview_argtypes_exports
10
10
  } from "./_browser-chunks/chunk-77RIPXG7.js";
11
- import "./_browser-chunks/chunk-CMP5DLKH.js";
11
+ import "./_browser-chunks/chunk-2AEMMVD7.js";
12
12
  import "./_browser-chunks/chunk-DDIRQRCA.js";
13
13
  import "./_browser-chunks/chunk-E4YOXNOQ.js";
14
14
  import "./_browser-chunks/chunk-SL3VIQZ3.js";
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_62r9dsmqeds from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_62r9dsmqeds from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_62r9dsmqeds from "node:module";
1
+ import CJS_COMPAT_NODE_URL_qh6ur8rkcci from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_qh6ur8rkcci from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_qh6ur8rkcci from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_62r9dsmqeds.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_62r9dsmqeds.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_62r9dsmqeds.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_qh6ur8rkcci.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_qh6ur8rkcci.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_qh6ur8rkcci.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/preview.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  __definePreview
3
- } from "./_browser-chunks/chunk-GUVY6QMW.js";
3
+ } from "./_browser-chunks/chunk-G4UOHMOB.js";
4
4
  import "./_browser-chunks/chunk-L3JF7GGZ.js";
5
5
  import "./_browser-chunks/chunk-77RIPXG7.js";
6
- import "./_browser-chunks/chunk-CMP5DLKH.js";
6
+ import "./_browser-chunks/chunk-2AEMMVD7.js";
7
7
  import "./_browser-chunks/chunk-DDIRQRCA.js";
8
8
  import "./_browser-chunks/chunk-E4YOXNOQ.js";
9
9
  import "./_browser-chunks/chunk-SL3VIQZ3.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react",
3
- "version": "10.4.2",
3
+ "version": "10.4.3",
4
4
  "description": "Storybook React renderer",
5
5
  "keywords": [
6
6
  "storybook"
@@ -53,7 +53,7 @@
53
53
  ],
54
54
  "dependencies": {
55
55
  "@storybook/global": "^5.0.0",
56
- "@storybook/react-dom-shim": "10.4.2",
56
+ "@storybook/react-dom-shim": "10.4.3",
57
57
  "react-docgen": "^8.0.2",
58
58
  "react-docgen-typescript": "^2.2.2"
59
59
  },
@@ -85,7 +85,7 @@
85
85
  "@types/react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
86
86
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
87
87
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
88
- "storybook": "^10.4.2",
88
+ "storybook": "^10.4.3",
89
89
  "typescript": ">= 4.9.x"
90
90
  },
91
91
  "peerDependenciesMeta": {