@zentauri-ui/zentauri-components 2.1.6 → 2.1.8

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.
Files changed (152) hide show
  1. package/README.md +12 -8
  2. package/cli/cli.integration.test.ts +36 -0
  3. package/cli/index.mjs +43 -7
  4. package/cli/props.json +462 -3
  5. package/cli/registry.json +29 -0
  6. package/cli/rewrite-imports.mjs +29 -4
  7. package/cli/rewrite-imports.test.ts +35 -0
  8. package/dist/{chunk-WWKAJHIV.mjs → chunk-4PAHLHYF.mjs} +3 -3
  9. package/dist/{chunk-WWKAJHIV.mjs.map → chunk-4PAHLHYF.mjs.map} +1 -1
  10. package/dist/chunk-4SLVTSHM.js +241 -0
  11. package/dist/chunk-4SLVTSHM.js.map +1 -0
  12. package/dist/chunk-6OVDBAMI.js +19 -0
  13. package/dist/{chunk-3W2UUKWP.js.map → chunk-6OVDBAMI.js.map} +1 -1
  14. package/dist/chunk-74SKXGTM.js +4 -0
  15. package/dist/chunk-74SKXGTM.js.map +1 -0
  16. package/dist/{chunk-QE7OJW4J.js → chunk-BAAXQPZ7.js} +6 -6
  17. package/dist/{chunk-QE7OJW4J.js.map → chunk-BAAXQPZ7.js.map} +1 -1
  18. package/dist/chunk-CYKSS5S5.mjs +128 -0
  19. package/dist/chunk-CYKSS5S5.mjs.map +1 -0
  20. package/dist/chunk-D7ZTSAA6.mjs +221 -0
  21. package/dist/chunk-D7ZTSAA6.mjs.map +1 -0
  22. package/dist/{chunk-VA6SB6NN.js → chunk-DPNTQ4AK.js} +73 -6
  23. package/dist/chunk-DPNTQ4AK.js.map +1 -0
  24. package/dist/chunk-HMDH4BQJ.js +123 -0
  25. package/dist/chunk-HMDH4BQJ.js.map +1 -0
  26. package/dist/chunk-I7EBE7BD.js +98 -0
  27. package/dist/chunk-I7EBE7BD.js.map +1 -0
  28. package/dist/chunk-IHDM7AHY.mjs +233 -0
  29. package/dist/chunk-IHDM7AHY.mjs.map +1 -0
  30. package/dist/chunk-L5QORCUO.js +225 -0
  31. package/dist/chunk-L5QORCUO.js.map +1 -0
  32. package/dist/chunk-LHBJD57K.mjs +143 -0
  33. package/dist/chunk-LHBJD57K.mjs.map +1 -0
  34. package/dist/{chunk-CHI6MBTI.mjs → chunk-OWVQVAOY.mjs} +3 -3
  35. package/dist/{chunk-CHI6MBTI.mjs.map → chunk-OWVQVAOY.mjs.map} +1 -1
  36. package/dist/chunk-OYAJG2BO.js +83 -0
  37. package/dist/chunk-OYAJG2BO.js.map +1 -0
  38. package/dist/chunk-PTU5ZAYX.js +145 -0
  39. package/dist/chunk-PTU5ZAYX.js.map +1 -0
  40. package/dist/chunk-QKO5DA4N.mjs +81 -0
  41. package/dist/chunk-QKO5DA4N.mjs.map +1 -0
  42. package/dist/chunk-T7PIKDUZ.js +130 -0
  43. package/dist/chunk-T7PIKDUZ.js.map +1 -0
  44. package/dist/chunk-TDK5TVJE.mjs +3 -0
  45. package/dist/chunk-TDK5TVJE.mjs.map +1 -0
  46. package/dist/{chunk-A4IB3C23.mjs → chunk-UVP3MUBU.mjs} +58 -7
  47. package/dist/chunk-UVP3MUBU.mjs.map +1 -0
  48. package/dist/chunk-VBNW2B4D.mjs +3 -0
  49. package/dist/chunk-VBNW2B4D.mjs.map +1 -0
  50. package/dist/chunk-W6DO36XD.mjs +96 -0
  51. package/dist/chunk-W6DO36XD.mjs.map +1 -0
  52. package/dist/chunk-XR3J46TZ.js +4 -0
  53. package/dist/chunk-XR3J46TZ.js.map +1 -0
  54. package/dist/chunk-ZOHCADDL.mjs +121 -0
  55. package/dist/chunk-ZOHCADDL.mjs.map +1 -0
  56. package/dist/design-system/data-table.d.ts +8 -0
  57. package/dist/design-system/data-table.d.ts.map +1 -0
  58. package/dist/design-system/facade.js +6 -6
  59. package/dist/design-system/facade.mjs +5 -5
  60. package/dist/design-system/index.d.ts +2 -0
  61. package/dist/design-system/index.d.ts.map +1 -1
  62. package/dist/design-system/split-button.d.ts +25 -0
  63. package/dist/design-system/split-button.d.ts.map +1 -0
  64. package/dist/hooks/useTableFilter.js +6 -116
  65. package/dist/hooks/useTableFilter.js.map +1 -1
  66. package/dist/hooks/useTableFilter.mjs +1 -118
  67. package/dist/hooks/useTableFilter.mjs.map +1 -1
  68. package/dist/hooks/useTableSort.js +6 -91
  69. package/dist/hooks/useTableSort.js.map +1 -1
  70. package/dist/hooks/useTableSort.mjs +1 -93
  71. package/dist/hooks/useTableSort.mjs.map +1 -1
  72. package/dist/hooks/useVirtualList.js +6 -76
  73. package/dist/hooks/useVirtualList.js.map +1 -1
  74. package/dist/hooks/useVirtualList.mjs +1 -78
  75. package/dist/hooks/useVirtualList.mjs.map +1 -1
  76. package/dist/ui/buttons/animated.js +8 -8
  77. package/dist/ui/buttons/animated.mjs +6 -6
  78. package/dist/ui/buttons.js +10 -9
  79. package/dist/ui/buttons.mjs +8 -7
  80. package/dist/ui/checkbox.js +7 -123
  81. package/dist/ui/checkbox.js.map +1 -1
  82. package/dist/ui/checkbox.mjs +2 -126
  83. package/dist/ui/checkbox.mjs.map +1 -1
  84. package/dist/ui/data-table/data-table-base.d.ts +6 -0
  85. package/dist/ui/data-table/data-table-base.d.ts.map +1 -0
  86. package/dist/ui/data-table/data-table.d.ts +6 -0
  87. package/dist/ui/data-table/data-table.d.ts.map +1 -0
  88. package/dist/ui/data-table/index.d.ts +4 -0
  89. package/dist/ui/data-table/index.d.ts.map +1 -0
  90. package/dist/ui/data-table/types.d.ts +92 -0
  91. package/dist/ui/data-table/types.d.ts.map +1 -0
  92. package/dist/ui/data-table/variants.d.ts +8 -0
  93. package/dist/ui/data-table/variants.d.ts.map +1 -0
  94. package/dist/ui/data-table.js +620 -0
  95. package/dist/ui/data-table.js.map +1 -0
  96. package/dist/ui/data-table.mjs +611 -0
  97. package/dist/ui/data-table.mjs.map +1 -0
  98. package/dist/ui/dropdown/dropdown.d.ts +1 -1
  99. package/dist/ui/dropdown/dropdown.d.ts.map +1 -1
  100. package/dist/ui/dropdown/types.d.ts +2 -2
  101. package/dist/ui/dropdown/types.d.ts.map +1 -1
  102. package/dist/ui/dropdown.js +31 -231
  103. package/dist/ui/dropdown.js.map +1 -1
  104. package/dist/ui/dropdown.mjs +4 -229
  105. package/dist/ui/dropdown.mjs.map +1 -1
  106. package/dist/ui/dynamic-stepper.js +18 -18
  107. package/dist/ui/dynamic-stepper.mjs +7 -7
  108. package/dist/ui/inputs.js +7 -138
  109. package/dist/ui/inputs.js.map +1 -1
  110. package/dist/ui/inputs.mjs +2 -141
  111. package/dist/ui/inputs.mjs.map +1 -1
  112. package/dist/ui/pagination.js +20 -221
  113. package/dist/ui/pagination.js.map +1 -1
  114. package/dist/ui/pagination.mjs +8 -223
  115. package/dist/ui/pagination.mjs.map +1 -1
  116. package/dist/ui/split-button/index.d.ts +4 -0
  117. package/dist/ui/split-button/index.d.ts.map +1 -0
  118. package/dist/ui/split-button/split-button-base.d.ts +6 -0
  119. package/dist/ui/split-button/split-button-base.d.ts.map +1 -0
  120. package/dist/ui/split-button/split-button.d.ts +6 -0
  121. package/dist/ui/split-button/split-button.d.ts.map +1 -0
  122. package/dist/ui/split-button/types.d.ts +30 -0
  123. package/dist/ui/split-button/types.d.ts.map +1 -0
  124. package/dist/ui/split-button/variants.d.ts +16 -0
  125. package/dist/ui/split-button/variants.d.ts.map +1 -0
  126. package/dist/ui/split-button.js +287 -0
  127. package/dist/ui/split-button.js.map +1 -0
  128. package/dist/ui/split-button.mjs +278 -0
  129. package/dist/ui/split-button.mjs.map +1 -0
  130. package/dist/ui/table.js +1 -0
  131. package/dist/ui/table.mjs +1 -0
  132. package/package.json +1 -1
  133. package/src/design-system/data-table.ts +20 -0
  134. package/src/design-system/index.ts +2 -0
  135. package/src/design-system/split-button.ts +38 -0
  136. package/src/ui/data-table/data-table-base.tsx +701 -0
  137. package/src/ui/data-table/data-table.test.tsx +389 -0
  138. package/src/ui/data-table/data-table.tsx +11 -0
  139. package/src/ui/data-table/index.ts +24 -0
  140. package/src/ui/data-table/types.ts +121 -0
  141. package/src/ui/data-table/variants.ts +21 -0
  142. package/src/ui/dropdown/dropdown.tsx +7 -3
  143. package/src/ui/dropdown/types.ts +2 -2
  144. package/src/ui/split-button/index.ts +19 -0
  145. package/src/ui/split-button/split-button-base.tsx +232 -0
  146. package/src/ui/split-button/split-button.test.tsx +208 -0
  147. package/src/ui/split-button/split-button.tsx +9 -0
  148. package/src/ui/split-button/types.ts +46 -0
  149. package/src/ui/split-button/variants.ts +46 -0
  150. package/dist/chunk-3W2UUKWP.js +0 -19
  151. package/dist/chunk-A4IB3C23.mjs.map +0 -1
  152. package/dist/chunk-VA6SB6NN.js.map +0 -1
package/README.md CHANGED
@@ -15,7 +15,7 @@ Published artifacts live under `dist/`. Imports use **per-entry subpaths**: `@ze
15
15
 
16
16
  | Surface | Count | Import shape |
17
17
  | ------------------- | ----: | ----------------------------------------------------- |
18
- | Static UI entries | 41 | `@zentauri-ui/zentauri-components/ui/<name>` |
18
+ | Static UI entries | 43 | `@zentauri-ui/zentauri-components/ui/<name>` |
19
19
  | Animated UI entries | 27 | `@zentauri-ui/zentauri-components/ui/<name>/animated` |
20
20
  | Animation entries | 41 | `@zentauri-ui/zentauri-components/animations/<name>` |
21
21
  | Chart entries | 9 | `@zentauri-ui/zentauri-components/charts/<type>` |
@@ -29,16 +29,16 @@ Generated from the component package Vitest JSON report via `pnpm --filter @zent
29
29
 
30
30
  | Metric | Result |
31
31
  | ---------- | ---------------- |
32
- | Test files | 96 passed (96) |
33
- | Tests | 792 passed (792) |
32
+ | Test files | 98 passed (98) |
33
+ | Tests | 819 passed (819) |
34
34
 
35
35
  | Area | Test files | Tests |
36
36
  | ------------------------------ | ---------- | ----- |
37
- | Components and UI utilities | 47 | 490 |
37
+ | Components and UI utilities | 49 | 514 |
38
38
  | Standalone animations | 1 | 45 |
39
39
  | React hooks | 41 | 174 |
40
40
  | Design system facade | 1 | 11 |
41
- | CLI and import rewriting | 4 | 30 |
41
+ | CLI and import rewriting | 4 | 33 |
42
42
  | Accessibility (axe + keyboard) | 2 | 42 |
43
43
 
44
44
  ### Per-suite snapshot
@@ -52,15 +52,17 @@ Generated from the component package Vitest JSON report via `pnpm --filter @zent
52
52
  | `src/ui/peer-isolation.test.ts` | 29 |
53
53
  | `src/accessibility/axe-core.test.tsx` | 24 |
54
54
  | `src/ui/combobox/combobox.test.tsx` | 24 |
55
- | `cli/cli.integration.test.ts` | 20 |
55
+ | `cli/cli.integration.test.ts` | 21 |
56
56
  | `src/accessibility/keyboard-interaction.test.tsx` | 18 |
57
57
  | `src/ui/pagination/pagination.test.tsx` | 15 |
58
58
  | `src/ui/timeline/timeline.test.tsx` | 14 |
59
+ | `src/ui/data-table/data-table.test.tsx` | 13 |
59
60
  | `src/ui/context-menu/context-menu.test.tsx` | 12 |
60
61
  | `src/lib/facade.test.ts` | 11 |
61
62
  | `src/ui/alert/alert.test.tsx` | 11 |
62
63
  | `src/ui/rating/rating.test.tsx` | 11 |
63
64
  | `src/ui/select/select.test.tsx` | 11 |
65
+ | `src/ui/split-button/split-button.test.tsx` | 11 |
64
66
  | `src/ui/table/table.test.tsx` | 11 |
65
67
  | `src/hooks/usePagination/usePagination.test.ts` | 10 |
66
68
  | `src/ui/marquee/marquee.test.tsx` | 10 |
@@ -78,6 +80,7 @@ Generated from the component package Vitest JSON report via `pnpm --filter @zent
78
80
  | `src/ui/progress/progress.test.tsx` | 8 |
79
81
  | `src/ui/scroll-area/scroll-area.test.tsx` | 8 |
80
82
  | `src/ui/spinner/animated/spinner.test.tsx` | 8 |
83
+ | `cli/rewrite-imports.test.ts` | 7 |
81
84
  | `src/hooks/useDynamicStepper/useDynamicStepper.test.ts` | 7 |
82
85
  | `src/hooks/useHotkeys/useHotkeys.test.ts` | 7 |
83
86
  | `src/hooks/useTableSort/useTableSort.test.ts` | 7 |
@@ -101,7 +104,6 @@ Generated from the component package Vitest JSON report via `pnpm --filter @zent
101
104
  | `src/ui/empty-state/empty-state.test.tsx` | 6 |
102
105
  | `src/ui/search/filter-search-suggestions.test.ts` | 6 |
103
106
  | `src/ui/toast/toast.test.tsx` | 6 |
104
- | `cli/rewrite-imports.test.ts` | 5 |
105
107
  | `src/hooks/useCookie/useCookie.test.ts` | 5 |
106
108
  | `src/hooks/useDisclosure/useDisclosure.test.ts` | 5 |
107
109
  | `src/hooks/useEventListener/useEventListener.test.ts` | 5 |
@@ -221,6 +223,7 @@ Import static primitives from `@zentauri-ui/zentauri-components/ui/<subpath>` wh
221
223
  | Command | `command` | `command/animated` |
222
224
  | Context menu | `context-menu` | — |
223
225
  | Copy button | `copy-button` | `copy-button/animated` |
226
+ | DataTable | `data-table` | — |
224
227
  | Divider | `divider` | `divider/animated` |
225
228
  | Drawer | `drawer` | `drawer/animated` |
226
229
  | Dropdown | `dropdown` | — |
@@ -243,6 +246,7 @@ Import static primitives from `@zentauri-ui/zentauri-components/ui/<subpath>` wh
243
246
  | Skeleton | `skeleton` | `skeleton/animated` |
244
247
  | Slider | `slider` | — |
245
248
  | Spinner | — | `spinner/animated` |
249
+ | Split button | `split-button` | — |
246
250
  | Table | `table` | `table/animated` |
247
251
  | Tabs | `tabs` | `tabs/animated` |
248
252
  | Timeline | `timeline` | `timeline/animated` |
@@ -850,7 +854,7 @@ From this package directory in the monorepo:
850
854
 
851
855
  - `pnpm build` (or `npm run build`) — production bundle via `tsup` (Rollup treeshake + `scripts/prepend-use-client.mjs` via `onSuccess` so each UI entry under `dist/ui/`, animation entry under `dist/animations/`, chart entry under `dist/charts/`, and `dist/ui/<name>/animated.*` starts with `"use client"` where needed)
852
856
  - `pnpm dev` — `tsup` watch mode (same `onSuccess` hook after each rebuild)
853
- - `pnpm test` / `pnpm test:watch` — **Vitest** and **Testing Library** unit tests // currently covered 792 test cases in total
857
+ - `pnpm test` / `pnpm test:watch` — **Vitest** and **Testing Library** unit tests // currently covered 819 test cases in total
854
858
  - `pnpm test:a11y` — focused accessibility coverage for package-level UI primitives and compound components: **axe-core** audits for every interactive component plus **keyboard-interaction** tests (focus order, arrow-key nav, Home/End, Escape/Enter) for the compound components
855
859
  - `pnpm check:tokens` — enforce the `--zui-*` token contract across design-system, variant, and local custom-property usage without generating a large checked-in token catalog
856
860
  - **`pnpm run generate:registry`** — runs `scripts/generate-registry.mjs`, which reads **`uiComponentNames`**, **`uiAnimatedComponentNames`**, **`animationEntryNames`**, **`chartEntryNames`**, and **`hooksEntryNames`** from `tsup.config.ts`, applies fixed **`nameAliases`**, scans each component/chart source to build **`peerHints`**, and writes **`cli/registry.json`** (`components` + `animations` + `hooks` + `peerHints`). Run this after adding or renaming UI, animation, chart, or hook entries so the CLI stays in sync (the script prints counts).
@@ -295,6 +295,42 @@ describe("zentauri-ui CLI", () => {
295
295
  }
296
296
  });
297
297
 
298
+ it("should add data-table with vendored sibling UI dependencies", () => {
299
+ const dir = mkdtempSync(join(tmpdir(), "zentauri-cli-data-table-"));
300
+ try {
301
+ runCli(dir, ["init"]);
302
+ const out = runCli(dir, ["add", "data-table"]);
303
+ expect(
304
+ existsSync(join(dir, "src/components/ui/data-table/data-table.tsx")),
305
+ ).toBe(true);
306
+ expect(
307
+ existsSync(join(dir, "src/components/ui/buttons/button.tsx")),
308
+ ).toBe(true);
309
+ expect(
310
+ existsSync(join(dir, "src/components/ui/checkbox/checkbox.tsx")),
311
+ ).toBe(true);
312
+ expect(existsSync(join(dir, "src/components/ui/inputs/input.tsx"))).toBe(
313
+ true,
314
+ );
315
+ expect(
316
+ existsSync(join(dir, "src/components/ui/pagination/pagination.tsx")),
317
+ ).toBe(true);
318
+ expect(existsSync(join(dir, "src/components/ui/table/table.tsx"))).toBe(
319
+ true,
320
+ );
321
+ const base = readFileSync(
322
+ join(dir, "src/components/ui/data-table/data-table-base.tsx"),
323
+ "utf8",
324
+ );
325
+ expect(base).toContain('from "@/components/ui/buttons"');
326
+ expect(base).not.toContain('from "../buttons"');
327
+ expect(out).toContain("Adding data-table…");
328
+ expect(out).toContain("Adding buttons…");
329
+ } finally {
330
+ rmSync(dir, { recursive: true, force: true });
331
+ }
332
+ });
333
+
298
334
  it("should print react-icons peer hint for components that use icons", () => {
299
335
  const dir = mkdtempSync(join(tmpdir(), "zentauri-cli-peer-"));
300
336
  try {
package/cli/index.mjs CHANGED
@@ -548,6 +548,27 @@ function isAnimatedComponent(name, registry) {
548
548
  return (registry.animatedComponents ?? []).includes(name);
549
549
  }
550
550
 
551
+ function expandComponentDependencies(names, registry) {
552
+ const dependencies = registry.componentDependencies ?? {};
553
+ const expanded = [];
554
+ const seen = new Set();
555
+ const queue = [...names];
556
+
557
+ while (queue.length > 0) {
558
+ const name = queue.shift();
559
+ if (seen.has(name)) {
560
+ continue;
561
+ }
562
+ seen.add(name);
563
+ expanded.push(name);
564
+ for (const dependency of dependencies[name] ?? []) {
565
+ queue.push(dependency);
566
+ }
567
+ }
568
+
569
+ return expanded;
570
+ }
571
+
551
572
  function printList(registry) {
552
573
  const ui = Array.from(
553
574
  new Set([
@@ -922,7 +943,13 @@ async function collectHookTransitiveClosure(packageRoot, seedHooks) {
922
943
  * // src/components/ui/buttons/Button.tsx
923
944
  * // with imports pointing at @/lib/utils, @/hooks/useX, etc.
924
945
  */
925
- async function copyUiComponent(componentName, config, configDir, packageRoot) {
946
+ async function copyUiComponent(
947
+ componentName,
948
+ config,
949
+ configDir,
950
+ packageRoot,
951
+ registry,
952
+ ) {
926
953
  const isChartEntry = componentName.startsWith("charts/");
927
954
  const isAnimationEntry = componentName.startsWith("animations/");
928
955
  const animationName = componentName.slice("animations/".length);
@@ -979,6 +1006,7 @@ async function copyUiComponent(componentName, config, configDir, packageRoot) {
979
1006
  utilsAlias: config.aliases.utils,
980
1007
  hooksAlias: config.aliases.hooks,
981
1008
  uiAlias: config.aliases.ui,
1009
+ uiComponents: registry.uiComponents ?? [],
982
1010
  });
983
1011
  const rewrittenCode = designSystemImportTarget
984
1012
  ? rewriteDesignSystemBarrelImports(code, designSystemImportTarget)
@@ -1310,8 +1338,9 @@ async function cmdAdd(names, cwd, options = {}) {
1310
1338
  }
1311
1339
 
1312
1340
  const resolvedNames = payload.map((n) => resolveComponentName(n, registry));
1341
+ const requestedNames = [...resolvedNames];
1313
1342
  if (animated) {
1314
- for (const name of resolvedNames) {
1343
+ for (const name of requestedNames) {
1315
1344
  if (!isAnimatedComponent(name, registry)) {
1316
1345
  console.error(`Component "${name}" has no animated entry.`);
1317
1346
  process.exitCode = 1;
@@ -1319,17 +1348,24 @@ async function cmdAdd(names, cwd, options = {}) {
1319
1348
  }
1320
1349
  }
1321
1350
  }
1351
+ const namesToCopy = expandComponentDependencies(requestedNames, registry);
1322
1352
 
1323
1353
  await ensureUtilsFile(config, configDir, packageRoot);
1324
- await copyDesignSystemFiles(resolvedNames, config, configDir, packageRoot);
1354
+ await copyDesignSystemFiles(namesToCopy, config, configDir, packageRoot);
1325
1355
 
1326
1356
  const allHooks = new Set();
1327
- for (const name of resolvedNames) {
1357
+ for (const name of namesToCopy) {
1328
1358
  console.log(`Adding ${name}…`);
1329
- if (animated) {
1359
+ if (animated && requestedNames.includes(name)) {
1330
1360
  console.log(`Including animated entry for ${name}…`);
1331
1361
  }
1332
- const uh = await copyUiComponent(name, config, configDir, packageRoot);
1362
+ const uh = await copyUiComponent(
1363
+ name,
1364
+ config,
1365
+ configDir,
1366
+ packageRoot,
1367
+ registry,
1368
+ );
1333
1369
  for (const h of uh) {
1334
1370
  allHooks.add(h);
1335
1371
  }
@@ -1345,7 +1381,7 @@ async function cmdAdd(names, cwd, options = {}) {
1345
1381
  }
1346
1382
 
1347
1383
  console.log("Done.");
1348
- printAdoptionHints(resolvedNames, registry, config, configDir);
1384
+ printAdoptionHints(namesToCopy, registry, config, configDir);
1349
1385
  }
1350
1386
 
1351
1387
  async function cmdTheme(hex, options, cwd) {