vibe-design-system 2.8.29 → 2.8.31
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/package.json
CHANGED
|
@@ -1226,8 +1226,10 @@ function buildStoryFileContent(comp) {
|
|
|
1226
1226
|
let importPath = "";
|
|
1227
1227
|
const isPageFile = fileNoExt.startsWith("pages/") || fileNoExt.startsWith("src/pages/");
|
|
1228
1228
|
if (isPageFile) {
|
|
1229
|
-
|
|
1230
|
-
|
|
1229
|
+
// Keep full path with src/ prefix so relative is computed correctly from src/stories/
|
|
1230
|
+
// e.g. "src/pages/Admin" → "../pages/Admin" (NOT "../../pages/Admin")
|
|
1231
|
+
const fullPath = fileNoExt.startsWith("src/") ? fileNoExt : "src/" + fileNoExt;
|
|
1232
|
+
importPath = path.posix.relative("src/stories", fullPath);
|
|
1231
1233
|
} else {
|
|
1232
1234
|
const targetPath = path.posix.join(COMPONENTS_REL_DIR, fileNoExt);
|
|
1233
1235
|
importPath = path.posix.relative("src/stories", targetPath);
|
|
@@ -1289,6 +1291,9 @@ function buildStoryFileContent(comp) {
|
|
|
1289
1291
|
const usageFromPages = findComponentUsageInPages(componentName, PROJECT_ROOT);
|
|
1290
1292
|
const { argLines: defaultArgLines, lucideImports, iconPropNames, needReact } = buildDefaultArgsForRequiredProps(effectiveProps, usageFromPages, componentName, source);
|
|
1291
1293
|
const useReactNodeChildrenRender = !omitChildren && hasChildrenPropReactNode(effectiveProps);
|
|
1294
|
+
// Any component with no extractable props: suppress children arg + simplify render.
|
|
1295
|
+
// Covers feature, page, and section-type components regardless of tier classification (e.g. HeroSection, Footer)
|
|
1296
|
+
const isNoPropsFeature = effectiveProps.length === 0;
|
|
1292
1297
|
|
|
1293
1298
|
// Skip story only if not a page and no export found
|
|
1294
1299
|
if (exportStyle === "unknown" && !isPage && (!source.includes("export") || !new RegExp(`\\b${componentName}\\b`).test(source))) {
|
|
@@ -1364,16 +1369,25 @@ function buildStoryFileContent(comp) {
|
|
|
1364
1369
|
const propsArg = argsFallback ? `{ ...args${argsFallback} }` : (useSafeWrapper ? "args" : "args");
|
|
1365
1370
|
const renderLine = useReactNodeChildrenRender
|
|
1366
1371
|
? ` render: (args) => React.createElement(React.Suspense, { fallback: null }, React.createElement(${RenderTarget}, { ...args, children: args.children || React.createElement('span', null, 'Example') })),`
|
|
1367
|
-
:
|
|
1368
|
-
|
|
1372
|
+
: isNoPropsFeature
|
|
1373
|
+
? ` render: () => React.createElement(React.Suspense, { fallback: null }, React.createElement(${RenderTarget})),`
|
|
1374
|
+
: ` render: ${argsParam} => React.createElement(React.Suspense, { fallback: null }, React.createElement(${RenderTarget}, ${propsArg})),`;
|
|
1375
|
+
const childrenArgLine = (label) => {
|
|
1376
|
+
if (isNoPropsFeature) return null; // Feature/page with no props: no children arg
|
|
1377
|
+
return !omitChildren && !useReactNodeChildrenRender ? ` children: ${JSON.stringify(label)},` : null;
|
|
1378
|
+
};
|
|
1369
1379
|
|
|
1370
1380
|
if (!variants.length) {
|
|
1371
1381
|
lines.push(`export const Default: Story = {`);
|
|
1372
1382
|
lines.push(renderLine);
|
|
1373
|
-
|
|
1374
|
-
if (childrenArgLine(componentName))
|
|
1375
|
-
for (const line of defaultArgLines)
|
|
1376
|
-
|
|
1383
|
+
const storyArgLines = [];
|
|
1384
|
+
if (childrenArgLine(componentName)) storyArgLines.push(childrenArgLine(componentName));
|
|
1385
|
+
for (const line of defaultArgLines) storyArgLines.push(line);
|
|
1386
|
+
if (storyArgLines.length > 0) {
|
|
1387
|
+
lines.push(` args: {`);
|
|
1388
|
+
for (const line of storyArgLines) lines.push(line);
|
|
1389
|
+
lines.push(` },`);
|
|
1390
|
+
}
|
|
1377
1391
|
lines.push(`};`);
|
|
1378
1392
|
} else {
|
|
1379
1393
|
const defaultVariant = variants[0];
|