@react-consulting/rc-kit 0.0.0-stage → 0.13.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 (337) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +94 -2
  3. package/devkit/README.md +301 -0
  4. package/devkit/cli.test.ts +211 -0
  5. package/devkit/cli.ts +120 -0
  6. package/devkit/commands/build.ts +127 -0
  7. package/devkit/commands/checks.ts +123 -0
  8. package/devkit/commands/context.ts +47 -0
  9. package/devkit/commands/db.ts +154 -0
  10. package/devkit/commands/deploy.ts +46 -0
  11. package/devkit/commands/dev.ts +191 -0
  12. package/devkit/commands/doctor.ts +25 -0
  13. package/devkit/commands/kit.ts +45 -0
  14. package/devkit/commands/new.ts +81 -0
  15. package/devkit/commands/registry.ts +20 -0
  16. package/devkit/commands/secrets.ts +254 -0
  17. package/devkit/lib/args.ts +65 -0
  18. package/devkit/lib/audit.test.ts +405 -0
  19. package/devkit/lib/audit.ts +813 -0
  20. package/devkit/lib/config.test.ts +203 -0
  21. package/devkit/lib/config.ts +417 -0
  22. package/devkit/lib/database/index.test.ts +223 -0
  23. package/devkit/lib/database/index.ts +314 -0
  24. package/devkit/lib/database/neon.test.ts +233 -0
  25. package/devkit/lib/database/neon.ts +357 -0
  26. package/devkit/lib/database/prepare.ts +54 -0
  27. package/devkit/lib/deploy-config.test.ts +217 -0
  28. package/devkit/lib/deploy-config.ts +133 -0
  29. package/devkit/lib/deploy.test.ts +275 -0
  30. package/devkit/lib/deploy.ts +177 -0
  31. package/devkit/lib/dev-gateway.test.ts +128 -0
  32. package/devkit/lib/dev-gateway.ts +162 -0
  33. package/devkit/lib/dev-menu.test.ts +114 -0
  34. package/devkit/lib/dev-menu.ts +332 -0
  35. package/devkit/lib/dev-secrets.test.ts +156 -0
  36. package/devkit/lib/dev-secrets.ts +97 -0
  37. package/devkit/lib/dev.test.ts +194 -0
  38. package/devkit/lib/dev.ts +119 -0
  39. package/devkit/lib/doctor.test.ts +144 -0
  40. package/devkit/lib/doctor.ts +264 -0
  41. package/devkit/lib/env-file.test.ts +102 -0
  42. package/devkit/lib/env-file.ts +96 -0
  43. package/devkit/lib/glob.ts +31 -0
  44. package/devkit/lib/infisical.test.ts +208 -0
  45. package/devkit/lib/infisical.ts +139 -0
  46. package/devkit/lib/json-schema.ts +220 -0
  47. package/devkit/lib/jsonc.test.ts +53 -0
  48. package/devkit/lib/jsonc.ts +93 -0
  49. package/devkit/lib/kit-migrate.test.ts +212 -0
  50. package/devkit/lib/kit-migrate.ts +617 -0
  51. package/devkit/lib/kit-package.test.ts +83 -0
  52. package/devkit/lib/kit-package.ts +57 -0
  53. package/devkit/lib/kit-version.ts +22 -0
  54. package/devkit/lib/naming.test.ts +547 -0
  55. package/devkit/lib/naming.ts +796 -0
  56. package/devkit/lib/paths.ts +7 -0
  57. package/devkit/lib/process.ts +78 -0
  58. package/devkit/lib/project-checks.ts +86 -0
  59. package/devkit/lib/scaffold.test.ts +302 -0
  60. package/devkit/lib/scaffold.ts +315 -0
  61. package/devkit/lib/secrets.test.ts +101 -0
  62. package/devkit/lib/secrets.ts +125 -0
  63. package/devkit/lib/sourcemaps.test.ts +86 -0
  64. package/devkit/lib/sourcemaps.ts +98 -0
  65. package/devkit/lib/test-utils.ts +68 -0
  66. package/devkit/lib/workspace.ts +87 -0
  67. package/devkit/lib/wrangler.ts +231 -0
  68. package/docs/rc-config.md +93 -0
  69. package/package.json +86 -4
  70. package/presets/build.d.ts +15 -0
  71. package/presets/build.js +53 -0
  72. package/presets/vite-plus.d.ts +28 -0
  73. package/presets/vite-plus.js +153 -0
  74. package/registry/README.md +294 -0
  75. package/registry/public/r/avatar-stack.json +18 -0
  76. package/registry/public/r/avatar.json +20 -0
  77. package/registry/public/r/back-link.json +21 -0
  78. package/registry/public/r/badge.json +17 -0
  79. package/registry/public/r/button.json +18 -0
  80. package/registry/public/r/calendar-days.json +14 -0
  81. package/registry/public/r/calendar-popover.json +24 -0
  82. package/registry/public/r/calendar.json +23 -0
  83. package/registry/public/r/callout.json +20 -0
  84. package/registry/public/r/card.json +18 -0
  85. package/registry/public/r/character-counter.json +17 -0
  86. package/registry/public/r/checkbox.json +22 -0
  87. package/registry/public/r/choice-cards.json +22 -0
  88. package/registry/public/r/color-tag.json +17 -0
  89. package/registry/public/r/combobox.json +24 -0
  90. package/registry/public/r/confirm-button.json +24 -0
  91. package/registry/public/r/confirm-dialog.json +23 -0
  92. package/registry/public/r/copy-button.json +24 -0
  93. package/registry/public/r/date-picker.json +24 -0
  94. package/registry/public/r/date-range-picker.json +28 -0
  95. package/registry/public/r/detail-header.json +17 -0
  96. package/registry/public/r/detail-row.json +17 -0
  97. package/registry/public/r/dev-inbox-api.json +33 -0
  98. package/registry/public/r/dev-toolbar.json +109 -0
  99. package/registry/public/r/dev-tools-contract.json +15 -0
  100. package/registry/public/r/dialog.json +23 -0
  101. package/registry/public/r/empty-state.json +20 -0
  102. package/registry/public/r/error-state.json +23 -0
  103. package/registry/public/r/eyebrow.json +17 -0
  104. package/registry/public/r/fab.json +20 -0
  105. package/registry/public/r/field-error.json +17 -0
  106. package/registry/public/r/field-grid.json +17 -0
  107. package/registry/public/r/field.json +19 -0
  108. package/registry/public/r/file-picker.json +22 -0
  109. package/registry/public/r/filter-chips.json +17 -0
  110. package/registry/public/r/form-section.json +17 -0
  111. package/registry/public/r/form-sheet.json +22 -0
  112. package/registry/public/r/icon-button.json +23 -0
  113. package/registry/public/r/input.json +18 -0
  114. package/registry/public/r/label.json +18 -0
  115. package/registry/public/r/list-row.json +17 -0
  116. package/registry/public/r/loading-state.json +18 -0
  117. package/registry/public/r/localized-field.json +23 -0
  118. package/registry/public/r/markdown-text.json +17 -0
  119. package/registry/public/r/menu.json +21 -0
  120. package/registry/public/r/money-input.json +17 -0
  121. package/registry/public/r/month-day-select.json +18 -0
  122. package/registry/public/r/numbered-step.json +20 -0
  123. package/registry/public/r/page-actions.json +14 -0
  124. package/registry/public/r/page-header.json +17 -0
  125. package/registry/public/r/pending.json +17 -0
  126. package/registry/public/r/person-option.json +21 -0
  127. package/registry/public/r/popover.json +20 -0
  128. package/registry/public/r/progress-bar.json +17 -0
  129. package/registry/public/r/query-view.json +22 -0
  130. package/registry/public/r/registry.json +1352 -0
  131. package/registry/public/r/retry-button.json +21 -0
  132. package/registry/public/r/rich-text-editor.json +32 -0
  133. package/registry/public/r/save-bar.json +22 -0
  134. package/registry/public/r/search-input.json +23 -0
  135. package/registry/public/r/search-select.json +24 -0
  136. package/registry/public/r/section-tabs.json +17 -0
  137. package/registry/public/r/segmented.json +18 -0
  138. package/registry/public/r/select.json +23 -0
  139. package/registry/public/r/sheet.json +24 -0
  140. package/registry/public/r/skeleton.json +17 -0
  141. package/registry/public/r/spinner.json +20 -0
  142. package/registry/public/r/stale-notice.json +23 -0
  143. package/registry/public/r/stat-tile.json +23 -0
  144. package/registry/public/r/stepper.json +23 -0
  145. package/registry/public/r/suggestion-strip.json +21 -0
  146. package/registry/public/r/swatch-picker.json +22 -0
  147. package/registry/public/r/switch.json +21 -0
  148. package/registry/public/r/tabs.json +20 -0
  149. package/registry/public/r/textarea.json +18 -0
  150. package/registry/public/r/theme.json +15 -0
  151. package/registry/public/r/timezone-select.json +19 -0
  152. package/registry/public/r/toaster.json +21 -0
  153. package/registry/public/r/tooltip.json +17 -0
  154. package/registry/public/r/ui-labels.json +14 -0
  155. package/registry/public/r/use-copy-to-clipboard.json +20 -0
  156. package/registry/public/r/use-online.json +14 -0
  157. package/registry/public/r/use-stale-queries.json +17 -0
  158. package/registry/public/r/utils.json +18 -0
  159. package/registry/public/r/weekday-picker.json +19 -0
  160. package/registry/public/r/yes-no.json +20 -0
  161. package/registry/serve.ts +29 -0
  162. package/rules/architecture.md +47 -0
  163. package/rules/cloudflare.md +74 -0
  164. package/rules/code.md +12 -0
  165. package/rules/git.md +10 -0
  166. package/rules/index.md +14 -0
  167. package/rules/observability.md +13 -0
  168. package/rules/performance.md +39 -0
  169. package/rules/runtime.md +9 -0
  170. package/rules/secrets.md +11 -0
  171. package/rules/stack.md +33 -0
  172. package/rules/ui.md +23 -0
  173. package/runtime/ai.test.ts +106 -0
  174. package/runtime/ai.ts +125 -0
  175. package/runtime/observability/allowlists.ts +42 -0
  176. package/runtime/observability/anonymize.test.ts +111 -0
  177. package/runtime/observability/anonymize.ts +249 -0
  178. package/runtime/observability/browser.test.ts +46 -0
  179. package/runtime/observability/browser.ts +126 -0
  180. package/runtime/observability/server.test.ts +84 -0
  181. package/runtime/observability/server.ts +152 -0
  182. package/runtime/observability/tunnel.test.ts +276 -0
  183. package/runtime/observability/tunnel.ts +360 -0
  184. package/runtime/observability/user-agent.ts +51 -0
  185. package/schema/rc.config.schema.json +333 -0
  186. package/template/.gitattributes +1 -0
  187. package/template/.github/workflows/ci.yml +64 -0
  188. package/template/CLAUDE.md +48 -0
  189. package/template/README.md +50 -0
  190. package/template/apps/admin/.dev.vars.example +5 -0
  191. package/template/apps/admin/components.json +24 -0
  192. package/template/apps/admin/package.json +48 -0
  193. package/template/apps/admin/public/favicon.svg +1 -0
  194. package/template/apps/admin/src/components/app-shell.tsx +41 -0
  195. package/template/apps/admin/src/components/dev-sign-in-links.tsx +57 -0
  196. package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-context.ts +13 -0
  197. package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-environment-panel.tsx +105 -0
  198. package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-inbox-list.tsx +54 -0
  199. package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-inbox-message.tsx +104 -0
  200. package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-inbox-panel.tsx +130 -0
  201. package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-launcher.tsx +45 -0
  202. package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-panel.tsx +90 -0
  203. package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-types.ts +11 -0
  204. package/template/apps/admin/src/components/dev-toolbar/dev-toolbar.tsx +61 -0
  205. package/template/apps/admin/src/components/dev-toolbar/development-devtools.tsx +32 -0
  206. package/template/apps/admin/src/components/login-form.tsx +115 -0
  207. package/template/apps/admin/src/components/login-sent.tsx +23 -0
  208. package/template/apps/admin/src/components/message-list.tsx +44 -0
  209. package/template/apps/admin/src/components/turnstile-challenge.tsx +140 -0
  210. package/template/apps/admin/src/components/ui/button.tsx +87 -0
  211. package/template/apps/admin/src/components/ui/callout.tsx +84 -0
  212. package/template/apps/admin/src/components/ui/card.tsx +48 -0
  213. package/template/apps/admin/src/components/ui/eyebrow.tsx +33 -0
  214. package/template/apps/admin/src/components/ui/field-error.tsx +24 -0
  215. package/template/apps/admin/src/components/ui/field.tsx +100 -0
  216. package/template/apps/admin/src/components/ui/input.tsx +73 -0
  217. package/template/apps/admin/src/components/ui/label.tsx +39 -0
  218. package/template/apps/admin/src/components/ui/skeleton.tsx +225 -0
  219. package/template/apps/admin/src/components/ui/spinner.tsx +12 -0
  220. package/template/apps/admin/src/components/ui/toaster.tsx +33 -0
  221. package/template/apps/admin/src/components/ui/tooltip.tsx +51 -0
  222. package/template/apps/admin/src/hooks/use-dev-inbox.ts +25 -0
  223. package/template/apps/admin/src/hooks/use-dev-toolbar-state.ts +48 -0
  224. package/template/apps/admin/src/lib/api.ts +39 -0
  225. package/template/apps/admin/src/lib/auth-client.ts +7 -0
  226. package/template/apps/admin/src/lib/dev-inbox-links.ts +66 -0
  227. package/template/apps/admin/src/lib/dev-tools-client.ts +54 -0
  228. package/template/apps/admin/src/lib/dev-tools-contract.ts +52 -0
  229. package/template/apps/admin/src/lib/messages.ts +5 -0
  230. package/template/apps/admin/src/lib/query-keys.ts +3 -0
  231. package/template/apps/admin/src/lib/security-headers.ts +18 -0
  232. package/template/apps/admin/src/lib/session.ts +27 -0
  233. package/template/apps/admin/src/lib/site-url.ts +7 -0
  234. package/template/apps/admin/src/lib/turnstile.ts +70 -0
  235. package/template/apps/admin/src/lib/ui-labels.tsx +182 -0
  236. package/template/apps/admin/src/lib/utils.ts +6 -0
  237. package/template/apps/admin/src/routeTree.gen.ts +109 -0
  238. package/template/apps/admin/src/router.tsx +29 -0
  239. package/template/apps/admin/src/routes/__root.tsx +56 -0
  240. package/template/apps/admin/src/routes/_app/index.tsx +38 -0
  241. package/template/apps/admin/src/routes/_app.tsx +26 -0
  242. package/template/apps/admin/src/routes/login.tsx +48 -0
  243. package/template/apps/admin/src/styles/app.css +11 -0
  244. package/template/apps/admin/src/worker.ts +88 -0
  245. package/template/apps/admin/tsconfig.json +19 -0
  246. package/template/apps/admin/vite.config.ts +69 -0
  247. package/template/apps/admin/wrangler.jsonc +92 -0
  248. package/template/apps/web/.env.example +1 -0
  249. package/template/apps/web/astro.config.ts +46 -0
  250. package/template/apps/web/package.json +33 -0
  251. package/template/apps/web/public/favicon.svg +1 -0
  252. package/template/apps/web/src/components/ContactForm.astro +78 -0
  253. package/template/apps/web/src/env.d.ts +11 -0
  254. package/template/apps/web/src/layouts/BaseLayout.astro +32 -0
  255. package/template/apps/web/src/lib/api.ts +8 -0
  256. package/template/apps/web/src/pages/api/messages.ts +32 -0
  257. package/template/apps/web/src/pages/index.astro +26 -0
  258. package/template/apps/web/src/pages/media/[...key].ts +4 -0
  259. package/template/apps/web/src/scripts/contact-form.ts +105 -0
  260. package/template/apps/web/src/scripts/error-reporting.ts +4 -0
  261. package/template/apps/web/src/scripts/turnstile.ts +177 -0
  262. package/template/apps/web/src/styles/global.css +11 -0
  263. package/template/apps/web/src/worker.ts +34 -0
  264. package/template/apps/web/tsconfig.json +11 -0
  265. package/template/apps/web/wrangler.jsonc +45 -0
  266. package/template/bun.lock +1925 -0
  267. package/template/bunfig.toml +2 -0
  268. package/template/gitignore +23 -0
  269. package/template/package.json +74 -0
  270. package/template/packages/api/components.json +21 -0
  271. package/template/packages/api/package.json +30 -0
  272. package/template/packages/api/src/client.ts +13 -0
  273. package/template/packages/api/src/cloudflare-env.d.ts +26 -0
  274. package/template/packages/api/src/emails/escape-html.ts +13 -0
  275. package/template/packages/api/src/emails/layout.ts +22 -0
  276. package/template/packages/api/src/emails/magic-link.ts +32 -0
  277. package/template/packages/api/src/emails/new-message.ts +32 -0
  278. package/template/packages/api/src/emails/send.ts +14 -0
  279. package/template/packages/api/src/lib/auth-guard.ts +16 -0
  280. package/template/packages/api/src/lib/auth.ts +108 -0
  281. package/template/packages/api/src/lib/context.ts +7 -0
  282. package/template/packages/api/src/lib/dev-inbox/routes.ts +77 -0
  283. package/template/packages/api/src/lib/dev-inbox/send.ts +57 -0
  284. package/template/packages/api/src/lib/dev-inbox/store.ts +185 -0
  285. package/template/packages/api/src/lib/dev-inbox.ts +6 -0
  286. package/template/packages/api/src/lib/dev-tools-contract.ts +52 -0
  287. package/template/packages/api/src/lib/environment.ts +17 -0
  288. package/template/packages/api/src/lib/turnstile.ts +33 -0
  289. package/template/packages/api/src/media.ts +45 -0
  290. package/template/packages/api/src/routes/admin-messages.ts +21 -0
  291. package/template/packages/api/src/routes/dev.ts +31 -0
  292. package/template/packages/api/src/routes/health.ts +7 -0
  293. package/template/packages/api/src/routes/messages.ts +58 -0
  294. package/template/packages/api/src/schemas.ts +18 -0
  295. package/template/packages/api/src/server.ts +29 -0
  296. package/template/packages/api/tsconfig.json +10 -0
  297. package/template/packages/db/migrations/0001_init.sql +79 -0
  298. package/template/packages/db/package.json +34 -0
  299. package/template/packages/db/prisma/schema.prisma +95 -0
  300. package/template/packages/db/prisma.config.ts +9 -0
  301. package/template/packages/db/scripts/migrate.ts +15 -0
  302. package/template/packages/db/scripts/new-migration.ts +185 -0
  303. package/template/packages/db/scripts/reset.ts +54 -0
  304. package/template/packages/db/scripts/seed.ts +44 -0
  305. package/template/packages/db/scripts/wrangler.ts +35 -0
  306. package/template/packages/db/src/d1.ts +7 -0
  307. package/template/packages/db/src/migration-guard.test.ts +43 -0
  308. package/template/packages/db/src/migration-guard.ts +51 -0
  309. package/template/packages/db/src/new-migration.test.ts +16 -0
  310. package/template/packages/db/src/scope.ts +38 -0
  311. package/template/packages/db/src/seed.ts +30 -0
  312. package/template/packages/db/src/sql.ts +42 -0
  313. package/template/packages/db/tsconfig.json +8 -0
  314. package/template/packages/shared/components.json +21 -0
  315. package/template/packages/shared/package.json +33 -0
  316. package/template/packages/shared/src/edge/origins.ts +20 -0
  317. package/template/packages/shared/src/edge/turnstile.ts +11 -0
  318. package/template/packages/shared/src/locales.ts +13 -0
  319. package/template/packages/shared/src/message-rules.ts +16 -0
  320. package/template/packages/shared/src/messages.test.ts +26 -0
  321. package/template/packages/shared/src/messages.ts +30 -0
  322. package/template/packages/shared/src/observability/build-release.ts +9 -0
  323. package/template/packages/shared/src/observability/error-reporting.ts +31 -0
  324. package/template/packages/shared/src/observability/error-tunnel.ts +20 -0
  325. package/template/packages/shared/src/observability/sentry-browser.ts +1 -0
  326. package/template/packages/shared/src/observability/server-errors.ts +74 -0
  327. package/template/packages/shared/src/project.ts +1 -0
  328. package/template/packages/shared/src/styles/rc-theme.css +138 -0
  329. package/template/packages/shared/src/styles/theme.css +9 -0
  330. package/template/packages/shared/tsconfig.json +10 -0
  331. package/template/rc.config.json +25 -0
  332. package/template/scripts/bootstrap-local.ts +42 -0
  333. package/template/tsconfig.base.json +20 -0
  334. package/template/tsconfig.json +8 -0
  335. package/template/tsconfig.worker.json +7 -0
  336. package/template/turbo.json +40 -0
  337. package/template/vite.config.ts +8 -0
@@ -0,0 +1,109 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "dev-toolbar",
4
+ "title": "Dev Toolbar",
5
+ "description": "Barre de dev flottante (local uniquement) : boîte mail de dev qui capture les e-mails, liens d'action en un clic, environnement, onglets de projet dans `project-dev-toolbar.tsx`, hors du build de production.",
6
+ "dependencies": [
7
+ "@tanstack/react-query@^5.107.1",
8
+ "lucide-react@^1.71.0",
9
+ "sonner@^2.0.8"
10
+ ],
11
+ "registryDependencies": [
12
+ "@rc/dev-tools-contract",
13
+ "@rc/query-view",
14
+ "@rc/skeleton",
15
+ "@rc/spinner",
16
+ "@rc/tooltip",
17
+ "@rc/ui-labels",
18
+ "@rc/utils"
19
+ ],
20
+ "files": [
21
+ {
22
+ "path": "src/blocks/dev-toolbar/dev-toolbar.tsx",
23
+ "content": "import { type CSSProperties, type ReactNode, useMemo, useState } from \"react\"\nimport { DevToolsClientContext } from \"@/components/dev-toolbar/dev-toolbar-context\"\nimport { DevToolbarLauncher } from \"@/components/dev-toolbar/dev-toolbar-launcher\"\nimport { DevToolbarPanel } from \"@/components/dev-toolbar/dev-toolbar-panel\"\nimport type { DevToolbarExtension } from \"@/components/dev-toolbar/dev-toolbar-types\"\nimport { useDevInbox } from \"@/hooks/use-dev-inbox\"\nimport { useDevToolbarState } from \"@/hooks/use-dev-toolbar-state\"\nimport { createDevToolsClient } from \"@/lib/dev-tools-client\"\nimport {\n DEV_API_PREFIX,\n type DevEnvironmentEntry,\n} from \"@/lib/dev-tools-contract\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface DevToolbarProps {\n /** Where the `/api/dev/*` routes live; \"/api/v1/dev\" for a versioned API. */\n apiBase?: string\n /** Room kept under the toolbar below `lg`, such as a mobile tab bar: \"4rem\", \"var(--spacing-tabbar)\". */\n bottomOffset?: string\n className?: string\n /** Room kept under the toolbar from `lg` up, such as a sticky save bar. */\n desktopBottomOffset?: string\n /** Buttons under the environment table: send a sign-in link, run the crons. */\n environmentActions?: ReactNode\n /** Rows only the browser knows, such as the signed-in account. */\n environmentEntries?: readonly DevEnvironmentEntry[]\n extensions?: readonly DevToolbarExtension[]\n /** Sits left of the launcher: a \"stop impersonating\" button, a role badge. */\n launcherAddon?: ReactNode\n}\n\n/** The floating dev toolbox: the mailbox every local e-mail lands in, the environment, and project tabs. Local only. */\nexport function DevToolbar({\n apiBase = DEV_API_PREFIX,\n bottomOffset = \"0px\",\n className,\n desktopBottomOffset = \"0px\",\n environmentActions,\n environmentEntries,\n extensions = [],\n launcherAddon,\n}: DevToolbarProps) {\n const client = useMemo(() => createDevToolsClient(apiBase), [apiBase])\n const { open, setOpen, setTab, tab } = useDevToolbarState()\n const [selectedMessageId, setSelectedMessageId] = useState<string | null>(\n null\n )\n const inbox = useDevInbox(client)\n const offsets = {\n \"--rc-dev-toolbar-offset\": bottomOffset,\n \"--rc-dev-toolbar-offset-lg\": desktopBottomOffset,\n } as CSSProperties\n\n return (\n <DevToolsClientContext.Provider value={client}>\n <div\n className={cn(\n \"pointer-events-none fixed inset-x-3 bottom-[calc(var(--rc-dev-toolbar-offset)+env(safe-area-inset-bottom)+0.75rem)] z-30 flex flex-col items-end gap-2 sm:inset-x-auto sm:right-4 sm:w-[min(56rem,calc(100vw-2rem))] lg:bottom-[calc(var(--rc-dev-toolbar-offset-lg)+1rem)]\",\n className\n )}\n data-dev-toolbar=\"\"\n style={offsets}\n >\n {open ? (\n <DevToolbarPanel\n environmentActions={environmentActions}\n environmentEntries={environmentEntries}\n extensions={extensions}\n inbox={inbox}\n onSelectMessage={setSelectedMessageId}\n onTabChange={setTab}\n selectedMessageId={selectedMessageId}\n tab={tab}\n />\n ) : null}\n <DevToolbarLauncher\n addon={launcherAddon}\n onOpenChange={setOpen}\n open={open}\n unreadCount={inbox.unreadCount}\n />\n </div>\n </DevToolsClientContext.Provider>\n )\n}\n",
24
+ "type": "registry:component",
25
+ "target": "~/src/components/dev-toolbar/dev-toolbar.tsx"
26
+ },
27
+ {
28
+ "path": "src/blocks/dev-toolbar/dev-toolbar-context.ts",
29
+ "content": "import { createContext, useContext } from \"react\"\nimport {\n createDevToolsClient,\n type DevToolsClient,\n} from \"@/lib/dev-tools-client\"\n\nexport const DevToolsClientContext = createContext<DevToolsClient>(\n createDevToolsClient()\n)\n\nexport function useDevToolsClient(): DevToolsClient {\n return useContext(DevToolsClientContext)\n}\n",
30
+ "type": "registry:component",
31
+ "target": "~/src/components/dev-toolbar/dev-toolbar-context.ts"
32
+ },
33
+ {
34
+ "path": "src/blocks/dev-toolbar/dev-toolbar-types.ts",
35
+ "content": "import type { LucideIcon } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\n\n/** A project-specific tab: account switching, simulated inbound messages, a job runner. */\nexport interface DevToolbarExtension {\n count?: number\n icon: LucideIcon\n id: string\n label: string\n panel: ReactNode\n}\n",
36
+ "type": "registry:component",
37
+ "target": "~/src/components/dev-toolbar/dev-toolbar-types.ts"
38
+ },
39
+ {
40
+ "path": "src/blocks/dev-toolbar/dev-toolbar-launcher.tsx",
41
+ "content": "import { Wrench, X } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\nimport { useUiLabels } from \"@/lib/ui-labels\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface DevToolbarLauncherProps {\n addon?: ReactNode\n onOpenChange: (open: boolean) => void\n open: boolean\n unreadCount: number\n}\n\nexport function DevToolbarLauncher({\n addon,\n onOpenChange,\n open,\n unreadCount,\n}: DevToolbarLauncherProps) {\n const labels = useUiLabels().devToolbar\n\n return (\n <div className=\"pointer-events-auto flex max-w-full items-center gap-2\">\n {addon}\n <button\n aria-expanded={open}\n aria-label={open ? labels.close : labels.open}\n className={cn(\n \"relative flex min-h-11 items-center gap-2 rounded-full bg-night px-4 text-sm font-semibold text-chalk shadow-lg transition-colors hover:bg-night-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent\",\n open && \"bg-accent text-accent-ink hover:bg-accent-deep\"\n )}\n onClick={() => onOpenChange(!open)}\n type=\"button\"\n >\n {open ? (\n <X aria-hidden=\"true\" className=\"size-4\" />\n ) : (\n <Wrench aria-hidden=\"true\" className=\"size-4\" />\n )}\n {labels.launcher}\n {unreadCount > 0 && !open ? (\n <span className=\"grid min-w-5 place-items-center rounded-full bg-accent px-1.5 text-xs leading-5 text-accent-ink\">\n {unreadCount}\n </span>\n ) : null}\n </button>\n </div>\n )\n}\n",
42
+ "type": "registry:component",
43
+ "target": "~/src/components/dev-toolbar/dev-toolbar-launcher.tsx"
44
+ },
45
+ {
46
+ "path": "src/blocks/dev-toolbar/dev-toolbar-panel.tsx",
47
+ "content": "import { Inbox, Settings2 } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\nimport { DevToolbarEnvironmentPanel } from \"@/components/dev-toolbar/dev-toolbar-environment-panel\"\nimport { DevToolbarInboxPanel } from \"@/components/dev-toolbar/dev-toolbar-inbox-panel\"\nimport type { DevToolbarExtension } from \"@/components/dev-toolbar/dev-toolbar-types\"\nimport type { DevInbox } from \"@/hooks/use-dev-inbox\"\nimport type { DevEnvironmentEntry } from \"@/lib/dev-tools-contract\"\nimport { useUiLabels } from \"@/lib/ui-labels\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface DevToolbarPanelProps {\n environmentActions?: ReactNode\n environmentEntries?: readonly DevEnvironmentEntry[]\n extensions: readonly DevToolbarExtension[]\n inbox: DevInbox\n onSelectMessage: (id: string | null) => void\n onTabChange: (tab: string) => void\n selectedMessageId: string | null\n tab: string\n}\n\nexport function DevToolbarPanel({\n environmentActions,\n environmentEntries,\n extensions,\n inbox,\n onSelectMessage,\n onTabChange,\n selectedMessageId,\n tab,\n}: DevToolbarPanelProps) {\n const labels = useUiLabels().devToolbar\n const tabs: DevToolbarExtension[] = [\n {\n count: inbox.unreadCount,\n icon: Inbox,\n id: \"inbox\",\n label: labels.inbox,\n panel: (\n <DevToolbarInboxPanel\n inbox={inbox}\n onSelectMessage={onSelectMessage}\n selectedMessageId={selectedMessageId}\n />\n ),\n },\n ...extensions,\n {\n icon: Settings2,\n id: \"environment\",\n label: labels.environment,\n panel: (\n <DevToolbarEnvironmentPanel\n actions={environmentActions}\n entries={environmentEntries}\n />\n ),\n },\n ]\n const active = tabs.find((entry) => entry.id === tab) ?? tabs[0]\n\n return (\n <section\n aria-label={labels.title}\n className=\"reveal pointer-events-auto flex h-[70dvh] max-h-176 w-full flex-col overflow-hidden rounded-lg border border-night-line bg-night text-chalk shadow-2xl\"\n >\n <div className=\"flex border-b border-night-line\" role=\"tablist\">\n {tabs.map((entry) => {\n const selected = entry.id === active?.id\n\n return (\n <button\n aria-selected={selected}\n className={cn(\n \"relative flex min-h-11 flex-1 items-center justify-center gap-2 text-xs font-semibold uppercase tracking-wider text-chalk-2 transition-colors hover:text-chalk focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-chalk\",\n selected &&\n \"text-chalk after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-accent\"\n )}\n key={entry.id}\n onClick={() => onTabChange(entry.id)}\n role=\"tab\"\n type=\"button\"\n >\n <entry.icon aria-hidden=\"true\" className=\"size-4\" />\n <span className=\"max-sm:sr-only\">{entry.label}</span>\n {entry.count ? (\n <span className=\"grid min-w-5 place-items-center rounded-full bg-accent px-1 text-xs leading-5 tracking-normal text-accent-ink\">\n {entry.count}\n </span>\n ) : null}\n </button>\n )\n })}\n </div>\n <div className=\"min-h-0 flex-1\" role=\"tabpanel\">\n {active?.panel}\n </div>\n </section>\n )\n}\n",
48
+ "type": "registry:component",
49
+ "target": "~/src/components/dev-toolbar/dev-toolbar-panel.tsx"
50
+ },
51
+ {
52
+ "path": "src/blocks/dev-toolbar/dev-toolbar-environment-panel.tsx",
53
+ "content": "import { useQuery, useQueryClient } from \"@tanstack/react-query\"\nimport { DatabaseZap, ExternalLink } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\nimport { useDevToolsClient } from \"@/components/dev-toolbar/dev-toolbar-context\"\nimport { QueryView } from \"@/components/ui/query-view\"\nimport { Skeleton } from \"@/components/ui/skeleton\"\nimport type { DevEnvironmentEntry } from \"@/lib/dev-tools-contract\"\nimport { useUiLabels } from \"@/lib/ui-labels\"\n\nexport const DEV_ACTION_CLASS_NAME =\n \"inline-flex min-h-10 items-center gap-2 rounded-md border border-night-line px-3 text-sm font-medium text-chalk transition-colors hover:bg-chalk hover:text-ink focus-visible:outline-2 focus-visible:outline-chalk disabled:opacity-50\"\n\nfunction Row({ label, children }: { children: ReactNode; label: string }) {\n return (\n <div className=\"flex items-baseline justify-between gap-4 border-b border-night-line py-2.5 text-sm\">\n <dt className=\"shrink-0 text-xs font-semibold uppercase tracking-wider text-chalk-2\">\n {label}\n </dt>\n <dd className=\"min-w-0 truncate text-right font-mono text-xs\">\n {children}\n </dd>\n </div>\n )\n}\n\nconst ROW_PLACEHOLDERS = [\"a\", \"b\", \"c\", \"d\", \"e\"]\n\nfunction EnvironmentPending() {\n return (\n <div className=\"flex flex-col p-4\">\n {ROW_PLACEHOLDERS.map((key) => (\n <div\n className=\"flex items-center justify-between gap-4 border-b border-night-line py-3\"\n key={key}\n >\n <Skeleton className=\"h-3 w-24\" tone=\"dark\" />\n <Skeleton className=\"h-3.5 w-40 max-w-[50%]\" tone=\"dark\" />\n </div>\n ))}\n </div>\n )\n}\n\nexport function DevToolbarEnvironmentPanel({\n actions,\n entries = [],\n}: {\n actions?: ReactNode\n /** Rows only the browser knows, such as the signed-in account; shown after the server's. */\n entries?: readonly DevEnvironmentEntry[]\n}) {\n const labels = useUiLabels().devToolbar\n const client = useDevToolsClient()\n const queryClient = useQueryClient()\n const environment = useQuery({\n queryFn: client.environment,\n queryKey: client.queryKeys.environment,\n retry: false,\n throwOnError: false,\n })\n\n return (\n <QueryView\n errorProps={{ message: labels.unavailable(client.base), tone: \"dark\" }}\n pending={<EnvironmentPending />}\n query={environment}\n >\n {(env) => (\n <div className=\"flex h-full min-h-0 flex-col gap-6 overflow-y-auto p-4\">\n <dl>\n <Row label={labels.environmentName}>\n <span className=\"rounded-sm bg-accent px-1.5 py-0.5 text-accent-ink\">\n {env.environment}\n </span>\n </Row>\n {[...env.entries, ...entries].map((entry) => (\n <Row key={entry.label} label={entry.label}>\n {entry.value}\n </Row>\n ))}\n </dl>\n <div className=\"flex flex-wrap gap-2\">\n {actions}\n <button\n className={DEV_ACTION_CLASS_NAME}\n onClick={() => queryClient.clear()}\n type=\"button\"\n >\n <DatabaseZap aria-hidden=\"true\" className=\"size-4\" />\n {labels.clearCache}\n </button>\n {env.links.map((link) => (\n <a\n className={DEV_ACTION_CLASS_NAME}\n href={link.href}\n key={link.href}\n rel=\"noopener\"\n target=\"_blank\"\n >\n <ExternalLink aria-hidden=\"true\" className=\"size-4\" />\n {link.label}\n </a>\n ))}\n </div>\n </div>\n )}\n </QueryView>\n )\n}\n",
54
+ "type": "registry:component",
55
+ "target": "~/src/components/dev-toolbar/dev-toolbar-environment-panel.tsx"
56
+ },
57
+ {
58
+ "path": "src/blocks/dev-toolbar/dev-toolbar-inbox-panel.tsx",
59
+ "content": "import { useMutation, useQueryClient } from \"@tanstack/react-query\"\nimport { Inbox, Trash2 } from \"lucide-react\"\nimport { toast } from \"sonner\"\nimport { useDevToolsClient } from \"@/components/dev-toolbar/dev-toolbar-context\"\nimport { DevToolbarInboxList } from \"@/components/dev-toolbar/dev-toolbar-inbox-list\"\nimport { DevToolbarInboxMessage } from \"@/components/dev-toolbar/dev-toolbar-inbox-message\"\nimport { QueryView } from \"@/components/ui/query-view\"\nimport { Skeleton } from \"@/components/ui/skeleton\"\nimport { Spinner } from \"@/components/ui/spinner\"\nimport { Tooltip } from \"@/components/ui/tooltip\"\nimport type { DevInbox } from \"@/hooks/use-dev-inbox\"\nimport { useUiLabels } from \"@/lib/ui-labels\"\nimport { cn } from \"@/lib/utils\"\n\nconst MESSAGE_PLACEHOLDERS = [\"a\", \"b\", \"c\", \"d\"]\n\nfunction InboxPending() {\n return (\n <div className=\"flex flex-col md:w-72 md:border-r md:border-night-line\">\n {MESSAGE_PLACEHOLDERS.map((key) => (\n <div\n className=\"flex flex-col gap-2 border-b border-night-line px-4 py-3\"\n key={key}\n >\n <Skeleton className=\"h-3.5 w-44 max-w-full\" tone=\"dark\" />\n <Skeleton className=\"h-3 w-28\" tone=\"dark\" />\n </div>\n ))}\n </div>\n )\n}\n\nexport interface DevToolbarInboxPanelProps {\n inbox: DevInbox\n onSelectMessage: (id: string | null) => void\n selectedMessageId: string | null\n}\n\nexport function DevToolbarInboxPanel({\n inbox,\n onSelectMessage,\n selectedMessageId,\n}: DevToolbarInboxPanelProps) {\n const labels = useUiLabels().devToolbar\n const client = useDevToolsClient()\n const queryClient = useQueryClient()\n const clear = useMutation({\n mutationFn: client.clearInbox,\n onError: () => toast.error(labels.inboxClearFailed),\n onSuccess: async () => {\n onSelectMessage(null)\n await queryClient.invalidateQueries({ queryKey: client.queryKeys.inbox })\n },\n })\n const visibleId = inbox.messages.some(\n (message) => message.id === selectedMessageId\n )\n ? selectedMessageId\n : null\n\n return (\n <QueryView\n className=\"h-full\"\n empty={\n <div className=\"flex h-full flex-col items-center justify-center gap-3 p-6 text-center\">\n <span className=\"grid size-12 place-items-center rounded-md border border-dashed border-night-line text-chalk-2\">\n <Inbox aria-hidden=\"true\" className=\"size-5\" />\n </span>\n <p className=\"text-base font-semibold\">{labels.inboxEmptyTitle}</p>\n <p className=\"max-w-xs text-sm text-chalk-2\">\n {labels.inboxEmptyBody}\n </p>\n </div>\n }\n errorProps={{\n message: labels.unavailable(`${client.base}/inbox`),\n tone: \"dark\",\n }}\n pending={<InboxPending />}\n query={inbox.query}\n >\n {(messages) => (\n <div className=\"grid h-full min-h-0 md:grid-cols-[18rem_minmax(0,1fr)]\">\n <section\n className={cn(\n \"flex min-h-0 flex-col md:border-r md:border-night-line\",\n visibleId && \"hidden md:flex\"\n )}\n >\n <header className=\"flex h-11 shrink-0 items-center justify-between gap-2 border-b border-night-line pr-1 pl-4\">\n <span className=\"text-xs font-semibold uppercase tracking-wider text-chalk-2\">\n {labels.inboxCount(messages.length)}\n </span>\n <Tooltip label={labels.inboxClear}>\n <button\n className=\"grid size-9 place-items-center rounded-sm text-chalk-2 transition-colors hover:text-danger focus-visible:outline-2 focus-visible:outline-chalk\"\n disabled={clear.isPending}\n onClick={() => clear.mutate()}\n type=\"button\"\n >\n {clear.isPending ? (\n <Spinner />\n ) : (\n <Trash2 aria-hidden=\"true\" className=\"size-4\" />\n )}\n </button>\n </Tooltip>\n </header>\n <DevToolbarInboxList\n messages={messages}\n onSelectMessage={onSelectMessage}\n selectedMessageId={visibleId}\n />\n </section>\n {visibleId ? (\n <DevToolbarInboxMessage\n id={visibleId}\n key={visibleId}\n onClose={() => onSelectMessage(null)}\n />\n ) : (\n <p className=\"hidden items-center justify-center p-6 text-sm text-chalk-2 md:flex\">\n {labels.inboxSelect}\n </p>\n )}\n </div>\n )}\n </QueryView>\n )\n}\n",
60
+ "type": "registry:component",
61
+ "target": "~/src/components/dev-toolbar/dev-toolbar-inbox-panel.tsx"
62
+ },
63
+ {
64
+ "path": "src/blocks/dev-toolbar/dev-toolbar-inbox-list.tsx",
65
+ "content": "import { useMemo } from \"react\"\nimport type { DevInboxSummary } from \"@/lib/dev-tools-contract\"\nimport { useUiLabels } from \"@/lib/ui-labels\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface DevToolbarInboxListProps {\n messages: DevInboxSummary[]\n onSelectMessage: (id: string) => void\n selectedMessageId: string | null\n}\n\nexport function DevToolbarInboxList({\n messages,\n onSelectMessage,\n selectedMessageId,\n}: DevToolbarInboxListProps) {\n const { locale } = useUiLabels()\n const timeFormat = useMemo(\n () =>\n new Intl.DateTimeFormat(locale, { hour: \"2-digit\", minute: \"2-digit\" }),\n [locale]\n )\n\n return (\n <ul className=\"min-h-0 flex-1 overflow-y-auto\">\n {messages.map((message) => (\n <li key={message.id}>\n <button\n className={cn(\n \"flex w-full flex-col gap-1 border-b border-night-line px-4 py-3 text-left transition-colors hover:bg-night-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-chalk\",\n message.id === selectedMessageId && \"bg-night-2\"\n )}\n onClick={() => onSelectMessage(message.id)}\n type=\"button\"\n >\n <span className=\"flex w-full items-center gap-2\">\n {message.readAt ? null : (\n <span\n aria-hidden=\"true\"\n className=\"size-1.5 shrink-0 rounded-full bg-accent\"\n />\n )}\n <span className=\"min-w-0 flex-1 truncate text-sm font-semibold\">\n {message.subject}\n </span>\n <span className=\"shrink-0 text-xs tabular-nums text-chalk-2\">\n {timeFormat.format(new Date(message.receivedAt))}\n </span>\n </span>\n <span className=\"w-full truncate text-xs text-chalk-2\">\n {message.to}\n </span>\n </button>\n </li>\n ))}\n </ul>\n )\n}\n",
66
+ "type": "registry:component",
67
+ "target": "~/src/components/dev-toolbar/dev-toolbar-inbox-list.tsx"
68
+ },
69
+ {
70
+ "path": "src/blocks/dev-toolbar/dev-toolbar-inbox-message.tsx",
71
+ "content": "import { useQuery, useQueryClient } from \"@tanstack/react-query\"\nimport { ArrowLeft, ExternalLink } from \"lucide-react\"\nimport { useEffect, useMemo } from \"react\"\nimport { useDevToolsClient } from \"@/components/dev-toolbar/dev-toolbar-context\"\nimport { QueryView } from \"@/components/ui/query-view\"\nimport { Skeleton } from \"@/components/ui/skeleton\"\nimport { Tooltip } from \"@/components/ui/tooltip\"\nimport { extractActionLinks } from \"@/lib/dev-inbox-links\"\nimport { useUiLabels } from \"@/lib/ui-labels\"\n\nfunction MessagePending() {\n return (\n <div className=\"flex flex-col\">\n <div className=\"flex flex-col gap-2 border-b border-night-line p-3\">\n <Skeleton className=\"h-3.5 w-56 max-w-full\" tone=\"dark\" />\n <Skeleton className=\"h-3 w-40 max-w-full\" tone=\"dark\" />\n </div>\n <div className=\"flex flex-col gap-2 p-4\">\n <Skeleton className=\"h-3 w-full\" tone=\"dark\" />\n <Skeleton className=\"h-3 w-11/12\" tone=\"dark\" />\n <Skeleton className=\"h-3 w-2/3\" tone=\"dark\" />\n </div>\n </div>\n )\n}\n\nexport interface DevToolbarInboxMessageProps {\n id: string\n onClose: () => void\n}\n\nexport function DevToolbarInboxMessage({\n id,\n onClose,\n}: DevToolbarInboxMessageProps) {\n const { devToolbar: labels, locale } = useUiLabels()\n const client = useDevToolsClient()\n const queryClient = useQueryClient()\n const message = useQuery({\n queryFn: () => client.inboxMessage(id),\n queryKey: client.queryKeys.inboxMessage(id),\n retry: false,\n throwOnError: false,\n })\n const mail = message.data\n const actionLinks = useMemo(\n () => (mail ? extractActionLinks(mail.html, mail.text) : []),\n [mail]\n )\n const timeFormat = useMemo(\n () =>\n new Intl.DateTimeFormat(locale, {\n dateStyle: \"short\",\n timeStyle: \"short\",\n }),\n [locale]\n )\n\n useEffect(() => {\n if (mail && !mail.readAt) {\n void client\n .markRead(mail.id)\n .then(() =>\n queryClient.invalidateQueries({ queryKey: client.queryKeys.inbox })\n )\n }\n }, [mail, client, queryClient])\n\n return (\n <QueryView\n errorProps={{ tone: \"dark\" }}\n pending={<MessagePending />}\n query={message}\n >\n {(loaded) => (\n <article className=\"flex min-h-0 flex-col\">\n <header className=\"flex items-start gap-2 border-b border-night-line p-3\">\n <Tooltip label={labels.inboxBack}>\n <button\n className=\"grid size-9 shrink-0 place-items-center rounded-sm text-chalk-2 hover:text-chalk md:hidden\"\n onClick={onClose}\n type=\"button\"\n >\n <ArrowLeft aria-hidden=\"true\" className=\"size-4\" />\n </button>\n </Tooltip>\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <h3 className=\"truncate text-sm font-semibold\">\n {loaded.subject}\n </h3>\n <p className=\"truncate text-xs text-chalk-2\">\n {labels.inboxTo} {loaded.to} ·{\" \"}\n {timeFormat.format(new Date(loaded.receivedAt))}\n </p>\n </div>\n </header>\n {actionLinks.length > 0 ? (\n <div className=\"flex flex-wrap gap-2 border-b border-night-line p-3\">\n {actionLinks.map((link) => (\n <a\n className=\"inline-flex min-h-9 items-center gap-2 rounded-md bg-accent px-3 text-sm font-medium text-accent-ink transition-colors hover:bg-accent-deep\"\n href={link.href}\n key={link.href}\n >\n <ExternalLink aria-hidden=\"true\" className=\"size-4\" />\n {link.label}\n </a>\n ))}\n </div>\n ) : null}\n <iframe\n className=\"min-h-0 w-full flex-1 bg-surface\"\n sandbox=\"allow-popups allow-popups-to-escape-sandbox\"\n src={client.inboxMessageHtmlUrl(loaded.id)}\n title={loaded.subject}\n />\n </article>\n )}\n </QueryView>\n )\n}\n",
72
+ "type": "registry:component",
73
+ "target": "~/src/components/dev-toolbar/dev-toolbar-inbox-message.tsx"
74
+ },
75
+ {
76
+ "path": "src/blocks/dev-toolbar/development-devtools.tsx",
77
+ "content": "import { lazy, Suspense, useSyncExternalStore } from \"react\"\nimport type { DevToolbarProps } from \"@/components/dev-toolbar/dev-toolbar\"\n\n// Folded to nothing in production builds, so the toolbar chunk (with the project's own panels) is never emitted.\nconst ProjectDevToolbar = import.meta.env.DEV\n ? lazy(() =>\n import(\"@/components/dev-toolbar/project-dev-toolbar\").then((module) => ({\n default: module.ProjectDevToolbar,\n }))\n )\n : () => null\n\nconst noSubscription = () => () => undefined\n\n/** Mount once in the root layout, inside the QueryClientProvider; renders nothing outside `vite dev`. */\nexport function DevelopmentDevtools(props: DevToolbarProps) {\n const mounted = useSyncExternalStore(\n noSubscription,\n () => true,\n () => false\n )\n\n if (!(import.meta.env.DEV && mounted)) {\n return null\n }\n\n return (\n <Suspense fallback={null}>\n <ProjectDevToolbar {...props} />\n </Suspense>\n )\n}\n",
78
+ "type": "registry:component",
79
+ "target": "~/src/components/dev-toolbar/development-devtools.tsx"
80
+ },
81
+ {
82
+ "path": "src/blocks/dev-toolbar/project-dev-toolbar.tsx",
83
+ "content": "import {\n DevToolbar,\n type DevToolbarProps,\n} from \"@/components/dev-toolbar/dev-toolbar\"\n\n/** The project's own toolbar: add its panels, actions and entries here, they stay out of production builds. */\nexport function ProjectDevToolbar(props: DevToolbarProps) {\n return <DevToolbar {...props} />\n}\n",
84
+ "type": "registry:component",
85
+ "target": "~/src/components/dev-toolbar/project-dev-toolbar.tsx"
86
+ },
87
+ {
88
+ "path": "src/hooks/use-dev-inbox.ts",
89
+ "content": "import { useQuery } from \"@tanstack/react-query\"\nimport { useMemo } from \"react\"\nimport type { DevToolsClient } from \"@/lib/dev-tools-client\"\n\nconst POLL_MS = 2500\n\nexport function useDevInbox(client: DevToolsClient) {\n const query = useQuery({\n queryFn: client.inbox,\n queryKey: client.queryKeys.inbox,\n refetchInterval: POLL_MS,\n retry: false,\n throwOnError: false,\n })\n\n const messages = useMemo(() => query.data ?? [], [query.data])\n const unreadCount = useMemo(\n () => messages.filter((message) => !message.readAt).length,\n [messages]\n )\n\n return { messages, query, unreadCount }\n}\n\nexport type DevInbox = ReturnType<typeof useDevInbox>\n",
90
+ "type": "registry:hook"
91
+ },
92
+ {
93
+ "path": "src/hooks/use-dev-toolbar-state.ts",
94
+ "content": "import { useCallback, useEffect, useState } from \"react\"\n\nconst STORAGE_KEY = \"rc_dev_toolbar\"\n\ninterface DevToolbarState {\n open: boolean\n tab: string\n}\n\nconst DEFAULT_STATE: DevToolbarState = { open: false, tab: \"inbox\" }\n\nfunction readState(): DevToolbarState {\n try {\n const stored = JSON.parse(\n window.sessionStorage.getItem(STORAGE_KEY) ?? \"null\"\n ) as Partial<DevToolbarState> | null\n\n return {\n open: stored?.open === true,\n tab: typeof stored?.tab === \"string\" ? stored.tab : DEFAULT_STATE.tab,\n }\n } catch {\n return DEFAULT_STATE\n }\n}\n\n/** Signing in again reloads the page; the tab's session brings the toolbar back where it was. */\nexport function useDevToolbarState() {\n const [state, setState] = useState(readState)\n\n useEffect(() => {\n try {\n window.sessionStorage.setItem(STORAGE_KEY, JSON.stringify(state))\n } catch {\n // Storage can be unavailable (private mode); the toolbar still works.\n }\n }, [state])\n\n const setOpen = useCallback((open: boolean) => {\n setState((current) => ({ ...current, open }))\n }, [])\n\n const setTab = useCallback((tab: string) => {\n setState((current) => ({ ...current, tab }))\n }, [])\n\n return { open: state.open, setOpen, setTab, tab: state.tab }\n}\n",
95
+ "type": "registry:hook"
96
+ },
97
+ {
98
+ "path": "src/lib/dev-tools-client.ts",
99
+ "content": "import {\n DEV_API_PREFIX,\n DEV_ROUTES,\n type DevEnvironment,\n type DevInboxMessage,\n type DevInboxSummary,\n type DevOk,\n} from \"@/lib/dev-tools-contract\"\n\nexport class DevToolsRequestError extends Error {\n readonly status: number\n\n constructor(path: string, status: number) {\n super(`${path} → ${status}`)\n this.name = \"DevToolsRequestError\"\n this.status = status\n }\n}\n\nexport function createDevToolsClient(base: string = DEV_API_PREFIX) {\n const request = async <T>(path: string, method = \"GET\"): Promise<T> => {\n const response = await fetch(`${base}${path}`, {\n credentials: \"include\",\n headers: { accept: \"application/json\" },\n method,\n })\n\n if (!response.ok) {\n throw new DevToolsRequestError(path, response.status)\n }\n\n return (await response.json()) as T\n }\n\n return {\n base,\n clearInbox: () => request<DevOk>(DEV_ROUTES.inbox, \"DELETE\"),\n environment: () => request<DevEnvironment>(DEV_ROUTES.environment),\n inbox: () => request<DevInboxSummary[]>(DEV_ROUTES.inbox),\n inboxMessage: (id: string) =>\n request<DevInboxMessage>(DEV_ROUTES.inboxMessage(id)),\n inboxMessageHtmlUrl: (id: string) =>\n `${base}${DEV_ROUTES.inboxMessageHtml(id)}`,\n markRead: (id: string) =>\n request<DevOk>(DEV_ROUTES.inboxMessageRead(id), \"POST\"),\n queryKeys: {\n environment: [\"dev-tools\", base, \"environment\"] as const,\n inbox: [\"dev-tools\", base, \"inbox\"] as const,\n inboxMessage: (id: string) => [\"dev-tools\", base, \"inbox\", id] as const,\n },\n }\n}\n\nexport type DevToolsClient = ReturnType<typeof createDevToolsClient>\n",
100
+ "type": "registry:lib"
101
+ },
102
+ {
103
+ "path": "src/lib/dev-inbox-links.ts",
104
+ "content": "const ANCHOR_RE = /<a\\b[^>]*\\bhref\\s*=\\s*([\"'])(.*?)\\1[^>]*>([\\s\\S]*?)<\\/a>/gi\nconst TAG_RE = /<[^>]+>/g\nconst WHITESPACE_RE = /\\s+/g\nconst BARE_URL_RE = /https?:\\/\\/[^\\s\"'<>]+/g\nconst ACTION_PATH_RE =\n /\\/(auth|invitation|magic-link|verify|reset)\\b|[?&](token|code)=/i\nconst NUMERIC_ENTITY_RE = /&#(x[0-9a-f]+|\\d+);/gi\nconst MAX_ACTION_LINKS = 3\n\nexport interface DevInboxActionLink {\n href: string\n label: string\n}\n\nfunction decodeEntities(value: string): string {\n return value\n .replace(NUMERIC_ENTITY_RE, (_match, code: string) =>\n String.fromCodePoint(\n code.startsWith(\"x\") ? Number.parseInt(code.slice(1), 16) : Number(code)\n )\n )\n .replaceAll(\"&amp;\", \"&\")\n .replaceAll(\"&quot;\", '\"')\n .replaceAll(\"&#39;\", \"'\")\n .replaceAll(\"&lt;\", \"<\")\n .replaceAll(\"&gt;\", \">\")\n .replaceAll(\"&nbsp;\", \" \")\n}\n\nfunction toPlainText(html: string): string {\n return decodeEntities(html.replace(TAG_RE, \" \"))\n .replace(WHITESPACE_RE, \" \")\n .trim()\n}\n\n/** The buttons a mail asks its reader to press (sign-in, invitation, reset), so the toolbar opens them in one click. */\nexport function extractActionLinks(\n html: string | null,\n text: string\n): DevInboxActionLink[] {\n const links: DevInboxActionLink[] = []\n const seen = new Set<string>()\n\n const add = (href: string, label: string) => {\n if (\n !href.startsWith(\"http\") ||\n seen.has(href) ||\n !ACTION_PATH_RE.test(href)\n ) {\n return\n }\n\n seen.add(href)\n links.push({ href, label: label || href })\n }\n\n for (const match of (html ?? \"\").matchAll(ANCHOR_RE)) {\n add(decodeEntities(match[2] ?? \"\").trim(), toPlainText(match[3] ?? \"\"))\n }\n\n for (const match of text.matchAll(BARE_URL_RE)) {\n add(match[0], \"\")\n }\n\n return links.slice(0, MAX_ACTION_LINKS)\n}\n",
105
+ "type": "registry:lib"
106
+ }
107
+ ],
108
+ "type": "registry:block"
109
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "dev-tools-contract",
4
+ "title": "Dev Tools Contract",
5
+ "description": "Contrat typé des routes `/api/dev/*` (environnement, boîte mail de dev) partagé par la barre de dev et le plugin Elysia.",
6
+ "files": [
7
+ {
8
+ "path": "src/lib/dev-tools-contract.ts",
9
+ "content": "export const DEV_API_PREFIX = \"/api/dev\"\n\nexport const DEV_INBOX_KEY_PREFIX = \"dev-inbox/\"\n\nexport const DEV_ROUTES = {\n environment: \"/environment\",\n inbox: \"/inbox\",\n inboxMessage: (id: string) => `/inbox/${encodeURIComponent(id)}`,\n inboxMessageHtml: (id: string) => `/inbox/${encodeURIComponent(id)}/html`,\n inboxMessageRead: (id: string) => `/inbox/${encodeURIComponent(id)}/read`,\n} as const\n\nexport interface DevInboxSummary {\n id: string\n readAt: string | null\n receivedAt: string\n subject: string\n to: string\n}\n\nexport interface DevInboxMessage extends DevInboxSummary {\n html: string | null\n text: string\n}\n\nexport interface DevEnvironmentEntry {\n label: string\n value: string\n}\n\nexport interface DevLink {\n href: string\n label: string\n}\n\nexport interface DevEnvironment {\n /** The value of `ENVIRONMENT`: always \"local\" when the routes answer. */\n environment: string\n entries: DevEnvironmentEntry[]\n links: DevLink[]\n}\n\nexport interface DevOk {\n ok: true\n}\n\nexport interface OutgoingEmail {\n html?: string\n subject: string\n text: string\n to: string\n}\n",
10
+ "type": "registry:lib",
11
+ "target": "~/src/lib/dev-tools-contract.ts"
12
+ }
13
+ ],
14
+ "type": "registry:lib"
15
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "dialog",
4
+ "title": "Dialog",
5
+ "description": "Modale centrée Base UI Dialog avec titre, description, corps défilant et pied d'actions.",
6
+ "dependencies": [
7
+ "@base-ui/react@^1.9.0",
8
+ "lucide-react@^1.71.0"
9
+ ],
10
+ "registryDependencies": [
11
+ "@rc/tooltip",
12
+ "@rc/ui-labels",
13
+ "@rc/utils"
14
+ ],
15
+ "files": [
16
+ {
17
+ "path": "src/ui/dialog.tsx",
18
+ "content": "import { Dialog as BaseDialog } from \"@base-ui/react/dialog\"\nimport { X } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\nimport { Tooltip } from \"@/components/ui/tooltip\"\nimport { useUiLabels } from \"@/lib/ui-labels\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface DialogProps {\n children: ReactNode\n className?: string\n description?: string\n footer?: ReactNode\n onOpenChange: (open: boolean) => void\n open: boolean\n size?: \"sm\" | \"md\" | \"lg\"\n title: string\n}\n\nconst SIZES = {\n sm: \"max-w-sm\",\n md: \"max-w-lg\",\n lg: \"max-w-3xl\",\n} as const\n\n/** A centred modal for content that is not a form about one record (use `Sheet` / `FormSheet` for that). */\nexport function Dialog({\n open,\n onOpenChange,\n title,\n description,\n footer,\n size = \"md\",\n className,\n children,\n}: DialogProps) {\n const labels = useUiLabels()\n\n return (\n <BaseDialog.Root onOpenChange={onOpenChange} open={open}>\n <BaseDialog.Portal>\n <BaseDialog.Backdrop className=\"fixed inset-0 z-40 bg-night/50 backdrop-blur-xs transition-opacity duration-200 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0\" />\n <BaseDialog.Popup\n className={cn(\n \"fixed top-1/2 left-1/2 z-50 flex max-h-[min(90dvh,48rem)] w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-lg bg-surface shadow-2xl outline-none\",\n \"transition-[opacity,transform] duration-200 ease-out-expo data-[ending-style]:scale-96 data-[ending-style]:opacity-0 data-[starting-style]:scale-96 data-[starting-style]:opacity-0\",\n SIZES[size],\n className\n )}\n >\n <header className=\"flex items-start justify-between gap-4 px-5 pt-5 pb-3\">\n <div className=\"flex min-w-0 flex-col gap-1\">\n <BaseDialog.Title className=\"font-display text-lg font-semibold leading-tight text-ink\">\n {title}\n </BaseDialog.Title>\n {description ? (\n <BaseDialog.Description className=\"text-sm leading-snug text-ink-2\">\n {description}\n </BaseDialog.Description>\n ) : null}\n </div>\n <Tooltip label={labels.close}>\n <BaseDialog.Close className=\"-mt-1 -mr-2 grid size-9 shrink-0 place-items-center rounded-md text-ink-3 hover:bg-ink/5 hover:text-ink focus-visible:outline-2 focus-visible:outline-accent\">\n <X aria-hidden=\"true\" className=\"size-4\" />\n </BaseDialog.Close>\n </Tooltip>\n </header>\n <div className=\"min-h-0 flex-1 overflow-y-auto px-5 pb-5 text-sm text-ink\">\n {children}\n </div>\n {footer ? (\n <footer className=\"flex flex-wrap items-center justify-end gap-2 rounded-b-lg border-t border-line bg-paper px-5 py-3\">\n {footer}\n </footer>\n ) : null}\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n )\n}\n",
19
+ "type": "registry:ui"
20
+ }
21
+ ],
22
+ "type": "registry:ui"
23
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "empty-state",
4
+ "title": "Empty State",
5
+ "description": "État vide d'une liste : icône, titre, texte et actions, dans une carte ou encadré seul.",
6
+ "dependencies": [
7
+ "lucide-react@^1.71.0"
8
+ ],
9
+ "registryDependencies": [
10
+ "@rc/utils"
11
+ ],
12
+ "files": [
13
+ {
14
+ "path": "src/ui/empty-state.tsx",
15
+ "content": "import type { LucideIcon } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface EmptyStateProps {\n body?: string\n /** Actions under the text: create the first item, clear the filters. */\n children?: ReactNode\n className?: string\n /** Stands alone on the page in its own bordered surface instead of inside a card. */\n framed?: boolean\n icon: LucideIcon\n title: string\n}\n\nexport function EmptyState({\n icon: Icon,\n title,\n body,\n framed = false,\n className,\n children,\n}: EmptyStateProps) {\n return (\n <div\n className={cn(\n \"flex flex-col items-center gap-3 px-6 py-10 text-center\",\n framed && \"rounded-lg border border-line bg-surface\",\n className\n )}\n >\n <span className=\"grid size-12 place-items-center rounded-md border border-dashed border-line-strong text-ink-4\">\n <Icon aria-hidden=\"true\" className=\"size-5\" />\n </span>\n <p className=\"font-display text-base font-semibold text-ink\">{title}</p>\n {body ? <p className=\"max-w-xs text-sm text-ink-3\">{body}</p> : null}\n {children}\n </div>\n )\n}\n",
16
+ "type": "registry:ui"
17
+ }
18
+ ],
19
+ "type": "registry:ui"
20
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "error-state",
4
+ "title": "Error State",
5
+ "description": "Lecture en échec expliquée simplement (hors ligne, 403, 404, erreur) avec bouton Réessayer ; `ErrorReadersProvider` pour lire les erreurs du projet, détails techniques en dev, ton sombre.",
6
+ "dependencies": [
7
+ "lucide-react@^1.71.0"
8
+ ],
9
+ "registryDependencies": [
10
+ "@rc/retry-button",
11
+ "@rc/ui-labels",
12
+ "@rc/use-online",
13
+ "@rc/utils"
14
+ ],
15
+ "files": [
16
+ {
17
+ "path": "src/ui/error-state.tsx",
18
+ "content": "import {\n CircleAlert,\n type LucideIcon,\n SearchX,\n ShieldX,\n WifiOff,\n} from \"lucide-react\"\nimport { createContext, type ReactNode, useContext, useMemo } from \"react\"\nimport { RetryButton } from \"@/components/ui/retry-button\"\nimport { useOnline } from \"@/hooks/use-online\"\nimport { type UiLabels, useUiLabels } from \"@/lib/ui-labels\"\nimport { cn } from \"@/lib/utils\"\n\nexport type ErrorStateSize = \"section\" | \"page\"\n\nexport type ErrorKind = \"forbidden\" | \"notFound\" | \"error\"\n\nexport type ErrorStateTone = \"light\" | \"dark\"\n\nexport interface ErrorStateProps {\n className?: string\n /** Shows the error's stack under the message; on by default in dev builds. */\n details?: boolean\n error: unknown\n /** Overrides the kind the `ErrorReaders` read from the error. */\n kind?: ErrorKind\n /** A message meant for people; defaults to what `ErrorReaders.messageOf` finds, never on a refusal. */\n message?: string\n /** Tells the offline story even when the browser still claims a connection. */\n offline?: boolean\n onRetry?: () => void\n retrying?: boolean\n /** `section` sits inside a card; `page` stands alone in its own frame. */\n size?: ErrorStateSize\n title?: string\n /** `dark` sits on the `night` surfaces, such as the dev toolbar. */\n tone?: ErrorStateTone\n}\n\ninterface Explanation {\n body: string\n icon: LucideIcon\n retryable: boolean\n title: string\n}\n\nfunction statusOf(error: unknown): number | undefined {\n if (typeof error !== \"object\" || error === null) {\n return undefined\n }\n\n const status = (error as { status?: unknown }).status\n\n if (typeof status === \"number\") {\n return status\n }\n\n return statusOf((error as { cause?: unknown }).cause)\n}\n\n/** Reads `status` on the error or its `cause`, as Eden, fetch wrappers and most HTTP clients set it. */\nexport function errorKindOf(error: unknown): ErrorKind {\n const status = statusOf(error)\n\n if (status === 401 || status === 403) {\n return \"forbidden\"\n }\n\n return status === 404 ? \"notFound\" : \"error\"\n}\n\nexport interface ErrorReaders {\n kindOf: (error: unknown) => ErrorKind\n /** The API's own explanation, already in the user's language; `undefined` keeps the generic text. */\n messageOf: (error: unknown) => string | undefined\n}\n\nconst DEFAULT_ERROR_READERS: ErrorReaders = {\n kindOf: errorKindOf,\n messageOf: () => undefined,\n}\n\nconst ErrorReadersContext = createContext<ErrorReaders>(DEFAULT_ERROR_READERS)\n\n/** Teaches every `ErrorState` and `QueryView` the project's own error classes; unset readers keep the defaults. */\nexport function ErrorReadersProvider({\n readers,\n children,\n}: {\n children: ReactNode\n readers: Partial<ErrorReaders>\n}) {\n const value = useMemo(\n () => ({ ...DEFAULT_ERROR_READERS, ...readers }),\n [readers]\n )\n\n return (\n <ErrorReadersContext.Provider value={value}>\n {children}\n </ErrorReadersContext.Provider>\n )\n}\n\nexport function useErrorReaders(): ErrorReaders {\n return useContext(ErrorReadersContext)\n}\n\nfunction explain(\n kind: ErrorKind,\n online: boolean,\n labels: UiLabels,\n message: string | undefined\n): Explanation {\n if (!online) {\n return {\n body: labels.offlineBody,\n icon: WifiOff,\n retryable: true,\n title: labels.offlineTitle,\n }\n }\n\n if (kind === \"forbidden\") {\n return {\n body: message ?? labels.forbiddenBody,\n icon: ShieldX,\n retryable: false,\n title: labels.forbiddenTitle,\n }\n }\n\n if (kind === \"notFound\") {\n return {\n body: message ?? labels.notFoundBody,\n icon: SearchX,\n retryable: false,\n title: labels.notFoundTitle,\n }\n }\n\n return {\n body: message ?? labels.errorBody,\n icon: CircleAlert,\n retryable: true,\n title: labels.errorTitle,\n }\n}\n\nfunction describe(error: unknown): string {\n return error instanceof Error ? (error.stack ?? error.message) : String(error)\n}\n\n/** A read that failed: says why in plain words and offers to try again when it can help. */\nexport function ErrorState({\n error,\n kind,\n message,\n details = import.meta.env.DEV,\n offline = false,\n onRetry,\n retrying = false,\n size = \"section\",\n title,\n tone = \"light\",\n className,\n}: ErrorStateProps) {\n const labels = useUiLabels()\n const readers = useErrorReaders()\n const online = useOnline() && !offline\n const resolvedKind = kind ?? readers.kindOf(error)\n const explanation = explain(\n resolvedKind,\n online,\n labels,\n message ??\n (resolvedKind === \"forbidden\" ? undefined : readers.messageOf(error))\n )\n const Icon = explanation.icon\n const page = size === \"page\"\n const dark = tone === \"dark\"\n\n return (\n <div\n className={cn(\n \"reveal flex flex-col items-center gap-3 px-6 text-center\",\n page && \"rounded-lg border py-14 sm:py-20\",\n page &&\n (dark ? \"border-night-line bg-night-2\" : \"border-line bg-surface\"),\n !page && \"py-10\",\n className\n )}\n role=\"alert\"\n >\n <span\n className={cn(\n \"grid place-items-center rounded-md bg-danger-soft text-danger\",\n page ? \"size-14\" : \"size-12\"\n )}\n >\n <Icon aria-hidden=\"true\" className={page ? \"size-6\" : \"size-5\"} />\n </span>\n <p\n className={cn(\n \"font-display font-semibold\",\n dark ? \"text-chalk\" : \"text-ink\",\n page ? \"text-2xl\" : \"text-base\"\n )}\n >\n {title ?? explanation.title}\n </p>\n <p\n className={cn(\n \"max-w-sm text-sm leading-snug\",\n dark ? \"text-chalk-2\" : \"text-ink-3\"\n )}\n >\n {explanation.body}\n </p>\n {onRetry && explanation.retryable ? (\n <RetryButton\n className=\"mt-1\"\n onRetry={onRetry}\n retrying={retrying}\n size={page ? \"md\" : \"sm\"}\n />\n ) : null}\n {details && explanation.retryable && online && error ? (\n <details\n className={cn(\n \"mt-2 w-full max-w-xl rounded-md border text-left text-sm\",\n dark ? \"border-night-line text-chalk-2\" : \"border-line text-ink-2\"\n )}\n >\n <summary className=\"cursor-pointer px-4 py-2.5 text-xs font-semibold uppercase tracking-wider\">\n {labels.details}\n </summary>\n <pre className=\"overflow-x-auto px-4 pb-4 font-mono text-xs leading-relaxed\">\n {describe(error)}\n </pre>\n </details>\n ) : null}\n </div>\n )\n}\n",
19
+ "type": "registry:ui"
20
+ }
21
+ ],
22
+ "type": "registry:ui"
23
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "eyebrow",
4
+ "title": "Eyebrow",
5
+ "description": "Petite ligne en capitales au-dessus d'un titre ou d'une valeur.",
6
+ "registryDependencies": [
7
+ "@rc/utils"
8
+ ],
9
+ "files": [
10
+ {
11
+ "path": "src/ui/eyebrow.tsx",
12
+ "content": "import type { ReactNode } from \"react\"\nimport { cn } from \"@/lib/utils\"\n\nexport type EyebrowTone = \"muted\" | \"strong\" | \"accent\" | \"chalk\"\n\nconst TONES: Record<EyebrowTone, string> = {\n muted: \"text-ink-3\",\n strong: \"text-ink-2\",\n accent: \"text-accent\",\n chalk: \"text-chalk-2\",\n}\n\nexport function Eyebrow({\n children,\n tone = \"muted\",\n className,\n}: {\n children: ReactNode\n className?: string\n tone?: EyebrowTone\n}) {\n return (\n <span\n className={cn(\n \"text-xs font-semibold uppercase tracking-wider\",\n TONES[tone],\n className\n )}\n >\n {children}\n </span>\n )\n}\n",
13
+ "type": "registry:ui"
14
+ }
15
+ ],
16
+ "type": "registry:ui"
17
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "fab",
4
+ "title": "Fab",
5
+ "description": "Bouton d'action principal flottant sous le pouce sur mobile, masqué à partir de `lg`.",
6
+ "dependencies": [
7
+ "lucide-react@^1.71.0"
8
+ ],
9
+ "registryDependencies": [
10
+ "@rc/utils"
11
+ ],
12
+ "files": [
13
+ {
14
+ "path": "src/ui/fab.tsx",
15
+ "content": "import type { LucideIcon } from \"lucide-react\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface FabProps {\n className?: string\n icon: LucideIcon\n label: string\n onClick: () => void\n}\n\n/** The page's main action under the thumb on a phone; hidden from `lg` up, where the header shows it. */\nexport function Fab({ icon: Icon, label, onClick, className }: FabProps) {\n return (\n <button\n className={cn(\n \"fixed right-4 bottom-[calc(env(safe-area-inset-bottom)+1rem)] z-20 flex min-h-14 items-center gap-2 rounded-full bg-accent px-5 font-medium text-accent-ink shadow-lg transition-transform duration-200 ease-out-expo hover:bg-accent-deep focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent active:translate-y-px lg:hidden\",\n className\n )}\n onClick={onClick}\n type=\"button\"\n >\n <Icon aria-hidden=\"true\" className=\"size-5\" />\n {label}\n </button>\n )\n}\n",
16
+ "type": "registry:ui"
17
+ }
18
+ ],
19
+ "type": "registry:ui"
20
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "field-error",
4
+ "title": "Field Error",
5
+ "description": "Message d'erreur de champ en `role=alert`, couleur danger et icône.",
6
+ "dependencies": [
7
+ "lucide-react@^1.71.0"
8
+ ],
9
+ "files": [
10
+ {
11
+ "path": "src/ui/field-error.tsx",
12
+ "content": "import { CircleAlert } from \"lucide-react\"\n\nexport function FieldError({\n children,\n id,\n}: {\n children?: string | null\n id?: string\n}) {\n if (!children) {\n return null\n }\n\n return (\n <p\n className=\"flex items-start gap-1.5 text-sm font-medium leading-snug text-danger\"\n id={id}\n role=\"alert\"\n >\n <CircleAlert aria-hidden=\"true\" className=\"mt-0.5 size-3.5 shrink-0\" />\n {children}\n </p>\n )\n}\n",
13
+ "type": "registry:ui"
14
+ }
15
+ ],
16
+ "type": "registry:ui"
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "field-grid",
4
+ "title": "Field Grid",
5
+ "description": "Grille de champs côte à côte qui aligne libellés, contrôles et aides (subgrid), 2 à 4 colonnes.",
6
+ "registryDependencies": [
7
+ "@rc/utils"
8
+ ],
9
+ "files": [
10
+ {
11
+ "path": "src/ui/field-grid.tsx",
12
+ "content": "import type { ReactNode } from \"react\"\nimport { cn } from \"@/lib/utils\"\n\nconst COLUMNS = {\n 2: \"sm:grid-cols-2\",\n 3: \"sm:grid-cols-2 lg:grid-cols-3\",\n 4: \"grid-cols-2 lg:grid-cols-4\",\n} as const\n\nconst SHARED_ROWS =\n \"[&>*:not([data-inline-control])]:row-span-3 [&>*:not([data-inline-control])]:grid [&>*:not([data-inline-control])]:grid-rows-subgrid [&>*:not([data-inline-control])]:content-start [&>*:not([data-inline-control])]:gap-y-2\"\n\n/** Side-by-side fields share label, control and hint rows; checkboxes and switches keep their own. */\nexport function FieldGrid({\n children,\n columns = 2,\n className,\n}: {\n children: ReactNode\n className?: string\n columns?: keyof typeof COLUMNS\n}) {\n return (\n <div\n className={cn(\n \"grid gap-x-4 gap-y-5\",\n SHARED_ROWS,\n COLUMNS[columns],\n className\n )}\n >\n {children}\n </div>\n )\n}\n",
13
+ "type": "registry:ui"
14
+ }
15
+ ],
16
+ "type": "registry:ui"
17
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "field",
4
+ "title": "Field",
5
+ "description": "Champ de formulaire : libellé, contrôle, aide et erreur reliés par `aria-describedby` via contexte (id généré si besoin), mise en évidence d'une valeur pré-remplie ; exporte `FieldGroup`, `FieldHint`, `joinIds`.",
6
+ "registryDependencies": [
7
+ "@rc/field-error",
8
+ "@rc/label",
9
+ "@rc/utils"
10
+ ],
11
+ "files": [
12
+ {
13
+ "path": "src/ui/field.tsx",
14
+ "content": "import { createContext, type ReactNode, useContext, useId } from \"react\"\nimport { FieldError } from \"@/components/ui/field-error\"\nimport { Label, LABEL_CLASS_NAME } from \"@/components/ui/label\"\nimport { cn } from \"@/lib/utils\"\n\ninterface FieldControl {\n describedBy?: string\n id: string\n invalid: boolean\n label: string\n}\n\nconst FieldContext = createContext<FieldControl | null>(null)\n\n/** Lets a control inside a Field pick up its id, label, hint, error and invalid state without prop drilling. */\nexport function useFieldControl(id: string | undefined) {\n const field = useContext(FieldContext)\n\n if (!field || (id !== undefined && id !== field.id)) {\n return { describedBy: undefined, id, invalid: undefined, label: undefined }\n }\n\n return {\n describedBy: field.describedBy,\n id: field.id,\n invalid: field.invalid || undefined,\n label: field.label,\n }\n}\n\nexport function joinIds(...ids: (string | undefined)[]): string | undefined {\n const joined = ids.filter(Boolean).join(\" \")\n\n return joined || undefined\n}\n\nexport function FieldHint({\n children,\n id,\n}: {\n children: ReactNode\n id?: string\n}) {\n return (\n <p className=\"text-sm leading-snug text-ink-3\" id={id}>\n {children}\n </p>\n )\n}\n\nfunction FieldLabelRow({\n children,\n badge,\n}: {\n badge?: ReactNode\n children: ReactNode\n}) {\n if (!badge) {\n return children\n }\n\n return (\n <span className=\"flex min-w-0 items-center gap-2\">\n {children}\n {badge}\n </span>\n )\n}\n\nexport interface FieldProps {\n /** Sits at the end of the label row: a counter, a link, a small action. */\n action?: ReactNode\n /** Sits right after the label: a small badge that tells where the value came from. */\n badge?: ReactNode\n children: ReactNode\n className?: string\n error?: string | null\n /** Marks a value filled in for the user (an assistant, an import) until they edit it; styled by `rc-theme.css`. */\n highlight?: boolean\n hint?: ReactNode\n /** Defaults to a generated id that a control inside without its own `id` picks up. */\n htmlFor?: string\n label: string\n optional?: boolean\n required?: boolean\n}\n\nexport function Field({\n label,\n htmlFor,\n error,\n hint,\n action,\n badge,\n highlight = false,\n optional,\n required,\n children,\n className,\n}: FieldProps) {\n const generatedId = useId()\n const id = htmlFor ?? generatedId\n const hintId = hint ? `${id}-hint` : undefined\n const errorId = error ? `${id}-error` : undefined\n\n return (\n <FieldContext.Provider\n value={{\n describedBy: joinIds(errorId, hintId),\n id,\n invalid: Boolean(error),\n label,\n }}\n >\n <div\n className={cn(\"flex min-w-0 flex-col gap-2\", className)}\n data-field-highlight={highlight || undefined}\n >\n <div className=\"flex min-h-5 items-end justify-between gap-3\">\n <FieldLabelRow badge={badge}>\n <Label htmlFor={id} optional={optional} required={required}>\n {label}\n </Label>\n </FieldLabelRow>\n {action}\n </div>\n {children}\n {error || hint ? (\n <div className=\"flex flex-col gap-1\">\n <FieldError id={errorId}>{error}</FieldError>\n {hint ? <FieldHint id={hintId}>{hint}</FieldHint> : null}\n </div>\n ) : null}\n </div>\n </FieldContext.Provider>\n )\n}\n\nexport interface FieldGroupProps {\n badge?: ReactNode\n children: ReactNode\n className?: string\n highlight?: boolean\n hint?: ReactNode\n label: string\n}\n\n/** A titled group of inline controls (checkboxes, switches) that each carry their own label. */\nexport function FieldGroup({\n label,\n hint,\n badge,\n highlight = false,\n children,\n className,\n}: FieldGroupProps) {\n const labelId = useId()\n const hintId = useId()\n\n return (\n <div\n aria-describedby={hint ? hintId : undefined}\n aria-labelledby={labelId}\n className={cn(\"flex min-w-0 flex-col gap-2\", className)}\n data-field-highlight={highlight || undefined}\n role=\"group\"\n >\n <div className=\"flex min-h-5 items-end\">\n <FieldLabelRow badge={badge}>\n <span className={LABEL_CLASS_NAME} id={labelId}>\n {label}\n </span>\n </FieldLabelRow>\n </div>\n {children}\n {hint ? <FieldHint id={hintId}>{hint}</FieldHint> : null}\n </div>\n )\n}\n",
15
+ "type": "registry:ui"
16
+ }
17
+ ],
18
+ "type": "registry:ui"
19
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "file-picker",
4
+ "title": "File Picker",
5
+ "description": "Zone de dépôt / sélection de fichiers et liste des fichiers choisis, chacun retirable ; exporte `fileSizeLabel()`.",
6
+ "dependencies": [
7
+ "lucide-react@^1.71.0"
8
+ ],
9
+ "registryDependencies": [
10
+ "@rc/tooltip",
11
+ "@rc/ui-labels",
12
+ "@rc/utils"
13
+ ],
14
+ "files": [
15
+ {
16
+ "path": "src/ui/file-picker.tsx",
17
+ "content": "import { FileText, ImageIcon, Paperclip, X } from \"lucide-react\"\nimport { useState } from \"react\"\nimport { Tooltip } from \"@/components/ui/tooltip\"\nimport { useUiLabels } from \"@/lib/ui-labels\"\nimport { cn } from \"@/lib/utils\"\n\nconst KILOBYTE = 1024\n\nexport function fileSizeLabel(bytes: number, locale: string): string {\n const megabytes = bytes >= KILOBYTE * KILOBYTE\n\n return new Intl.NumberFormat(locale, {\n maximumFractionDigits: megabytes ? 1 : 0,\n style: \"unit\",\n unit: megabytes ? \"megabyte\" : \"kilobyte\",\n unitDisplay: \"short\",\n }).format(\n megabytes ? bytes / (KILOBYTE * KILOBYTE) : Math.max(1, bytes / KILOBYTE)\n )\n}\n\nfunction fileKey(file: File) {\n return `${file.name}-${file.size}-${file.lastModified}`\n}\n\n/** A drop zone and the list of picked files, each removable; the files stay in the caller's state. */\nexport function FilePicker({\n accept,\n capture,\n className,\n compact = false,\n files,\n id,\n multiple = false,\n onChange,\n}: {\n accept?: string\n capture?: \"environment\" | \"user\"\n className?: string\n compact?: boolean\n files: File[]\n id: string\n multiple?: boolean\n onChange: (files: File[]) => void\n}) {\n const labels = useUiLabels()\n const [dragging, setDragging] = useState(false)\n\n const add = (incoming: File[]) => {\n if (incoming.length === 0) {\n return\n }\n\n if (!multiple) {\n onChange(incoming.slice(0, 1))\n\n return\n }\n\n const known = new Set(files.map(fileKey))\n\n onChange([\n ...files,\n ...incoming.filter((file) => !known.has(fileKey(file))),\n ])\n }\n\n return (\n <div className={cn(\"flex flex-col gap-2\", className)}>\n <label\n className={cn(\n \"relative flex cursor-pointer items-center gap-3 rounded-md border border-dashed border-line-strong bg-surface px-4\",\n compact ? \"min-h-11 py-1.5\" : \"min-h-14 py-3\",\n \"transition-colors duration-200 hover:border-accent has-focus-visible:border-accent has-focus-visible:ring-3 has-focus-visible:ring-accent/20\",\n dragging && \"border-accent bg-accent-soft\"\n )}\n htmlFor={id}\n >\n <span\n className={cn(\n \"grid shrink-0 place-items-center rounded-sm bg-accent-soft text-accent-deep\",\n compact ? \"size-7\" : \"size-9\"\n )}\n >\n <Paperclip aria-hidden=\"true\" className=\"size-4\" />\n </span>\n <span className=\"flex min-w-0 flex-col\">\n <span className=\"text-sm font-medium text-ink\">\n {multiple ? labels.chooseFiles : labels.chooseFile}\n </span>\n <span\n className={cn(\n \"text-xs text-ink-3\",\n compact ? \"hidden\" : \"hidden sm:block\"\n )}\n >\n {labels.dropFiles}\n </span>\n </span>\n <input\n accept={accept}\n capture={capture}\n className=\"absolute inset-0 cursor-pointer opacity-0\"\n id={id}\n multiple={multiple}\n onChange={(event) => {\n setDragging(false)\n add(Array.from(event.target.files ?? []))\n event.target.value = \"\"\n }}\n onDragEnter={() => setDragging(true)}\n onDragLeave={() => setDragging(false)}\n onDrop={() => setDragging(false)}\n type=\"file\"\n />\n </label>\n\n {files.length > 0 ? (\n <ul className=\"flex flex-col gap-1.5\">\n {files.map((file, index) => {\n const Icon = file.type.startsWith(\"image/\") ? ImageIcon : FileText\n\n return (\n <li\n className=\"flex min-h-11 items-center gap-3 rounded-md border border-line bg-paper pr-1 pl-3\"\n key={fileKey(file)}\n >\n <Icon\n aria-hidden=\"true\"\n className=\"size-4 shrink-0 text-ink-3\"\n />\n <span className=\"min-w-0 flex-1 truncate text-sm text-ink\">\n {file.name}\n </span>\n <span className=\"shrink-0 text-xs tabular-nums text-ink-3\">\n {fileSizeLabel(file.size, labels.locale)}\n </span>\n <Tooltip label={labels.removeFile(file.name)}>\n <button\n className=\"grid size-9 shrink-0 place-items-center rounded-sm text-ink-3 hover:text-danger focus-visible:outline-2 focus-visible:outline-accent pointer-coarse:size-11\"\n onClick={() =>\n onChange(\n files.filter((_, position) => position !== index)\n )\n }\n type=\"button\"\n >\n <X aria-hidden=\"true\" className=\"size-4\" />\n </button>\n </Tooltip>\n </li>\n )\n })}\n </ul>\n ) : null}\n </div>\n )\n}\n",
18
+ "type": "registry:ui"
19
+ }
20
+ ],
21
+ "type": "registry:ui"
22
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "filter-chips",
4
+ "title": "Filter Chips",
5
+ "description": "Filtre à valeur unique en rangée de puces (compteur, pastille de couleur), défilante sur mobile.",
6
+ "registryDependencies": [
7
+ "@rc/utils"
8
+ ],
9
+ "files": [
10
+ {
11
+ "path": "src/ui/filter-chips.tsx",
12
+ "content": "import { type CSSProperties, useId } from \"react\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface FilterChip<Value extends string> {\n count?: number\n label: string\n /** A colour dot before the label: any CSS colour, such as `var(--color-success)`. */\n swatch?: string\n value: Value\n}\n\n/** One filter value among a few, as a row of chips that scrolls on a phone. */\nexport function FilterChips<Value extends string>({\n label,\n options,\n value,\n onChange,\n hideLabel = false,\n}: {\n hideLabel?: boolean\n label: string\n onChange: (value: Value) => void\n options: readonly FilterChip<Value>[]\n value: Value\n}) {\n const name = useId()\n\n return (\n <fieldset className=\"min-w-0\">\n <legend\n className={\n hideLabel ? \"sr-only\" : \"mb-2 text-xs font-medium text-ink-3\"\n }\n >\n {label}\n </legend>\n <div className=\"-mx-4 flex gap-2 overflow-x-auto px-4 pb-0.5 [scrollbar-width:none] sm:mx-0 sm:flex-wrap sm:px-0\">\n {options.map((option) => {\n const selected = option.value === value\n\n return (\n <label\n className={cn(\n \"flex min-h-9 shrink-0 cursor-pointer select-none items-center gap-2 rounded-full border px-3.5 text-sm font-medium transition-colors duration-150 has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-accent pointer-coarse:min-h-11\",\n selected\n ? \"border-ink bg-ink text-chalk\"\n : \"border-line bg-surface text-ink-2 hover:border-line-strong hover:text-ink\"\n )}\n key={option.value}\n >\n <input\n checked={selected}\n className=\"sr-only\"\n name={name}\n onChange={() => onChange(option.value)}\n type=\"radio\"\n value={option.value}\n />\n {option.swatch ? (\n <span\n aria-hidden=\"true\"\n className=\"size-2.5 shrink-0 rounded-full bg-(--swatch)\"\n style={{ \"--swatch\": option.swatch } as CSSProperties}\n />\n ) : null}\n {option.label}\n {option.count ? (\n <span\n className={cn(\n \"min-w-5 rounded-full px-1.5 text-center text-xs tabular-nums leading-5\",\n selected ? \"bg-chalk text-ink\" : \"bg-accent text-accent-ink\"\n )}\n >\n {option.count}\n </span>\n ) : null}\n </label>\n )\n })}\n </div>\n </fieldset>\n )\n}\n",
13
+ "type": "registry:ui"
14
+ }
15
+ ],
16
+ "type": "registry:ui"
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "form-section",
4
+ "title": "Form Section",
5
+ "description": "Section titrée d'un formulaire long, avec description et action.",
6
+ "registryDependencies": [
7
+ "@rc/utils"
8
+ ],
9
+ "files": [
10
+ {
11
+ "path": "src/ui/form-section.tsx",
12
+ "content": "import type { ReactNode } from \"react\"\nimport { cn } from \"@/lib/utils\"\n\nexport function FormSection({\n title,\n description,\n action,\n children,\n className,\n}: {\n action?: ReactNode\n children: ReactNode\n className?: string\n description?: ReactNode\n title: string\n}) {\n return (\n <section className={cn(\"flex flex-col gap-4\", className)}>\n <header className=\"flex flex-col gap-1 border-b border-line pb-2.5\">\n <div className=\"flex items-center justify-between gap-3\">\n <h3 className=\"font-display text-base font-semibold leading-tight text-ink\">\n {title}\n </h3>\n {action}\n </div>\n {description ? (\n <p className=\"text-sm leading-snug text-ink-3\">{description}</p>\n ) : null}\n </header>\n {children}\n </section>\n )\n}\n",
13
+ "type": "registry:ui"
14
+ }
15
+ ],
16
+ "type": "registry:ui"
17
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "form-sheet",
4
+ "title": "Form Sheet",
5
+ "description": "Sheet d'édition d'un enregistrement branchée sur react-hook-form : vrai formulaire, reset à l'ouverture, garde des modifications, pied standard.",
6
+ "dependencies": [
7
+ "react-hook-form@^7.91.0"
8
+ ],
9
+ "registryDependencies": [
10
+ "@rc/button",
11
+ "@rc/sheet",
12
+ "@rc/ui-labels"
13
+ ],
14
+ "files": [
15
+ {
16
+ "path": "src/ui/form-sheet.tsx",
17
+ "content": "import { type ReactNode, type RefObject, useEffect, useId, useRef } from \"react\"\nimport type { FieldValues, UseFormReturn } from \"react-hook-form\"\nimport { Button } from \"@/components/ui/button\"\nimport { Sheet } from \"@/components/ui/sheet\"\nimport { useUiLabels } from \"@/lib/ui-labels\"\n\nexport interface FormSheetProps<Input extends FieldValues, Output> {\n children: ReactNode\n /** Sits at the start of the footer: usually a `ConfirmButton` that deletes. */\n danger?: ReactNode\n /** Values the form starts from each time the sheet opens; leave it out to reset the form yourself. */\n defaults?: NoInfer<Input>\n description?: string\n /** Unsaved state the form does not hold (picked files, a list edited apart). */\n dirty?: boolean\n form: UseFormReturn<Input, unknown, Output>\n initialFocus?: RefObject<HTMLElement | null>\n onOpenChange: (open: boolean) => void\n onSubmit: (values: Output) => unknown\n open: boolean\n size?: \"md\" | \"lg\"\n submitLabel?: string\n submitting?: boolean\n title: string\n}\n\n/** A sheet that edits one thing: a real form (Enter submits), field errors through `Field`, a guard on unsaved input, the standard footer. */\nexport function FormSheet<Input extends FieldValues, Output = Input>({\n open,\n onOpenChange,\n title,\n description,\n form,\n defaults,\n dirty = false,\n children,\n onSubmit,\n submitting = false,\n submitLabel,\n danger,\n initialFocus,\n size,\n}: FormSheetProps<Input, Output>) {\n const labels = useUiLabels()\n const formId = useId()\n const latestDefaults = useRef(defaults)\n\n latestDefaults.current = defaults\n\n useEffect(() => {\n if (open && latestDefaults.current) {\n form.reset(latestDefaults.current)\n }\n }, [open, form])\n\n const submit = form.handleSubmit(async (values) => {\n try {\n await onSubmit(values)\n } catch {\n // The caller's mutation already reported the error; the form only has to stay open.\n }\n })\n\n return (\n <Sheet\n description={description}\n dirty={(form.formState.isDirty || dirty) && !submitting}\n footer={\n <>\n {danger ? <div className=\"mr-auto flex\">{danger}</div> : null}\n <Button onClick={() => onOpenChange(false)} variant=\"ghost\">\n {labels.cancel}\n </Button>\n <Button\n form={formId}\n loading={submitting}\n type=\"submit\"\n variant=\"primary\"\n >\n {submitLabel ?? labels.save}\n </Button>\n </>\n }\n initialFocus={initialFocus}\n onOpenChange={onOpenChange}\n open={open}\n size={size}\n title={title}\n >\n <form\n className=\"flex flex-col gap-6\"\n id={formId}\n noValidate\n onSubmit={(event) => {\n event.stopPropagation()\n void submit(event)\n }}\n >\n {children}\n </form>\n </Sheet>\n )\n}\n",
18
+ "type": "registry:ui"
19
+ }
20
+ ],
21
+ "type": "registry:ui"
22
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "icon-button",
4
+ "title": "Icon Button",
5
+ "description": "Bouton à icône seule dont le libellé obligatoire devient tooltip et nom accessible.",
6
+ "dependencies": [
7
+ "lucide-react@^1.71.0"
8
+ ],
9
+ "registryDependencies": [
10
+ "@rc/button",
11
+ "@rc/spinner",
12
+ "@rc/tooltip",
13
+ "@rc/utils"
14
+ ],
15
+ "files": [
16
+ {
17
+ "path": "src/ui/icon-button.tsx",
18
+ "content": "import type { LucideIcon } from \"lucide-react\"\nimport type { ButtonHTMLAttributes, Ref } from \"react\"\nimport { type ButtonVariant, buttonClassName } from \"@/components/ui/button\"\nimport { Spinner } from \"@/components/ui/spinner\"\nimport { Tooltip, type TooltipSide } from \"@/components/ui/tooltip\"\nimport { cn } from \"@/lib/utils\"\n\nexport type IconButtonSize = \"sm\" | \"md\"\n\nconst SIZES: Record<IconButtonSize, string> = {\n sm: \"size-9 min-h-9 px-0 pointer-coarse:size-11\",\n md: \"size-10 px-0\",\n}\n\nexport function iconButtonSizeClassName(size: IconButtonSize): string {\n return cn(SIZES[size], \"shrink-0\")\n}\n\nexport interface IconButtonProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"aria-label\" | \"children\" | \"title\"\n> {\n icon: LucideIcon\n label: string\n loading?: boolean\n ref?: Ref<HTMLButtonElement>\n size?: IconButtonSize\n tooltipSide?: TooltipSide\n variant?: ButtonVariant\n}\n\n/** A button whose only content is an icon: the label is required and shows as a tooltip. */\nexport function IconButton({\n icon: Icon,\n label,\n loading = false,\n disabled = false,\n size = \"sm\",\n variant = \"ghost\",\n tooltipSide,\n type = \"button\",\n className,\n ...props\n}: IconButtonProps) {\n return (\n <Tooltip label={label} side={tooltipSide}>\n <button\n aria-busy={loading || undefined}\n className={buttonClassName({\n className: cn(\n iconButtonSizeClassName(size),\n loading && \"disabled:cursor-progress\",\n className\n ),\n variant,\n })}\n disabled={disabled || loading}\n type={type}\n {...props}\n >\n {loading ? <Spinner /> : <Icon aria-hidden=\"true\" className=\"size-4\" />}\n </button>\n </Tooltip>\n )\n}\n",
19
+ "type": "registry:ui"
20
+ }
21
+ ],
22
+ "type": "registry:ui"
23
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "input",
4
+ "title": "Input",
5
+ "description": "Champ texte aux tokens du kit, unité optionnelle dans le champ (€, km), relié au `Field` ; exporte `CONTROL_CLASS_NAME`.",
6
+ "registryDependencies": [
7
+ "@rc/field",
8
+ "@rc/utils"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/ui/input.tsx",
13
+ "content": "import type { ComponentProps, CSSProperties, InputHTMLAttributes } from \"react\"\nimport { joinIds, useFieldControl } from \"@/components/ui/field\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface InputProps extends ComponentProps<\"input\"> {\n /** A short unit shown inside the end of the box: €, km, min. */\n unit?: string\n}\n\nexport const CONTROL_CLASS_NAME = cn(\n \"min-h-10 w-full rounded-md border border-line bg-surface text-base leading-snug text-ink sm:text-sm\",\n \"transition-[border-color,box-shadow,background-color] duration-200 ease-out-expo\",\n \"hover:border-line-strong\",\n \"focus-visible:border-accent focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-accent/20\",\n \"disabled:cursor-not-allowed disabled:border-dashed disabled:bg-paper disabled:text-ink-3 disabled:hover:border-line\",\n \"aria-invalid:border-danger aria-invalid:focus-visible:ring-danger/20\"\n)\n\nexport function useControlAria({\n id,\n \"aria-describedby\": describedBy,\n \"aria-invalid\": invalid,\n}: {\n \"aria-describedby\"?: string\n \"aria-invalid\"?: InputHTMLAttributes<HTMLElement>[\"aria-invalid\"]\n id?: string\n}) {\n const field = useFieldControl(id)\n\n return {\n \"aria-describedby\": joinIds(describedBy, field.describedBy),\n \"aria-invalid\": invalid ?? field.invalid,\n id: field.id,\n }\n}\n\nexport function Input({ className, unit, ...props }: InputProps) {\n const aria = useControlAria(props)\n\n if (!unit) {\n return (\n <input\n className={cn(\n CONTROL_CLASS_NAME,\n \"px-3 placeholder:text-ink-3\",\n className\n )}\n {...props}\n {...aria}\n />\n )\n }\n\n const unitStyle = { \"--unit-chars\": unit.length } as CSSProperties\n\n return (\n <div className={cn(\"relative\", className)} style={unitStyle}>\n <input\n className={cn(\n CONTROL_CLASS_NAME,\n \"pr-[max(2.75rem,calc(var(--unit-chars)*1ch+1.5rem))] pl-3 placeholder:text-ink-3\"\n )}\n {...props}\n {...aria}\n />\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-y-0 right-0 grid min-w-10 place-items-center px-3 text-sm font-medium text-ink-3\"\n >\n {unit}\n </span>\n </div>\n )\n}\n",
14
+ "type": "registry:ui"
15
+ }
16
+ ],
17
+ "type": "registry:ui"
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "label",
4
+ "title": "Label",
5
+ "description": "Libellé de champ avec marque obligatoire ou mention facultatif.",
6
+ "registryDependencies": [
7
+ "@rc/ui-labels",
8
+ "@rc/utils"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/ui/label.tsx",
13
+ "content": "import type { LabelHTMLAttributes } from \"react\"\nimport { useUiLabels } from \"@/lib/ui-labels\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n optional?: boolean\n required?: boolean\n}\n\nexport const LABEL_CLASS_NAME = \"text-sm font-medium leading-5 text-ink\"\n\nexport function Label({\n className,\n children,\n optional = false,\n required = false,\n ...props\n}: LabelProps) {\n const labels = useUiLabels()\n\n return (\n <label className={cn(LABEL_CLASS_NAME, className)} {...props}>\n {children}\n {required ? (\n <>\n <span aria-hidden=\"true\" className=\"ml-0.5 text-danger\">\n *\n </span>\n <span className=\"sr-only\"> ({labels.required})</span>\n </>\n ) : null}\n {optional && !required ? (\n <span className=\"ml-1.5 text-xs font-normal text-ink-3\">\n {labels.optional}\n </span>\n ) : null}\n </label>\n )\n}\n",
14
+ "type": "registry:ui"
15
+ }
16
+ ],
17
+ "type": "registry:ui"
18
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "list-row",
4
+ "title": "List Row",
5
+ "description": "Liste `divide-y` et ligne type : média, titre, méta, actions.",
6
+ "registryDependencies": [
7
+ "@rc/utils"
8
+ ],
9
+ "files": [
10
+ {
11
+ "path": "src/ui/list-row.tsx",
12
+ "content": "import type { ReactNode } from \"react\"\nimport { cn } from \"@/lib/utils\"\n\n/** A `divide-y` list inside a card or a framed surface. */\nexport function List({\n children,\n className,\n framed = false,\n label,\n}: {\n children: ReactNode\n className?: string\n framed?: boolean\n label?: string\n}) {\n return (\n <ul\n aria-label={label}\n className={cn(\n \"divide-y divide-line\",\n framed && \"rounded-lg border border-line bg-surface\",\n className\n )}\n >\n {children}\n </ul>\n )\n}\n\n/** One row: an optional square (avatar, swatch, icon), a title, a meta line, actions at the end. */\nexport function ListRow({\n media,\n title,\n meta,\n actions,\n className,\n}: {\n actions?: ReactNode\n className?: string\n media?: ReactNode\n meta?: ReactNode\n title: ReactNode\n}) {\n return (\n <li\n className={cn(\n \"flex min-h-16 items-center gap-3 px-5 py-3 sm:px-6\",\n className\n )}\n >\n {media ? <div className=\"flex shrink-0\">{media}</div> : null}\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <div className=\"min-w-0 truncate font-medium leading-snug text-ink\">\n {title}\n </div>\n {meta ? <div className=\"min-w-0 text-sm text-ink-3\">{meta}</div> : null}\n </div>\n {actions ? (\n <div className=\"flex shrink-0 items-center gap-1\">{actions}</div>\n ) : null}\n </li>\n )\n}\n",
13
+ "type": "registry:ui"
14
+ }
15
+ ],
16
+ "type": "registry:ui"
17
+ }