create-modoock-app 2.0.1 → 2.2.0

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 (35) hide show
  1. package/dist/cli.js +79 -75
  2. package/package.json +1 -1
  3. package/template/.cursor/hooks/gate-ui-pack.mjs +59 -11
  4. package/template/.cursor/rules/honey.mdc +16 -9
  5. package/template/.cursor/rules/ui.mdc +1 -1
  6. package/template/AGENTS.md +29 -19
  7. package/template/README.md +10 -10
  8. package/template/app/{(local) → (main)}/components/page.tsx +7 -49
  9. package/template/app/{(local) → (main)}/page.tsx +1 -1
  10. package/template/app/auth/login/page.tsx +2 -2
  11. package/template/app/layout.tsx +1 -1
  12. package/template/archives/.gitkeep +0 -0
  13. package/template/backup/.gitkeep +0 -0
  14. package/template/components/layout/app-layout.tsx +3 -3
  15. package/template/components/layout/header.tsx +1 -6
  16. package/template/components/layout/index.ts +3 -3
  17. package/template/components/layout/side-nav.tsx +56 -32
  18. package/template/components/shared/index.ts +1 -7
  19. package/template/components/ui/index.ts +0 -0
  20. package/template/data/index.ts +0 -0
  21. package/template/hooks/.gitkeep +0 -0
  22. package/template/lib/.gitkeep +0 -0
  23. package/template/next.config.ts +17 -0
  24. package/template/public/docs/.gitkeep +0 -0
  25. package/template/public/fonts/.gitkeep +0 -0
  26. package/template/public/images/.gitkeep +0 -0
  27. package/template/tsconfig.json +28 -0
  28. package/template/components/shared/detail-header.tsx +0 -39
  29. package/template/components/shared/info-card.tsx +0 -75
  30. package/template/components/shared/summary-card.tsx +0 -31
  31. package/template/components/shared/table-section.tsx +0 -38
  32. package/template/components/shared/timeline-list.tsx +0 -31
  33. /package/template/app/{(local) → (main)}/design-system/page.tsx +0 -0
  34. /package/template/app/{(local) → (main)}/layout.tsx +0 -0
  35. /package/template/public/{login-hero.png → images/login-hero.png} +0 -0
package/dist/cli.js CHANGED
@@ -7,11 +7,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const node_path_1 = __importDefault(require("node:path"));
9
9
  const node_child_process_1 = require("node:child_process");
10
- const COMPONENTS_PACKAGE = "@modoock/components";
11
- const COMPONENTS_VERSION = "1.0.0";
10
+ const MODOOCK_PACKAGES = [
11
+ "@modoock/components",
12
+ "@modoock/knowledge-base",
13
+ ];
12
14
  function copyDirectory(source, destination) {
13
15
  node_fs_1.default.mkdirSync(destination, { recursive: true });
14
- for (const entry of node_fs_1.default.readdirSync(source, { withFileTypes: true })) {
16
+ for (const entry of node_fs_1.default.readdirSync(source, {
17
+ withFileTypes: true,
18
+ })) {
15
19
  const sourcePath = node_path_1.default.join(source, entry.name);
16
20
  const destinationPath = node_path_1.default.join(destination, entry.name);
17
21
  if (entry.isDirectory()) {
@@ -22,38 +26,55 @@ function copyDirectory(source, destination) {
22
26
  }
23
27
  }
24
28
  }
25
- function getComponentsSource(packageRoot) {
26
- const temporaryDirectory = node_path_1.default.join(packageRoot, ".modoock-components-temp");
27
- node_fs_1.default.rmSync(temporaryDirectory, {
28
- recursive: true,
29
- force: true,
30
- });
31
- node_fs_1.default.mkdirSync(temporaryDirectory, {
32
- recursive: true,
33
- });
34
- console.log(`Getting ${COMPONENTS_PACKAGE}@${COMPONENTS_VERSION}...`);
35
- (0, node_child_process_1.execSync)(`npm pack ${COMPONENTS_PACKAGE}@${COMPONENTS_VERSION} --pack-destination "${temporaryDirectory}"`, {
36
- cwd: packageRoot,
37
- stdio: "inherit",
38
- });
39
- const tarball = node_fs_1.default
40
- .readdirSync(temporaryDirectory)
41
- .find((file) => file.endsWith(".tgz"));
42
- if (!tarball) {
43
- throw new Error("Could not find the components package archive.");
29
+ function getLatestVersion(packageName) {
30
+ try {
31
+ const version = (0, node_child_process_1.execSync)(`npm view ${packageName} version`, {
32
+ encoding: "utf8",
33
+ stdio: ["ignore", "pipe", "pipe"],
34
+ }).trim();
35
+ if (!version) {
36
+ throw new Error(`No stable version found for ${packageName}.`);
37
+ }
38
+ return version;
44
39
  }
45
- const extractDirectory = node_path_1.default.join(temporaryDirectory, "package");
46
- node_fs_1.default.mkdirSync(extractDirectory, {
47
- recursive: true,
48
- });
49
- (0, node_child_process_1.execSync)(`tar -xzf "${node_path_1.default.join(temporaryDirectory, tarball)}" -C "${temporaryDirectory}"`, {
50
- stdio: "inherit",
51
- });
52
- const uiSource = node_path_1.default.join(extractDirectory, "components", "ui");
53
- if (!node_fs_1.default.existsSync(uiSource)) {
54
- throw new Error(`Could not find components/ui in ${COMPONENTS_PACKAGE}@${COMPONENTS_VERSION}.`);
40
+ catch {
41
+ throw new Error(`Could not resolve the latest stable version of ${packageName}.`);
42
+ }
43
+ }
44
+ function getLatestModoockDependencies() {
45
+ const dependencies = {};
46
+ for (const packageName of MODOOCK_PACKAGES) {
47
+ console.log(`Resolving latest ${packageName}...`);
48
+ const version = getLatestVersion(packageName);
49
+ dependencies[packageName] = version;
50
+ console.log(` ${packageName}@${version}`);
51
+ }
52
+ return dependencies;
53
+ }
54
+ function updateProjectPackageJson(targetDirectory) {
55
+ const packageJsonPath = node_path_1.default.join(targetDirectory, "package.json");
56
+ const packageJson = JSON.parse(node_fs_1.default.readFileSync(packageJsonPath, "utf8"));
57
+ packageJson.name =
58
+ node_path_1.default.basename(targetDirectory);
59
+ const modoockDependencies = getLatestModoockDependencies();
60
+ packageJson.dependencies = {
61
+ ...(packageJson.dependencies ?? {}),
62
+ ...modoockDependencies,
63
+ };
64
+ node_fs_1.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
65
+ }
66
+ function installDependencies(targetDirectory) {
67
+ console.log("");
68
+ console.log("Installing dependencies...");
69
+ try {
70
+ (0, node_child_process_1.execSync)("npm install", {
71
+ cwd: targetDirectory,
72
+ stdio: "inherit",
73
+ });
74
+ }
75
+ catch {
76
+ throw new Error("Failed to install project dependencies.");
55
77
  }
56
- return uiSource;
57
78
  }
58
79
  function main() {
59
80
  const projectName = process.argv[2];
@@ -69,53 +90,36 @@ function main() {
69
90
  const packageRoot = node_path_1.default.resolve(__dirname, "..");
70
91
  const templateDirectory = node_path_1.default.join(packageRoot, "template");
71
92
  console.log(`Creating Modooock project: ${node_path_1.default.basename(targetDirectory)}`);
72
- // Copy the project foundation.
73
- copyDirectory(templateDirectory, targetDirectory);
74
- // Get the official UI source package.
75
- let uiSource;
76
93
  try {
77
- uiSource = getComponentsSource(packageRoot);
78
- const uiDestination = node_path_1.default.join(targetDirectory, "components", "ui");
79
- // Copy UI components into the generated project.
80
- copyDirectory(uiSource, uiDestination);
94
+ // Copy the project foundation.
95
+ copyDirectory(templateDirectory, targetDirectory);
96
+ // Configure the generated project.
97
+ updateProjectPackageJson(targetDirectory);
98
+ // Install all dependencies.
99
+ installDependencies(targetDirectory);
100
+ console.log("");
101
+ console.log("Done!");
102
+ console.log("");
103
+ console.log(`Project created at: ${targetDirectory}`);
104
+ console.log("");
105
+ console.log("Next steps:");
106
+ console.log(` cd ${projectName}`);
107
+ console.log(" npm run dev");
81
108
  }
82
- finally {
83
- // Remove the temporary downloaded package.
84
- node_fs_1.default.rmSync(node_path_1.default.join(packageRoot, ".modoock-components-temp"), {
109
+ catch (error) {
110
+ console.error("");
111
+ if (error instanceof Error) {
112
+ console.error(error.message);
113
+ }
114
+ else {
115
+ console.error("Failed to create the project.");
116
+ }
117
+ // Do not leave a partially generated project.
118
+ node_fs_1.default.rmSync(targetDirectory, {
85
119
  recursive: true,
86
120
  force: true,
87
121
  });
122
+ process.exit(1);
88
123
  }
89
- // Update the generated project's package.json.
90
- const projectPackageJsonPath = node_path_1.default.join(targetDirectory, "package.json");
91
- const projectPackageJson = JSON.parse(node_fs_1.default.readFileSync(projectPackageJsonPath, "utf8"));
92
- // Set the generated project's name.
93
- projectPackageJson.name =
94
- node_path_1.default.basename(targetDirectory);
95
- // Install the Knowledge Base as an npm dependency.
96
- projectPackageJson.dependencies = {
97
- ...(projectPackageJson.dependencies ?? {}),
98
- "@modoock/knowledge-base": "1.0.0",
99
- };
100
- // Components are copied into components/ui/,
101
- // so they must not remain an npm dependency.
102
- if (projectPackageJson.dependencies["@modoock/components"]) {
103
- delete projectPackageJson.dependencies["@modoock/components"];
104
- }
105
- node_fs_1.default.writeFileSync(projectPackageJsonPath, JSON.stringify(projectPackageJson, null, 2) + "\n");
106
- // Install generated project dependencies.
107
- console.log("Installing dependencies...");
108
- (0, node_child_process_1.execSync)("npm install", {
109
- cwd: targetDirectory,
110
- stdio: "inherit",
111
- });
112
- console.log("");
113
- console.log("Done!");
114
- console.log("");
115
- console.log(`Project created at: ${targetDirectory}`);
116
- console.log("");
117
- console.log("Next steps:");
118
- console.log(` cd ${projectName}`);
119
- console.log(" npm run dev");
120
124
  }
121
125
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-modoock-app",
3
- "version": "2.0.1",
3
+ "version": "2.2.0",
4
4
  "description": "Official Modoock project starter and boilerplate generator.",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {
@@ -4,6 +4,11 @@ import os from "node:os";
4
4
  import path from "node:path";
5
5
 
6
6
  const CATALOG = "knowledge-base/metadata/catalog.yaml";
7
+ const CANONICAL_INDEXES = [
8
+ "components/components/ui/index.ts",
9
+ "create-modoock-app/template/components/layout/index.ts",
10
+ "create-modoock-app/template/components/shared/index.ts",
11
+ ];
7
12
  const allow = { permission: "allow" };
8
13
  const emit = (o) => process.stdout.write(JSON.stringify(o));
9
14
 
@@ -21,11 +26,43 @@ try {
21
26
  )
22
27
  : "";
23
28
 
29
+ const monorepoRoot = (() => {
30
+ if (
31
+ fs.existsSync(path.join(root, "components", "components", "ui")) &&
32
+ fs.existsSync(path.join(root, "create-modoock-app", "template", "components"))
33
+ ) {
34
+ return root;
35
+ }
36
+ const parent = path.join(root, "..");
37
+ if (
38
+ fs.existsSync(path.join(parent, "components", "components", "ui")) &&
39
+ fs.existsSync(path.join(parent, "create-modoock-app", "template", "components"))
40
+ ) {
41
+ return parent;
42
+ }
43
+ return root;
44
+ })();
45
+
24
46
  const rel = (file) => {
25
47
  if (!file) return "";
26
- const r = path.relative(root, path.resolve(root, String(file)));
27
- if (!r || r.startsWith("..") || path.isAbsolute(r)) return "";
28
- return r.split(path.sep).join("/");
48
+ const abs = path.resolve(root, String(file));
49
+ const r = path.relative(root, abs);
50
+ if (r && !r.startsWith("..") && !path.isAbsolute(r)) {
51
+ return r.split(path.sep).join("/");
52
+ }
53
+ // Allow stamping canonical sibling sources when workspace is builder/
54
+ const fromMono = path.relative(monorepoRoot, abs);
55
+ if (
56
+ fromMono &&
57
+ !fromMono.startsWith("..") &&
58
+ !path.isAbsolute(fromMono) &&
59
+ CANONICAL_INDEXES.some(
60
+ (ip) => fromMono.split(path.sep).join("/") === ip,
61
+ )
62
+ ) {
63
+ return fromMono.split(path.sep).join("/");
64
+ }
65
+ return "";
29
66
  };
30
67
 
31
68
  let input = p.tool_input;
@@ -47,6 +84,21 @@ try {
47
84
  }
48
85
  };
49
86
 
87
+ const componentIndexes = () => {
88
+ const localDir = path.join(root, "components");
89
+ if (fs.existsSync(localDir)) {
90
+ const local = [];
91
+ for (const d of fs.readdirSync(localDir, { withFileTypes: true })) {
92
+ const ip = `components/${d.name}/index.ts`;
93
+ if (d.isDirectory() && fs.existsSync(path.join(root, ip))) local.push(ip);
94
+ }
95
+ if (local.length) return local;
96
+ }
97
+ return CANONICAL_INDEXES.filter((ip) =>
98
+ fs.existsSync(path.join(monorepoRoot, ip)),
99
+ );
100
+ };
101
+
50
102
  if (event === "precompact") {
51
103
  if (stampFile) fs.rmSync(stampFile, { force: true });
52
104
  emit({});
@@ -67,7 +119,9 @@ try {
67
119
  fileRel === "app" ||
68
120
  fileRel === "components" ||
69
121
  fileRel.startsWith("app/") ||
70
- fileRel.startsWith("components/");
122
+ fileRel.startsWith("components/") ||
123
+ fileRel.startsWith("builder/app/") ||
124
+ fileRel.startsWith("builder/components/");
71
125
  if (!fileRel || !ui || !cid) {
72
126
  emit(allow);
73
127
  } else {
@@ -85,13 +139,7 @@ try {
85
139
  need.push(cur);
86
140
  }
87
141
  }
88
- const dir = path.join(root, "components");
89
- if (fs.existsSync(dir)) {
90
- for (const d of fs.readdirSync(dir, { withFileTypes: true })) {
91
- const ip = `components/${d.name}/index.ts`;
92
- if (d.isDirectory() && fs.existsSync(path.join(root, ip))) need.push(ip);
93
- }
94
- }
142
+ need.push(...componentIndexes());
95
143
  const missing = [...new Set(need)].filter((x) => !loadStamp().has(x));
96
144
  emit(
97
145
  missing.length
@@ -39,9 +39,11 @@ naming the main edge case (e.g. "raises `KeyError` on a missing key — use `.ge
39
39
  a tradeoff, a correctness argument, or a learner who needs the explanation. Keep
40
40
  Lever 1, ease Lever 2. Brevity that forces a follow-up round-trip costs more than it saved.
41
41
 
42
- **Do not invent to stay terse.** An unspecified part, an unclear idea, or a choice
43
- the prompt did not make is a question (AGENTS.md), not a Honey default. "Implement"
44
- is not license to fill gaps.
42
+ **Do not invent to stay terse.** An unspecified product part is a question
43
+ (AGENTS.md), not a Honey default: a new public component, a new token, an
44
+ interaction pattern the catalog does not name, or an ambiguous requirement.
45
+ "Implement" is not license to fill those gaps. Grouping, hierarchy, spacing,
46
+ order, and empty, loading, and error states with existing primitives are in scope.
45
47
 
46
48
  ## Lever 1 — minimum code that needs to exist
47
49
 
@@ -98,12 +100,16 @@ Never simplify away:
98
100
  - **Visual/UX design when the deliverable is user-facing** — for landing pages,
99
101
  marketing sites, and UI components, polish (layout depth, hero composition,
100
102
  motion, responsive richness, on-brand visual hierarchy) *is* the requirement,
101
- not "speculative." Markup that looks unfinished isn't minimal. The ladder still
102
- trims *structure* (no dead markup, no unused framework), never how it looks.
103
+ not "speculative." On a screen, this outranks minimum markup: grouping,
104
+ spacing, and hierarchy stay. Minimum code still applies to logic. Markup that
105
+ looks unfinished isn't minimal. The ladder still trims *structure* (no dead
106
+ markup, no unused framework), never how it looks.
103
107
  - **Anything the user explicitly asked for.**
104
108
  - **The ask for a Design System primitive** — do not skip it to write less code.
105
- - **Unspecified parts, unclear ideas, choices, preferences** — do not generate
106
- them to finish the ticket. Ask (AGENTS.md).
109
+ - **Unspecified product parts** — a new public component, a new token, an
110
+ interaction pattern the catalog does not name, or an ambiguous requirement.
111
+ Do not generate them to finish the ticket. Ask (AGENTS.md). Screen composition
112
+ with existing primitives is in scope (AGENTS.md).
107
113
 
108
114
  Leave one runnable check (test/assert/invocation) behind for non-trivial logic.
109
115
  "Lazy" = no wasted code, not no proof it works.
@@ -115,8 +121,9 @@ Fewest words that stay clear. Cut the scaffolding:
115
121
  - **Drop wind-up/wind-down** — no "Great question!", no "hope this helps!", no
116
122
  restating the prompt, no announcing what you're about to do.
117
123
  - **Drop hedging** — "use X", not "you might possibly consider perhaps X", when
118
- X is already in the prompt or the repo. A choice the prompt did not make is
119
- not hedging: ask (AGENTS.md) and wait. Do not pick a default to stay terse.
124
+ X is already in the prompt or the repo. A product choice AGENTS.md lists as a
125
+ question is not hedging: ask and wait. Screen composition with existing
126
+ primitives is in scope. Do not pick a product default to stay terse.
120
127
  - **Fragments and lists** over paragraphs when they carry the same info faster.
121
128
  - **Don't narrate readable code** — explain the *why* and the non-obvious, skip the *what*.
122
129
  - **Answer first**; context only if load-bearing.
@@ -13,6 +13,6 @@ Same load as `AGENTS.md`. Cursor injects this reminder; it is not a second ruleb
13
13
  3. Open any other `path` whose `description` matches the need, then that entry's `open:`.
14
14
  4. What exists: `components/*/index.ts`. Open a component `.mdc` only if the catalog lists it.
15
15
 
16
- List page → `data-table-page` (then its `open:`). Workflow / dossier → `workflow-page` (then its `open:`).
16
+ List page → `table-page` (then its `open:`). Workflow / dossier → `workflow-page` (then its `open:`).
17
17
 
18
18
  Do not open `knowledge-base/validation/` until verification.
@@ -9,7 +9,7 @@ This file is the canonical router. Product constraints live in `knowledge-base/`
9
9
  | Layer | When | What |
10
10
  | --- | --- | --- |
11
11
  | Always | every turn | this file, `.cursor/rules/honey.mdc` |
12
- | UI files | `app/**` or `components/**` | every catalog `path` with `load: ui`, then `components/*/index.ts` |
12
+ | UI files | `app/**` or component sources | every catalog `path` with `load: ui`, then the three component `index.ts` files below |
13
13
  | On demand | `description` matches the need | that `path`, then its `open:` |
14
14
  | After coding | verification | `knowledge-base/validation/` for the change type |
15
15
 
@@ -30,35 +30,45 @@ knowledge-base/
30
30
 
31
31
  ## Which file to open
32
32
 
33
- Open `knowledge-base/metadata/catalog.yaml`. UI edit: every `load: ui` `path`. Then any `description` that matches — exact `path` (no `.mdc` guess). After each catalog `path`, also open that entry's `open:`. What exists: `components/*/index.ts` (no `.mdc` required).
33
+ Open `knowledge-base/metadata/catalog.yaml`. UI edit: every `load: ui` `path`. Then any `description` that matches — exact `path` (no `.mdc` guess). After each catalog `path`, also open that entry's `open:`. What exists (canonical indexes, no `.mdc` required):
34
+ - `../components/components/ui/index.ts`
35
+ - `../create-modoock-app/template/components/layout/index.ts`
36
+ - `../create-modoock-app/template/components/shared/index.ts`
34
37
 
35
38
  If no file covers the need, follow **New rules**. Missing `.mdc` for an existing export is not a gap.
36
39
 
37
40
  ## Before coding
38
41
 
42
+ Break the request down first. All six are required. Do not write this breakdown to a file.
43
+
44
+ 1. **Problem** — the request as written. Do not expand it.
45
+ 2. **Numbers** — files, props, and data the request names.
46
+ 3. **Diagram** — the route and components already in the code. Do not draw a new one.
47
+ 4. **Instructions** — catalog paths that match (`load: ui`, then `description`, then `open:`). Apply those files. Nothing else.
48
+ 5. **Already solved** — the closest `knowledge-base/patterns/` entry and one page that already does it.
49
+ 6. **Comment** — only if a part is uncovered: ask per **Mandatory human validation**, then wait.
50
+
39
51
  - Inspect the existing code. Reproduce a failure before fixing it. Change one thing at a time, then verify.
40
- - Open the catalog paths that match the task and apply those files. Nothing else.
41
- - Reuse and page composition: `knowledge-base/design-system/components.mdc`. Public APIs: `components/*/index.ts`.
42
- - Apply **Mandatory human validation**. Do not invent rules or unspecified behavior.
52
+ - Reuse: `knowledge-base/design-system/components.mdc`. Composition: `knowledge-base/rules/architecture/composition.mdc`. APIs: the three `index.ts` above.
53
+ - Apply **Mandatory human validation**.
43
54
 
44
55
  ## Mandatory human validation
45
56
 
46
- Do not invent. Code only what the prompt and existing rules already specify.
57
+ Compose with existing primitives (group, order, space, hierarchy, empty/loading/error). Do not ask for that.
47
58
 
48
- If you would generate a missing part, interpret an unclear idea, pick among options, or assume a preference — stop that part, ask the developer, wait. There is no checklist of cases. Anything the request did not decide is a question, including things the developer did not think to mention.
59
+ Ask and wait only for:
60
+ - a new public component in `../components/components/ui` | `../create-modoock-app/template/components/layout` | `../create-modoock-app/template/components/shared`
61
+ - a new token or global variable
62
+ - an interaction not named in the catalog / `patterns/`
63
+ - an ambiguous product requirement (purpose, data, action)
49
64
 
50
- - Do not fill the gap with a "reasonable default" to finish the implementation.
51
- - An existing pattern, a similar page, or "the usual way" does not authorize inventing the unspecified parts.
52
- - Honey (fewer words, fewer lines) does not override this. Asking is cheaper than generating the wrong thing.
53
- - Covered parts may proceed in the same turn. Uncovered parts stay paused until the developer answers.
54
- - Yes / a chosen option: implement that part. No: leave it out.
55
- - Do not replace a question with a weaker workaround (for example keeping a reusable UI piece in the page file so you do not have to ask).
65
+ Yes → implement. No → leave out. Do not hide a Design System piece as page-local to skip the ask.
56
66
 
57
- When the question is a new reusable component in `components/ui/`, `components/layout/` or `components/shared/`, use this block (then wait):
58
- - **What:** ComponentName
59
- - **Where:** `components/ui` | `components/layout` | `components/shared`
60
- - **Why:** existing `index.ts` exports that do not fit
61
- - **Reuse:** one sentence (which other page would copy this JSX)
67
+ New component block:
68
+ - **What:** Name
69
+ - **Where:** path above
70
+ - **Why:** which `index.ts` exports do not fit
71
+ - **Reuse:** one sentence
62
72
 
63
73
  ## New rules
64
74
 
@@ -75,7 +85,7 @@ After a modification:
75
85
 
76
86
  - Check the change against `knowledge-base/validation/` for the files that match. For a read-only pass on the diff, use `.cursor/agents/code-reviewer.md`.
77
87
  - Check that existing features are not unnecessarily affected.
78
- - If a new component has been created, export it from the folder `index.ts` (`components/ui/`, `components/layout/` or `components/shared/`).
88
+ - If a new component has been created, export it from the folder `index.ts` at the canonical path (`../components/components/ui/`, `../create-modoock-app/template/components/layout/`, or `../create-modoock-app/template/components/shared/`).
79
89
  - Run `npm run lint`, `npm run typecheck` and `npm run sg:scan` and fix any **error** before finishing. `typecheck` proves JSX props exist on the component type. Do not apply catalog auto-fixes (`ast-grep scan -U`) and do not rewrite existing app JSX to silence catalog warnings.
80
90
  - Report any problems or hypotheses that require a decision from the developer.
81
91
 
@@ -204,7 +204,7 @@ Honey is **not** generated (`skills/honey/SKILL.md` / `scripts/build-rules.js` d
204
204
  open: # optional — load graph
205
205
  - knowledge-base/…/other.mdc
206
206
  # patterns only:
207
- # id: data-table-page # alias (ui.mdc)
207
+ # id: table-page # alias (ui.mdc)
208
208
  ```
209
209
 
210
210
  | Field | Effect |
@@ -213,16 +213,16 @@ Honey is **not** generated (`skills/honey/SKILL.md` / `scripts/build-rules.js` d
213
213
  | `description` | If it matches the need → open `path` |
214
214
  | `load: ui` | UI pack. Cursor: the hook **requires** a `Read` of these `path`s (plus `catalog.yaml` and `components/*/index.ts`) before any write under `app/` or `components/`. Other agents follow `AGENTS.md` (hint) |
215
215
  | `open:` | After `path`, also open these files (do not copy the rules into them) |
216
- | `id` | Patterns only — alias (`data-table-page`, `workflow-page`) |
216
+ | `id` | Patterns only — alias (`table-page`, `workflow-page`) |
217
217
 
218
218
  With no `load`: on demand only. `catalog.yaml` injects nothing. Cursor injects via `.cursor/rules/` (hints) and **gates** via `.cursor/hooks` (UI writes).
219
219
 
220
- **Current pack** (`load: ui`): `components.mdc`, `tokens.mdc`, `simple-ui.mdc`, `layout.mdc`, `ui-copy.mdc`.
220
+ **Current pack** (`load: ui`): `components.mdc`, `tokens.mdc`, `layout.mdc`, `ui-copy.mdc`, `composition.mdc`.
221
221
 
222
222
  **Current graph** (`open:`):
223
223
 
224
224
  ```
225
- data-table-page.mdc ──open──► tables.mdc
225
+ table-page.mdc ──open──► tables.mdc
226
226
  workflow-page.mdc ──open──► stepper.mdc
227
227
  action-stack.mdc
228
228
  detail-header.mdc
@@ -264,7 +264,7 @@ Lot A (**error**, except layout chrome as warning):
264
264
  | `no-js-layout-size` | `offsetHeight` / `clientHeight` / `ResizeObserver` |
265
265
  | `no-password-field-outside-auth` | password `name` / `autoComplete` outside `app/auth` |
266
266
  | `no-block-typing` | inline `preventDefault` on `onPaste` / `onKeyDown` |
267
- | `no-two-tables` | two `UserTable` or `<table>` on one page |
267
+ | `no-two-tables` | two `Table` or `<table>` on one page |
268
268
 
269
269
  Copy, scroll, information density, destructive confirmation, “ask don’t invent”: still `validation/*.mdc` + the agent. Do not run `ast-grep scan -U` on existing app JSX to silence a warning.
270
270
 
@@ -293,7 +293,7 @@ After code → lint / typecheck / sg:scan; validation/*.mdc for the theme (st
293
293
 
294
294
  ### 5. Splitting a module (list page)
295
295
 
296
- Pattern `knowledge-base/patterns/pages/data-table-page.mdc`:
296
+ Pattern `knowledge-base/patterns/pages/table-page.mdc`:
297
297
 
298
298
  ```
299
299
  /entity → one list, one entity
@@ -329,11 +329,11 @@ Do not copy the need → file table into the README or the router.
329
329
  2. Inspect the code already there (components and usages).
330
330
  3. Open `catalog.yaml`: every `load: ui` on a UI edit; then matching `description`s; then each `open:`. Cursor will block the UI write until the pack is read.
331
331
  4. Read `components/*/index.ts` — that is the real catalog.
332
- 5. Reuse: existing export → pattern → composition. Anything the request did not decide (missing part, unclear idea, choice, preference) → question, wait. Do not generate the gap. Do not hide a Design System primitive in the page.
332
+ 5. Reuse: existing export → pattern → composition. Group, order, space, and states are in scope. A new public component, a new token, an interaction the catalog does not name, or an ambiguous product requirement → question, wait. Do not hide a Design System primitive in the page.
333
333
 
334
334
  **During:**
335
335
 
336
- - Every decision comes from the request or an existing rule — otherwise question, that part pauses.
336
+ - Screen composition uses existing primitives. A product or system change that `AGENTS.md` lists as a question pauses that part.
337
337
  - Do not invent a rule, do not change `knowledge-base/` without agreement.
338
338
  - Recurring uncovered case → propose a rule and its catalog `path`, wait.
339
339
 
@@ -348,9 +348,9 @@ Do not copy the need → file table into the README or the router.
348
348
 
349
349
  ### UI (`components/ui/`)
350
350
 
351
- `ClickableButton`, `Input`, `Textarea`, `Badge`, `UserTable`, `Select` / `MultiSelect` / `SelectFilter`, `Modal`, `Tabs`, `Icon`, `Loader`, `MetricBar`, `Stepper`, `ActionStack`.
351
+ `ClickableButton`, `Input`, `Textarea`, `Badge`, `Table`, `Select` / `MultiSelect` / `SelectFilter`, `Modal`, `Tabs`, `Icon`, `Loader`, `MetricBar`, `Stepper`, `ActionStack`.
352
352
 
353
- `UserTable` handles sort, pagination, empty message, transpose, and below `md` table → cards (every column stays reachable).
353
+ `Table` handles sort, pagination, empty message, transpose, and below `md` table → cards (every column stays reachable).
354
354
 
355
355
  ### Shared (`components/shared/`)
356
356
 
@@ -1,7 +1,6 @@
1
- "use client";
1
+ "use client";
2
2
 
3
3
  import {
4
- ActionStack,
5
4
  Badge,
6
5
  ClickableButton,
7
6
  Icon,
@@ -17,9 +16,9 @@ import {
17
16
  Stepper,
18
17
  Tabs,
19
18
  Textarea,
20
- UserTable,
21
- } from "@/components/ui";
22
- import type { CardAction, Column } from "@/components/ui";
19
+ Table,
20
+ } from "@modoock/components";
21
+ import type { CardAction, Column } from "@modoock/components";
23
22
  import { useEffect, useState } from "react";
24
23
  import type { ReactNode } from "react";
25
24
 
@@ -375,7 +374,7 @@ function TabsDemo() {
375
374
  }
376
375
 
377
376
  export default function CompsPage() {
378
- // Showcase page: allow page scroll; explicit height for UserTable (md:h-full).
377
+ // Showcase page: allow page scroll; explicit height for Table (md:h-full).
379
378
  return (
380
379
  <main className="flex flex-col">
381
380
  {/* Vitrine des variantes du champ de saisie */}
@@ -817,57 +816,16 @@ export default function CompsPage() {
817
816
  </div>
818
817
  </div>
819
818
 
820
- {/* Vitrine ActionStack */}
821
- <div className="page-container pt-section">
822
- <div className="flex flex-wrap items-baseline justify-between gap-inline">
823
- <h2 className="text-section-title text-foreground">Pile d&apos;actions</h2>
824
- <span className="text-small text-muted-foreground">
825
- Composant <code className="font-mono">ActionStack</code>
826
- </span>
827
- </div>
828
- <div className="mt-component grid gap-component md:grid-cols-2">
829
- <InputDemoCard title="Actions disponibles">
830
- <ActionStack
831
- actions={[
832
- {
833
- key: "validate",
834
- label: "Valider",
835
- variant: "primary",
836
- onClick: () => undefined,
837
- },
838
- {
839
- key: "request",
840
- label: "Demander des infos",
841
- variant: "secondary",
842
- onClick: () => undefined,
843
- },
844
- {
845
- key: "reject",
846
- label: "Rejeter",
847
- variant: "danger",
848
- onClick: () => undefined,
849
- },
850
- ]}
851
- />
852
- </InputDemoCard>
853
- <InputDemoCard title="Aucune action" description="Message vide affiché.">
854
- <ActionStack
855
- actions={[]}
856
- emptyMessage="Aucune action disponible pour ce dossier."
857
- />
858
- </InputDemoCard>
859
- </div>
860
- </div>
861
819
 
862
820
  <div className="page-container flex h-[min(32rem,70dvh)] flex-col pb-section pt-section">
863
821
  <div className="mb-component flex shrink-0 flex-wrap items-baseline justify-between gap-inline">
864
822
  <h2 className="text-section-title text-foreground">Tableau</h2>
865
823
  <span className="text-small text-muted-foreground">
866
- Composant <code className="font-mono">UserTable</code>
824
+ Composant <code className="font-mono">Table</code>
867
825
  </span>
868
826
  </div>
869
827
  <div className="min-h-0 flex-1">
870
- <UserTable
828
+ <Table
871
829
  columns={COLUMNS}
872
830
  data={USERS}
873
831
  rowsPerPage={8}
@@ -1,5 +1,5 @@
1
1
  import Link from "next/link";
2
- import { Icon } from "@/components/ui";
2
+ import { Icon } from "@modoock/components";
3
3
 
4
4
  const DESTINATIONS = [
5
5
  {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import Image from "next/image";
4
4
  import { FormEvent, useState } from "react";
5
- import { ClickableButton, Icon, Input } from "@/components/ui";
5
+ import { ClickableButton, Icon, Input } from "@modoock/components";
6
6
 
7
7
  export default function LoginPage() {
8
8
  const [loading, setLoading] = useState(false);
@@ -19,7 +19,7 @@ export default function LoginPage() {
19
19
  {/* Left — image */}
20
20
  <aside className="relative hidden min-h-full w-1/2 overflow-hidden bg-primary md:block">
21
21
  <Image
22
- src="/login-hero.png"
22
+ src="/images/login-hero.png"
23
23
  alt=""
24
24
  fill
25
25
  priority
@@ -21,7 +21,7 @@ export default function RootLayout({ children }: LayoutProps<"/">) {
21
21
  return (
22
22
  <html lang="fr" className={`${montserrat.className} antialiased`}>
23
23
  <body className="flex h-screen overflow-hidden bg-background">
24
- {children}
24
+ {children}
25
25
  </body>
26
26
  </html>
27
27
  );
File without changes
File without changes
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
3
  import { useState } from "react";
4
- import Header from "./header";
5
- import SideNav from "./side-nav";
4
+ import Header from "./header";
5
+ import SideNav from "./side-nav";
6
6
 
7
7
  export default function AppLayout({ children }: { children: React.ReactNode }) {
8
8
  const [navCollapsed, setNavCollapsed] = useState(true);
@@ -16,7 +16,7 @@ export default function AppLayout({ children }: { children: React.ReactNode }) {
16
16
  Dashboard, list and compact-detail pages (/, equipment, infrastructure, incidents
17
17
  and their [id] detail pages, plus /interventions, /projects, /patients, /research) MUST NOT create page-level vertical
18
18
  scrolling at md+: their `flex min-h-0 flex-1` roots plus internally
19
- scrolling components (UserTable, InfoCard with `scrollable`) keep
19
+ scrolling components (Table, InfoCard with `scrollable`) keep
20
20
  them fitting the viewport. Workflow / dossier pages (/change-request) and other pages
21
21
  (/tables, /design-system) use this scroll when their
22
22
  content is taller than the visible area.
@@ -1,19 +1,14 @@
1
1
  "use client";
2
2
 
3
3
  import { usePathname, useRouter } from "next/navigation";
4
- import { ClickableButton, Icon } from "@/components/ui";
4
+ import { ClickableButton, Icon } from "@modoock/components";
5
5
 
6
6
  /**
7
7
  * Titre (et sous-titre optionnel) affiché dans le header pour chaque route.
8
8
  * Source unique du titre de page : les pages ne redéfinissent pas le leur.
9
9
  */
10
10
  const HEADER_META: Record<string, { title: string; description?: string }> = {
11
- "/": { title: "Beginning" },
12
11
  "/components": { title: "Components" },
13
- "/patients": {
14
- title: "Patients",
15
- description: "Registre des patients.",
16
- },
17
12
  "/design-system": {
18
13
  title: "Design System",
19
14
  description:
@@ -1,3 +1,3 @@
1
- export {default as AppLayout} from "./app-layout";
2
- export {default as Header} from "./header";
3
- export {default as SideNav} from "./side-nav";
1
+ export { default as AppLayout } from "./app-layout";
2
+ export { default as Header } from "./header";
3
+ export { default as SideNav } from "./side-nav";
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { useEffect, useRef, useState, type KeyboardEvent as ReactKeyboardEvent } from "react";
4
4
  import { usePathname, useRouter } from "next/navigation";
5
- import { Icon } from "@/components/ui";
6
- import type { IconName } from "@/components/ui";
5
+ import { Icon } from "@modoock/components";
6
+ import type { IconName } from "@modoock/components";
7
7
 
8
8
  const MD_NAV = "(min-width: 56rem)";
9
9
  const DESKTOP_NAV = "(min-width: 1024px)";
@@ -23,9 +23,9 @@ interface NavItem {
23
23
  }
24
24
 
25
25
  const NAV_ITEMS: NavItem[] = [
26
- { label: "Beginning", href: "/", icon: "Flame" },
26
+ { label: "Accueil", href: "/", icon: "Flame" },
27
27
  { label: "Design System", href: "/design-system", icon: "Palette" },
28
- { label: "Components", href: "/components", icon: "Puzzle" }
28
+ { label: "Components", href: "/components", icon: "Puzzle" },
29
29
  ];
30
30
 
31
31
  interface SideNavProps {
@@ -111,6 +111,19 @@ export default function SideNav({
111
111
  setExpanded((prev) => ({ ...prev, [href]: !prev[href] }));
112
112
  };
113
113
 
114
+ useEffect(() => {
115
+ const parent = NAV_ITEMS.find(
116
+ (item) =>
117
+ !!item.children?.length &&
118
+ (item.href === pathname ||
119
+ item.children.some((child) => child.href === pathname)),
120
+ );
121
+ if (!parent) return;
122
+ setExpanded((prev) =>
123
+ prev[parent.href] ? prev : { ...prev, [parent.href]: true },
124
+ );
125
+ }, [pathname]);
126
+
114
127
  return (
115
128
  <>
116
129
  <div
@@ -152,9 +165,9 @@ export default function SideNav({
152
165
  className="grid size-8 place-items-center rounded-small text-white/80 transition-colors hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0 [&_svg]:text-current"
153
166
  >
154
167
  {collapsed ? (
155
- <Icon name="PanelLeftOpen" aria-hidden="true" />
168
+ <Icon name="PanelLeftOpen" variant="white" aria-hidden="true" />
156
169
  ) : (
157
- <Icon name="PanelLeftClose" aria-hidden="true" />
170
+ <Icon name="PanelLeftClose" variant="white" aria-hidden="true" />
158
171
  )}
159
172
  </button>
160
173
  </div>
@@ -170,37 +183,48 @@ export default function SideNav({
170
183
 
171
184
  return (
172
185
  <div key={item.href} className="flex flex-col gap-1">
173
- <button
174
- type="button"
175
- onClick={() =>
176
- hasChildren && showLabels
177
- ? toggleGroup(item.href)
178
- : handleNavigate(item.href)
179
- }
180
- title={item.label}
181
- aria-label={showLabels ? undefined : item.label}
182
- aria-expanded={hasChildren && showLabels ? isOpen : undefined}
183
- className={`flex items-center gap-3 rounded-small px-3 py-2 text-left text-body-medium transition-colors focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0 [&_svg]:text-current ${
184
- isActive
185
- ? "bg-white/15 text-white"
186
- : "text-white/80 hover:bg-white/10 hover:text-white"
187
- } ${showLabels ? "" : "justify-center"}`}
186
+ <div
187
+ className={`flex items-center rounded-small ${
188
+ isActive ? "bg-white/15 text-white" : "text-white/80"
189
+ }`}
188
190
  >
189
- <Icon name={item.icon} aria-hidden="true" />
190
- {showLabels ? <span className="truncate">{item.label}</span> : null}
191
+ <button
192
+ type="button"
193
+ onClick={() => {
194
+ if (hasChildren) {
195
+ setExpanded((prev) => ({ ...prev, [item.href]: true }));
196
+ }
197
+ handleNavigate(item.href);
198
+ }}
199
+ title={item.label}
200
+ aria-label={showLabels ? undefined : item.label}
201
+ className={`flex min-w-0 flex-1 items-center gap-3 rounded-small px-3 py-2 text-left text-body-medium transition-colors hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0 [&_svg]:text-current ${
202
+ showLabels ? "" : "justify-center"
203
+ }`}
204
+ >
205
+ <Icon name={item.icon} variant="white" aria-hidden="true" />
206
+ {showLabels ? <span className="truncate">{item.label}</span> : null}
207
+ </button>
191
208
  {hasChildren && showLabels ? (
192
- <Icon
193
- name="ChevronDown"
194
- aria-hidden="true"
195
- className={`ml-auto transition-transform ${
196
- isOpen ? "rotate-180" : ""
197
- }`}
198
- />
209
+ <button
210
+ type="button"
211
+ onClick={() => toggleGroup(item.href)}
212
+ aria-expanded={isOpen}
213
+ aria-label={isOpen ? `Replier ${item.label}` : `Déplier ${item.label}`}
214
+ className="mr-1 grid size-8 shrink-0 place-items-center rounded-small transition-colors hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-white"
215
+ >
216
+ <Icon
217
+ name="ChevronDown"
218
+ variant="white"
219
+ aria-hidden="true"
220
+ className={`transition-transform ${isOpen ? "rotate-180" : ""}`}
221
+ />
222
+ </button>
199
223
  ) : null}
200
- </button>
224
+ </div>
201
225
 
202
226
  {hasChildren && showLabels && isOpen ? (
203
- <div className="ml-9 flex flex-col gap-1 border-l border-white/20 pl-2">
227
+ <div className="ml-5 flex flex-col gap-1 border-l border-white/20 pl-2">
204
228
  {item.children!.map((child) => {
205
229
  const isChildActive = pathname === child.href;
206
230
  return (
@@ -1,8 +1,2 @@
1
- export { default as SummaryCard } from "./summary-card";
2
- export { default as InfoCard, InfoList } from "./info-card";
3
- export type { InfoListLayout } from "./info-card";
4
- export { default as DetailHeader } from "./detail-header";
5
- export { default as TableSection } from "./table-section";
6
- export { default as TimelineList } from "./timeline-list";
7
- export type { TimelineEntry } from "./timeline-list";
1
+
8
2
 
File without changes
File without changes
File without changes
File without changes
@@ -1,4 +1,5 @@
1
1
  import type { NextConfig } from "next";
2
+ import path from "node:path";
2
3
  import { networkInterfaces } from "node:os";
3
4
 
4
5
  function lanHostnames(): string[] {
@@ -14,8 +15,24 @@ function lanHostnames(): string[] {
14
15
  return [...hosts];
15
16
  }
16
17
 
18
+ const monorepoRoot = path.join(__dirname, "..", "..");
19
+
17
20
  const nextConfig: NextConfig = {
18
21
  allowedDevOrigins: lanHostnames(),
22
+ experimental: {
23
+ externalDir: true,
24
+ },
25
+ turbopack: {
26
+ root: monorepoRoot,
27
+ resolveAlias: {
28
+ "@/components/ui": "../../components/components/ui",
29
+ react: "./node_modules/react",
30
+ "react/jsx-runtime": "./node_modules/react/jsx-runtime.js",
31
+ "react/jsx-dev-runtime": "./node_modules/react/jsx-dev-runtime.js",
32
+ "react-dom": "./node_modules/react-dom",
33
+ "lucide-react": "./node_modules/lucide-react",
34
+ },
35
+ },
19
36
  };
20
37
 
21
38
  export default nextConfig;
File without changes
File without changes
File without changes
@@ -22,7 +22,35 @@
22
22
  "name": "next"
23
23
  }
24
24
  ],
25
+ "baseUrl": ".",
25
26
  "paths": {
27
+ "@/components/ui": [
28
+ "../../components/components/ui"
29
+ ],
30
+ "@/components/ui/*": [
31
+ "../../components/components/ui/*"
32
+ ],
33
+ "react": [
34
+ "./node_modules/@types/react"
35
+ ],
36
+ "react-dom": [
37
+ "./node_modules/@types/react-dom"
38
+ ],
39
+ "react/jsx-runtime": [
40
+ "./node_modules/@types/react/jsx-runtime.d.ts"
41
+ ],
42
+ "react/jsx-dev-runtime": [
43
+ "./node_modules/@types/react/jsx-dev-runtime.d.ts"
44
+ ],
45
+ "lucide-react": [
46
+ "./node_modules/lucide-react"
47
+ ],
48
+ "next": [
49
+ "./node_modules/next"
50
+ ],
51
+ "next/*": [
52
+ "./node_modules/next/*"
53
+ ],
26
54
  "@/*": [
27
55
  "./*"
28
56
  ]
@@ -1,39 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import { Icon } from "@/components/ui";
3
- import type { IconName } from "@/components/ui";
4
-
5
- /**
6
- * En-tête d'identité d'une fiche : icône, titre, description, badges ou actions.
7
- */
8
- export default function DetailHeader({
9
- icon,
10
- title,
11
- description,
12
- children,
13
- }: {
14
- icon: IconName;
15
- title: string;
16
- description?: string;
17
- children?: ReactNode;
18
- }) {
19
- return (
20
- <header className="flex flex-wrap items-start justify-between gap-inline">
21
- <div className="flex min-w-0 items-start gap-inline">
22
- <div className="flex size-14 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary">
23
- <Icon name={icon} size="large" aria-hidden="true" />
24
- </div>
25
- <div className="min-w-0">
26
- <h2 className="text-section-title text-foreground">{title}</h2>
27
- {description ? (
28
- <p className="mt-micro text-small text-muted-foreground">
29
- {description}
30
- </p>
31
- ) : null}
32
- </div>
33
- </div>
34
- {children ? (
35
- <div className="flex flex-wrap items-center gap-inline">{children}</div>
36
- ) : null}
37
- </header>
38
- );
39
- }
@@ -1,75 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import { Icon } from "@/components/ui";
3
- import type { IconName } from "@/components/ui";
4
-
5
- /**
6
- * Carte d'information des fiches détail : en-tête icône + titre, corps libre.
7
- * Réutilisée par les fiches équipement, service et incident.
8
- */
9
- export default function InfoCard({
10
- icon,
11
- title,
12
- children,
13
- scrollable = false,
14
- }: {
15
- icon: IconName;
16
- title: string;
17
- children: ReactNode;
18
- /** At md+, the body scrolls inside the card. Below md, the page scrolls instead. */
19
- scrollable?: boolean;
20
- }) {
21
- return (
22
- <section className={scrollable ? "flex min-h-0 flex-col rounded-large border border-border bg-surface p-component" : "rounded-large border border-border bg-surface p-component"}>
23
- <header className={scrollable ? "shrink-0 flex items-center gap-inline" : "flex items-center gap-inline"}>
24
- <Icon name={icon} variant="muted" aria-hidden="true" />
25
- <h3 className="text-component-title text-foreground">{title}</h3>
26
- </header>
27
- <div
28
- className={scrollable ? "mt-component min-h-0 flex-1 md:overflow-y-auto" : "mt-component"}
29
- >
30
- {children}
31
- </div>
32
- </section>
33
- );
34
- }
35
-
36
- export type InfoListLayout = "inline" | "stacked";
37
-
38
- /**
39
- * Liste label/valeur compacte affichée dans les cartes d'information.
40
- * `inline` : valeur à droite (fiches courtes). `stacked` : label au-dessus (textes longs).
41
- */
42
- export function InfoList({
43
- rows,
44
- layout = "inline",
45
- }: {
46
- rows: { label: string; value: ReactNode }[];
47
- layout?: InfoListLayout;
48
- }) {
49
- const stacked = layout === "stacked";
50
- return (
51
- <dl>
52
- {rows.map((row) => (
53
- <div
54
- key={row.label}
55
- className={
56
- stacked
57
- ? "border-b border-border py-inline last:border-b-0"
58
- : "flex items-start justify-between gap-inline border-b border-border py-inline last:border-b-0"
59
- }
60
- >
61
- <dt className="text-label text-muted-foreground">{row.label}</dt>
62
- <dd
63
- className={
64
- stacked
65
- ? "mt-micro text-body-medium text-foreground"
66
- : "max-w-[60%] text-right text-body-medium text-foreground break-all"
67
- }
68
- >
69
- {row.value}
70
- </dd>
71
- </div>
72
- ))}
73
- </dl>
74
- );
75
- }
@@ -1,31 +0,0 @@
1
- import { Icon } from "@/components/ui";
2
- import type { IconName, IconVariant } from "@/components/ui";
3
-
4
- /**
5
- * Carte de synthèse compacte des pages dashboard : une icône, un chiffre clé
6
- * et son libellé. Réutilisée par les pages équipements, infrastructure et
7
- * incidents.
8
- */
9
- export default function SummaryCard({
10
- icon,
11
- iconVariant,
12
- label,
13
- count,
14
- }: {
15
- icon: IconName;
16
- iconVariant: IconVariant;
17
- label: string;
18
- count: number | string;
19
- }) {
20
- return (
21
- <div className="rounded-large border border-border bg-surface p-component">
22
- <div className="flex items-center gap-inline">
23
- <Icon name={icon} variant={iconVariant} size="large" aria-hidden="true" />
24
- <p className="text-component-title leading-none text-foreground">
25
- {count}
26
- </p>
27
- </div>
28
- <p className="mt-micro text-small text-muted-foreground">{label}</p>
29
- </div>
30
- );
31
- }
@@ -1,38 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import { Badge, Icon } from "@/components/ui";
3
- import type { IconName } from "@/components/ui";
4
-
5
- /**
6
- * Section de page avec en-tête (icône + titre + compteur) et contenu libre.
7
- * Réutilisée par les onglets équipement et autres sections de tableau.
8
- */
9
- export default function TableSection({
10
- icon,
11
- title,
12
- count,
13
- children,
14
- className,
15
- }: {
16
- icon: IconName;
17
- title: string;
18
- count?: number;
19
- children: ReactNode;
20
- className?: string;
21
- }) {
22
- return (
23
- <section className={`flex min-h-0 flex-1 flex-col ${className ?? ""}`}>
24
- <div className="flex items-center justify-between gap-inline">
25
- <div className="flex items-center gap-inline">
26
- <Icon name={icon} variant="muted" aria-hidden="true" />
27
- <h3 className="text-component-title text-foreground">{title}</h3>
28
- </div>
29
- {typeof count === "number" ? (
30
- <Badge variant="secondary">{count}</Badge>
31
- ) : null}
32
- </div>
33
- <div className="mt-component flex min-h-0 flex-1 flex-col">
34
- {children}
35
- </div>
36
- </section>
37
- );
38
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * Entrée de timeline avec heure formatée et texte descriptif.
3
- */
4
- export interface TimelineEntry {
5
- time: string;
6
- text: string;
7
- }
8
-
9
- /**
10
- * Liste d'historique avec heure et texte descriptif.
11
- * Réutilisée par les fiches incident et autres vues temporelles.
12
- */
13
- export default function TimelineList({ entries }: { entries: TimelineEntry[] }) {
14
- return (
15
- <ul className="space-y-component">
16
- {entries.map((entry, i) => (
17
- <li
18
- key={entry.time + "-" + entry.text + "-" + i}
19
- className="flex items-start gap-inline border-b border-border py-inline last:border-b-0"
20
- >
21
- <span className="w-20 shrink-0 font-mono text-body-medium text-muted-foreground">
22
- {entry.time}
23
- </span>
24
- <span className="min-w-0 flex-1 text-body-medium text-foreground">
25
- {entry.text}
26
- </span>
27
- </li>
28
- ))}
29
- </ul>
30
- );
31
- }
File without changes