create-modoock-app 1.0.1 → 2.0.1
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 +68 -237
- package/dist/cli.js +112 -43
- package/package.json +22 -22
- package/template/.cursor/hooks/gate-ui-pack.mjs +108 -0
- package/template/.cursor/hooks.json +18 -0
- package/template/.cursor/rules/honey.mdc +11 -3
- package/template/AGENTS.md +13 -12
- package/template/README.md +225 -175
- package/template/app/(local)/components/page.tsx +3 -3
- package/template/app/(local)/design-system/page.tsx +2 -2
- package/template/components/layout/app-layout.tsx +17 -6
- package/template/components/layout/header.tsx +19 -1
- package/template/components/layout/side-nav.tsx +103 -30
- package/template/postcss.config.mjs +7 -7
- package/template/public/identity/full_logo_black.svg +26 -26
- package/template/public/identity/full_logo_color.svg +37 -37
- package/template/public/identity/full_logo_white.svg +33 -33
- package/template/public/identity/logo_icon_black.svg +5 -5
- package/template/public/identity/logo_icon_color.svg +12 -12
- package/template/public/identity/logo_icon_white.svg +12 -12
- package/template/components/ui/action-stack.tsx +0 -42
- package/template/components/ui/badge.tsx +0 -43
- package/template/components/ui/button.tsx +0 -104
- package/template/components/ui/icon.tsx +0 -78
- package/template/components/ui/index.ts +0 -28
- package/template/components/ui/input.tsx +0 -376
- package/template/components/ui/loader.tsx +0 -78
- package/template/components/ui/metric-bar.tsx +0 -49
- package/template/components/ui/modal.tsx +0 -177
- package/template/components/ui/select.tsx +0 -458
- package/template/components/ui/stepper.tsx +0 -96
- package/template/components/ui/tab.tsx +0 -85
- package/template/components/ui/user-table.tsx +0 -806
- package/template/knowledge-base/design-system/components/action-stack.mdc +0 -17
- package/template/knowledge-base/design-system/components/badges.mdc +0 -16
- package/template/knowledge-base/design-system/components/buttons.mdc +0 -21
- package/template/knowledge-base/design-system/components/detail-header.mdc +0 -17
- package/template/knowledge-base/design-system/components/dropdowns.mdc +0 -12
- package/template/knowledge-base/design-system/components/info-list.mdc +0 -17
- package/template/knowledge-base/design-system/components/inputs.mdc +0 -23
- package/template/knowledge-base/design-system/components/menu.mdc +0 -20
- package/template/knowledge-base/design-system/components/modals.mdc +0 -24
- package/template/knowledge-base/design-system/components/selects.mdc +0 -39
- package/template/knowledge-base/design-system/components/stepper.mdc +0 -18
- package/template/knowledge-base/design-system/components/tables.mdc +0 -59
- package/template/knowledge-base/design-system/components/tabs.mdc +0 -17
- package/template/knowledge-base/design-system/components.mdc +0 -91
- package/template/knowledge-base/design-system/tokens.mdc +0 -24
- package/template/knowledge-base/examples/bad/README.md +0 -8
- package/template/knowledge-base/examples/good/README.md +0 -13
- package/template/knowledge-base/metadata/catalog.yaml +0 -245
- package/template/knowledge-base/patterns/components/reuse-existing.mdc +0 -26
- package/template/knowledge-base/patterns/data-fetching/local-data.mdc +0 -20
- package/template/knowledge-base/patterns/layouts/app-shell.mdc +0 -20
- package/template/knowledge-base/patterns/pages/data-table-page.mdc +0 -31
- package/template/knowledge-base/patterns/pages/workflow-page.mdc +0 -27
- package/template/knowledge-base/rules/accessibility/responsive.mdc +0 -31
- package/template/knowledge-base/rules/architecture/layout.mdc +0 -52
- package/template/knowledge-base/rules/architecture/single-screen.mdc +0 -62
- package/template/knowledge-base/rules/code-quality/jsx.mdc +0 -19
- package/template/knowledge-base/rules/global/naming.mdc +0 -12
- package/template/knowledge-base/rules/global/technology.mdc +0 -19
- package/template/knowledge-base/rules/global/ui-copy.mdc +0 -20
- package/template/knowledge-base/rules/performance/client.mdc +0 -20
- package/template/knowledge-base/rules/ui/information-density.mdc +0 -36
- package/template/knowledge-base/rules/ui/interaction.mdc +0 -47
- package/template/knowledge-base/rules/ui/simple-ui.mdc +0 -58
- package/template/knowledge-base/validation/accessibility.mdc +0 -13
- package/template/knowledge-base/validation/architecture.mdc +0 -10
- package/template/knowledge-base/validation/ast-grep/do-what-brooooooklyn-said.yml +0 -15
- package/template/knowledge-base/validation/ast-grep/no-nested-links.yml +0 -12
- package/template/knowledge-base/validation/ast-grep/rewrite-svg-attribute.yml +0 -19
- package/template/knowledge-base/validation/code-quality.mdc +0 -18
- package/template/knowledge-base/validation/performance.mdc +0 -11
- package/template/knowledge-base/validation/ui.mdc +0 -26
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Action stack — contextual buttons for the current state of a record
|
|
3
|
-
globs: app/**/*.tsx,components/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [actions, buttons, workflow, component, ui, design-system]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Action stack
|
|
10
|
-
|
|
11
|
-
- Reuse `ActionStack` (`components/ui/index.ts`) for a vertical list of record actions.
|
|
12
|
-
- Each item is a `ClickableButton` (variant + label). Do not use raw `<button>`.
|
|
13
|
-
- When no action is available, pass `emptyMessage` (French, cause + next step).
|
|
14
|
-
- Destructive or irreversible actions still require a `Modal` confirmation in the page.
|
|
15
|
-
|
|
16
|
-
## Reference implementation
|
|
17
|
-
See `components/ui/action-stack.tsx`.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Badge component and usage
|
|
3
|
-
globs: components/**/*.tsx, app/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [badge, status, component, ui, design-system]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Badges
|
|
10
|
-
|
|
11
|
-
Badges should have a compact, pill-shaped appearance with clear visual distinction
|
|
12
|
-
between different statuses or categories. They should remain lightweight and
|
|
13
|
-
secondary in the visual hierarchy
|
|
14
|
-
|
|
15
|
-
## Reference implementation
|
|
16
|
-
See `components/ui/badge.tsx`.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Button component and usage
|
|
3
|
-
globs: components/**/*.tsx, app/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [button, buttons, component, ui, design-system]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Buttons
|
|
10
|
-
|
|
11
|
-
## Rules
|
|
12
|
-
|
|
13
|
-
- Reuse the existing `ClickableButton` component (exported from `components/ui/index.ts`) whenever a button is needed.
|
|
14
|
-
- Respect the style of the reference component.
|
|
15
|
-
- Buttons must follow the Design System for all visual properties, including
|
|
16
|
-
colors, typography, spacing, radius, sizing, states, and iconography.
|
|
17
|
-
- Use a clean, compact, content-driven appearance with clear visual hierarchy
|
|
18
|
-
between primary, secondary, and low-emphasis actions.
|
|
19
|
-
|
|
20
|
-
## Reference implementation
|
|
21
|
-
See `components/ui/button.tsx`.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Detail header — identity strip of a fiche (icon, title, status)
|
|
3
|
-
globs: app/**/*.tsx,components/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [header, fiche, detail, component, shared, design-system]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Detail header
|
|
10
|
-
|
|
11
|
-
- Reuse `DetailHeader` (`components/shared/index.ts`) for the identity of a fiche.
|
|
12
|
-
- Do not copy the icon-circle + title + badge markup into a page file.
|
|
13
|
-
- `children` holds status badges or compact actions, not a second title.
|
|
14
|
-
- Status is never color alone: a `Badge` with a text label.
|
|
15
|
-
|
|
16
|
-
## Reference implementation
|
|
17
|
-
See `components/shared/detail-header.tsx`.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Dropdown behavior — only one dropdown open at a time, re-toggling closes, openable and closable again
|
|
3
|
-
globs: app/**/*.tsx,components/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: medium
|
|
6
|
-
tags: [dropdown, select, menu, filter]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Dropdowns
|
|
10
|
-
|
|
11
|
-
- Only one dropdown can be open at a time. When a dropdown opens, any other currently open dropdown must automatically close.
|
|
12
|
-
- The menu must be openable and closable again.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: InfoList — label/value rows inside InfoCard
|
|
3
|
-
globs: app/**/*.tsx,components/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: medium
|
|
6
|
-
tags: [infolist, card, fiche, component, shared]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Info list
|
|
10
|
-
|
|
11
|
-
- Reuse `InfoList` inside `InfoCard` (`components/shared/index.ts`).
|
|
12
|
-
- `layout="inline"` (default): short values, right-aligned. Use on compact fiches.
|
|
13
|
-
- `layout="stacked"`: label above value. Use for long text or a `Badge` as the value.
|
|
14
|
-
- `value` may be a string or a node (for example a `Badge`). Do not duplicate `DetailField` in the page.
|
|
15
|
-
|
|
16
|
-
## Reference implementation
|
|
17
|
-
See `components/shared/info-card.tsx`.
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Input component and usage
|
|
3
|
-
globs: components/**/*.tsx, app/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [input, form, field, search, ui, component]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Inputs
|
|
10
|
-
|
|
11
|
-
## Rules
|
|
12
|
-
|
|
13
|
-
- The field must be responsive.
|
|
14
|
-
|
|
15
|
-
Use a compact search field with:
|
|
16
|
-
- a leading search icon inside the field;
|
|
17
|
-
- a subtle bordered input surface;
|
|
18
|
-
- muted placeholder text;
|
|
19
|
-
- clear focus feedback;
|
|
20
|
-
- full available width when used as a form/search control.
|
|
21
|
-
|
|
22
|
-
## Reference implementation
|
|
23
|
-
See `components/ui/input.tsx`.
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Menu component behavior and responsive states
|
|
3
|
-
globs: components/**/*.tsx, app/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [menu, navigation, sidebar, component, ui]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Menu
|
|
10
|
-
|
|
11
|
-
## Rules
|
|
12
|
-
|
|
13
|
-
- The menu must have two states: open and closed.
|
|
14
|
-
- Open menu: display the icons and labels.
|
|
15
|
-
- Closed menu: collapse the menu into a vertical bar showing only the icons of all options.
|
|
16
|
-
- Use a vertical sidebar with a blue background matching the primary color of the design system.
|
|
17
|
-
- Use white text and icons.
|
|
18
|
-
- The active item must be visually distinguished by a slightly lighter background.
|
|
19
|
-
- Use slightly rounded corners for the navigation items.
|
|
20
|
-
- See `components/layout/side-nav.tsx`.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Modal component and usage
|
|
3
|
-
globs: components/**/*.tsx, app/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [modal, dialog, component, ui, design-system]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Modals
|
|
10
|
-
|
|
11
|
-
## Rules
|
|
12
|
-
|
|
13
|
-
- The modal must appear above the page content with a dark overlay.
|
|
14
|
-
- The overlay must cover the whole window.
|
|
15
|
-
- The content behind the modal must remain visually dimmed.
|
|
16
|
-
- The modal must have a clearly identifiable close button.
|
|
17
|
-
- The close button must be placed at the top right.
|
|
18
|
-
- The primary actions must be placed at the bottom of the modal, aligned to the right.
|
|
19
|
-
- The primary action uses the primary color of the design system (solid blue, white text).
|
|
20
|
-
- The secondary action remains a simple text link, without background or border.
|
|
21
|
-
- The buttons must reuse the existing `ClickableButton` component (exported from `components/ui/index.ts`).
|
|
22
|
-
|
|
23
|
-
## Reference implementation
|
|
24
|
-
See `components/ui/modal.tsx`.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Select with search component and usage
|
|
3
|
-
globs: components/**/*.tsx, app/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [select, dropdown, search, form, field, ui, component]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Select with Search
|
|
10
|
-
|
|
11
|
-
### 1. Single selection
|
|
12
|
-
|
|
13
|
-
The single-select component must follow a simple, clear and compact design:
|
|
14
|
-
|
|
15
|
-
- The field displays the currently selected value with a chevron indicating that it can be opened.
|
|
16
|
-
- On click, a dropdown menu opens directly below the field.
|
|
17
|
-
- The menu has a distinct, clean and readable surface.
|
|
18
|
-
- Each option is displayed on a separate line with consistent alignment.
|
|
19
|
-
- The selected option is identifiable by a check icon (✓) placed on the left.
|
|
20
|
-
|
|
21
|
-
### 2. Multiple selection
|
|
22
|
-
|
|
23
|
-
- The multiple selection uses the same visual language as the single selection.
|
|
24
|
-
- Each option has a square selection checkbox on the left.
|
|
25
|
-
- The box is empty when an option is not selected and checked when it is.
|
|
26
|
-
- Several options can be selected simultaneously.
|
|
27
|
-
|
|
28
|
-
### 3. Selection with search
|
|
29
|
-
|
|
30
|
-
For lists containing many options, the menu must include a search bar.
|
|
31
|
-
|
|
32
|
-
- The search bar is integrated at the top of the menu, above the list of options.
|
|
33
|
-
- The input dynamically filters the displayed options.
|
|
34
|
-
- Only the options matching the search are displayed.
|
|
35
|
-
- If no result matches, show an explicit empty state.
|
|
36
|
-
- The search must work with both single selection and multiple selection.
|
|
37
|
-
|
|
38
|
-
## Reference implementation
|
|
39
|
-
See `components/ui/select.tsx`.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Stepper — visual lifecycle of a request or case
|
|
3
|
-
globs: app/**/*.tsx,components/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [stepper, workflow, lifecycle, component, ui, design-system]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Stepper
|
|
10
|
-
|
|
11
|
-
- Reuse `Stepper` (`components/ui/index.ts`) for a linear lifecycle.
|
|
12
|
-
- Do not hand-roll step circles, connectors or `aria-current` in a page file.
|
|
13
|
-
- The current step must be identifiable by more than color (label + `aria-current`).
|
|
14
|
-
- Completed, current, upcoming and rejected states must stay distinguishable.
|
|
15
|
-
- Drive it with `steps`, `currentIndex`, `complete` and `rejected` — no domain types inside the component.
|
|
16
|
-
|
|
17
|
-
## Reference implementation
|
|
18
|
-
See `components/ui/stepper.tsx`.
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Table rules — one table per page, fixed header, pagination, sorting and filters; table→cards under md (mechanics in user-table.tsx)
|
|
3
|
-
globs: app/**/*.tsx,components/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [table, dashboard, data, pagination, filter, list]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Tables
|
|
10
|
-
|
|
11
|
-
- A page displaying a table must not scroll: the table fills the available
|
|
12
|
-
space on its own, and long content is handled by pagination, not by page
|
|
13
|
-
scroll.
|
|
14
|
-
|
|
15
|
-
- Only one table per interface: a single page or visible tab may display at
|
|
16
|
-
most one table at a time.
|
|
17
|
-
|
|
18
|
-
- An empty table must occupy all the available space.
|
|
19
|
-
|
|
20
|
-
- Tables use a fixed table header.
|
|
21
|
-
|
|
22
|
-
- The table header can contain the filtering controls.
|
|
23
|
-
|
|
24
|
-
- Sorting must be indicated visually when a column is sortable.
|
|
25
|
-
|
|
26
|
-
- The table must use pagination when the number of rows is large.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- The table content can scroll horizontally or vertically inside its own
|
|
30
|
-
dedicated area when necessary — this is the only scroll allowed around a
|
|
31
|
-
table: a page with a table never scrolls.
|
|
32
|
-
|
|
33
|
-
## Responsive (table → cards)
|
|
34
|
-
|
|
35
|
-
- Under `md` (viewport width < 896px), `UserTable` automatically renders each row as a
|
|
36
|
-
stacked card. Both views use the exact same columns, data, sorting and pagination.
|
|
37
|
-
- A card = one row: it MUST keep ALL the row's column values reachable inside the
|
|
38
|
-
card (directly visible, or revealed by its in-place toggle): no dropped column,
|
|
39
|
-
no horizontal scroll.
|
|
40
|
-
- The card mirrors the table look: its mechanics — card anatomy (which column
|
|
41
|
-
becomes the title, the footer actions, the label/value rows), the
|
|
42
|
-
`cardVisiblePairs` in-place "Voir tout" toggle and the opt-in `cardActions`
|
|
43
|
-
enriched mode (per-card 3-dot menus, "Actions" toolbars above and below the
|
|
44
|
-
card list) — are documented in `components/ui/user-table.tsx`. Do not
|
|
45
|
-
duplicate them here.
|
|
46
|
-
- Card action menus follow `knowledge-base/design-system/components/dropdowns.mdc`: only one
|
|
47
|
-
menu open at a time across the table, re-toggling closes, outside tap closes.
|
|
48
|
-
|
|
49
|
-
- Tables should have a clean, structured, information-dense appearance with clear
|
|
50
|
-
column hierarchy, readable rows, and subtle separation between content.
|
|
51
|
-
|
|
52
|
-
- When applicable, tables should support:
|
|
53
|
-
- Column sorting.
|
|
54
|
-
- Pagination.
|
|
55
|
-
- Configurable number of rows per page.
|
|
56
|
-
- Search and filtering.
|
|
57
|
-
|
|
58
|
-
## Reference implementation
|
|
59
|
-
See `components/ui/user-table.tsx`.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Tabbed pages navigation component and usage
|
|
3
|
-
globs: components/**/*.tsx, app/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [tabs, navigation, pages, component, ui, design-system]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Tabbed Pages
|
|
10
|
-
|
|
11
|
-
- The tabs are displayed on a single line.
|
|
12
|
-
- Only one tab can be active at a time.
|
|
13
|
-
- The active tab must be clearly distinguished visually from inactive tabs.
|
|
14
|
-
- Clicking a tab activates it immediately and displays its associated content.
|
|
15
|
-
|
|
16
|
-
## Reference implementation
|
|
17
|
-
See `components/ui/tab.tsx`.
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: General component rules
|
|
3
|
-
globs: app/**/*.tsx,components/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [component, reusable, props]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Components
|
|
10
|
-
|
|
11
|
-
## Discovery
|
|
12
|
-
|
|
13
|
-
- What exists: the exports in `components/ui/index.ts`, `components/layout/index.ts` and `components/shared/index.ts`. That is the catalog. An export does not need a `.mdc` (`Icon`, `Loader`, `MetricBar`, `SummaryCard`, `TableSection`, `TimelineList`, `InfoCard`, …).
|
|
14
|
-
- Extra rules: only files under `knowledge-base/design-system/components/` that `catalog.yaml` lists. Open that exact path. No `.mdc` means use the export as-is — do not invent a wrapper, a sibling component, or a new rule.
|
|
15
|
-
|
|
16
|
-
## No unnecessary wrappers
|
|
17
|
-
|
|
18
|
-
- Do not wrap a component in a `<div>` or any other container when it is the only
|
|
19
|
-
element or when the container serves no layout/styling purpose. Examples: a
|
|
20
|
-
single `<Input>`, a single `<Modal>`, a `<UserTable>` as the sole content of
|
|
21
|
-
a page — none of them need a wrapping `<div>`. A wrapper is only justified when
|
|
22
|
-
it carries a className needed for positioning/spacing or when grouping several
|
|
23
|
-
siblings.
|
|
24
|
-
|
|
25
|
-
## Reuse
|
|
26
|
-
|
|
27
|
-
- Do not create an abstraction for a one-off that cannot be reused (page-specific wiring).
|
|
28
|
-
Test: would a second screen copy this JSX? If yes, it is a Design System
|
|
29
|
-
candidate even if the first caller is a single page: ask, then put it in
|
|
30
|
-
`components/` if the developer says yes. If no, keep it in the page file.
|
|
31
|
-
|
|
32
|
-
- Follow this order before adding UI:
|
|
33
|
-
1. Reuse an existing component (`components/ui/index.ts`, `components/layout/index.ts`, `components/shared/index.ts`).
|
|
34
|
-
2. Follow an existing pattern in `knowledge-base/patterns/`.
|
|
35
|
-
3. Compose existing primitives.
|
|
36
|
-
4. If the piece is specific to that page and is not a Design System primitive, it may stay in the page file.
|
|
37
|
-
5. If a new reusable component is needed (`components/ui/`, `components/layout/`, `components/shared/`), a new dependency, a new token, or a global architecture change: ask the developer with the block in AGENTS.md (**Mandatory human validation**). Do not hide it as page-local to skip the question. If they say yes, create it there, export it from `index.ts`, and finish the page. If they say no, stop that part.
|
|
38
|
-
- Do not write a raw HTML element (`<button>`, `<input>`, `<select>`, `<table>`, badge, etc.) when an `index.ts` export covers the need.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Optimize before creating
|
|
42
|
-
|
|
43
|
-
- Before creating any new component (local or in `components/`), always inspect
|
|
44
|
-
the existing components first (`components/ui/index.ts`,
|
|
45
|
-
`components/layout/index.ts`, `components/shared/index.ts`). If a similar
|
|
46
|
-
component already exists, extend or modify it dynamically (new prop, new
|
|
47
|
-
variant, new `className` overload) rather than duplicating its logic.
|
|
48
|
-
- A new page that follows an existing pattern does not require a question.
|
|
49
|
-
- A page-local piece is allowed when it is specific to that page, is not a
|
|
50
|
-
Design System primitive, and cannot be obtained by composing existing
|
|
51
|
-
components.
|
|
52
|
-
- A new reusable component in `components/ui/`, `components/layout/` or
|
|
53
|
-
`components/shared/` requires a question to the developer. After they say
|
|
54
|
-
yes, place it there and export it from the folder's `index.ts`. After they
|
|
55
|
-
say no, do not add it. Never keep a Design System primitive in the page
|
|
56
|
-
file to avoid asking.
|
|
57
|
-
|
|
58
|
-
## Page files
|
|
59
|
-
|
|
60
|
-
- A page file primarily composes, wires data, and holds layout.
|
|
61
|
-
- Extract a module-scope helper when the same cell or block of JSX appears
|
|
62
|
-
twice. Do not copy it across tabs.
|
|
63
|
-
- Extract a child component only when it owns state the rest of the page does
|
|
64
|
-
not need. Do not split a page into named wrappers for comments or visual
|
|
65
|
-
sections.
|
|
66
|
-
- Keep static lists (tabs, filter options, column defs that do not close over
|
|
67
|
-
state) at module scope. Keep inside the component only what closes over state
|
|
68
|
-
or the router.
|
|
69
|
-
- Drive an existing component through its props. Do not reimplement a behavior
|
|
70
|
-
it already exposes, and do not pass empty no-op props to demonstrate an API.
|
|
71
|
-
Do not pass a prop that is not on the component's exported type (`npm run typecheck`).
|
|
72
|
-
- Do not wrap a value that never changes in `useMemo` or `useCallback`.
|
|
73
|
-
|
|
74
|
-
## Location
|
|
75
|
-
|
|
76
|
-
- A reusable component belongs in the `components/` folder, after the developer says yes.
|
|
77
|
-
- Place a component in `components/ui/` when it is generic and related to the interface or the Design System.
|
|
78
|
-
Examples: ClickableButton, Input, Badge, Modal, UserTable, Stepper, ActionStack.
|
|
79
|
-
- Place a component in `components/layout/` when it defines the structure or the layout of the application.
|
|
80
|
-
Examples: AppLayout, SideNav, Header.
|
|
81
|
-
- Place a component in `components/shared/` when it is global, cross-cutting and reused by several independent parts of the application.
|
|
82
|
-
Examples: InfoCard, DetailHeader, TimelineList.
|
|
83
|
-
- A page-local piece may stay in the page file only when it is specific to that page and is not a Design System primitive.
|
|
84
|
-
|
|
85
|
-
## Exports
|
|
86
|
-
|
|
87
|
-
- Each subfolder of `components/` that contains components must have an `index.ts` file.
|
|
88
|
-
- If the `index.ts` file does not exist, create it when adding a component in that folder.
|
|
89
|
-
- The `index.ts` file must export only the public API of the folder's components.
|
|
90
|
-
- Use named exports.
|
|
91
|
-
- Import components from the folder's `index.ts` file whenever possible.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Enterprise Design System
|
|
3
|
-
globs: app/**/*.tsx,components/**/*.tsx
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
priority: high
|
|
6
|
-
tags: [design, system, component, consistency]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Design System
|
|
10
|
-
|
|
11
|
-
- Orange is reserved exclusively for critical alerts or urgent cases. It must never be used as a decorative color.
|
|
12
|
-
|
|
13
|
-
- If orange or yellow are used for an alert, they must not be reused elsewhere on the same page.
|
|
14
|
-
|
|
15
|
-
- Consult the Design System page: `app/design-system/page.tsx`.
|
|
16
|
-
- Consult the global style file: `app/globals.css`.
|
|
17
|
-
|
|
18
|
-
## Global variables and tokens
|
|
19
|
-
|
|
20
|
-
- Use the existing global variables and design tokens defined in `app/globals.css`.
|
|
21
|
-
- Do not repeat the same visual value across several components.
|
|
22
|
-
- Do not hard-code colors, spacings, radiuses, text sizes or other values already available as tokens.
|
|
23
|
-
- Create a new global variable only when it meets a need that is reusable across several components or pages.
|
|
24
|
-
- Any new global variable or new design token must be validated by the developer before being added.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Bad examples
|
|
2
|
-
|
|
3
|
-
Validated anti-patterns. Do not invent extras.
|
|
4
|
-
|
|
5
|
-
- Implementing a stepper, action stack or fiche header as page-local JSX to
|
|
6
|
-
avoid asking the developer. Ask (AGENTS.md question format), then if yes put
|
|
7
|
-
the component in `components/` and export it. See `app/change-request/page.tsx`
|
|
8
|
-
for the correct composition.
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Good examples
|
|
2
|
-
|
|
3
|
-
Real files to imitate. Do not copy rule text here.
|
|
4
|
-
|
|
5
|
-
- `components/ui/user-table.tsx`
|
|
6
|
-
- `app/projects/page.tsx` (list)
|
|
7
|
-
- `app/change-request/page.tsx` (workflow / dossier)
|
|
8
|
-
- `components/ui/stepper.tsx`
|
|
9
|
-
- `components/ui/action-stack.tsx`
|
|
10
|
-
- `components/shared/detail-header.tsx`
|
|
11
|
-
- `app/tables/page.tsx`
|
|
12
|
-
- `components/layout/app-layout.tsx`
|
|
13
|
-
- `components/ui/index.ts`
|