@zentauri-ui/zentauri-components 2.1.4 → 2.1.5
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/README.md +6 -5
- package/cli/cli.integration.test.ts +44 -2
- package/cli/index.mjs +86 -23
- package/cli/props.json +14858 -0
- package/cli/props.test.ts +80 -0
- package/package.json +5 -2
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
|
|
6
|
+
const manifestPath = join(__dirname, "props.json");
|
|
7
|
+
|
|
8
|
+
type PropsManifest = {
|
|
9
|
+
components: Record<
|
|
10
|
+
string,
|
|
11
|
+
{
|
|
12
|
+
subcomponents: Array<{
|
|
13
|
+
name: string;
|
|
14
|
+
propsType: string;
|
|
15
|
+
props: Array<{
|
|
16
|
+
name: string;
|
|
17
|
+
options?: string[];
|
|
18
|
+
default?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
group: string;
|
|
21
|
+
isVariant?: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function readManifest() {
|
|
29
|
+
return JSON.parse(readFileSync(manifestPath, "utf8")) as PropsManifest;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
describe("props manifest", () => {
|
|
33
|
+
it("documents accordion variants and compound props without dumping raw DOM props", () => {
|
|
34
|
+
const manifest = readManifest();
|
|
35
|
+
const accordion = manifest.components.accordion;
|
|
36
|
+
|
|
37
|
+
expect(accordion).toBeDefined();
|
|
38
|
+
|
|
39
|
+
const root = accordion.subcomponents.find(
|
|
40
|
+
(subcomponent) => subcomponent.propsType === "AccordionProps",
|
|
41
|
+
);
|
|
42
|
+
const item = accordion.subcomponents.find(
|
|
43
|
+
(subcomponent) => subcomponent.propsType === "AccordionItemProps",
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
expect(root?.props).toEqual(
|
|
47
|
+
expect.arrayContaining([
|
|
48
|
+
expect.objectContaining({
|
|
49
|
+
name: "appearance",
|
|
50
|
+
group: "variant",
|
|
51
|
+
isVariant: true,
|
|
52
|
+
default: "default",
|
|
53
|
+
options: expect.arrayContaining(["default", "blue", "ghost"]),
|
|
54
|
+
}),
|
|
55
|
+
expect.objectContaining({
|
|
56
|
+
name: "size",
|
|
57
|
+
group: "variant",
|
|
58
|
+
isVariant: true,
|
|
59
|
+
default: "md",
|
|
60
|
+
options: expect.arrayContaining(["sm", "md", "lg"]),
|
|
61
|
+
}),
|
|
62
|
+
expect.objectContaining({
|
|
63
|
+
name: "value",
|
|
64
|
+
group: "controlled",
|
|
65
|
+
description: "Controlled value for `single` mode.",
|
|
66
|
+
}),
|
|
67
|
+
]),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
expect(item?.props).toEqual(
|
|
71
|
+
expect.arrayContaining([
|
|
72
|
+
expect.objectContaining({
|
|
73
|
+
name: "value",
|
|
74
|
+
group: "controlled",
|
|
75
|
+
}),
|
|
76
|
+
]),
|
|
77
|
+
);
|
|
78
|
+
expect(item?.props.map((prop) => prop.name)).not.toContain("aria-label");
|
|
79
|
+
});
|
|
80
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zentauri-ui/zentauri-components",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "React + Tailwind UI kit with charts, ESM/CJS builds, per-entry exports, and a zentauri-components / zentauri-ui CLI to vendor UI or hook source into your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"import": "./dist/design-system/facade.mjs",
|
|
61
61
|
"require": "./dist/design-system/facade.js"
|
|
62
62
|
},
|
|
63
|
+
"./props.json": "./cli/props.json",
|
|
63
64
|
"./ui/*": {
|
|
64
65
|
"types": "./dist/ui/*/index.d.ts",
|
|
65
66
|
"import": "./dist/ui/*.mjs",
|
|
@@ -97,10 +98,12 @@
|
|
|
97
98
|
"build:types": "tsc -p tsconfig.emit-types.json",
|
|
98
99
|
"build": "npm run build:js && npm run build:types",
|
|
99
100
|
"generate:registry": "node scripts/generate-registry.mjs",
|
|
101
|
+
"generate:props": "node scripts/generate-props.mjs",
|
|
100
102
|
"update:test-health": "node scripts/update-test-health.mjs",
|
|
101
103
|
"check:tokens": "node scripts/check-design-tokens.mjs",
|
|
104
|
+
"check:props": "node scripts/check-props.mjs",
|
|
102
105
|
"check:exports": "node scripts/check-exports.mjs",
|
|
103
|
-
"prepack": "npm run build && node scripts/generate-registry.mjs && node scripts/check-design-tokens.mjs && node scripts/check-exports.mjs",
|
|
106
|
+
"prepack": "npm run build && node scripts/generate-registry.mjs && node scripts/generate-props.mjs && node scripts/check-design-tokens.mjs && node scripts/check-props.mjs && node scripts/check-exports.mjs",
|
|
104
107
|
"lint": "eslint .",
|
|
105
108
|
"check-types": "tsc -p tsconfig.check-types.json --noEmit",
|
|
106
109
|
"test": "vitest run",
|