vibe-design-system 2.5.42 → 2.5.43
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
|
@@ -20,6 +20,9 @@ const VDS_OUTPUT = path.join(PROJECT_ROOT, "vds-output.json");
|
|
|
20
20
|
const SRC_DIR = path.join(PROJECT_ROOT, "src");
|
|
21
21
|
const STORIES_DIR = path.join(SRC_DIR, "stories");
|
|
22
22
|
|
|
23
|
+
// Filled in main() after reading vds-output.json so helpers (buildSpecialStories) can see foundations data (e.g. buttonUsage).
|
|
24
|
+
let FOUNDATIONS_DATA = null;
|
|
25
|
+
|
|
23
26
|
// CSS is loaded from .storybook/preview.tsx — never add CSS import to story files.
|
|
24
27
|
|
|
25
28
|
// Components we don't want to auto-generate stories for (project-specific dashboards, heavy UIs, etc.)
|
|
@@ -843,6 +846,30 @@ function detectExportStyle(source, componentName) {
|
|
|
843
846
|
function buildSpecialStories(componentName, variants) {
|
|
844
847
|
const lines = [];
|
|
845
848
|
|
|
849
|
+
// Button: show used variant/size/asChild combinations from buttonUsage (if available)
|
|
850
|
+
if (componentName === "Button") {
|
|
851
|
+
const usage = FOUNDATIONS_DATA?.buttonUsage;
|
|
852
|
+
const combos = Array.isArray(usage?.combos) && usage.combos.length
|
|
853
|
+
? usage.combos
|
|
854
|
+
: (variants && variants.length ? variants.map((v) => ({ key: v, variant: v, size: "default", asChild: false, count: 1 })) : []);
|
|
855
|
+
lines.push(`export const UsedVariants: Story = {`);
|
|
856
|
+
lines.push(` render: () => (`);
|
|
857
|
+
lines.push(` <div style={{ display: "flex", flexWrap: "wrap", gap: 12 }}>`);
|
|
858
|
+
lines.push(` {${JSON.stringify(combos)}.map((c) => (`);
|
|
859
|
+
lines.push(` <ComponentRef`);
|
|
860
|
+
lines.push(` key={c.key}`);
|
|
861
|
+
lines.push(` variant={c.variant}`);
|
|
862
|
+
lines.push(` size={c.size}`);
|
|
863
|
+
lines.push(` >`);
|
|
864
|
+
lines.push(` {c.variant}{c.size !== "default" ? " · " + c.size : ""}`);
|
|
865
|
+
lines.push(` </ComponentRef>`);
|
|
866
|
+
lines.push(` ))}`);
|
|
867
|
+
lines.push(` </div>`);
|
|
868
|
+
lines.push(` ),`);
|
|
869
|
+
lines.push(`};`);
|
|
870
|
+
return lines.join("\\n");
|
|
871
|
+
}
|
|
872
|
+
|
|
846
873
|
// Simple input-like primitives — always render real component with args
|
|
847
874
|
if (componentName === "Input") {
|
|
848
875
|
lines.push(`export const Default: Story = {`);
|
|
@@ -1452,6 +1479,7 @@ function main() {
|
|
|
1452
1479
|
const data = JSON.parse(raw);
|
|
1453
1480
|
const components = Array.isArray(data.components) ? data.components : [];
|
|
1454
1481
|
const foundations = data.foundations || null;
|
|
1482
|
+
FOUNDATIONS_DATA = foundations;
|
|
1455
1483
|
|
|
1456
1484
|
const onlyName = process.argv[2] || null;
|
|
1457
1485
|
|