@tailor-platform/app-shell 1.15.0 → 1.17.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 (109) hide show
  1. package/dist/app-shell-core.css +1 -1
  2. package/dist/app-shell.d.ts +811 -131
  3. package/dist/app-shell.js +7155 -5797
  4. package/dist/{appshell-DLVBFo5J.js → appshell-CahhZy7v.js} +656 -524
  5. package/dist/semantic-contrast.test.ts +154 -0
  6. package/dist/style-entry.d.ts +147 -92
  7. package/dist/testing.d.ts +152 -95
  8. package/dist/testing.js +1 -1
  9. package/dist/theme-bridge.test.ts +101 -1
  10. package/dist/theme.bridge.css +91 -0
  11. package/dist/theme.css +6 -1
  12. package/dist/themes/_template.css +7 -1
  13. package/dist/themes/bloom.css +0 -6
  14. package/dist/themes/cream.css +0 -6
  15. package/dist/themes/default.css +389 -69
  16. package/dist/vite-plugin.d.ts +147 -92
  17. package/package.json +8 -8
  18. package/skills/app-shell-patterns/SKILL.md +108 -19
  19. package/skills/app-shell-patterns/references/api/create-ai-gateway-client.md +115 -0
  20. package/skills/app-shell-patterns/references/api/create-typed-paths.md +117 -0
  21. package/skills/app-shell-patterns/references/api/define-i18n-labels.md +143 -0
  22. package/skills/app-shell-patterns/references/api/define-module.md +247 -0
  23. package/skills/app-shell-patterns/references/api/define-resource.md +307 -0
  24. package/skills/app-shell-patterns/references/api/guards/hidden.md +202 -0
  25. package/skills/app-shell-patterns/references/api/guards/overview.md +354 -0
  26. package/skills/app-shell-patterns/references/api/guards/pass.md +129 -0
  27. package/skills/app-shell-patterns/references/api/guards/redirect-to.md +307 -0
  28. package/skills/app-shell-patterns/references/api/router/use-location.md +240 -0
  29. package/skills/app-shell-patterns/references/api/router/use-navigate.md +138 -0
  30. package/skills/app-shell-patterns/references/api/router/use-params.md +218 -0
  31. package/skills/app-shell-patterns/references/api/use-ai-chat.md +110 -0
  32. package/skills/app-shell-patterns/references/api/use-app-shell-config.md +132 -0
  33. package/skills/app-shell-patterns/references/api/use-app-shell-data.md +150 -0
  34. package/skills/app-shell-patterns/references/api/use-app-shell.md +150 -0
  35. package/skills/app-shell-patterns/references/api/use-auth.md +145 -0
  36. package/skills/app-shell-patterns/references/api/use-override-breadcrumb.md +74 -0
  37. package/skills/app-shell-patterns/references/api/use-page-meta.md +96 -0
  38. package/skills/app-shell-patterns/references/api/use-register-command-palette-actions.md +90 -0
  39. package/skills/app-shell-patterns/references/api/use-resolved-locale.md +67 -0
  40. package/skills/app-shell-patterns/references/api/use-route-error.md +214 -0
  41. package/skills/app-shell-patterns/references/api/use-theme.md +108 -0
  42. package/skills/app-shell-patterns/references/api/use-time-zone.md +80 -0
  43. package/skills/app-shell-patterns/references/api/use-toast.md +104 -0
  44. package/skills/app-shell-patterns/references/components/action-panel.md +168 -0
  45. package/skills/app-shell-patterns/references/components/activity-card.md +142 -0
  46. package/skills/app-shell-patterns/references/components/ai-chat.md +315 -0
  47. package/skills/app-shell-patterns/references/components/alert.md +202 -0
  48. package/skills/app-shell-patterns/references/components/app-shell.md +530 -0
  49. package/skills/app-shell-patterns/references/components/appearance-switcher.md +87 -0
  50. package/skills/app-shell-patterns/references/components/attachment.md +138 -0
  51. package/skills/app-shell-patterns/references/components/autocomplete.md +278 -0
  52. package/skills/app-shell-patterns/references/components/avatar.md +80 -0
  53. package/skills/app-shell-patterns/references/components/badge.md +309 -0
  54. package/skills/app-shell-patterns/references/components/button.md +164 -0
  55. package/skills/app-shell-patterns/references/components/card.md +181 -0
  56. package/skills/app-shell-patterns/references/components/checkbox.md +169 -0
  57. package/skills/app-shell-patterns/references/components/combobox.md +318 -0
  58. package/skills/app-shell-patterns/references/components/command-palette.md +413 -0
  59. package/skills/app-shell-patterns/references/components/csv-importer.md +214 -0
  60. package/skills/app-shell-patterns/references/components/data-table.md +1168 -0
  61. package/skills/app-shell-patterns/references/components/date-picker.md +259 -0
  62. package/skills/app-shell-patterns/references/components/default-header.md +75 -0
  63. package/skills/app-shell-patterns/references/components/default-sidebar.md +136 -0
  64. package/skills/app-shell-patterns/references/components/description-card.md +569 -0
  65. package/skills/app-shell-patterns/references/components/dialog.md +164 -0
  66. package/skills/app-shell-patterns/references/components/document-progress-card.md +154 -0
  67. package/skills/app-shell-patterns/references/components/filter-rail.md +165 -0
  68. package/skills/app-shell-patterns/references/components/form.md +378 -0
  69. package/skills/app-shell-patterns/references/components/global-header-layout.md +132 -0
  70. package/skills/app-shell-patterns/references/components/grid.md +184 -0
  71. package/skills/app-shell-patterns/references/components/input.md +83 -0
  72. package/skills/app-shell-patterns/references/components/layout.md +539 -0
  73. package/skills/app-shell-patterns/references/components/menu.md +218 -0
  74. package/skills/app-shell-patterns/references/components/metric-card.md +94 -0
  75. package/skills/app-shell-patterns/references/components/select.md +283 -0
  76. package/skills/app-shell-patterns/references/components/sheet.md +237 -0
  77. package/skills/app-shell-patterns/references/components/sidebar-group.md +472 -0
  78. package/skills/app-shell-patterns/references/components/sidebar-item.md +458 -0
  79. package/skills/app-shell-patterns/references/components/sidebar-layout.md +258 -0
  80. package/skills/app-shell-patterns/references/components/sidebar-section.md +114 -0
  81. package/skills/app-shell-patterns/references/components/spinner.md +81 -0
  82. package/skills/app-shell-patterns/references/components/table.md +188 -0
  83. package/skills/app-shell-patterns/references/components/tabs.md +158 -0
  84. package/skills/app-shell-patterns/references/components/textarea.md +122 -0
  85. package/skills/app-shell-patterns/references/components/timeline.md +317 -0
  86. package/skills/app-shell-patterns/references/components/toolbar.md +138 -0
  87. package/skills/app-shell-patterns/references/components/tooltip.md +144 -0
  88. package/skills/app-shell-patterns/references/components/with-guard.md +445 -0
  89. package/skills/app-shell-patterns/references/concepts/authentication.md +301 -0
  90. package/skills/app-shell-patterns/references/concepts/custom-components.md +59 -0
  91. package/skills/app-shell-patterns/references/concepts/file-based-routing.md +356 -0
  92. package/skills/app-shell-patterns/references/{fundamental → concepts}/graphql.md +31 -18
  93. package/skills/app-shell-patterns/references/concepts/modules-and-resources.md +229 -0
  94. package/skills/app-shell-patterns/references/concepts/routing-navigation.md +425 -0
  95. package/skills/app-shell-patterns/references/concepts/sidebar-navigation.md +420 -0
  96. package/skills/app-shell-patterns/references/concepts/styling-theming.md +785 -0
  97. package/skills/app-shell-patterns/references/migrations.md +55 -0
  98. package/skills/app-shell-patterns/references/pages/{detail.md → document-detail.md} +10 -33
  99. package/skills/app-shell-patterns/references/patterns/form-composer.md +43 -45
  100. package/skills/app-shell-patterns/references/patterns/form-modal.md +37 -92
  101. package/skills/app-shell-patterns/references/patterns/form-sectioned.md +12 -38
  102. package/skills/app-shell-patterns/references/patterns/form-single-page.md +11 -32
  103. package/skills/app-shell-patterns/references/patterns/form-wizard.md +12 -53
  104. package/skills/app-shell-patterns/references/patterns/interaction-confirm.md +11 -27
  105. package/skills/app-shell-patterns/references/patterns/interaction-multi-select.md +136 -139
  106. package/skills/app-shell-patterns/references/patterns/interaction-toast.md +10 -34
  107. package/skills/app-shell-patterns/references/patterns/list-dense-scan.md +13 -88
  108. package/skills/app-shell-patterns/references/fundamental/components.md +0 -1009
  109. package/skills/app-shell-patterns/references/fundamental/design-system.md +0 -440
@@ -1,440 +0,0 @@
1
- # Design System
2
-
3
- Authority for **visual-only** decisions — tokens, theme imports, breakpoints intent, and custom-component conformance. For **React component APIs** (imports, props, JSX composition), pair this file with `components.md`; that split avoids duplicating tables and lengthy examples across both docs.
4
-
5
- `@tailor-platform/app-shell` ships an opinionated design system as CSS variables, bridged into Tailwind v4's token namespace. Use it whether you are consuming AppShell components (most cases) or building a custom component to fill a gap.
6
-
7
- **The tokens are the rails.** Consistency across customers, apps, and AI runs comes from the token system, not from rules written in prose. A hand-typed `#fff` or `padding: 13px` is not a "small deviation" — it is the mechanism by which consistency dies.
8
-
9
- **Every token in this file is verified against the shipped CSS.** If a token is not listed here, assume it does not exist. Inventing a plausible-sounding token (`bg-surface-1`, `text-fg-muted`, `--space-4`) is the worst failure mode available to you: Tailwind emits **no CSS at all** for an unknown utility, so the class is silently dropped and the element renders unstyled. There is no error, no warning, and nothing in the console. When unsure, read `node_modules/@tailor-platform/app-shell/dist/themes/default.css` — it is the ground truth.
10
-
11
- ## 1. Setup
12
-
13
- The app's CSS entrypoint (`index.css` / `globals.css`) needs exactly this:
14
-
15
- ```css
16
- @import "tailwindcss";
17
- @import "@tailor-platform/app-shell/styles";
18
-
19
- /* Optional: at most one palette override, imported AFTER styles */
20
- @import "@tailor-platform/app-shell/themes/bloom";
21
- ```
22
-
23
- - **`tailwindcss`** — your app's own Tailwind build, which generates the utilities you write in your components.
24
- - **`@tailor-platform/app-shell/styles`** — the single required import. It pulls in both the design tokens (the `@theme inline` bridge, so `bg-background` / `text-muted-foreground` resolve in _your_ Tailwind build) and AppShell's precompiled component CSS.
25
- - **`@tailor-platform/app-shell/themes/*`** — optional palette overrides (`default`, `cream`, `bloom`). Import at most one, after `styles`. Palette selection is by CSS import; there is no runtime palette prop.
26
-
27
- **Do not import `@tailor-platform/app-shell/theme.css`.** That export is a deprecated no-op shim, kept only so older apps keep building. It emits nothing. Older docs also referred to `app-shell.css`; prefer `styles`.
28
-
29
- Tailwind v4 stays CSS-first; minimal `vite` / PostCSS wiring is in `project-setup.md`.
30
-
31
- ## 2. Theming via CSS variables
32
-
33
- Tokens exist in two layers, and knowing which one you are touching matters:
34
-
35
- 1. **Raw CSS variables** (`--background`, `--primary`, `--radius`) — defined on `:root` in `themes/*.css`. These are what you **override**.
36
- 2. **The Tailwind bridge** (`@theme inline` in `theme.bridge.css`) — maps each raw variable into Tailwind's namespace (`--background` → `--color-background`), which is what makes `bg-background` a real utility. You do **not** edit this layer.
37
-
38
- Override raw variables after the `styles` import, using `:root` for light and `:root.dark` for dark. Set every override in both modes — overriding just `:root` misbehaves either way: on the default palette the light value carries into dark mode, and on a branded palette the override stops applying in dark mode altogether.
39
-
40
- ```css
41
- :root {
42
- --primary: #3b82f6;
43
- }
44
-
45
- :root.dark {
46
- --primary: #60a5fa;
47
- }
48
- ```
49
-
50
- Use `:root.dark`, not a bare `.dark`. The default palette is imported inside a cascade layer (`layer(theme.defaults)`), so any unlayered declaration of yours beats it — but the branded palettes (`cream`, `bloom`) are imported unlayered and define their dark values on `:root.dark`, which outranks `.dark`. A `.dark` override would silently lose against those.
51
-
52
- Override at the highest scope where the change applies. A narrower scope (per-section, per-tenant) needs the same both-modes treatment, and its dark rule must still outrank a branded palette's `:root.dark` — pair `.tenant-a` with `:root.dark .tenant-a`. Do not duplicate token values across files — change them at the source. Never copy the palette wholesale; tokens you did not copy stay on AppShell's values, so the two halves drift apart and any surface AppShell adds later has no value in the copy at all.
53
-
54
- **Do not paste a `@theme inline` block, a `@custom-variant dark` rule, or a copy of AppShell's palette into the app's entry CSS.** `styles` provides all three. A copy of any of them in the app's own CSS is unlayered, so it beats AppShell's layered palette and silently breaks dark mode — the build succeeds and nothing warns.
55
-
56
- **Dark mode is a `.dark` class on `<html>`**, not a data attribute. AppShell's theme provider toggles `document.documentElement.classList` between `light` and `dark` and persists the choice under the `appshell-ui-theme` localStorage key; the bundled `AppearanceSwitcher` component drives it. The bridge registers `@custom-variant dark (&:where(.dark, .dark *))`, so the `dark:` variant works in your own markup.
57
-
58
- AppShell primitives respond to dark mode automatically. Custom components inherit it for free as long as they reference tokens (`bg-card`, `text-muted-foreground`) and never inline literal colors.
59
-
60
- ## 3. Component styling with data attributes
61
-
62
- AppShell's UI components support data-attribute-based styling, following the [Base UI data attributes](https://base-ui.com/react/handbook/styling#data-attributes) convention. Components expose `data-*` attributes that reflect their internal state, enabling CSS-only style control without JavaScript:
63
-
64
- ```css
65
- /* Style a component based on its state */
66
- .SwitchThumb[data-checked] {
67
- background-color: var(--status-completed);
68
- }
69
-
70
- .MenuItem[data-highlighted] {
71
- background-color: var(--accent);
72
- color: var(--accent-foreground);
73
- }
74
- ```
75
-
76
- This works with Tailwind as well — **use theme tokens**, not raw Tailwind grays:
77
-
78
- ```tsx
79
- <Switch.Thumb className="bg-muted data-[checked]:bg-primary" />
80
- ```
81
-
82
- Check each component's API reference (`components.md`) for the data attributes it exposes. Custom components must follow the same convention (see Section 6).
83
-
84
- ## 4. Tokens
85
-
86
- Everything below is verified present in the shipped CSS. **Use the token, never hand-type the value.** A hex literal or magic px in a PR is a review failure.
87
-
88
- ### Color
89
-
90
- Colors follow shadcn-style semantic naming: a surface token and its matching `-foreground` pair. Pick by **intent**, not by visual taste. Pair a background with its own foreground — `bg-card` goes with `text-card-foreground`.
91
-
92
- #### Surface & chrome
93
-
94
- | Token | Use | Tailwind |
95
- | ------------------------------------ | ----------------------------- | ---------------------------------------- |
96
- | `--background` / `--foreground` | page background, default text | `bg-background` / `text-foreground` |
97
- | `--card` / `--card-foreground` | card and panel surfaces | `bg-card` / `text-card-foreground` |
98
- | `--popover` / `--popover-foreground` | menus, popovers, tooltips | `bg-popover` / `text-popover-foreground` |
99
- | `--muted` / `--muted-foreground` | subtle fills; secondary text | `bg-muted` / `text-muted-foreground` |
100
- | `--border` | hairlines, dividers | `border-border` |
101
- | `--input` | form control borders | `border-input` |
102
- | `--ring` | focus rings | `ring-ring` / `outline-ring` |
103
-
104
- Surfaces are named by **role**, not by depth — there is no numbered `surface-1/2/3` ladder, and no third tier of body text below `muted-foreground`. Stack depth with `background` → `card` → `muted` plus a border or shadow, and reach for `popover` when the surface actually floats.
105
-
106
- #### Brand & action
107
-
108
- | Token | Use | Tailwind |
109
- | -------------------------------------------- | -------------------------------- | -------------------------------------------- |
110
- | `--primary` / `--primary-foreground` | primary buttons, emphasis | `bg-primary` / `text-primary-foreground` |
111
- | `--secondary` / `--secondary-foreground` | secondary buttons, neutral chips | `bg-secondary` / `text-secondary-foreground` |
112
- | `--accent` / `--accent-foreground` | hover and selected nav states | `bg-accent` / `text-accent-foreground` |
113
- | `--destructive` / `--destructive-foreground` | destructive actions, errors | `bg-destructive` / `text-destructive` |
114
-
115
- There are no `-hover` or `-active` brand tokens. Express interaction states with Tailwind variants and opacity — `hover:bg-primary/90`, `active:bg-primary/80` — which is what AppShell's own components do.
116
-
117
- #### Status
118
-
119
- Five status colors, used for badge fills and status dots:
120
-
121
- | Token | Use | Tailwind |
122
- | -------------------- | ------------------------ | --------------------- |
123
- | `--status-default` | none / not applicable | `bg-status-default` |
124
- | `--status-neutral` | informational | `bg-status-neutral` |
125
- | `--status-completed` | success, completed | `bg-status-completed` |
126
- | `--status-attention` | warning, needs attention | `bg-status-attention` |
127
- | `--status-danger` | error, blocked | `bg-status-danger` |
128
-
129
- Prefer `Badge` with a semantic variant (`success`, `warning`, `error`, `info`, `neutral`) over applying these directly — the variants already pair fill and foreground correctly. Reach for the raw token only on custom surfaces.
130
-
131
- #### Sidebar & charts
132
-
133
- `--sidebar`, `--sidebar-foreground`, `--sidebar-border`, `--sidebar-primary(-foreground)`, `--sidebar-accent(-foreground)`, `--sidebar-ring` → `bg-sidebar`, `text-sidebar-foreground`, and so on. These let a palette tint the shell independently of page content.
134
-
135
- `--chart-1` … `--chart-5` → `bg-chart-1`, `text-chart-1`, `fill-chart-1`. Use them in order for categorical series.
136
-
137
- #### Alerts
138
-
139
- `--alert-{neutral,success,warning,error,info}-{background,foreground,foreground-muted,border}` — five variants × four slots, each bridged into Tailwind:
140
-
141
- | Slot | Tailwind | Use for |
142
- | ------------------ | ---------------------------------- | -------------------------- |
143
- | `background` | `bg-alert-info-background` | Callout fill |
144
- | `foreground` | `text-alert-info-foreground` | Primary text and icons |
145
- | `foreground-muted` | `text-alert-info-foreground-muted` | Secondary/description text |
146
- | `border` | `border-alert-info-border` | Callout border |
147
-
148
- Prefer the `Alert` component — it already pairs the four slots per variant and supplies the icon. Reach for the utilities directly only on custom surfaces `Alert` doesn't cover, such as a status-highlighted table row or an inline note:
149
-
150
- ```tsx
151
- <div className="rounded-lg border bg-alert-warning-background text-alert-warning-foreground border-alert-warning-border">
152
- …
153
- </div>
154
- ```
155
-
156
- The `background` and `border` slots are already semi-transparent tints (~10% and ~20%), so an opacity modifier compounds rather than replaces — `bg-alert-info-background/50` lands near 5% alpha, not 50%.
157
-
158
- ```tsx
159
- // Good — semantic token pairs, and a variant where one exists
160
- <div className="bg-card text-card-foreground">…</div>
161
- <Button variant="destructive">Delete</Button>
162
- <Badge variant="warning">Pending review</Badge>
163
-
164
- // Bad — raw colors bypass the theme
165
- <div style={{ background: "#fff", color: "#111" }}>…</div>
166
-
167
- // Bad — these classes do not exist and render as nothing at all
168
- <div className="bg-surface-1 text-fg-muted">…</div>
169
- ```
170
-
171
- ### Spacing
172
-
173
- **AppShell defines no spacing tokens.** Use Tailwind's default 4px-based scale (`p-4`, `gap-2`, `mt-8`) — the same scale AppShell's own components use internally. There is no `--space-*` variable.
174
-
175
- ```tsx
176
- // Good — scale step
177
- <div className="flex gap-3 p-4">…</div>
178
-
179
- // Bad — magic value
180
- <div className="p-[13px]">…</div>
181
- ```
182
-
183
- Hand-typing `padding: 13px` is a smell. Round to the nearest scale step; if nothing fits, the layout is wrong, not the scale.
184
-
185
- ### Typography
186
-
187
- **AppShell defines no typography scale tokens.** There is no `text-h1`, `text-body`, or `text-caption`. The only typography token is `--font-sans` (Inter Variable for Latin, Noto Sans JP Variable for Japanese) → `font-sans`, which the base layer already applies to `body`. Both are variable fonts, so every weight token is real in both scripts. Override the whole stack by setting `--app-shell-font-sans` on `:root`.
188
-
189
- Compose roles from stock Tailwind utilities. These pairings are what AppShell's own components use — match them so your screens sit consistently alongside the primitives:
190
-
191
- | Role | Utilities |
192
- | --------------------------------- | ----------------------------------------- |
193
- | Page title (`Layout.Header`) | `text-2xl font-bold tracking-tight` |
194
- | Section heading | `text-lg font-semibold` |
195
- | Card title | `text-lg font-semibold leading-none` |
196
- | Body copy | `text-sm` |
197
- | Secondary copy, descriptions | `text-sm text-muted-foreground` |
198
- | Caption, timestamp, metadata | `text-xs text-muted-foreground` |
199
- | Numeric value in a table or field | `text-sm font-medium tabular-nums` |
200
- | ID, code, keyboard hint | `font-mono text-xs text-muted-foreground` |
201
-
202
- ```tsx
203
- <h2 className="text-lg font-semibold">Section</h2>
204
- <p className="text-sm text-muted-foreground">Description copy</p>
205
- <span className="text-xs text-muted-foreground">Updated 2h ago</span>
206
- ```
207
-
208
- Always use `tabular-nums` for numbers that stack in a column — without it, digits jitter between rows.
209
-
210
- ### Radius
211
-
212
- `--radius` (`0.625rem`) is the base; the bridge derives four steps from it. Pick by component role — a card is always `md`, regardless of its size on screen.
213
-
214
- | Token | Value | Use | Tailwind |
215
- | ------------- | -------------- | ------------------- | ------------ |
216
- | `--radius-sm` | `radius − 4px` | inputs, small chips | `rounded-sm` |
217
- | `--radius-md` | `radius − 2px` | buttons, cards | `rounded-md` |
218
- | `--radius-lg` | `radius` | modals, sheets | `rounded-lg` |
219
- | `--radius-xl` | `radius + 4px` | large surfaces | `rounded-xl` |
220
-
221
- `rounded-full` (pills, avatars) is a stock Tailwind utility — there is no `--radius-full` token, but the class works.
222
-
223
- Changing `--radius` alone rescales all four steps together.
224
-
225
- ### Shadow
226
-
227
- Four mode-aware shadows. There are **no `--elevation-*` tokens**; the scale is expressed as shadows. Never hand-craft a `box-shadow`.
228
-
229
- | Token | Bridged to | Use |
230
- | ---------------------- | ----------- | --------------------------------- |
231
- | `--semantic-shadow-xs` | `shadow-xs` | hairline lift, active nav item |
232
- | `--semantic-shadow-sm` | `shadow-sm` | cards, persistent panels |
233
- | `--semantic-shadow-md` | `shadow-md` | popovers, menus, hovered surfaces |
234
- | `--semantic-shadow-lg` | `shadow-lg` | modals, dialogs, sheets |
235
-
236
- Higher shadow reads as "more transient" — match it to the component's lifetime. Each token carries a different value in dark mode, so using the token (rather than a literal) is what keeps depth legible on both backgrounds.
237
-
238
- ### Motion
239
-
240
- **AppShell defines no motion tokens.** There is no `--motion-fast` or `--ease-out` variable. Use Tailwind's `duration-*` and `ease-*` utilities. AppShell uses `tw-animate-css` internally for its own enter/exit animations, but those classes are prefixed and are not available to your app — add `@import "tw-animate-css";` to your own entrypoint if you want them.
241
-
242
- | Intent | Utilities |
243
- | ----------------------------- | -------------------------- |
244
- | Hover, focus, button press | `duration-150 ease-out` |
245
- | State change (toggle, select) | `duration-200 ease-in-out` |
246
- | Entrance, dialog open | `duration-300 ease-out` |
247
-
248
- ```tsx
249
- <div className="transition-colors duration-150 ease-out motion-reduce:transition-none" />
250
- ```
251
-
252
- Always give motion a reduced-motion escape (`motion-reduce:transition-none`, or a `@media (prefers-reduced-motion: reduce)` block in CSS). AppShell components handle this internally; custom components must do the same.
253
-
254
- ### Z-index
255
-
256
- These exist as raw `:root` variables in the shipped base layer, but are **not** bridged into Tailwind — `z-sidebar` is not a class. Use the stock numeric utility, or reference the variable when you need it to track AppShell's layering:
257
-
258
- | Token | Value | Use |
259
- | ------------------ | ----- | ----------------------------- |
260
- | `--z-sidebar` | 10 | persistent sidebar |
261
- | `--z-sidebar-rail` | 20 | sidebar collapsed rail |
262
- | `--z-popup` | 50 | menu, tooltip, popover |
263
- | `--z-overlay` | 50 | modal, sheet, dialog backdrop |
264
-
265
- ```tsx
266
- <div className="z-50" />
267
- <div className="z-[var(--z-popup)]" />
268
- ```
269
-
270
- Never invent a z value — `z-index: 9999` is always wrong. Popups and overlays share `50` intentionally: sequencing comes from DOM order, not z escalation.
271
-
272
- ### Icons
273
-
274
- **AppShell exports no `Icon` component and defines no `--icon-*` tokens.** Icons come from [`lucide-react`](https://lucide.dev), which AppShell already depends on. Size them with Tailwind, pairing icon size to the adjacent text:
275
-
276
- | Text size | Icon class |
277
- | ------------------ | ---------- |
278
- | `text-xs` | `size-3` |
279
- | `text-sm` | `size-4` |
280
- | `text-lg` | `size-5` |
281
- | `text-2xl` (title) | `size-6` |
282
-
283
- ```tsx
284
- import { Check } from "lucide-react";
285
-
286
- <Check className="size-4" />;
287
- ```
288
-
289
- ### Breakpoints
290
-
291
- Stock Tailwind breakpoints — AppShell does not change them.
292
-
293
- | Token | Width |
294
- | ----- | ------ |
295
- | `sm` | 640px |
296
- | `md` | 768px |
297
- | `lg` | 1024px |
298
- | `xl` | 1280px |
299
- | `2xl` | 1536px |
300
-
301
- **ERP target is `xl`/`2xl` desktop.** Pages should be designed for those widths first; smaller breakpoints exist for graceful degradation, not parity. Don't waste effort on mobile-first composition unless a screen explicitly calls for it. A list page that collapses gracefully at `md` is fine; a list page redesigned for `sm` is over-investment.
302
-
303
- Two-column **behavior** (right rail stacks under `lg`): respect AppShell defaults — do not force side-by-side grids on narrow viewports. The `Layout` column width table lives in `components.md` → Layout; reuse those numbers instead of guessing rem values here.
304
-
305
- ## 4b. Links
306
-
307
- One treatment for every text link — inside `DescriptionCard`, in table rows,
308
- in cards:
309
-
310
- - **`text-primary` at rest, `hover:underline` only.** Colour carries the affordance; a resting underline is noise. Pair with `underline-offset-4`.
311
- - **Internal routes** use app-shell's `Link` (`to`), never a bare `<a href>`.
312
- - **External destinations** use `<a target="_blank" rel="noopener noreferrer">` with a lucide `ExternalLink` at `size-3` after the label. There is no dedicated component for this; that markup is the convention.
313
- - **Identifiers** (document numbers, SKUs) keep `font-mono` on top of the link style.
314
-
315
- This is the treatment `DescriptionCard` already applies to its `type: "link"`
316
- fields — match it rather than inventing a second one.
317
-
318
- ## 5. AppShell styling boundary
319
-
320
- `astw:` is AppShell's internal compiled CSS prefix. **Never write it in an application.** It is not a consumer customization API and arbitrary prefixed utilities may not exist in the shipped CSS.
321
-
322
- Use ordinary Tailwind utilities on your own markup. An explicitly documented layout hook, such as `Table.Root`'s `containerClassName`, also accepts ordinary utilities from the application's Tailwind build:
323
-
324
- ```tsx
325
- <Table.Root containerClassName="px-6 overflow-y-auto" />
326
- ```
327
-
328
- For an AppShell component's appearance, use its documented props, variants, or composition instead of styling over its internals.
329
-
330
- ## 6. When AppShell doesn't have a component you need
331
-
332
- Most ERP screens compose entirely from AppShell primitives. When you hit a gap, work through this decision tree before building anything:
333
-
334
- ### Decision tree
335
-
336
- 1. **Can you compose existing AppShell primitives?** A "card with a metric and a trend arrow" is `MetricCard`, or `Card` plus a lucide icon — not a new component. Compose first, and check `components.md` for what already exists before concluding there is a gap.
337
- 2. **If composition won't work, is the behavior one-off?** Build it locally under `src/components/<name>/` and flag it for the `build-component` skill, which promotes useful customs into AppShell upstream.
338
- 3. **If it's already proven reusable across 2+ apps**, skip local entirely — use the `build-component` skill to add it to AppShell directly.
339
-
340
- ### Conformance rules (non-negotiable for any custom component)
341
-
342
- - **Tokens only.** No hex literals, no magic px values, no hand-rolled shadows. Every visual property maps to a token from Section 4 — and only to a token that actually exists there.
343
- - **Base UI data-attribute pattern for state.** Expose `data-*` attributes that reflect internal state; never style off React props alone. A custom toggle exposes `data-checked`; a custom step indicator exposes `data-active`, `data-completed`, etc.
344
- - **Compose AppShell primitives inside.** If the custom needs a button, use `Button` — not raw `<button>`. Same for `Input`, `Badge`, `Card`. The custom's job is composition, not reinvention.
345
- - **Document with a `README.md`** in the component folder listing: purpose, props, tokens used, and a brief justification for why this can't be composed from existing AppShell primitives.
346
- - **Match accessibility behavior** of the closest AppShell equivalent — focus management, ARIA roles/attributes, keyboard interactions. Reach for Base UI primitives if the behavior is non-trivial.
347
-
348
- Example skeleton for a local custom component:
349
-
350
- ```tsx
351
- // src/components/StepIndicator/index.tsx
352
- import { Check } from "lucide-react";
353
-
354
- type Props = { steps: string[]; current: number };
355
-
356
- export function StepIndicator({ steps, current }: Props) {
357
- return (
358
- <ol className="flex gap-2">
359
- {steps.map((label, i) => (
360
- <li
361
- key={label}
362
- data-active={i === current ? "" : undefined}
363
- data-completed={i < current ? "" : undefined}
364
- className="
365
- flex items-center gap-2 rounded-md px-3 py-2
366
- bg-muted text-sm text-muted-foreground
367
- data-[active]:bg-primary data-[active]:text-primary-foreground
368
- data-[completed]:text-status-completed
369
- "
370
- >
371
- {i < current && <Check className="size-4" />}
372
- {label}
373
- </li>
374
- ))}
375
- </ol>
376
- );
377
- }
378
- ```
379
-
380
- Notice: every value is a real token, `data-*` attributes carry state, no hex literals, and the icon comes from `lucide-react` rather than a nonexistent `Icon` component.
381
-
382
- ### Promotion path
383
-
384
- When a custom component proves reusable across 2+ apps, promote it upstream into AppShell via the `build-component` skill (a separate skill at `~/.claude/skills/build-component/`). The skill handles API design, exports, test coverage, and the upstream PR. Local custom components should be considered staging — not a permanent home.
385
-
386
- ## 7. Quick reference
387
-
388
- ### Where to look
389
-
390
- | Concern | File |
391
- | --------------------------------------------------------------- | ---------------------------------- |
392
- | Component imports, props, JSX composition | **`components.md`** |
393
- | Page / screen layout patterns | **`patterns/<type>/<slug>.md`** |
394
- | Design tokens, AppShell styling boundary, custom UI conformance | **this file** (`design-system.md`) |
395
-
396
- **`components.md`** holds long JSX compositions (e.g. **`DataTable`**, **card + `Table`**). **Do not copy those trees into this file** — link back here only for tokens and the AppShell styling boundary.
397
-
398
- `patterns/` is organised by page type: `patterns/list/`, `patterns/detail/`, `patterns/form/`, `patterns/interaction/`. Pick the slug matching the screen you're building.
399
-
400
- ### Semantic decisions
401
-
402
- | Intent | Pick |
403
- | ---------------------------------- | ------------------------------------------------------------------------------------------------------- |
404
- | Destructive action (delete, void) | `Button variant="destructive"`; `bg-destructive` on custom surfaces; confirm in a dialog at `shadow-lg` |
405
- | Non-blocking caution | `Badge variant="warning"`, or `bg-status-attention` |
406
- | Confirmation / completed state | `Badge variant="success"`, or `bg-status-completed` |
407
- | Neutral callout | `Badge variant="info"`, or the `Alert` component |
408
- | Persistent panel (sidebar, header) | `shadow-sm` |
409
- | Hovered / sticky surface | `shadow-md` |
410
- | Popover / menu / tooltip | `bg-popover`, `shadow-md`, `duration-150` |
411
- | Modal / sheet / dialog | `shadow-lg`, `duration-300` entrance |
412
- | Hover / focus transition | `duration-150 ease-out` |
413
- | State change (toggle, select) | `duration-200 ease-in-out` |
414
- | Two-column detail at <1024 | right column collapses below main — do not override |
415
- | Inline ID, code, table number | `font-mono text-xs` (identifiers) / `tabular-nums` (figures) |
416
- | Timestamp, label, subtle metadata | `text-xs text-muted-foreground` |
417
-
418
- ### Composition & emphasis rules
419
-
420
- These are visual-composition rules every screen must follow, regardless of pattern. They exist because emphasis only works when it is scarce.
421
-
422
- **Emphasis budget.** Attention is a budget you spend once per scan region.
423
-
424
- - **One primary action per view.** A screen (or a card/section) has at most one filled/primary `Button`; everything else is `outline`, `secondary`, or `ghost`. If two things look equally important, neither reads as important.
425
- - **Badges** encode status by semantic color, with a clear primary/secondary split:
426
- - A record's **primary / lifecycle status** (PO status, SO status) → a **filled semantic** variant (`success` / `warning` / `error` / `info` / `neutral`) — one per row in a list, one in a detail header.
427
- - **Secondary statuses** (delivery, billing, fulfilment) and dense supporting columns → **`outline-*`** (with status dot).
428
- - **Tags / labels** ("New", "Returned") → **`subtle-*`**.
429
- - Reserve **`default`** (brand fill) for non-status emphasis — never the brand color as a routine status. The defect to avoid: making _every_ chip a loud fill, or giving secondary statuses the same weight as the primary one. (Variants: **`components.md`** → `Badge`.)
430
- - **Color:** status colors signal meaning, not decoration — don't tint neutral content.
431
-
432
- **Hierarchy.** One `h1` per page (the `Layout.Header` title). Section headings step down in weight and size; never skip levels for size — pick the role from §4 Typography, not the pixel size.
433
-
434
- **States — never ship only the happy path.** Every data-backed screen handles:
435
-
436
- - **Loading** — skeleton/placeholder, not a blank flash.
437
- - **Empty** — a labelled empty state (what it is, how to add the first record), not a bare empty table.
438
- - **Error** — an inline error with a retry affordance, not a silent failure.
439
-
440
- **Spacing rhythm.** Use the spacing scale (§4) consistently — equal gaps between sibling sections, consistent card padding. A one-off `gap` or `padding` that doesn't match its siblings reads as a mistake.