@sdxc/kit 2026.10.16 → 2026.10.20

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 (358) hide show
  1. package/README.md +391 -20
  2. package/changelog.jsonl +1160 -1035
  3. package/config.schema.json +47 -1
  4. package/dist/author.d.ts +36 -0
  5. package/dist/author.js +107 -0
  6. package/dist/cli.js +12 -0
  7. package/dist/commands/create.js +9 -4
  8. package/dist/commands/deploy.d.ts +23 -0
  9. package/dist/commands/deploy.js +167 -0
  10. package/dist/commands/destroy.d.ts +22 -0
  11. package/dist/commands/destroy.js +92 -0
  12. package/dist/commands/doctor.d.ts +26 -0
  13. package/dist/commands/doctor.js +65 -0
  14. package/dist/commands/initializers.d.ts +16 -0
  15. package/dist/commands/initializers.js +23 -0
  16. package/dist/commands/make.d.ts +72 -6
  17. package/dist/commands/make.js +127 -19
  18. package/dist/commands/middleware.d.ts +16 -0
  19. package/dist/commands/middleware.js +21 -0
  20. package/dist/commands/models.d.ts +18 -0
  21. package/dist/commands/models.js +29 -0
  22. package/dist/commands/notes.d.ts +17 -0
  23. package/dist/commands/notes.js +27 -0
  24. package/dist/commands/routes.d.ts +25 -0
  25. package/dist/commands/routes.js +50 -0
  26. package/dist/commands/run.d.ts +18 -2
  27. package/dist/commands/run.js +35 -12
  28. package/dist/commands/scaffold.d.ts +29 -0
  29. package/dist/commands/scaffold.js +33 -0
  30. package/dist/commands/schedule.d.ts +16 -0
  31. package/dist/commands/schedule.js +21 -0
  32. package/dist/commands/stats.d.ts +16 -0
  33. package/dist/commands/stats.js +21 -0
  34. package/dist/commands/ui/update.d.ts +6 -3
  35. package/dist/commands/ui/update.js +24 -7
  36. package/dist/commands/upgrade.d.ts +3 -1
  37. package/dist/commands/upgrade.js +88 -23
  38. package/dist/config.d.ts +18 -0
  39. package/dist/config.js +28 -1
  40. package/dist/contract.d.ts +97 -3
  41. package/dist/contract.js +360 -26
  42. package/dist/create/templates.d.ts +8 -1
  43. package/dist/create/templates.js +26 -2
  44. package/dist/dependencies.d.ts +4 -1
  45. package/dist/dependencies.js +13 -1
  46. package/dist/deploy/plan.d.ts +49 -0
  47. package/dist/deploy/plan.js +68 -0
  48. package/dist/destroy.d.ts +40 -0
  49. package/dist/destroy.js +311 -0
  50. package/dist/doctor/check.d.ts +71 -0
  51. package/dist/doctor/check.js +53 -0
  52. package/dist/doctor/checks.d.ts +23 -0
  53. package/dist/doctor/checks.js +68 -0
  54. package/dist/doctor/define.d.ts +59 -0
  55. package/dist/doctor/define.js +16 -0
  56. package/dist/doctor/emails.d.ts +18 -0
  57. package/dist/doctor/emails.js +243 -0
  58. package/dist/doctor/env.d.ts +26 -0
  59. package/dist/doctor/env.js +88 -0
  60. package/dist/doctor/files.d.ts +14 -0
  61. package/dist/doctor/files.js +34 -0
  62. package/dist/doctor/fixture.d.ts +23 -0
  63. package/dist/doctor/fixture.js +46 -0
  64. package/dist/doctor/install.d.ts +17 -0
  65. package/dist/doctor/install.js +37 -0
  66. package/dist/doctor/installed.d.ts +11 -0
  67. package/dist/doctor/installed.js +79 -0
  68. package/dist/doctor/layout.d.ts +23 -0
  69. package/dist/doctor/layout.js +83 -0
  70. package/dist/doctor/migrations.d.ts +16 -0
  71. package/dist/doctor/migrations.js +96 -0
  72. package/dist/doctor/models.d.ts +13 -0
  73. package/dist/doctor/models.js +69 -0
  74. package/dist/doctor/pins.d.ts +15 -0
  75. package/dist/doctor/pins.js +79 -0
  76. package/dist/doctor/project.d.ts +58 -0
  77. package/dist/doctor/project.js +261 -0
  78. package/dist/doctor/remix.d.ts +14 -0
  79. package/dist/doctor/remix.js +44 -0
  80. package/dist/doctor/routes.d.ts +11 -0
  81. package/dist/doctor/routes.js +49 -0
  82. package/dist/doctor/typegen.d.ts +13 -0
  83. package/dist/doctor/typegen.js +57 -0
  84. package/dist/doctor/ui.d.ts +14 -0
  85. package/dist/doctor/ui.js +51 -0
  86. package/dist/init.d.ts +5 -3
  87. package/dist/init.js +15 -7
  88. package/dist/initializers.d.ts +25 -0
  89. package/dist/initializers.js +89 -0
  90. package/dist/lock.d.ts +2 -2
  91. package/dist/make/actions.d.ts +23 -0
  92. package/dist/make/actions.js +82 -0
  93. package/dist/make/declare.d.ts +32 -4
  94. package/dist/make/declare.js +405 -27
  95. package/dist/make/email.d.ts +23 -0
  96. package/dist/make/email.js +111 -0
  97. package/dist/make/from-fields.d.ts +30 -0
  98. package/dist/make/from-fields.js +162 -0
  99. package/dist/make/from-model.d.ts +39 -0
  100. package/dist/make/from-model.js +161 -0
  101. package/dist/make/generate.d.ts +16 -5
  102. package/dist/make/generate.js +43 -14
  103. package/dist/make/guard.d.ts +35 -0
  104. package/dist/make/guard.js +73 -0
  105. package/dist/make/imports.d.ts +6 -0
  106. package/dist/make/imports.js +19 -0
  107. package/dist/make/index.d.ts +47 -4
  108. package/dist/make/index.js +287 -25
  109. package/dist/make/kinds.d.ts +31 -3
  110. package/dist/make/kinds.js +82 -9
  111. package/dist/make/mount.d.ts +25 -0
  112. package/dist/make/mount.js +135 -0
  113. package/dist/make/schema-diff.d.ts +58 -0
  114. package/dist/make/schema-diff.js +609 -0
  115. package/dist/make/schema.d.ts +76 -0
  116. package/dist/make/schema.js +206 -0
  117. package/dist/make/stubs.d.ts +7 -5
  118. package/dist/make/stubs.js +16 -5
  119. package/dist/make/test.d.ts +43 -0
  120. package/dist/make/test.js +149 -0
  121. package/dist/make/trigger.d.ts +31 -0
  122. package/dist/make/trigger.js +163 -0
  123. package/dist/models.d.ts +42 -0
  124. package/dist/models.js +149 -0
  125. package/dist/notes.d.ts +28 -0
  126. package/dist/notes.js +66 -0
  127. package/dist/reference.d.ts +27 -0
  128. package/dist/reference.js +103 -0
  129. package/dist/releases.d.ts +9 -0
  130. package/dist/releases.js +29 -8
  131. package/dist/routes/chains.d.ts +34 -0
  132. package/dist/routes/chains.js +95 -0
  133. package/dist/routes/filter.d.ts +53 -0
  134. package/dist/routes/filter.js +147 -0
  135. package/dist/routes/format.d.ts +23 -0
  136. package/dist/routes/format.js +123 -0
  137. package/dist/routes/helpers.d.ts +21 -0
  138. package/dist/routes/helpers.js +165 -0
  139. package/dist/routes/index.d.ts +56 -0
  140. package/dist/routes/index.js +167 -0
  141. package/dist/routes/modules.d.ts +116 -0
  142. package/dist/routes/modules.js +235 -0
  143. package/dist/routes/parse.d.ts +161 -0
  144. package/dist/routes/parse.js +621 -0
  145. package/dist/routes/routers.d.ts +69 -0
  146. package/dist/routes/routers.js +327 -0
  147. package/dist/scaffold/fields.d.ts +129 -0
  148. package/dist/scaffold/fields.js +421 -0
  149. package/dist/scaffold/index.d.ts +37 -0
  150. package/dist/scaffold/index.js +613 -0
  151. package/dist/scaffold/render.d.ts +51 -0
  152. package/dist/scaffold/render.js +332 -0
  153. package/dist/schedule.d.ts +45 -0
  154. package/dist/schedule.js +124 -0
  155. package/dist/stats.d.ts +37 -0
  156. package/dist/stats.js +126 -0
  157. package/dist/testing.d.ts +12 -2
  158. package/dist/testing.js +22 -3
  159. package/dist/ui/commands.d.ts +10 -3
  160. package/dist/ui/commands.js +85 -15
  161. package/dist/ui/registry.d.ts +8 -8
  162. package/dist/upgrade/agents.d.ts +49 -0
  163. package/dist/upgrade/agents.js +110 -0
  164. package/dist/upgrade/changelog.d.ts +2 -2
  165. package/dist/upgrade/project.d.ts +4 -0
  166. package/dist/upgrade/project.js +11 -1
  167. package/dist/upgrade/prompt.d.ts +11 -0
  168. package/dist/upgrade/prompt.js +50 -7
  169. package/package.json +6 -4
  170. package/registry/ui/alert-dialog.json +2 -2
  171. package/registry/ui/attachment.json +2 -2
  172. package/registry/ui/calendar.json +2 -2
  173. package/registry/ui/color-picker.json +2 -2
  174. package/registry/ui/command.json +2 -2
  175. package/registry/ui/date-picker.json +2 -2
  176. package/registry/ui/date-range-picker.json +2 -2
  177. package/registry/ui/dialog.json +2 -2
  178. package/registry/ui/file-trigger.json +2 -2
  179. package/registry/ui/heading-scope.json +2 -2
  180. package/registry/ui/message-scroller.json +2 -2
  181. package/registry/ui/number-field.json +2 -2
  182. package/registry/ui/range-calendar.json +2 -2
  183. package/registry/ui/resizable.json +2 -2
  184. package/registry/ui/select.json +2 -2
  185. package/registry/ui/shared-element.json +2 -2
  186. package/stubs/command.stub +4 -0
  187. package/stubs/command.test.stub +3 -0
  188. package/stubs/controller.api.resource.stub +23 -0
  189. package/stubs/controller.api.stub +21 -0
  190. package/stubs/controller.api.test.stub +18 -0
  191. package/stubs/controller.form.stub +40 -10
  192. package/stubs/controller.form.test.stub +61 -0
  193. package/stubs/controller.resource.form.stub +67 -0
  194. package/stubs/controller.resource.stub +28 -0
  195. package/stubs/controller.stub +15 -8
  196. package/stubs/controller.test.stub +3 -0
  197. package/stubs/email.stub +15 -38
  198. package/stubs/email.test.stub +12 -7
  199. package/stubs/factory.stub +4 -1
  200. package/stubs/initializer.stub +2 -0
  201. package/stubs/initializer.test.stub +3 -0
  202. package/stubs/job.cron.stub +4 -0
  203. package/stubs/job.stub +4 -0
  204. package/stubs/job.test.stub +3 -0
  205. package/stubs/mcp.resource.stub +3 -0
  206. package/stubs/mcp.stub +3 -0
  207. package/stubs/mcp.test.stub +3 -0
  208. package/stubs/middleware.stub +6 -1
  209. package/stubs/middleware.test.stub +3 -0
  210. package/stubs/model.stub +12 -3
  211. package/stubs/model.test.stub +3 -0
  212. package/stubs/policy.test.stub +36 -7
  213. package/stubs/scaffold.api.create.stub +34 -0
  214. package/stubs/scaffold.api.create.test.stub +37 -0
  215. package/stubs/scaffold.api.destroy.stub +34 -0
  216. package/stubs/scaffold.api.destroy.test.stub +44 -0
  217. package/stubs/scaffold.api.index.stub +23 -0
  218. package/stubs/scaffold.api.index.test.stub +31 -0
  219. package/stubs/scaffold.api.show.stub +27 -0
  220. package/stubs/scaffold.api.show.test.stub +41 -0
  221. package/stubs/scaffold.api.update.stub +44 -0
  222. package/stubs/scaffold.api.update.test.stub +46 -0
  223. package/stubs/scaffold.command.create.stub +22 -0
  224. package/stubs/scaffold.command.create.test.stub +30 -0
  225. package/stubs/scaffold.command.delete.stub +20 -0
  226. package/stubs/scaffold.command.delete.test.stub +39 -0
  227. package/stubs/scaffold.command.list.stub +18 -0
  228. package/stubs/scaffold.command.list.test.stub +31 -0
  229. package/stubs/scaffold.command.show.stub +19 -0
  230. package/stubs/scaffold.command.show.test.stub +37 -0
  231. package/stubs/scaffold.controller.destroy.stub +35 -0
  232. package/stubs/scaffold.controller.destroy.test.stub +65 -0
  233. package/stubs/scaffold.controller.edit.stub +97 -0
  234. package/stubs/scaffold.controller.edit.test.stub +91 -0
  235. package/stubs/scaffold.controller.index.stub +55 -0
  236. package/stubs/scaffold.controller.index.test.stub +32 -0
  237. package/stubs/scaffold.controller.new.stub +70 -0
  238. package/stubs/scaffold.controller.new.test.stub +81 -0
  239. package/stubs/scaffold.controller.show.stub +59 -0
  240. package/stubs/scaffold.controller.show.test.stub +43 -0
  241. package/stubs/scaffold.factory.stub +16 -0
  242. package/stubs/scaffold.form.stub +75 -0
  243. package/stubs/scaffold.mcp.create.stub +24 -0
  244. package/stubs/scaffold.mcp.create.test.stub +36 -0
  245. package/stubs/scaffold.mcp.delete.stub +31 -0
  246. package/stubs/scaffold.mcp.delete.test.stub +43 -0
  247. package/stubs/scaffold.mcp.get.stub +21 -0
  248. package/stubs/scaffold.mcp.get.test.stub +31 -0
  249. package/stubs/scaffold.mcp.list.stub +23 -0
  250. package/stubs/scaffold.mcp.list.test.stub +25 -0
  251. package/stubs/scaffold.mcp.update.stub +37 -0
  252. package/stubs/scaffold.mcp.update.test.stub +40 -0
  253. package/stubs/scaffold.migration.stub +2 -0
  254. package/stubs/scaffold.model.stub +35 -0
  255. package/stubs/scaffold.model.test.stub +25 -0
  256. package/stubs/scaffold.test-database.stub +33 -0
  257. package/stubs/scaffold.test-mcp.stub +92 -0
  258. package/stubs/scaffold.validator.stub +18 -0
  259. package/stubs/scaffold.validator.test.stub +26 -0
  260. package/stubs/service.stub +4 -0
  261. package/stubs/service.test.stub +3 -0
  262. package/stubs/validator.stub +3 -0
  263. package/stubs/validator.test.stub +3 -0
  264. package/templates/app/.env.example +16 -0
  265. package/templates/app/AGENTS.md +163 -0
  266. package/templates/app/CLAUDE.md +1 -0
  267. package/templates/app/README.md +79 -37
  268. package/templates/app/app/commands/about.test.ts +1 -1
  269. package/templates/app/app/commands/console.test.ts +26 -0
  270. package/templates/app/app/commands/console.ts +19 -0
  271. package/templates/app/app/commands/db/console.ts +6 -0
  272. package/templates/app/app/commands/db/fresh.test.ts +57 -0
  273. package/templates/app/app/commands/db/fresh.ts +37 -0
  274. package/templates/app/app/commands/db/migrate.test.ts +46 -0
  275. package/templates/app/app/commands/db/migrate.ts +88 -0
  276. package/templates/app/app/commands/db/prepare.test.ts +39 -0
  277. package/templates/app/app/commands/db/prepare.ts +35 -0
  278. package/templates/app/app/commands/db/seed.test.ts +38 -0
  279. package/templates/app/app/commands/db/seed.ts +26 -0
  280. package/templates/app/app/commands/deploy.test.ts +34 -0
  281. package/templates/app/app/commands/deploy.ts +18 -0
  282. package/templates/app/app/commands/emails/preview.test.tsx +63 -0
  283. package/templates/app/app/commands/emails/preview.ts +24 -0
  284. package/templates/app/app/commands/index.ts +72 -1
  285. package/templates/app/app/commands/typegen.test.ts +17 -0
  286. package/templates/app/app/commands/typegen.ts +16 -0
  287. package/templates/app/app/emails/index.ts +10 -0
  288. package/templates/app/app/http/controllers/api/health.tsx +15 -0
  289. package/templates/app/app/http/controllers/api/not-found.tsx +16 -0
  290. package/templates/app/app/http/controllers/api/openapi.tsx +17 -0
  291. package/templates/app/app/http/controllers/home.tsx +21 -13
  292. package/templates/app/app/http/controllers/mcp.tsx +16 -0
  293. package/templates/app/app/http/controllers/not-found.tsx +23 -18
  294. package/templates/app/app/http/controllers/robots.test.ts +18 -0
  295. package/templates/app/app/http/controllers/robots.ts +24 -0
  296. package/templates/app/app/http/controllers/sitemap.test.ts +28 -0
  297. package/templates/app/app/http/controllers/sitemap.ts +25 -0
  298. package/templates/app/app/http/middleware/access.test.ts +43 -0
  299. package/templates/app/app/http/middleware/access.ts +41 -0
  300. package/templates/app/app/http/middleware/api.ts +19 -0
  301. package/templates/app/app/http/middleware/page.test.ts +43 -0
  302. package/templates/app/app/http/middleware/page.ts +51 -0
  303. package/templates/app/app/http/middleware/server-timing.test.ts +15 -0
  304. package/templates/app/app/http/middleware/server-timing.ts +42 -0
  305. package/templates/app/app/initializers/assets.ts +1 -1
  306. package/templates/app/app/initializers/captcha.ts +11 -0
  307. package/templates/app/app/initializers/cli.ts +68 -2
  308. package/templates/app/app/initializers/database.test.ts +18 -0
  309. package/templates/app/app/initializers/database.ts +18 -0
  310. package/templates/app/app/initializers/dispatcher.ts +26 -0
  311. package/templates/app/app/initializers/honeypot.ts +11 -0
  312. package/templates/app/app/initializers/i18n.test.ts +16 -0
  313. package/templates/app/app/initializers/i18n.ts +28 -0
  314. package/templates/app/app/initializers/local-database.test.ts +33 -0
  315. package/templates/app/app/initializers/local-database.ts +53 -0
  316. package/templates/app/app/initializers/mail-transport.test.ts +27 -0
  317. package/templates/app/app/initializers/mail-transport.ts +26 -0
  318. package/templates/app/app/initializers/mail.test.ts +27 -0
  319. package/templates/app/app/initializers/mail.ts +19 -0
  320. package/templates/app/app/initializers/mcp.ts +1 -1
  321. package/templates/app/app/initializers/openapi.ts +21 -0
  322. package/templates/app/app/initializers/router.test.ts +68 -0
  323. package/templates/app/app/initializers/router.tsx +81 -25
  324. package/templates/app/app/initializers/seo.ts +15 -0
  325. package/templates/app/app/initializers/session.test.ts +34 -0
  326. package/templates/app/app/initializers/session.ts +29 -0
  327. package/templates/app/app/initializers/spam.ts +10 -0
  328. package/templates/app/app/jobs/email.test.tsx +70 -0
  329. package/templates/app/app/jobs/email.ts +16 -0
  330. package/templates/app/app/jobs/index.ts +6 -2
  331. package/templates/app/app/models/index.ts +10 -0
  332. package/templates/app/app/policies/abilities.ts +13 -0
  333. package/templates/app/app/policies/policy.test.ts +15 -0
  334. package/templates/app/app/policies/policy.ts +30 -0
  335. package/templates/app/app/services/commands.ts +30 -0
  336. package/templates/app/app/services/migrations.test.ts +92 -0
  337. package/templates/app/app/services/migrations.ts +117 -0
  338. package/templates/app/app/test/cloudflare-workers.ts +25 -0
  339. package/templates/app/app/test/local-database.ts +67 -0
  340. package/templates/app/app/test/session.ts +28 -0
  341. package/templates/app/bootstrap/cli.ts +1 -1
  342. package/templates/app/bootstrap/console.ts +13 -0
  343. package/templates/app/bootstrap/worker.ts +4 -4
  344. package/templates/app/cloudflare.config.ts +30 -2
  345. package/templates/app/config/constants.ts +19 -0
  346. package/templates/app/config/problems.ts +24 -0
  347. package/templates/app/config/security-policy.ts +34 -0
  348. package/templates/app/config/security-txt.ts +28 -0
  349. package/templates/app/database/migrations/.gitkeep +0 -0
  350. package/templates/app/database/seed.ts +12 -0
  351. package/templates/app/package.json +37 -6
  352. package/templates/app/resources/layouts/document.tsx +28 -7
  353. package/templates/app/resources/locales/en.json +10 -0
  354. package/templates/app/routes/api.ts +29 -0
  355. package/templates/app/routes/web.ts +6 -4
  356. package/templates/app/vite.config.ts +4 -0
  357. package/stubs/policy.stub +0 -13
  358. package/templates/app/config/router-context.d.ts +0 -20
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "command",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.10.20",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "Command"
7
7
  ],
8
8
  "source": {
9
9
  "path": "command.tsx",
10
- "content": "/**\n * A bordered panel for searching and choosing among a list of actions:\n * {@link Command.Input} holds the query row, {@link Command.List} scrolls\n * through {@link Command.Item} rows, and {@link Command.Empty} holds a\n * message for when nothing matches. Its baseline rendering is a plain, fully\n * visible list of options, styled and ready to compose; the as-you-type\n * filtering and match highlighting a search experience needs arrive through\n * a separate opt-in behavior a consumer attaches.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { bg, borderEdge, fg, outline, outlineStyle } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, raw } from \"@sdxc/u/general\";\nimport { hstack, shrink, vstack } from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { bs, is, maxBs, pb, pi } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { text, textAlign } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { concentricRadius, floatingSurface, surfacePadding } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\n\n/** `role=\"listbox\"` applied to {@link Command.List} through {@link attrs} unless a consumer supplies its own `role`. */\nconst DEFAULT_LIST_ROLE = \"listbox\";\n\n/** `role=\"option\"` applied to {@link Command.Item} through {@link attrs} unless a consumer supplies its own `role`. */\nconst DEFAULT_ITEM_ROLE = \"option\";\n\n/**\n * Prop types for {@link Command} and its compound parts.\n */\nexport namespace Command {\n\t/**\n\t * Props accepted by {@link Command}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** The panel's compound parts: {@link Command.Input}, {@link Command.List}, {@link Command.Empty}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<input>` attribute, unchanged, plus the `mix` passthrough,\n\t * styling the control itself — a type alias, since the native input prop\n\t * type resolves through a conditional type only a type alias can express.\n\t */\n\texport type InputProps = TagProps<\"input\">;\n\n\t/**\n\t * Props accepted by {@link Command.List}.\n\t */\n\texport interface ListProps extends TagProps<\"div\"> {\n\t\t/** The {@link Command.Item} rows (and, once nothing matches, {@link Command.Empty}) to scroll through. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Command.Item}.\n\t */\n\texport interface ItemProps extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Plain-text value identifying this row's content. A paired filter\n\t\t * behavior matches typed text against this value directly, so it stays\n\t\t * required even when the visible content is already plain text.\n\t\t */\n\t\tvalue: string;\n\t\t/** The row's visible content: a label, and optionally a leading icon or trailing hint. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Command.Empty}.\n\t */\n\texport interface EmptyProps extends TagProps<\"div\"> {}\n}\n\n/**\n * Renders the panel's root host: an elevated `<div>` rounded concentric\n * with {@link Command.Item}'s corners, stacking its compound parts in a\n * column and clipping {@link Command.List}'s scrolled content to that radius.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the panel's markup.\n * @example\n * <Command aria-label={t(\"command.label\")}>\n * \t<Command.Input aria-label={t(\"command.label\")} placeholder={t(\"command.placeholder\")} />\n * \t<Command.List>\n * \t\t<Command.Item value=\"new-file\">{t(\"command.newFile\")}</Command.Item>\n * \t\t<Command.Item value=\"new-folder\">{t(\"command.newFolder\")}</Command.Item>\n * \t</Command.List>\n * \t<Command.Empty>{t(\"command.empty\")}</Command.Empty>\n * </Command>\n */\nexport function Command(handle: Handle<Command.Props>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"command\"\n\t\t\t\tmix={[\n\t\t\t\t\tfloatingSurface(),\n\t\t\t\t\traw({ borderRadius: concentricRadius(surfacePadding(1)) }),\n\t\t\t\t\tvstack(),\n\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders the panel's query row: a `<div>` bordered along its block-end\n * edge wrapping a native `<input>` sized to the row's full padding and\n * height, marked `data-command-input` for a paired filter mixin to read.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the query row's markup.\n * @example\n * <Command.Input aria-label={t(\"command.label\")} placeholder={t(\"command.placeholder\")} />\n * @example\n * <Command.Input aria-label={t(\"command.label\")} value={query} disabled />\n */\nCommand.Input = function CommandInput(handle: Handle<Command.InputProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div data-slot=\"input-wrapper\" mix={borderEdge(\"block-end\", { color: \"neutral\", width: 1 })}>\n\t\t\t\t<input\n\t\t\t\t\t{...rest}\n\t\t\t\t\tdata-slot=\"input\"\n\t\t\t\t\tdata-command-input\n\t\t\t\t\tmix={[\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(\"3.5rem\"),\n\t\t\t\t\t\tpi(3),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\twhen(\"&::placeholder\", fg(\"neutral.muted\")),\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\toutlineStyle(\"none\"),\n\t\t\t\t\t\tmix,\n\t\t\t\t\t]}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders the panel's scrollable option region: a `<div>` carrying the\n * `listbox` role, capped at a fixed block size, its small inline padding\n * leaving room for a selected {@link Command.Item}'s own rounded corners.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the option region's markup.\n * @example\n * <Command.List>\n * \t<Command.Item value=\"new-file\">{t(\"command.newFile\")}</Command.Item>\n * \t<Command.Item value=\"new-folder\">{t(\"command.newFolder\")}</Command.Item>\n * </Command.List>\n */\nCommand.List = function CommandList(handle: Handle<Command.ListProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"list\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_LIST_ROLE }),\n\t\t\t\t\tmaxBs(\"18rem\"),\n\t\t\t\t\toverflow(\"auto\"),\n\t\t\t\t\tpi(surfacePadding(1)),\n\t\t\t\t\t/**\n\t\t\t\t\t * The list spends its block padding only while a row is visible, so a filter hiding every\n\t\t\t\t\t * row leaves the empty-state message centered.\n\t\t\t\t\t */\n\t\t\t\t\twhen('&:has([data-slot=\"item\"]:not([hidden]))', pb(2)),\n\t\t\t\t\toutlineStyle(\"none\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single row: a `<div>` carrying the `option` role, its `value`\n * mirrored onto `data-value` for a paired filter behavior to read. Nest a\n * `<button>` or `<a>` in `children` for native activation.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Command.Item value=\"new-file\">{t(\"command.newFile\")}</Command.Item>\n * @example\n * <Command.Item value=\"archived-project\" aria-disabled=\"true\">\n * \t{t(\"command.archivedProject\")}\n * </Command.Item>\n */\nCommand.Item = function CommandItem(handle: Handle<Command.ItemProps>) {\n\treturn () => {\n\t\tlet { value, children, mix, ...rest } = handle.props;\n\n\t\tif (import.meta.env.DEV && !value) {\n\t\t\tconsole.warn(\n\t\t\t\t'Command.Item: needs a \"value\" — a filter behavior matches typed text against this instead of parsing rendered children.',\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tdata-value={value}\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\tattrs({ role: DEFAULT_ITEM_ROLE }),\n\t\t\t\t\thstack({ gap: 2, align: \"center\" }),\n\t\t\t\t\t/**\n\t\t\t\t\t * A glyph anywhere in the row is sized against the row's text and holds that size when the\n\t\t\t\t\t * row runs short; the default `flex-shrink: 1` would squeeze each glyph by its own row's\n\t\t\t\t\t * overrun and leave the column of glyphs ragged.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tpi(2),\n\t\t\t\t\tpb(2),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The active row is a cursor tinted far enough off the surface to find at a glance, while\n\t\t\t\t\t * its text keeps reading as text. Pointer and cursor states use mutually exclusive selectors,\n\t\t\t\t\t * so the row under the pointer stays marked active whichever order the layers land in.\n\t\t\t\t\t */\n\t\t\t\t\twhen('&:hover:not([aria-selected=\"true\"])', bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\twhen('&:active:not([aria-selected=\"true\"])', bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\twhen('&:focus:not([aria-selected=\"true\"])', bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\twhen('&[aria-selected=\"true\"]', [bg(\"brand.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\twhen('&[aria-selected=\"true\"]:hover', bg(\"brand.bg-tint-pressed\")),\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\toutlineStyle(\"none\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders the panel's no-match message: a centered, muted passage of small\n * text filling {@link Command.List}'s content area, carrying a\n * `data-command-empty` marker a paired filter behavior reads to toggle it.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the message's markup.\n * @example\n * <Command.Empty>{t(\"command.empty\")}</Command.Empty>\n */\nCommand.Empty = function CommandEmpty(handle: Handle<Command.EmptyProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"empty\"\n\t\t\t\tdata-command-empty\n\t\t\t\tmix={[pi(3), pb(6), textAlign(\"center\"), fg(\"neutral.muted\"), text(\"sm\"), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n"
10
+ "content": "/**\n * A bordered panel for searching and choosing among a list of actions:\n * {@link Command.Input} holds the query row, {@link Command.List} scrolls\n * through {@link Command.Item} rows, and {@link Command.Empty} holds a\n * message for when nothing matches. Its baseline rendering is a plain, fully\n * visible list of options, styled and ready to compose; the as-you-type\n * filtering and match highlighting a search experience needs arrive through\n * a separate opt-in behavior a consumer attaches.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { bg, borderEdge, fg, outline, outlineStyle } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, raw } from \"@sdxc/u/general\";\nimport { hstack, shrink, vstack } from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { bs, is, maxBs, pb, pi } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { text, textAlign } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { concentricRadius, floatingSurface, surfacePadding } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\n\n/** `role=\"listbox\"` applied to {@link Command.List} through {@link attrs} unless a consumer supplies its own `role`. */\nconst DEFAULT_LIST_ROLE = \"listbox\";\n\n/** `role=\"option\"` applied to {@link Command.Item} through {@link attrs} unless a consumer supplies its own `role`. */\nconst DEFAULT_ITEM_ROLE = \"option\";\n\n/**\n * Prop types for {@link Command} and its compound parts.\n */\nexport namespace Command {\n\t/**\n\t * Props accepted by {@link Command}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** The panel's compound parts: {@link Command.Input}, {@link Command.List}, {@link Command.Empty}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<input>` attribute, unchanged, plus the `mix` passthrough,\n\t * styling the control itself — a type alias, since the native input prop\n\t * type resolves through a conditional type only a type alias can express.\n\t */\n\texport type InputProps = TagProps<\"input\">;\n\n\t/**\n\t * Props accepted by {@link Command.List}.\n\t */\n\texport interface ListProps extends TagProps<\"div\"> {\n\t\t/** The {@link Command.Item} rows (and, once nothing matches, {@link Command.Empty}) to scroll through. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Command.Item}.\n\t */\n\texport interface ItemProps extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Plain-text value identifying this row's content. A paired filter\n\t\t * behavior matches typed text against this value directly, so it stays\n\t\t * required even when the visible content is already plain text.\n\t\t */\n\t\tvalue: string;\n\t\t/** The row's visible content: a label, and optionally a leading icon or trailing hint. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Command.Empty}.\n\t */\n\texport interface EmptyProps extends TagProps<\"div\"> {}\n}\n\n/**\n * Renders the panel's root host: an elevated `<div>` rounded concentric\n * with {@link Command.Item}'s corners, stacking its compound parts in a\n * column and clipping {@link Command.List}'s scrolled content to that radius.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the panel's markup.\n * @example\n * <Command aria-label={t(\"command.label\")}>\n * \t<Command.Input aria-label={t(\"command.label\")} placeholder={t(\"command.placeholder\")} />\n * \t<Command.List>\n * \t\t<Command.Item value=\"new-file\">{t(\"command.newFile\")}</Command.Item>\n * \t\t<Command.Item value=\"new-folder\">{t(\"command.newFolder\")}</Command.Item>\n * \t</Command.List>\n * \t<Command.Empty>{t(\"command.empty\")}</Command.Empty>\n * </Command>\n */\nexport function Command(handle: Handle<Command.Props>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"command\"\n\t\t\t\tmix={[\n\t\t\t\t\tfloatingSurface(),\n\t\t\t\t\traw({ borderRadius: concentricRadius(surfacePadding(1)) }),\n\t\t\t\t\tvstack(),\n\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders the panel's query row: a `<div>` bordered along its block-end\n * edge wrapping a native `<input>` sized to the row's full padding and\n * height, marked `data-command-input` for a paired filter mixin to read.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the query row's markup.\n * @example\n * <Command.Input aria-label={t(\"command.label\")} placeholder={t(\"command.placeholder\")} />\n * @example\n * <Command.Input aria-label={t(\"command.label\")} value={query} disabled />\n */\nCommand.Input = function CommandInput(handle: Handle<Command.InputProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div data-slot=\"input-wrapper\" mix={borderEdge(\"block-end\", { color: \"neutral\", width: 1 })}>\n\t\t\t\t<input\n\t\t\t\t\t{...rest}\n\t\t\t\t\tdata-slot=\"input\"\n\t\t\t\t\tdata-command-input\n\t\t\t\t\tmix={[\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(\"3.5rem\"),\n\t\t\t\t\t\tpi(3),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\twhen(\"&::placeholder\", fg(\"neutral.muted\")),\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\toutlineStyle(\"none\"),\n\t\t\t\t\t\tmix,\n\t\t\t\t\t]}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders the panel's scrollable option region: a `<div>` carrying the\n * `listbox` role, capped at a fixed block size, its small inline padding\n * leaving room for a selected {@link Command.Item}'s own rounded corners.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the option region's markup.\n * @example\n * <Command.List>\n * \t<Command.Item value=\"new-file\">{t(\"command.newFile\")}</Command.Item>\n * \t<Command.Item value=\"new-folder\">{t(\"command.newFolder\")}</Command.Item>\n * </Command.List>\n */\nCommand.List = function CommandList(handle: Handle<Command.ListProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"list\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_LIST_ROLE }),\n\t\t\t\t\tmaxBs(\"18rem\"),\n\t\t\t\t\toverflow(\"auto\"),\n\t\t\t\t\tpi(surfacePadding(1)),\n\t\t\t\t\t/**\n\t\t\t\t\t * The list spends its block padding only while a row is visible, so a filter hiding every\n\t\t\t\t\t * row leaves the empty-state message centered.\n\t\t\t\t\t */\n\t\t\t\t\twhen('&:has([data-slot=\"item\"]:not([hidden]))', pb(2)),\n\t\t\t\t\toutlineStyle(\"none\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single row: a `<div>` carrying the `option` role, its `value`\n * mirrored onto `data-value` for a paired filter behavior to read. Nest a\n * `<button>` or `<a>` in `children` for native activation.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Command.Item value=\"new-file\">{t(\"command.newFile\")}</Command.Item>\n * @example\n * <Command.Item value=\"archived-project\" aria-disabled=\"true\">\n * \t{t(\"command.archivedProject\")}\n * </Command.Item>\n */\nCommand.Item = function CommandItem(handle: Handle<Command.ItemProps>) {\n\treturn () => {\n\t\tlet { value, children, mix, ...rest } = handle.props;\n\n\t\tif (import.meta.env?.DEV && !value) {\n\t\t\tconsole.warn(\n\t\t\t\t'Command.Item: needs a \"value\" — a filter behavior matches typed text against this instead of parsing rendered children.',\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tdata-value={value}\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\tattrs({ role: DEFAULT_ITEM_ROLE }),\n\t\t\t\t\thstack({ gap: 2, align: \"center\" }),\n\t\t\t\t\t/**\n\t\t\t\t\t * A glyph anywhere in the row is sized against the row's text and holds that size when the\n\t\t\t\t\t * row runs short; the default `flex-shrink: 1` would squeeze each glyph by its own row's\n\t\t\t\t\t * overrun and leave the column of glyphs ragged.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tpi(2),\n\t\t\t\t\tpb(2),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The active row is a cursor tinted far enough off the surface to find at a glance, while\n\t\t\t\t\t * its text keeps reading as text. Pointer and cursor states use mutually exclusive selectors,\n\t\t\t\t\t * so the row under the pointer stays marked active whichever order the layers land in.\n\t\t\t\t\t */\n\t\t\t\t\twhen('&:hover:not([aria-selected=\"true\"])', bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\twhen('&:active:not([aria-selected=\"true\"])', bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\twhen('&:focus:not([aria-selected=\"true\"])', bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\twhen('&[aria-selected=\"true\"]', [bg(\"brand.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\twhen('&[aria-selected=\"true\"]:hover', bg(\"brand.bg-tint-pressed\")),\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\toutlineStyle(\"none\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders the panel's no-match message: a centered, muted passage of small\n * text filling {@link Command.List}'s content area, carrying a\n * `data-command-empty` marker a paired filter behavior reads to toggle it.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the message's markup.\n * @example\n * <Command.Empty>{t(\"command.empty\")}</Command.Empty>\n */\nCommand.Empty = function CommandEmpty(handle: Handle<Command.EmptyProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"empty\"\n\t\t\t\tdata-command-empty\n\t\t\t\tmix={[pi(3), pb(6), textAlign(\"center\"), fg(\"neutral.muted\"), text(\"sm\"), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n"
11
11
  },
12
12
  "test": null
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "date-picker",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.10.20",
4
4
  "dependencies": [
5
5
  "date-field"
6
6
  ],
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "source": {
11
11
  "path": "date-picker.tsx",
12
- "content": "/**\n * A labeled date field built on {@link DateField}, with a\n * {@link DatePicker.Group} row for composing more than one field into a single\n * control. The calendar is the platform's: the field is a native date input, so\n * the picker, its keyboard handling and its locale all come from the browser and\n * all of it works before any script loads. Leaving `children` unset renders the\n * field on its own.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { outline } from \"@sdxc/u/color\";\nimport { roundedCorner } from \"@sdxc/u/effects\";\nimport { raw } from \"@sdxc/u/general\";\nimport { flex, flexCol, gap, items } from \"@sdxc/u/layout\";\nimport { mis } from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { when } from \"@sdxc/u/state\";\n\nimport { DateField } from \"@sdxc/ui/date-field\";\n\n/**\n * Prop types for {@link DatePicker} and its compound parts.\n */\nexport namespace DatePicker {\n\t/**\n\t * Semantic color role for the fallback field's keyboard focus ring. Read\n\t * only by the fallback field — {@link DatePicker.Group}'s composed\n\t * control carries no `color` prop of its own.\n\t */\n\texport type Color = DateField.Color;\n\n\t/**\n\t * Every prop {@link DateField.PartsProps} accepts, applied only to the\n\t * field's internally composed parts; a composed layout styles the controls\n\t * inside {@link DatePicker.Group} individually.\n\t */\n\texport interface PartsProps extends DateField.PartsProps {}\n\n\t/**\n\t * Props accepted by {@link DatePicker}. Leaving `children` unset renders the\n\t * field using every prop below; composing {@link DatePicker.Group} instead\n\t * renders the joined row and leaves every prop below unread.\n\t */\n\texport interface Props extends Omit<TagProps<\"div\">, \"children\"> {\n\t\t/** Semantic color role for the fallback field's focus ring. Read only when `children` is unset. */\n\t\tcolor?: Color;\n\t\t/** The fallback field's caption, rendered through {@link DateField}. Read only when `children` is unset. */\n\t\tlabel?: RemixNode;\n\t\t/** Supporting copy beneath the fallback field. Read only when `children` is unset. */\n\t\tdescription?: RemixNode;\n\t\t/** Validation message beneath the fallback field. Read only when `children` is unset. */\n\t\terrorMessage?: RemixNode;\n\t\t/** Native `name` submitted with an enclosing form, read only by the fallback field. */\n\t\tname?: string;\n\t\t/** Current value, in `YYYY-MM-DD` form, for a fallback field a consumer tracks itself. */\n\t\tvalue?: string;\n\t\t/** Initial value, in `YYYY-MM-DD` form, for a fallback field left to the platform's own uncontrolled state. */\n\t\tdefaultValue?: string;\n\t\t/** Earliest accepted date, in `YYYY-MM-DD` form, read only by the fallback field. */\n\t\tmin?: string;\n\t\t/** Latest accepted date, in `YYYY-MM-DD` form, read only by the fallback field. */\n\t\tmax?: string;\n\t\t/** Granularity, in days, the fallback field's value must fall on. */\n\t\tstep?: number;\n\t\t/** Marks the fallback field required for its enclosing form. */\n\t\trequired?: boolean;\n\t\t/** Marks the fallback field inert and excluded from the tab order. */\n\t\tdisabled?: boolean;\n\t\t/** Marks the fallback field's value fixed, while keeping it focusable and included in form submission. */\n\t\treadOnly?: boolean;\n\t\t/** Native autofill hint for the fallback field, e.g. `\"bday\"`. */\n\t\tautoComplete?: string;\n\t\t/** Per-part styling for the fallback field's internally composed parts. Read only when `children` is unset. */\n\t\tparts?: PartsProps;\n\t\t/**\n\t\t * The composed layout — typically a `Label` and a\n\t\t * {@link DatePicker.Group} — rendered in place of the field, leaving every\n\t\t * field above unread.\n\t\t */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * `children` composes the field's own control, and a second one for a\n\t * range, into one visual row.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {}\n}\n\n/**\n * Renders {@link DatePicker}'s root. Leaving `children` unset renders the field,\n * passing every prop above through unchanged; composing\n * {@link DatePicker.Group} as `children` instead renders the joined row and\n * leaves those props unread.\n *\n * @param handle Runtime handle carrying the root element's props.\n * @returns The render function producing the date picker's markup.\n * @example\n * <DatePicker label={t(\"form.birthday.label\")} name=\"birthday\" autoComplete=\"bday\" />\n * @example\n * <DatePicker>\n * \t<Label htmlFor=\"startDate\">{t(\"form.startDate.label\")}</Label>\n * \t<DatePicker.Group>\n * \t\t<Input id=\"startDate\" type=\"date\" name=\"startDate\" />\n * \t</DatePicker.Group>\n * </DatePicker>\n */\nexport function DatePicker(handle: Handle<DatePicker.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor,\n\t\t\tlabel,\n\t\t\tdescription,\n\t\t\terrorMessage,\n\t\t\tname,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tmin,\n\t\t\tmax,\n\t\t\tstep,\n\t\t\trequired,\n\t\t\tdisabled,\n\t\t\treadOnly,\n\t\t\tautoComplete,\n\t\t\tparts,\n\t\t\tchildren,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\n\t\tif (import.meta.env.DEV && !children && !label) {\n\t\t\tconsole.warn(\n\t\t\t\t'DatePicker: falling back to DateField\\'s plain \"input type=date\" needs a \"label\" describing what it collects for assistive technology.',\n\t\t\t);\n\t\t}\n\n\t\tif (!children) {\n\t\t\treturn (\n\t\t\t\t<DateField\n\t\t\t\t\t{...rest}\n\t\t\t\t\tcolor={color}\n\t\t\t\t\tlabel={label}\n\t\t\t\t\tdescription={description}\n\t\t\t\t\terrorMessage={errorMessage}\n\t\t\t\t\tname={name}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t\tmin={min}\n\t\t\t\t\tmax={max}\n\t\t\t\t\tstep={step}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\tautoComplete={autoComplete}\n\t\t\t\t\tparts={parts}\n\t\t\t\t\tmix={mix}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"date-picker\" mix={[flex(), flexCol(), gap(1), mix]}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link DatePicker}'s control row: a flex host laying one or more date\n * controls side by side and joining their edges, so a pair reads as one field.\n * Focus and validity are drawn the way `Group` draws them — focus by the control\n * that holds it, validity once around the row.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <DatePicker.Group>\n * \t<Input id=\"startDate\" type=\"date\" name=\"startDate\" />\n * </DatePicker.Group>\n */\nDatePicker.Group = function DatePickerGroup(handle: Handle<DatePicker.GroupProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The fields compose into one control, so the pair keeps the rounding on its own\n\t\t\t\t\t * outer corners and the seam the two share is drawn once.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& > *:not(:first-child)\", [\n\t\t\t\t\t\troundedCorner(\"start-start\", \"none\"),\n\t\t\t\t\t\troundedCorner(\"end-start\", \"none\"),\n\t\t\t\t\t\tmis(\"-1px\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"& > *:not(:last-child)\", [\n\t\t\t\t\t\troundedCorner(\"start-end\", \"none\"),\n\t\t\t\t\t\troundedCorner(\"end-end\", \"none\"),\n\t\t\t\t\t]),\n\t\t\t\t\t/**\n\t\t\t\t\t * Focus shows on the field holding it, naming which date has it where a ring around\n\t\t\t\t\t * the pair names only the group. That field is raised so its ring crosses the seam.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& > *:focus-visible\", z(1)),\n\t\t\t\t\t/**\n\t\t\t\t\t * Validity belongs to the pair, since a range is one value and half of one makes it\n\t\t\t\t\t * invalid: one ring is drawn around the group and each field's own ring is released,\n\t\t\t\t\t * so the seam shows one field needing attention.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'&:has(> :user-invalid), &:has(> [aria-invalid=\"true\"])',\n\t\t\t\t\t\toutline({ color: \"danger.ring\", offset: 2 }),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'& > :user-invalid:not(:focus-visible), & > [aria-invalid=\"true\"]:not(:focus-visible)',\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Important so it reaches across to the cascade layer where `Input` states the field's\n\t\t\t\t\t\t * invalid ring. The selector excludes `:focus-visible`, so a field being filled in still\n\t\t\t\t\t\t * shows its own focus ring.\n\t\t\t\t\t\t */\n\t\t\t\t\t\traw({ outline: \"none !important\" }),\n\t\t\t\t\t),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n"
12
+ "content": "/**\n * A labeled date field built on {@link DateField}, with a\n * {@link DatePicker.Group} row for composing more than one field into a single\n * control. The calendar is the platform's: the field is a native date input, so\n * the picker, its keyboard handling and its locale all come from the browser and\n * all of it works before any script loads. Leaving `children` unset renders the\n * field on its own.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { outline } from \"@sdxc/u/color\";\nimport { roundedCorner } from \"@sdxc/u/effects\";\nimport { raw } from \"@sdxc/u/general\";\nimport { flex, flexCol, gap, items } from \"@sdxc/u/layout\";\nimport { mis } from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { when } from \"@sdxc/u/state\";\n\nimport { DateField } from \"@sdxc/ui/date-field\";\n\n/**\n * Prop types for {@link DatePicker} and its compound parts.\n */\nexport namespace DatePicker {\n\t/**\n\t * Semantic color role for the fallback field's keyboard focus ring. Read\n\t * only by the fallback field — {@link DatePicker.Group}'s composed\n\t * control carries no `color` prop of its own.\n\t */\n\texport type Color = DateField.Color;\n\n\t/**\n\t * Every prop {@link DateField.PartsProps} accepts, applied only to the\n\t * field's internally composed parts; a composed layout styles the controls\n\t * inside {@link DatePicker.Group} individually.\n\t */\n\texport interface PartsProps extends DateField.PartsProps {}\n\n\t/**\n\t * Props accepted by {@link DatePicker}. Leaving `children` unset renders the\n\t * field using every prop below; composing {@link DatePicker.Group} instead\n\t * renders the joined row and leaves every prop below unread.\n\t */\n\texport interface Props extends Omit<TagProps<\"div\">, \"children\"> {\n\t\t/** Semantic color role for the fallback field's focus ring. Read only when `children` is unset. */\n\t\tcolor?: Color;\n\t\t/** The fallback field's caption, rendered through {@link DateField}. Read only when `children` is unset. */\n\t\tlabel?: RemixNode;\n\t\t/** Supporting copy beneath the fallback field. Read only when `children` is unset. */\n\t\tdescription?: RemixNode;\n\t\t/** Validation message beneath the fallback field. Read only when `children` is unset. */\n\t\terrorMessage?: RemixNode;\n\t\t/** Native `name` submitted with an enclosing form, read only by the fallback field. */\n\t\tname?: string;\n\t\t/** Current value, in `YYYY-MM-DD` form, for a fallback field a consumer tracks itself. */\n\t\tvalue?: string;\n\t\t/** Initial value, in `YYYY-MM-DD` form, for a fallback field left to the platform's own uncontrolled state. */\n\t\tdefaultValue?: string;\n\t\t/** Earliest accepted date, in `YYYY-MM-DD` form, read only by the fallback field. */\n\t\tmin?: string;\n\t\t/** Latest accepted date, in `YYYY-MM-DD` form, read only by the fallback field. */\n\t\tmax?: string;\n\t\t/** Granularity, in days, the fallback field's value must fall on. */\n\t\tstep?: number;\n\t\t/** Marks the fallback field required for its enclosing form. */\n\t\trequired?: boolean;\n\t\t/** Marks the fallback field inert and excluded from the tab order. */\n\t\tdisabled?: boolean;\n\t\t/** Marks the fallback field's value fixed, while keeping it focusable and included in form submission. */\n\t\treadOnly?: boolean;\n\t\t/** Native autofill hint for the fallback field, e.g. `\"bday\"`. */\n\t\tautoComplete?: string;\n\t\t/** Per-part styling for the fallback field's internally composed parts. Read only when `children` is unset. */\n\t\tparts?: PartsProps;\n\t\t/**\n\t\t * The composed layout — typically a `Label` and a\n\t\t * {@link DatePicker.Group} — rendered in place of the field, leaving every\n\t\t * field above unread.\n\t\t */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * `children` composes the field's own control, and a second one for a\n\t * range, into one visual row.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {}\n}\n\n/**\n * Renders {@link DatePicker}'s root. Leaving `children` unset renders the field,\n * passing every prop above through unchanged; composing\n * {@link DatePicker.Group} as `children` instead renders the joined row and\n * leaves those props unread.\n *\n * @param handle Runtime handle carrying the root element's props.\n * @returns The render function producing the date picker's markup.\n * @example\n * <DatePicker label={t(\"form.birthday.label\")} name=\"birthday\" autoComplete=\"bday\" />\n * @example\n * <DatePicker>\n * \t<Label htmlFor=\"startDate\">{t(\"form.startDate.label\")}</Label>\n * \t<DatePicker.Group>\n * \t\t<Input id=\"startDate\" type=\"date\" name=\"startDate\" />\n * \t</DatePicker.Group>\n * </DatePicker>\n */\nexport function DatePicker(handle: Handle<DatePicker.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor,\n\t\t\tlabel,\n\t\t\tdescription,\n\t\t\terrorMessage,\n\t\t\tname,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tmin,\n\t\t\tmax,\n\t\t\tstep,\n\t\t\trequired,\n\t\t\tdisabled,\n\t\t\treadOnly,\n\t\t\tautoComplete,\n\t\t\tparts,\n\t\t\tchildren,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\n\t\tif (import.meta.env?.DEV && !children && !label) {\n\t\t\tconsole.warn(\n\t\t\t\t'DatePicker: falling back to DateField\\'s plain \"input type=date\" needs a \"label\" describing what it collects for assistive technology.',\n\t\t\t);\n\t\t}\n\n\t\tif (!children) {\n\t\t\treturn (\n\t\t\t\t<DateField\n\t\t\t\t\t{...rest}\n\t\t\t\t\tcolor={color}\n\t\t\t\t\tlabel={label}\n\t\t\t\t\tdescription={description}\n\t\t\t\t\terrorMessage={errorMessage}\n\t\t\t\t\tname={name}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t\tmin={min}\n\t\t\t\t\tmax={max}\n\t\t\t\t\tstep={step}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\tautoComplete={autoComplete}\n\t\t\t\t\tparts={parts}\n\t\t\t\t\tmix={mix}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"date-picker\" mix={[flex(), flexCol(), gap(1), mix]}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link DatePicker}'s control row: a flex host laying one or more date\n * controls side by side and joining their edges, so a pair reads as one field.\n * Focus and validity are drawn the way `Group` draws them — focus by the control\n * that holds it, validity once around the row.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <DatePicker.Group>\n * \t<Input id=\"startDate\" type=\"date\" name=\"startDate\" />\n * </DatePicker.Group>\n */\nDatePicker.Group = function DatePickerGroup(handle: Handle<DatePicker.GroupProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The fields compose into one control, so the pair keeps the rounding on its own\n\t\t\t\t\t * outer corners and the seam the two share is drawn once.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& > *:not(:first-child)\", [\n\t\t\t\t\t\troundedCorner(\"start-start\", \"none\"),\n\t\t\t\t\t\troundedCorner(\"end-start\", \"none\"),\n\t\t\t\t\t\tmis(\"-1px\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"& > *:not(:last-child)\", [\n\t\t\t\t\t\troundedCorner(\"start-end\", \"none\"),\n\t\t\t\t\t\troundedCorner(\"end-end\", \"none\"),\n\t\t\t\t\t]),\n\t\t\t\t\t/**\n\t\t\t\t\t * Focus shows on the field holding it, naming which date has it where a ring around\n\t\t\t\t\t * the pair names only the group. That field is raised so its ring crosses the seam.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& > *:focus-visible\", z(1)),\n\t\t\t\t\t/**\n\t\t\t\t\t * Validity belongs to the pair, since a range is one value and half of one makes it\n\t\t\t\t\t * invalid: one ring is drawn around the group and each field's own ring is released,\n\t\t\t\t\t * so the seam shows one field needing attention.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'&:has(> :user-invalid), &:has(> [aria-invalid=\"true\"])',\n\t\t\t\t\t\toutline({ color: \"danger.ring\", offset: 2 }),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'& > :user-invalid:not(:focus-visible), & > [aria-invalid=\"true\"]:not(:focus-visible)',\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Important so it reaches across to the cascade layer where `Input` states the field's\n\t\t\t\t\t\t * invalid ring. The selector excludes `:focus-visible`, so a field being filled in still\n\t\t\t\t\t\t * shows its own focus ring.\n\t\t\t\t\t\t */\n\t\t\t\t\t\traw({ outline: \"none !important\" }),\n\t\t\t\t\t),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n"
13
13
  },
14
14
  "test": null
15
15
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "date-range-picker",
3
- "changedIn": "2026.10.2",
3
+ "changedIn": "2026.10.20",
4
4
  "dependencies": [
5
5
  "date-field",
6
6
  "date-picker"
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "source": {
12
12
  "path": "date-range-picker.tsx",
13
- "content": "/**\n * A paired-field date range control built on {@link DateField} — independent\n * start-date and end-date fields, each fully labeled, described, and validated\n * on its own — with a {@link DateRangePicker.Group} row for joining the two\n * into one control. The calendar is the platform's, since each field is a\n * native date input, so the whole range is pickable before any script loads.\n * Leaving `children` unset renders the pair on its own.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { flex, flexCol, gap, items } from \"@sdxc/u/layout\";\nimport { attrs } from \"remix/component\";\n\nimport { DateField } from \"@sdxc/ui/date-field\";\nimport { DatePicker } from \"@sdxc/ui/date-picker\";\n\n/**\n * Prop types for {@link DateRangePicker} and its compound parts.\n * {@link DateRangePicker.Group} aliases {@link DatePicker.Group} directly,\n * since a row of fields reads the same for a range as for a single date.\n */\nexport namespace DateRangePicker {\n\t/**\n\t * Semantic color role for the fallback pair's keyboard focus rings. Read\n\t * only by the fallback fields — {@link DateRangePicker.Group}'s composed\n\t * control carries no `color` prop of its own.\n\t */\n\texport type Color = DateField.Color;\n\n\t/**\n\t * Per-part styling for the two {@link DateField} instances the fallback\n\t * pair composes, each forwarded to that field's own `parts`. Read only\n\t * when `children` is unset; the composed layout styles its own parts individually instead.\n\t */\n\texport interface PartsProps {\n\t\t/** Per-part styling for the fallback pair's start-date field. */\n\t\tstart?: DateField.PartsProps;\n\t\t/** Per-part styling for the fallback pair's end-date field. */\n\t\tend?: DateField.PartsProps;\n\t}\n\n\t/**\n\t * Props accepted by {@link DateRangePicker}. Leaving `children` unset\n\t * renders two independent {@link DateField} instances — one per end of\n\t * the range — using every field below; composing\n\t * {@link DateRangePicker.Group} instead renders the joined row and leaves\n\t * every field below unread.\n\t */\n\texport interface Props extends Omit<TagProps<\"div\">, \"children\"> {\n\t\t/** Semantic color role for the fallback pair's focus rings. Read only when `children` is unset. */\n\t\tcolor?: Color;\n\t\t/** The start-date field's caption, rendered through {@link DateField}. Read only when `children` is unset. */\n\t\tstartLabel?: RemixNode;\n\t\t/** The end-date field's caption, rendered through {@link DateField}. Read only when `children` is unset. */\n\t\tendLabel?: RemixNode;\n\t\t/** Supporting copy beneath the start-date field. Read only when `children` is unset. */\n\t\tstartDescription?: RemixNode;\n\t\t/** Supporting copy beneath the end-date field. Read only when `children` is unset. */\n\t\tendDescription?: RemixNode;\n\t\t/** Validation message beneath the start-date field. Read only when `children` is unset. */\n\t\tstartErrorMessage?: RemixNode;\n\t\t/** Validation message beneath the end-date field. Read only when `children` is unset. */\n\t\tendErrorMessage?: RemixNode;\n\t\t/** Native `name` submitted with an enclosing form for the start-date field. */\n\t\tstartName?: string;\n\t\t/** Native `name` submitted with an enclosing form for the end-date field. */\n\t\tendName?: string;\n\t\t/** Current start-of-range value, in `YYYY-MM-DD` form, for a fallback pair a consumer tracks itself. */\n\t\tstartValue?: string;\n\t\t/** Current end-of-range value, in `YYYY-MM-DD` form, for a fallback pair a consumer tracks itself. */\n\t\tendValue?: string;\n\t\t/** Initial start-of-range value, in `YYYY-MM-DD` form, for a fallback pair left to the platform's own uncontrolled state. */\n\t\tstartDefaultValue?: string;\n\t\t/** Initial end-of-range value, in `YYYY-MM-DD` form, for a fallback pair left to the platform's own uncontrolled state. */\n\t\tendDefaultValue?: string;\n\t\t/** Earliest accepted date, in `YYYY-MM-DD` form, read by both of the fallback pair's fields. */\n\t\tmin?: string;\n\t\t/** Latest accepted date, in `YYYY-MM-DD` form, read by both of the fallback pair's fields. */\n\t\tmax?: string;\n\t\t/** Granularity, in days, both of the fallback pair's values must fall on. */\n\t\tstep?: number;\n\t\t/** Marks both of the fallback pair's fields required for their enclosing form. */\n\t\trequired?: boolean;\n\t\t/** Marks both of the fallback pair's fields inert and excluded from the tab order. */\n\t\tdisabled?: boolean;\n\t\t/** Marks both of the fallback pair's fields' values fixed, while keeping them focusable and included in form submission. */\n\t\treadOnly?: boolean;\n\t\t/** Native autofill hint for both of the fallback pair's fields. */\n\t\tautoComplete?: string;\n\t\t/** Per-part styling for the fallback pair's internally composed {@link DateField} instances. Read only when `children` is unset. */\n\t\tparts?: PartsProps;\n\t\t/**\n\t\t * The joined layout — typically a `Label` and a\n\t\t * {@link DateRangePicker.Group} — rendered in place of the paired fields,\n\t\t * leaving every field above unread when set.\n\t\t */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every prop {@link DatePicker.GroupProps} accepts, unchanged. `children`\n\t * composes the range's own start and end controls into one visual row.\n\t */\n\texport interface GroupProps extends DatePicker.GroupProps {}\n}\n\n/**\n * Renders {@link DateRangePicker}'s root. Leaving `children` unset renders\n * two independent {@link DateField} instances side by side under a native\n * `role=\"group\"`, each aligned to its own start edge so a validation message\n * under one never shifts the other's label; composing\n * {@link DateRangePicker.Group} as `children` instead joins the two fields into\n * one row and leaves every field prop above unread.\n *\n * @param handle Runtime handle carrying the root element's props.\n * @returns The render function producing the date range picker's markup.\n * @example\n * <DateRangePicker\n * \tstartLabel={t(\"form.stay.checkIn\")}\n * \tendLabel={t(\"form.stay.checkOut\")}\n * \tstartName=\"checkIn\"\n * \tendName=\"checkOut\"\n * />\n * @example\n * <DateRangePicker>\n * \t<Label htmlFor=\"tripStart\">{t(\"form.trip.label\")}</Label>\n * \t<DateRangePicker.Group>\n * \t\t<Input id=\"tripStart\" type=\"date\" name=\"tripStart\" aria-label={t(\"form.trip.start\")} />\n * \t\t<Input id=\"tripEnd\" type=\"date\" name=\"tripEnd\" aria-label={t(\"form.trip.end\")} />\n * \t</DateRangePicker.Group>\n * </DateRangePicker>\n */\nexport function DateRangePicker(handle: Handle<DateRangePicker.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor,\n\t\t\tstartLabel,\n\t\t\tendLabel,\n\t\t\tstartDescription,\n\t\t\tendDescription,\n\t\t\tstartErrorMessage,\n\t\t\tendErrorMessage,\n\t\t\tstartName,\n\t\t\tendName,\n\t\t\tstartValue,\n\t\t\tendValue,\n\t\t\tstartDefaultValue,\n\t\t\tendDefaultValue,\n\t\t\tmin,\n\t\t\tmax,\n\t\t\tstep,\n\t\t\trequired,\n\t\t\tdisabled,\n\t\t\treadOnly,\n\t\t\tautoComplete,\n\t\t\tparts,\n\t\t\tchildren,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\n\t\tif (import.meta.env.DEV && !children) {\n\t\t\tif (!startLabel) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'DateRangePicker: falling back to paired \"input type=date\" fields needs a \"startLabel\" describing the range\\'s start for assistive technology.',\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!endLabel) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'DateRangePicker: falling back to paired \"input type=date\" fields needs an \"endLabel\" describing the range\\'s end for assistive technology.',\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (!children) {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\t{...rest}\n\t\t\t\t\tdata-slot=\"fields\"\n\t\t\t\t\tmix={[attrs({ role: \"group\" }), flex(), gap(2), items(\"start\"), mix]}\n\t\t\t\t>\n\t\t\t\t\t<DateField\n\t\t\t\t\t\tcolor={color}\n\t\t\t\t\t\tlabel={startLabel}\n\t\t\t\t\t\tdescription={startDescription}\n\t\t\t\t\t\terrorMessage={startErrorMessage}\n\t\t\t\t\t\tname={startName}\n\t\t\t\t\t\tvalue={startValue}\n\t\t\t\t\t\tdefaultValue={startDefaultValue}\n\t\t\t\t\t\tmin={min}\n\t\t\t\t\t\tmax={max}\n\t\t\t\t\t\tstep={step}\n\t\t\t\t\t\trequired={required}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\tautoComplete={autoComplete}\n\t\t\t\t\t\tparts={parts?.start}\n\t\t\t\t\t/>\n\t\t\t\t\t<DateField\n\t\t\t\t\t\tcolor={color}\n\t\t\t\t\t\tlabel={endLabel}\n\t\t\t\t\t\tdescription={endDescription}\n\t\t\t\t\t\terrorMessage={endErrorMessage}\n\t\t\t\t\t\tname={endName}\n\t\t\t\t\t\tvalue={endValue}\n\t\t\t\t\t\tdefaultValue={endDefaultValue}\n\t\t\t\t\t\tmin={min}\n\t\t\t\t\t\tmax={max}\n\t\t\t\t\t\tstep={step}\n\t\t\t\t\t\trequired={required}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\tautoComplete={autoComplete}\n\t\t\t\t\t\tparts={parts?.end}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"date-range-picker\" mix={[flex(), flexCol(), gap(1), mix]}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link DateRangePicker}'s control row: identical to\n * {@link DatePicker.Group}'s markup and focus-within outline. `children`\n * composes the range's start and end controls with {@link DateRangePicker.Button}, and the row gains a keyboard focus ring whenever focus lands anywhere inside it.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <DateRangePicker.Group>\n * \t<Input id=\"tripStart\" type=\"date\" name=\"tripStart\" aria-label={t(\"form.trip.start\")} />\n * \t<Input id=\"tripEnd\" type=\"date\" name=\"tripEnd\" aria-label={t(\"form.trip.end\")} />\n * </DateRangePicker.Group>\n */\nDateRangePicker.Group = DatePicker.Group;\n"
13
+ "content": "/**\n * A paired-field date range control built on {@link DateField} — independent\n * start-date and end-date fields, each fully labeled, described, and validated\n * on its own — with a {@link DateRangePicker.Group} row for joining the two\n * into one control. The calendar is the platform's, since each field is a\n * native date input, so the whole range is pickable before any script loads.\n * Leaving `children` unset renders the pair on its own.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { flex, flexCol, gap, items } from \"@sdxc/u/layout\";\nimport { attrs } from \"remix/component\";\n\nimport { DateField } from \"@sdxc/ui/date-field\";\nimport { DatePicker } from \"@sdxc/ui/date-picker\";\n\n/**\n * Prop types for {@link DateRangePicker} and its compound parts.\n * {@link DateRangePicker.Group} aliases {@link DatePicker.Group} directly,\n * since a row of fields reads the same for a range as for a single date.\n */\nexport namespace DateRangePicker {\n\t/**\n\t * Semantic color role for the fallback pair's keyboard focus rings. Read\n\t * only by the fallback fields — {@link DateRangePicker.Group}'s composed\n\t * control carries no `color` prop of its own.\n\t */\n\texport type Color = DateField.Color;\n\n\t/**\n\t * Per-part styling for the two {@link DateField} instances the fallback\n\t * pair composes, each forwarded to that field's own `parts`. Read only\n\t * when `children` is unset; the composed layout styles its own parts individually instead.\n\t */\n\texport interface PartsProps {\n\t\t/** Per-part styling for the fallback pair's start-date field. */\n\t\tstart?: DateField.PartsProps;\n\t\t/** Per-part styling for the fallback pair's end-date field. */\n\t\tend?: DateField.PartsProps;\n\t}\n\n\t/**\n\t * Props accepted by {@link DateRangePicker}. Leaving `children` unset\n\t * renders two independent {@link DateField} instances — one per end of\n\t * the range — using every field below; composing\n\t * {@link DateRangePicker.Group} instead renders the joined row and leaves\n\t * every field below unread.\n\t */\n\texport interface Props extends Omit<TagProps<\"div\">, \"children\"> {\n\t\t/** Semantic color role for the fallback pair's focus rings. Read only when `children` is unset. */\n\t\tcolor?: Color;\n\t\t/** The start-date field's caption, rendered through {@link DateField}. Read only when `children` is unset. */\n\t\tstartLabel?: RemixNode;\n\t\t/** The end-date field's caption, rendered through {@link DateField}. Read only when `children` is unset. */\n\t\tendLabel?: RemixNode;\n\t\t/** Supporting copy beneath the start-date field. Read only when `children` is unset. */\n\t\tstartDescription?: RemixNode;\n\t\t/** Supporting copy beneath the end-date field. Read only when `children` is unset. */\n\t\tendDescription?: RemixNode;\n\t\t/** Validation message beneath the start-date field. Read only when `children` is unset. */\n\t\tstartErrorMessage?: RemixNode;\n\t\t/** Validation message beneath the end-date field. Read only when `children` is unset. */\n\t\tendErrorMessage?: RemixNode;\n\t\t/** Native `name` submitted with an enclosing form for the start-date field. */\n\t\tstartName?: string;\n\t\t/** Native `name` submitted with an enclosing form for the end-date field. */\n\t\tendName?: string;\n\t\t/** Current start-of-range value, in `YYYY-MM-DD` form, for a fallback pair a consumer tracks itself. */\n\t\tstartValue?: string;\n\t\t/** Current end-of-range value, in `YYYY-MM-DD` form, for a fallback pair a consumer tracks itself. */\n\t\tendValue?: string;\n\t\t/** Initial start-of-range value, in `YYYY-MM-DD` form, for a fallback pair left to the platform's own uncontrolled state. */\n\t\tstartDefaultValue?: string;\n\t\t/** Initial end-of-range value, in `YYYY-MM-DD` form, for a fallback pair left to the platform's own uncontrolled state. */\n\t\tendDefaultValue?: string;\n\t\t/** Earliest accepted date, in `YYYY-MM-DD` form, read by both of the fallback pair's fields. */\n\t\tmin?: string;\n\t\t/** Latest accepted date, in `YYYY-MM-DD` form, read by both of the fallback pair's fields. */\n\t\tmax?: string;\n\t\t/** Granularity, in days, both of the fallback pair's values must fall on. */\n\t\tstep?: number;\n\t\t/** Marks both of the fallback pair's fields required for their enclosing form. */\n\t\trequired?: boolean;\n\t\t/** Marks both of the fallback pair's fields inert and excluded from the tab order. */\n\t\tdisabled?: boolean;\n\t\t/** Marks both of the fallback pair's fields' values fixed, while keeping them focusable and included in form submission. */\n\t\treadOnly?: boolean;\n\t\t/** Native autofill hint for both of the fallback pair's fields. */\n\t\tautoComplete?: string;\n\t\t/** Per-part styling for the fallback pair's internally composed {@link DateField} instances. Read only when `children` is unset. */\n\t\tparts?: PartsProps;\n\t\t/**\n\t\t * The joined layout — typically a `Label` and a\n\t\t * {@link DateRangePicker.Group} — rendered in place of the paired fields,\n\t\t * leaving every field above unread when set.\n\t\t */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every prop {@link DatePicker.GroupProps} accepts, unchanged. `children`\n\t * composes the range's own start and end controls into one visual row.\n\t */\n\texport interface GroupProps extends DatePicker.GroupProps {}\n}\n\n/**\n * Renders {@link DateRangePicker}'s root. Leaving `children` unset renders\n * two independent {@link DateField} instances side by side under a native\n * `role=\"group\"`, each aligned to its own start edge so a validation message\n * under one never shifts the other's label; composing\n * {@link DateRangePicker.Group} as `children` instead joins the two fields into\n * one row and leaves every field prop above unread.\n *\n * @param handle Runtime handle carrying the root element's props.\n * @returns The render function producing the date range picker's markup.\n * @example\n * <DateRangePicker\n * \tstartLabel={t(\"form.stay.checkIn\")}\n * \tendLabel={t(\"form.stay.checkOut\")}\n * \tstartName=\"checkIn\"\n * \tendName=\"checkOut\"\n * />\n * @example\n * <DateRangePicker>\n * \t<Label htmlFor=\"tripStart\">{t(\"form.trip.label\")}</Label>\n * \t<DateRangePicker.Group>\n * \t\t<Input id=\"tripStart\" type=\"date\" name=\"tripStart\" aria-label={t(\"form.trip.start\")} />\n * \t\t<Input id=\"tripEnd\" type=\"date\" name=\"tripEnd\" aria-label={t(\"form.trip.end\")} />\n * \t</DateRangePicker.Group>\n * </DateRangePicker>\n */\nexport function DateRangePicker(handle: Handle<DateRangePicker.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor,\n\t\t\tstartLabel,\n\t\t\tendLabel,\n\t\t\tstartDescription,\n\t\t\tendDescription,\n\t\t\tstartErrorMessage,\n\t\t\tendErrorMessage,\n\t\t\tstartName,\n\t\t\tendName,\n\t\t\tstartValue,\n\t\t\tendValue,\n\t\t\tstartDefaultValue,\n\t\t\tendDefaultValue,\n\t\t\tmin,\n\t\t\tmax,\n\t\t\tstep,\n\t\t\trequired,\n\t\t\tdisabled,\n\t\t\treadOnly,\n\t\t\tautoComplete,\n\t\t\tparts,\n\t\t\tchildren,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\n\t\tif (import.meta.env?.DEV && !children) {\n\t\t\tif (!startLabel) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'DateRangePicker: falling back to paired \"input type=date\" fields needs a \"startLabel\" describing the range\\'s start for assistive technology.',\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!endLabel) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'DateRangePicker: falling back to paired \"input type=date\" fields needs an \"endLabel\" describing the range\\'s end for assistive technology.',\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (!children) {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\t{...rest}\n\t\t\t\t\tdata-slot=\"fields\"\n\t\t\t\t\tmix={[attrs({ role: \"group\" }), flex(), gap(2), items(\"start\"), mix]}\n\t\t\t\t>\n\t\t\t\t\t<DateField\n\t\t\t\t\t\tcolor={color}\n\t\t\t\t\t\tlabel={startLabel}\n\t\t\t\t\t\tdescription={startDescription}\n\t\t\t\t\t\terrorMessage={startErrorMessage}\n\t\t\t\t\t\tname={startName}\n\t\t\t\t\t\tvalue={startValue}\n\t\t\t\t\t\tdefaultValue={startDefaultValue}\n\t\t\t\t\t\tmin={min}\n\t\t\t\t\t\tmax={max}\n\t\t\t\t\t\tstep={step}\n\t\t\t\t\t\trequired={required}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\tautoComplete={autoComplete}\n\t\t\t\t\t\tparts={parts?.start}\n\t\t\t\t\t/>\n\t\t\t\t\t<DateField\n\t\t\t\t\t\tcolor={color}\n\t\t\t\t\t\tlabel={endLabel}\n\t\t\t\t\t\tdescription={endDescription}\n\t\t\t\t\t\terrorMessage={endErrorMessage}\n\t\t\t\t\t\tname={endName}\n\t\t\t\t\t\tvalue={endValue}\n\t\t\t\t\t\tdefaultValue={endDefaultValue}\n\t\t\t\t\t\tmin={min}\n\t\t\t\t\t\tmax={max}\n\t\t\t\t\t\tstep={step}\n\t\t\t\t\t\trequired={required}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\tautoComplete={autoComplete}\n\t\t\t\t\t\tparts={parts?.end}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"date-range-picker\" mix={[flex(), flexCol(), gap(1), mix]}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link DateRangePicker}'s control row: identical to\n * {@link DatePicker.Group}'s markup and focus-within outline. `children`\n * composes the range's start and end controls with {@link DateRangePicker.Button}, and the row gains a keyboard focus ring whenever focus lands anywhere inside it.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <DateRangePicker.Group>\n * \t<Input id=\"tripStart\" type=\"date\" name=\"tripStart\" aria-label={t(\"form.trip.start\")} />\n * \t<Input id=\"tripEnd\" type=\"date\" name=\"tripEnd\" aria-label={t(\"form.trip.end\")} />\n * </DateRangePicker.Group>\n */\nDateRangePicker.Group = DatePicker.Group;\n"
14
14
  },
15
15
  "test": null
16
16
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dialog",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.10.20",
4
4
  "dependencies": [
5
5
  "button",
6
6
  "heading-scope"
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "source": {
12
12
  "path": "dialog.tsx",
13
- "content": "/**\n * A modal surface built on the native `<dialog>` element, opened and closed\n * declaratively through Invoker Commands (`commandfor`/`command`) instead of\n * a JavaScript-tracked open state. Compound parts cover a header, title,\n * description, footer, and a dismiss control, so a page composes only the\n * pieces a given dialog needs.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { XIcon } from \"@sdxc/icons\";\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport {\n\tbackdropBlur,\n\tbackdropSaturate,\n\topacity,\n\trounded,\n\tshadow,\n\ttransition,\n\ttransitionBehavior,\n} from \"@sdxc/u/effects\";\nimport { raw, vars } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tcontainer,\n\tfixed,\n\tflex,\n\tflexCol,\n\tflexColReverse,\n\tflexRow,\n\tgap,\n\tinset,\n\tjustify,\n\trelative,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { at, media, startingStyle, supports } from \"@sdxc/u/responsive\";\nimport { is, maxBs, maxIs, p } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport {\n\tbalance,\n\tfontSize,\n\tleading,\n\tpretty,\n\ttextAlign,\n\ttracking,\n\tweight,\n} from \"@sdxc/u/typography\";\n\nimport { durations, easings } from \"@sdxc/ui/animations\";\nimport { SHADOW_RING } from \"@sdxc/ui/styles\";\n\nimport { Button } from \"@sdxc/ui/button\";\nimport { resolveHeadingLevel, TAG_BY_LEVEL } from \"@sdxc/ui/heading-scope\";\n\n/**\n * Named container {@link Dialog} declares on its own host, so\n * {@link Dialog.Header} and {@link Dialog.Footer} can query the panel's own\n * width instead of the page's.\n */\nconst CONTAINER_NAME = \"ui-dialog\";\n\n/**\n * Panel width from which {@link Dialog.Header} and {@link Dialog.Footer} lay out for a\n * comfortable dialog: a leading title and a trailing row of actions. It is measured\n * against the panel's own inline size, which a dialog keeps well under a viewport's.\n */\nconst COMFORTABLE_WIDTH = \"24rem\";\n\n/**\n * Invoker Commands verb {@link Dialog.CloseProps.command} falls back to when\n * omitted, dismissing the ancestor Dialog named by `commandfor`.\n */\nconst DEFAULT_CLOSE_COMMAND = \"close\";\n\n/**\n * Prop types for {@link Dialog} and its compound parts.\n */\nexport namespace Dialog {\n\t/**\n\t * Every native `<dialog>` attribute, plus the `mix` passthrough. `role`\n\t * stays the platform's implicit `\"dialog\"` unless set to `\"alertdialog\"`,\n\t * and `open`/`closedby` stay the platform's own native state and light-dismiss controls.\n\t */\n\texport interface Props extends TagProps<\"dialog\"> {\n\t\t/** The panel's compound parts: {@link Dialog.Header}, {@link Dialog.Footer}, {@link Dialog.Close}, or any other content. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Dialog.Header}.\n\t */\n\texport interface HeaderProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Props accepted by {@link Dialog.Title}. Every native heading-element\n\t * attribute still applies, since the rendered tag depends on the nearest\n\t * ambient heading level, falling back to `<h1>` where none is set.\n\t */\n\texport interface TitleProps extends TagProps<\"h1\"> {}\n\n\t/**\n\t * Props accepted by {@link Dialog.Description}.\n\t */\n\texport interface DescriptionProps extends TagProps<\"p\"> {}\n\n\t/**\n\t * Props accepted by {@link Dialog.Footer}.\n\t */\n\texport interface FooterProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Props accepted by {@link Dialog.Close}: every {@link Button.Props} field\n\t * except the ones this component fixes on the consumer's behalf.\n\t */\n\texport interface CloseProps extends Omit<\n\t\tButton.Props,\n\t\t\"children\" | \"variant\" | \"color\" | \"size\" | \"aria-label\" | \"commandfor\" | \"command\"\n\t> {\n\t\t/** `id` of the ancestor {@link Dialog} this button dismisses. */\n\t\tcommandfor: string;\n\t\t/** Invoker Commands verb dispatched to the target Dialog. Defaults to `\"close\"`. */\n\t\tcommand?: \"close\";\n\t\t/**\n\t\t * Accessible label for the icon-only control — required, since the\n\t\t * button carries no visible text for assistive technology to read.\n\t\t */\n\t\t\"aria-label\": string;\n\t}\n}\n\n/**\n * Renders the dialog panel as a native `<dialog>` host, its `::backdrop`\n * tinted and, where supported, blurred to dim the page behind it. The panel\n * declares the `ui-dialog` named container so {@link Dialog.Header} and {@link Dialog.Footer} can size against the panel's own width; Invoker Commands open and close it declaratively — a trigger elsewhere points `commandfor` at this element's `id` with `command=\"show-modal\"`, and any control inside, including {@link Dialog.Close}, points `commandfor` at that same `id` with `command=\"close\"`.\n *\n * @param handle Runtime handle carrying the host `<dialog>`'s props.\n * @returns The render function producing the panel's markup.\n * @example\n * <Button commandfor=\"confirm-delete\" command=\"show-modal\">{t(\"project.delete\")}</Button>\n * <Dialog id=\"confirm-delete\" aria-labelledby=\"confirm-delete-title\">\n * \t<Dialog.Header>\n * \t\t<Dialog.Title id=\"confirm-delete-title\">{t(\"project.deleteTitle\")}</Dialog.Title>\n * \t\t<Dialog.Description>{t(\"project.deleteDescription\")}</Dialog.Description>\n * \t</Dialog.Header>\n * \t<Dialog.Footer>\n * \t\t<Button commandfor=\"confirm-delete\" command=\"close\" color=\"danger\">{t(\"actions.delete\")}</Button>\n * \t</Dialog.Footer>\n * \t<Dialog.Close commandfor=\"confirm-delete\" aria-label={t(\"actions.close\")} />\n * </Dialog>\n * @example\n * <Dialog id=\"welcome\" mix={zoom({ duration: durations.normal })}>\n * \t<Dialog.Header>\n * \t\t<Dialog.Title>{t(\"welcome.title\")}</Dialog.Title>\n * \t</Dialog.Header>\n * </Dialog>\n */\nexport function Dialog(handle: Handle<Dialog.Props>) {\n\treturn () => {\n\t\tlet { id, children, mix, ...rest } = handle.props;\n\n\t\tif (import.meta.env.DEV && !id) {\n\t\t\tconsole.warn(\n\t\t\t\t'Dialog rendered without an \"id\" — \"commandfor\" on a trigger or close control has nothing to target.',\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<dialog\n\t\t\t\t{...rest}\n\t\t\t\tid={id}\n\t\t\t\tdata-slot=\"dialog\"\n\t\t\t\tmix={[\n\t\t\t\t\t/**\n\t\t\t\t\t * Establishes the containing block {@link Dialog.Close} pins itself to while\n\t\t\t\t\t * the panel sits in the page's flow, which a dialog opened through its `open`\n\t\t\t\t\t * attribute alone does.\n\t\t\t\t\t */\n\t\t\t\t\trelative(),\n\t\t\t\t\t/**\n\t\t\t\t\t * Measures a modal panel against the viewport, so it stays centered on screen\n\t\t\t\t\t * however far the page behind it is scrolled: the top layer resolves any other\n\t\t\t\t\t * positioning scheme against the document's own coordinates.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&:modal\", fixed()),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * Wide enough for the form a dialog usually carries, so a field, its help text and a row\n\t\t\t\t\t * of actions read as one column. A consumer with less to say narrows it through `mix`.\n\t\t\t\t\t */\n\t\t\t\t\tmaxIs(\"32rem\"),\n\t\t\t\t\tmaxBs(\"90vh\"),\n\t\t\t\t\tgap(6),\n\t\t\t\t\tp(6),\n\t\t\t\t\toverflow(\"auto\"),\n\t\t\t\t\t/** Gated on `[open]` so the UA's own `dialog:not([open])` hiding still applies. */\n\t\t\t\t\twhen(\"&[open]\", flex()),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tcontainer(CONTAINER_NAME, \"inline-size\"),\n\t\t\t\t\twhen(\"&::backdrop\", [\n\t\t\t\t\t\tbg(\"rgb(0 0 0 / 0.5)\"),\n\t\t\t\t\t\ttransitionBehavior(\"allow-discrete\"),\n\t\t\t\t\t\topacity(0),\n\t\t\t\t\t\ttransition(\"opacity, display, overlay\", {\n\t\t\t\t\t\t\tduration: durations.normal,\n\t\t\t\t\t\t\teasing: easings.standard,\n\t\t\t\t\t\t}),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&[open]::backdrop\", opacity(100)),\n\t\t\t\t\tsupports(\n\t\t\t\t\t\t\"(backdrop-filter: blur(0))\",\n\t\t\t\t\t\tmedia(\n\t\t\t\t\t\t\t\"(prefers-reduced-transparency: no-preference)\",\n\t\t\t\t\t\t\twhen(\"&::backdrop\", [backdropBlur(\"md\"), backdropSaturate(1.4)]),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\tstartingStyle(when(\"&[open]::backdrop\", opacity(0))),\n\t\t\t\t\toutline(\"none\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The panel's edge is a ring shadow that takes on the tone behind it, over a\n\t\t\t\t\t * transparent border that forced-colors mode still paints as a line.\n\t\t\t\t\t */\n\t\t\t\t\tborder({ color: \"transparent\", width: 1 }),\n\t\t\t\t\tshadow(\"xl\"),\n\t\t\t\t\tvars({ \"ui-box-shadow-ring\": SHADOW_RING }),\n\t\t\t\t\t/** `overscrollBehavior` has no matching utility. */\n\t\t\t\t\traw({ overscrollBehavior: \"contain\" }),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</dialog>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link Dialog.HeaderProps.children} as the panel's header slot: a\n * column stacking {@link Dialog.Title} and {@link Dialog.Description},\n * centered while narrow and start-aligned (flipping under `dir=\"rtl\"`) once the panel's own `ui-dialog` container grows past `40rem`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the header slot's markup.\n * @example\n * <Dialog.Header>\n * \t<Dialog.Title>{t(\"project.deleteTitle\")}</Dialog.Title>\n * \t<Dialog.Description>{t(\"project.deleteDescription\")}</Dialog.Description>\n * </Dialog.Header>\n */\nDialog.Header = function DialogHeader(handle: Handle<Dialog.HeaderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"header\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tgap(1.5),\n\t\t\t\t\ttextAlign(\"center\"),\n\t\t\t\t\tat(COMFORTABLE_WIDTH, CONTAINER_NAME, textAlign(\"start\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Dialog.TitleProps.children} as the panel's heading, inside\n * the native heading element matching the nearest ambient heading level —\n * `<h1>` by default — sized and weighted as the panel's most prominent line of text at every level.\n *\n * @param handle Runtime handle carrying the host heading element's props.\n * @returns The render function producing the heading's markup.\n * @example\n * <Dialog.Title>{t(\"project.deleteTitle\")}</Dialog.Title>\n */\nDialog.Title = function DialogTitle(handle: Handle<Dialog.TitleProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\t\tlet resolved = resolveHeadingLevel(handle);\n\t\tlet Tag = TAG_BY_LEVEL[resolved];\n\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"title\"\n\t\t\t\tmix={[\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\ttracking(\"tight\"),\n\t\t\t\t\tfontSize(\"lg\"),\n\t\t\t\t\tleading(1),\n\t\t\t\t\tbalance(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{rest.children}\n\t\t\t</Tag>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Dialog.DescriptionProps.children} as the panel's supporting\n * copy, in a native `<p>` set to the panel's muted foreground color so it\n * reads as secondary to {@link Dialog.Title}.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the description's markup.\n * @example\n * <Dialog.Description>{t(\"project.deleteDescription\")}</Dialog.Description>\n */\nDialog.Description = function DialogDescription(handle: Handle<Dialog.DescriptionProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"description\"\n\t\t\t\tmix={[fg(\"neutral.muted\"), fontSize(\"sm\"), pretty(), mix]}\n\t\t\t>\n\t\t\t\t{rest.children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Dialog.FooterProps.children} as the panel's action row: a\n * column of stacked, full-width controls while the panel is narrow,\n * switching to a single end-aligned row past the panel's own `40rem` container mark.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action row's markup.\n * @example\n * <Dialog.Footer>\n * \t<Button commandfor=\"confirm-delete\" command=\"close\" variant=\"outline\">{t(\"actions.cancel\")}</Button>\n * \t<Button commandfor=\"confirm-delete\" command=\"close\" color=\"danger\">{t(\"actions.delete\")}</Button>\n * </Dialog.Footer>\n */\nDialog.Footer = function DialogFooter(handle: Handle<Dialog.FooterProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"footer\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tgap(2),\n\t\t\t\t\tflexColReverse(),\n\t\t\t\t\tat(COMFORTABLE_WIDTH, CONTAINER_NAME, [flexRow(), justify(\"end\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a dismiss control for the ancestor {@link Dialog} named by\n * `commandfor`: a small, ghost-styled {@link Button} with a fixed \"X\" glyph,\n * pinned to the panel's corner. `command` defaults to `\"close\"`, so passing only `commandfor` and `aria-label` wires it up.\n *\n * @param handle Runtime handle carrying the host button's props.\n * @returns The render function producing the dismiss control's markup.\n * @example\n * <Dialog.Close commandfor=\"confirm-delete\" aria-label={t(\"actions.close\")} />\n */\nDialog.Close = function DialogClose(handle: Handle<Dialog.CloseProps>) {\n\treturn () => {\n\t\tlet { commandfor, command, mix, ...rest } = handle.props;\n\t\tlet resolvedCommand = command ?? DEFAULT_CLOSE_COMMAND;\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\t{...rest}\n\t\t\t\ttype=\"button\"\n\t\t\t\tvariant=\"ghost\"\n\t\t\t\tcolor=\"neutral\"\n\t\t\t\tsize=\"sm\"\n\t\t\t\tcommandfor={commandfor}\n\t\t\t\tcommand={resolvedCommand}\n\t\t\t\tdata-slot=\"close\"\n\t\t\t\tmix={[absolute(), inset(4, 4, \"auto\", \"auto\"), mix]}\n\t\t\t>\n\t\t\t\t<XIcon size={16} />\n\t\t\t</Button>\n\t\t);\n\t};\n};\n"
13
+ "content": "/**\n * A modal surface built on the native `<dialog>` element, opened and closed\n * declaratively through Invoker Commands (`commandfor`/`command`) instead of\n * a JavaScript-tracked open state. Compound parts cover a header, title,\n * description, footer, and a dismiss control, so a page composes only the\n * pieces a given dialog needs.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { XIcon } from \"@sdxc/icons\";\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport {\n\tbackdropBlur,\n\tbackdropSaturate,\n\topacity,\n\trounded,\n\tshadow,\n\ttransition,\n\ttransitionBehavior,\n} from \"@sdxc/u/effects\";\nimport { raw, vars } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tcontainer,\n\tfixed,\n\tflex,\n\tflexCol,\n\tflexColReverse,\n\tflexRow,\n\tgap,\n\tinset,\n\tjustify,\n\trelative,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { at, media, startingStyle, supports } from \"@sdxc/u/responsive\";\nimport { is, maxBs, maxIs, p } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport {\n\tbalance,\n\tfontSize,\n\tleading,\n\tpretty,\n\ttextAlign,\n\ttracking,\n\tweight,\n} from \"@sdxc/u/typography\";\n\nimport { durations, easings } from \"@sdxc/ui/animations\";\nimport { SHADOW_RING } from \"@sdxc/ui/styles\";\n\nimport { Button } from \"@sdxc/ui/button\";\nimport { resolveHeadingLevel, TAG_BY_LEVEL } from \"@sdxc/ui/heading-scope\";\n\n/**\n * Named container {@link Dialog} declares on its own host, so\n * {@link Dialog.Header} and {@link Dialog.Footer} can query the panel's own\n * width instead of the page's.\n */\nconst CONTAINER_NAME = \"ui-dialog\";\n\n/**\n * Panel width from which {@link Dialog.Header} and {@link Dialog.Footer} lay out for a\n * comfortable dialog: a leading title and a trailing row of actions. It is measured\n * against the panel's own inline size, which a dialog keeps well under a viewport's.\n */\nconst COMFORTABLE_WIDTH = \"24rem\";\n\n/**\n * Invoker Commands verb {@link Dialog.CloseProps.command} falls back to when\n * omitted, dismissing the ancestor Dialog named by `commandfor`.\n */\nconst DEFAULT_CLOSE_COMMAND = \"close\";\n\n/**\n * Prop types for {@link Dialog} and its compound parts.\n */\nexport namespace Dialog {\n\t/**\n\t * Every native `<dialog>` attribute, plus the `mix` passthrough. `role`\n\t * stays the platform's implicit `\"dialog\"` unless set to `\"alertdialog\"`,\n\t * and `open`/`closedby` stay the platform's own native state and light-dismiss controls.\n\t */\n\texport interface Props extends TagProps<\"dialog\"> {\n\t\t/** The panel's compound parts: {@link Dialog.Header}, {@link Dialog.Footer}, {@link Dialog.Close}, or any other content. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Dialog.Header}.\n\t */\n\texport interface HeaderProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Props accepted by {@link Dialog.Title}. Every native heading-element\n\t * attribute still applies, since the rendered tag depends on the nearest\n\t * ambient heading level, falling back to `<h1>` where none is set.\n\t */\n\texport interface TitleProps extends TagProps<\"h1\"> {}\n\n\t/**\n\t * Props accepted by {@link Dialog.Description}.\n\t */\n\texport interface DescriptionProps extends TagProps<\"p\"> {}\n\n\t/**\n\t * Props accepted by {@link Dialog.Footer}.\n\t */\n\texport interface FooterProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Props accepted by {@link Dialog.Close}: every {@link Button.Props} field\n\t * except the ones this component fixes on the consumer's behalf.\n\t */\n\texport interface CloseProps extends Omit<\n\t\tButton.Props,\n\t\t\"children\" | \"variant\" | \"color\" | \"size\" | \"aria-label\" | \"commandfor\" | \"command\"\n\t> {\n\t\t/** `id` of the ancestor {@link Dialog} this button dismisses. */\n\t\tcommandfor: string;\n\t\t/** Invoker Commands verb dispatched to the target Dialog. Defaults to `\"close\"`. */\n\t\tcommand?: \"close\";\n\t\t/**\n\t\t * Accessible label for the icon-only control — required, since the\n\t\t * button carries no visible text for assistive technology to read.\n\t\t */\n\t\t\"aria-label\": string;\n\t}\n}\n\n/**\n * Renders the dialog panel as a native `<dialog>` host, its `::backdrop`\n * tinted and, where supported, blurred to dim the page behind it. The panel\n * declares the `ui-dialog` named container so {@link Dialog.Header} and {@link Dialog.Footer} can size against the panel's own width; Invoker Commands open and close it declaratively — a trigger elsewhere points `commandfor` at this element's `id` with `command=\"show-modal\"`, and any control inside, including {@link Dialog.Close}, points `commandfor` at that same `id` with `command=\"close\"`.\n *\n * @param handle Runtime handle carrying the host `<dialog>`'s props.\n * @returns The render function producing the panel's markup.\n * @example\n * <Button commandfor=\"confirm-delete\" command=\"show-modal\">{t(\"project.delete\")}</Button>\n * <Dialog id=\"confirm-delete\" aria-labelledby=\"confirm-delete-title\">\n * \t<Dialog.Header>\n * \t\t<Dialog.Title id=\"confirm-delete-title\">{t(\"project.deleteTitle\")}</Dialog.Title>\n * \t\t<Dialog.Description>{t(\"project.deleteDescription\")}</Dialog.Description>\n * \t</Dialog.Header>\n * \t<Dialog.Footer>\n * \t\t<Button commandfor=\"confirm-delete\" command=\"close\" color=\"danger\">{t(\"actions.delete\")}</Button>\n * \t</Dialog.Footer>\n * \t<Dialog.Close commandfor=\"confirm-delete\" aria-label={t(\"actions.close\")} />\n * </Dialog>\n * @example\n * <Dialog id=\"welcome\" mix={zoom({ duration: durations.normal })}>\n * \t<Dialog.Header>\n * \t\t<Dialog.Title>{t(\"welcome.title\")}</Dialog.Title>\n * \t</Dialog.Header>\n * </Dialog>\n */\nexport function Dialog(handle: Handle<Dialog.Props>) {\n\treturn () => {\n\t\tlet { id, children, mix, ...rest } = handle.props;\n\n\t\tif (import.meta.env?.DEV && !id) {\n\t\t\tconsole.warn(\n\t\t\t\t'Dialog rendered without an \"id\" — \"commandfor\" on a trigger or close control has nothing to target.',\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<dialog\n\t\t\t\t{...rest}\n\t\t\t\tid={id}\n\t\t\t\tdata-slot=\"dialog\"\n\t\t\t\tmix={[\n\t\t\t\t\t/**\n\t\t\t\t\t * Establishes the containing block {@link Dialog.Close} pins itself to while\n\t\t\t\t\t * the panel sits in the page's flow, which a dialog opened through its `open`\n\t\t\t\t\t * attribute alone does.\n\t\t\t\t\t */\n\t\t\t\t\trelative(),\n\t\t\t\t\t/**\n\t\t\t\t\t * Measures a modal panel against the viewport, so it stays centered on screen\n\t\t\t\t\t * however far the page behind it is scrolled: the top layer resolves any other\n\t\t\t\t\t * positioning scheme against the document's own coordinates.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&:modal\", fixed()),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * Wide enough for the form a dialog usually carries, so a field, its help text and a row\n\t\t\t\t\t * of actions read as one column. A consumer with less to say narrows it through `mix`.\n\t\t\t\t\t */\n\t\t\t\t\tmaxIs(\"32rem\"),\n\t\t\t\t\tmaxBs(\"90vh\"),\n\t\t\t\t\tgap(6),\n\t\t\t\t\tp(6),\n\t\t\t\t\toverflow(\"auto\"),\n\t\t\t\t\t/** Gated on `[open]` so the UA's own `dialog:not([open])` hiding still applies. */\n\t\t\t\t\twhen(\"&[open]\", flex()),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tcontainer(CONTAINER_NAME, \"inline-size\"),\n\t\t\t\t\twhen(\"&::backdrop\", [\n\t\t\t\t\t\tbg(\"rgb(0 0 0 / 0.5)\"),\n\t\t\t\t\t\ttransitionBehavior(\"allow-discrete\"),\n\t\t\t\t\t\topacity(0),\n\t\t\t\t\t\ttransition(\"opacity, display, overlay\", {\n\t\t\t\t\t\t\tduration: durations.normal,\n\t\t\t\t\t\t\teasing: easings.standard,\n\t\t\t\t\t\t}),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&[open]::backdrop\", opacity(100)),\n\t\t\t\t\tsupports(\n\t\t\t\t\t\t\"(backdrop-filter: blur(0))\",\n\t\t\t\t\t\tmedia(\n\t\t\t\t\t\t\t\"(prefers-reduced-transparency: no-preference)\",\n\t\t\t\t\t\t\twhen(\"&::backdrop\", [backdropBlur(\"md\"), backdropSaturate(1.4)]),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\tstartingStyle(when(\"&[open]::backdrop\", opacity(0))),\n\t\t\t\t\toutline(\"none\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The panel's edge is a ring shadow that takes on the tone behind it, over a\n\t\t\t\t\t * transparent border that forced-colors mode still paints as a line.\n\t\t\t\t\t */\n\t\t\t\t\tborder({ color: \"transparent\", width: 1 }),\n\t\t\t\t\tshadow(\"xl\"),\n\t\t\t\t\tvars({ \"ui-box-shadow-ring\": SHADOW_RING }),\n\t\t\t\t\t/** `overscrollBehavior` has no matching utility. */\n\t\t\t\t\traw({ overscrollBehavior: \"contain\" }),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</dialog>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link Dialog.HeaderProps.children} as the panel's header slot: a\n * column stacking {@link Dialog.Title} and {@link Dialog.Description},\n * centered while narrow and start-aligned (flipping under `dir=\"rtl\"`) once the panel's own `ui-dialog` container grows past `40rem`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the header slot's markup.\n * @example\n * <Dialog.Header>\n * \t<Dialog.Title>{t(\"project.deleteTitle\")}</Dialog.Title>\n * \t<Dialog.Description>{t(\"project.deleteDescription\")}</Dialog.Description>\n * </Dialog.Header>\n */\nDialog.Header = function DialogHeader(handle: Handle<Dialog.HeaderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"header\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tgap(1.5),\n\t\t\t\t\ttextAlign(\"center\"),\n\t\t\t\t\tat(COMFORTABLE_WIDTH, CONTAINER_NAME, textAlign(\"start\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Dialog.TitleProps.children} as the panel's heading, inside\n * the native heading element matching the nearest ambient heading level —\n * `<h1>` by default — sized and weighted as the panel's most prominent line of text at every level.\n *\n * @param handle Runtime handle carrying the host heading element's props.\n * @returns The render function producing the heading's markup.\n * @example\n * <Dialog.Title>{t(\"project.deleteTitle\")}</Dialog.Title>\n */\nDialog.Title = function DialogTitle(handle: Handle<Dialog.TitleProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\t\tlet resolved = resolveHeadingLevel(handle);\n\t\tlet Tag = TAG_BY_LEVEL[resolved];\n\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"title\"\n\t\t\t\tmix={[\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\ttracking(\"tight\"),\n\t\t\t\t\tfontSize(\"lg\"),\n\t\t\t\t\tleading(1),\n\t\t\t\t\tbalance(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{rest.children}\n\t\t\t</Tag>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Dialog.DescriptionProps.children} as the panel's supporting\n * copy, in a native `<p>` set to the panel's muted foreground color so it\n * reads as secondary to {@link Dialog.Title}.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the description's markup.\n * @example\n * <Dialog.Description>{t(\"project.deleteDescription\")}</Dialog.Description>\n */\nDialog.Description = function DialogDescription(handle: Handle<Dialog.DescriptionProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"description\"\n\t\t\t\tmix={[fg(\"neutral.muted\"), fontSize(\"sm\"), pretty(), mix]}\n\t\t\t>\n\t\t\t\t{rest.children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Dialog.FooterProps.children} as the panel's action row: a\n * column of stacked, full-width controls while the panel is narrow,\n * switching to a single end-aligned row past the panel's own `40rem` container mark.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action row's markup.\n * @example\n * <Dialog.Footer>\n * \t<Button commandfor=\"confirm-delete\" command=\"close\" variant=\"outline\">{t(\"actions.cancel\")}</Button>\n * \t<Button commandfor=\"confirm-delete\" command=\"close\" color=\"danger\">{t(\"actions.delete\")}</Button>\n * </Dialog.Footer>\n */\nDialog.Footer = function DialogFooter(handle: Handle<Dialog.FooterProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"footer\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tgap(2),\n\t\t\t\t\tflexColReverse(),\n\t\t\t\t\tat(COMFORTABLE_WIDTH, CONTAINER_NAME, [flexRow(), justify(\"end\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a dismiss control for the ancestor {@link Dialog} named by\n * `commandfor`: a small, ghost-styled {@link Button} with a fixed \"X\" glyph,\n * pinned to the panel's corner. `command` defaults to `\"close\"`, so passing only `commandfor` and `aria-label` wires it up.\n *\n * @param handle Runtime handle carrying the host button's props.\n * @returns The render function producing the dismiss control's markup.\n * @example\n * <Dialog.Close commandfor=\"confirm-delete\" aria-label={t(\"actions.close\")} />\n */\nDialog.Close = function DialogClose(handle: Handle<Dialog.CloseProps>) {\n\treturn () => {\n\t\tlet { commandfor, command, mix, ...rest } = handle.props;\n\t\tlet resolvedCommand = command ?? DEFAULT_CLOSE_COMMAND;\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\t{...rest}\n\t\t\t\ttype=\"button\"\n\t\t\t\tvariant=\"ghost\"\n\t\t\t\tcolor=\"neutral\"\n\t\t\t\tsize=\"sm\"\n\t\t\t\tcommandfor={commandfor}\n\t\t\t\tcommand={resolvedCommand}\n\t\t\t\tdata-slot=\"close\"\n\t\t\t\tmix={[absolute(), inset(4, 4, \"auto\", \"auto\"), mix]}\n\t\t\t>\n\t\t\t\t<XIcon size={16} />\n\t\t\t</Button>\n\t\t);\n\t};\n};\n"
14
14
  },
15
15
  "test": {
16
16
  "path": "dialog.test.tsx",
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "file-trigger",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.10.20",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "FileTrigger"
7
7
  ],
8
8
  "source": {
9
9
  "path": "file-trigger.tsx",
10
- "content": "/**\n * A pressable surface that opens the platform's file picker, backed by a\n * native `<input type=\"file\">` wrapped in a `<label>` so the platform itself\n * handles the trigger-to-picker wiring. Its visible content renders inside\n * the same label as a button-like surface, colored, weighted, and sized\n * through the same semantic contract as this library's other pressable\n * controls.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { visuallyHidden } from \"@sdxc/u/a11y\";\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, userSelect } from \"@sdxc/u/general\";\nimport { gap, inlineFlex, items, justify, shrink } from \"@sdxc/u/layout\";\nimport { bs, is, minBs, pb, pi } from \"@sdxc/u/size\";\nimport { active, data, hover, when } from \"@sdxc/u/state\";\nimport { text, weight } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { hasAccessibleText } from \"@sdxc/ui/utils\";\n\n/** Semantic color role {@link FileTrigger} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: FileTrigger.Color = \"neutral\";\n\n/** Visual weight {@link FileTrigger} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: FileTrigger.Variant = \"solid\";\n\n/** Size variant {@link FileTrigger} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: FileTrigger.Size = \"md\";\n\n/**\n * Prop types for {@link FileTrigger}.\n */\nexport namespace FileTrigger {\n\t/**\n\t * Semantic color role, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Visual weight the trigger renders with: a solid fill with an on-solid\n\t * foreground, a transparent fill with a strong colored border, or a fully\n\t * transparent fill with just a colored label.\n\t */\n\texport type Variant = \"solid\" | \"outline\" | \"ghost\";\n\n\t/**\n\t * Size variant controlling the trigger's padding and font size.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * Per-part styling for the elements this component composes besides its\n\t * own host `<input>`.\n\t */\n\texport interface PartsProps {\n\t\t/** Styling for the `<label>` rendering as the trigger's visible, pressable surface. */\n\t\ttrigger?: TagProps<\"label\">[\"mix\"];\n\t}\n\n\t/**\n\t * Props accepted by {@link FileTrigger}. Every native `<input type=\"file\">`\n\t * attribute applies unchanged except `type` (fixed `\"file\"`), `role` (not\n\t * overridable on a file input), and `size` (repurposed for visual size).\n\t */\n\texport interface Props extends Omit<TagProps<\"input\">, \"type\" | \"role\" | \"size\"> {\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Visual weight. Defaults to {@link DEFAULT_VARIANT}. */\n\t\tvariant?: Variant;\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t\t/**\n\t\t * Switches the picker from choosing individual files to choosing whole\n\t\t * directories, carrying every file nested inside the chosen directory.\n\t\t */\n\t\tacceptDirectory?: boolean;\n\t\t/**\n\t\t * The trigger's visible content, rendered inside the same `<label>` that\n\t\t * wraps the host `<input>` — an icon, text, or both, kept decorative so\n\t\t * the platform's label-to-control association reaches the input on click.\n\t\t */\n\t\tchildren?: RemixNode;\n\t\t/** Per-part styling for this component's internally composed elements. */\n\t\tparts?: PartsProps;\n\t}\n}\n\n/**\n * Renders a native `<input type=\"file\">` wrapped in a `<label>` styled\n * through this library's shared `data-color`/`data-variant`/`data-size`\n * contract; in dev mode, content lacking an accessible name logs a warning.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the trigger's markup.\n * @example\n * <FileTrigger name=\"avatar\" accept=\"image/png, image/jpeg\">\n * \t{t(\"profile.chooseFile\")}\n * </FileTrigger>\n * @example\n * <FileTrigger name=\"attachments\" multiple color=\"brand\" variant=\"outline\">\n * \t{t(\"thread.attachFiles\")}\n * </FileTrigger>\n * @example\n * <FileTrigger name=\"folder\" acceptDirectory aria-label={t(\"importer.chooseFolder\")} />\n */\nexport function FileTrigger(handle: Handle<FileTrigger.Props>) {\n\treturn () => {\n\t\tlet { color, variant, size, acceptDirectory, children, parts, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet resolvedSize = size ?? DEFAULT_SIZE;\n\n\t\tif (\n\t\t\timport.meta.env.DEV &&\n\t\t\t!handle.props[\"aria-label\"] &&\n\t\t\t!handle.props[\"aria-labelledby\"] &&\n\t\t\t!hasAccessibleText(children)\n\t\t) {\n\t\t\tconsole.warn(\n\t\t\t\t\"FileTrigger: a trigger with no visible label text needs an `aria-label` describing what it opens — assistive technology has no accessible name to announce otherwise.\",\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\tdata-slot=\"trigger\"\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\tgap(2),\n\t\t\t\t\t/**\n\t\t\t\t\t * A glyph is sized against the label beside it and holds that size, so the row keeps the\n\t\t\t\t\t * height its text and padding ask for; the default `flex-shrink: 1` would squash the glyph\n\t\t\t\t\t * ahead of the words.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& > svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\twhen(\"&:has(input:focus-visible)\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&:has(input:disabled)\", [opacity(50), cursor(\"not-allowed\")]),\n\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\tpi(\"1rem\"),\n\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\ttext(\"sm\"),\n\n\t\t\t\t\t/**\n\t\t\t\t\t * The row measure is stated, so the control lines up with a field of the same size when\n\t\t\t\t\t * a Group fuses the two, and still grows when a long label wraps.\n\t\t\t\t\t */\n\t\t\t\t\tminBs(\"2.5rem\"),\n\n\t\t\t\t\tdata(\"size\", \"sm\", [\n\t\t\t\t\t\tpi(\"0.75rem\"),\n\t\t\t\t\t\tpb(\"0.375rem\"),\n\t\t\t\t\t\ttext(\"xs\"),\n\t\t\t\t\t\tminBs(\"2rem\"),\n\t\t\t\t\t\twhen(\"& > svg\", [is(3), bs(3)]),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"size\", \"lg\", [pi(\"1.25rem\"), pb(\"0.625rem\"), text(\"base\"), minBs(\"3rem\")]),\n\n\t\t\t\t\tdata(\"variant\", \"solid\", [\n\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t\thover(bg(\"brand.bg-solid-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"brand.bg-solid-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\thover(bg(\"neutral.bg-solid-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"neutral.bg-solid-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\thover(bg(\"success.bg-solid-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"success.bg-solid-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\thover(bg(\"warning.bg-solid-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"warning.bg-solid-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\thover(bg(\"danger.bg-solid-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"danger.bg-solid-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\n\t\t\t\t\tdata(\"variant\", \"outline\", [\n\t\t\t\t\t\tborder({ width: 1, noStyleDefault: true }),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\tborder(\"brand\"),\n\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\thover([bg(\"brand.tint\"), border(\"brand.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\thover([bg(\"neutral.tint\"), border(\"neutral.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\tborder(\"success\"),\n\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\thover([bg(\"success.tint\"), border(\"success.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\tborder(\"warning\"),\n\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\thover([bg(\"warning.tint\"), border(\"warning.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\thover([bg(\"danger.tint\"), border(\"danger.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\n\t\t\t\t\tdata(\"variant\", \"ghost\", [\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\thover(bg(\"brand.tint\")),\n\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\thover(bg(\"success.tint\")),\n\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\thover(bg(\"warning.tint\")),\n\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\thover(bg(\"danger.tint\")),\n\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\n\t\t\t\t\tparts?.trigger,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t<input\n\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t{...rest}\n\t\t\t\t\tmix={[acceptDirectory && attrs({ webkitdirectory: true }), visuallyHidden(), mix]}\n\t\t\t\t/>\n\t\t\t</label>\n\t\t);\n\t};\n}\n"
10
+ "content": "/**\n * A pressable surface that opens the platform's file picker, backed by a\n * native `<input type=\"file\">` wrapped in a `<label>` so the platform itself\n * handles the trigger-to-picker wiring. Its visible content renders inside\n * the same label as a button-like surface, colored, weighted, and sized\n * through the same semantic contract as this library's other pressable\n * controls.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { visuallyHidden } from \"@sdxc/u/a11y\";\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, userSelect } from \"@sdxc/u/general\";\nimport { gap, inlineFlex, items, justify, shrink } from \"@sdxc/u/layout\";\nimport { bs, is, minBs, pb, pi } from \"@sdxc/u/size\";\nimport { active, data, hover, when } from \"@sdxc/u/state\";\nimport { text, weight } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { hasAccessibleText } from \"@sdxc/ui/utils\";\n\n/** Semantic color role {@link FileTrigger} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: FileTrigger.Color = \"neutral\";\n\n/** Visual weight {@link FileTrigger} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: FileTrigger.Variant = \"solid\";\n\n/** Size variant {@link FileTrigger} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: FileTrigger.Size = \"md\";\n\n/**\n * Prop types for {@link FileTrigger}.\n */\nexport namespace FileTrigger {\n\t/**\n\t * Semantic color role, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Visual weight the trigger renders with: a solid fill with an on-solid\n\t * foreground, a transparent fill with a strong colored border, or a fully\n\t * transparent fill with just a colored label.\n\t */\n\texport type Variant = \"solid\" | \"outline\" | \"ghost\";\n\n\t/**\n\t * Size variant controlling the trigger's padding and font size.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * Per-part styling for the elements this component composes besides its\n\t * own host `<input>`.\n\t */\n\texport interface PartsProps {\n\t\t/** Styling for the `<label>` rendering as the trigger's visible, pressable surface. */\n\t\ttrigger?: TagProps<\"label\">[\"mix\"];\n\t}\n\n\t/**\n\t * Props accepted by {@link FileTrigger}. Every native `<input type=\"file\">`\n\t * attribute applies unchanged except `type` (fixed `\"file\"`), `role` (not\n\t * overridable on a file input), and `size` (repurposed for visual size).\n\t */\n\texport interface Props extends Omit<TagProps<\"input\">, \"type\" | \"role\" | \"size\"> {\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Visual weight. Defaults to {@link DEFAULT_VARIANT}. */\n\t\tvariant?: Variant;\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t\t/**\n\t\t * Switches the picker from choosing individual files to choosing whole\n\t\t * directories, carrying every file nested inside the chosen directory.\n\t\t */\n\t\tacceptDirectory?: boolean;\n\t\t/**\n\t\t * The trigger's visible content, rendered inside the same `<label>` that\n\t\t * wraps the host `<input>` — an icon, text, or both, kept decorative so\n\t\t * the platform's label-to-control association reaches the input on click.\n\t\t */\n\t\tchildren?: RemixNode;\n\t\t/** Per-part styling for this component's internally composed elements. */\n\t\tparts?: PartsProps;\n\t}\n}\n\n/**\n * Renders a native `<input type=\"file\">` wrapped in a `<label>` styled\n * through this library's shared `data-color`/`data-variant`/`data-size`\n * contract; in dev mode, content lacking an accessible name logs a warning.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the trigger's markup.\n * @example\n * <FileTrigger name=\"avatar\" accept=\"image/png, image/jpeg\">\n * \t{t(\"profile.chooseFile\")}\n * </FileTrigger>\n * @example\n * <FileTrigger name=\"attachments\" multiple color=\"brand\" variant=\"outline\">\n * \t{t(\"thread.attachFiles\")}\n * </FileTrigger>\n * @example\n * <FileTrigger name=\"folder\" acceptDirectory aria-label={t(\"importer.chooseFolder\")} />\n */\nexport function FileTrigger(handle: Handle<FileTrigger.Props>) {\n\treturn () => {\n\t\tlet { color, variant, size, acceptDirectory, children, parts, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet resolvedSize = size ?? DEFAULT_SIZE;\n\n\t\tif (\n\t\t\timport.meta.env?.DEV &&\n\t\t\t!handle.props[\"aria-label\"] &&\n\t\t\t!handle.props[\"aria-labelledby\"] &&\n\t\t\t!hasAccessibleText(children)\n\t\t) {\n\t\t\tconsole.warn(\n\t\t\t\t\"FileTrigger: a trigger with no visible label text needs an `aria-label` describing what it opens — assistive technology has no accessible name to announce otherwise.\",\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\tdata-slot=\"trigger\"\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\tgap(2),\n\t\t\t\t\t/**\n\t\t\t\t\t * A glyph is sized against the label beside it and holds that size, so the row keeps the\n\t\t\t\t\t * height its text and padding ask for; the default `flex-shrink: 1` would squash the glyph\n\t\t\t\t\t * ahead of the words.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& > svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\twhen(\"&:has(input:focus-visible)\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&:has(input:disabled)\", [opacity(50), cursor(\"not-allowed\")]),\n\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\tpi(\"1rem\"),\n\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\ttext(\"sm\"),\n\n\t\t\t\t\t/**\n\t\t\t\t\t * The row measure is stated, so the control lines up with a field of the same size when\n\t\t\t\t\t * a Group fuses the two, and still grows when a long label wraps.\n\t\t\t\t\t */\n\t\t\t\t\tminBs(\"2.5rem\"),\n\n\t\t\t\t\tdata(\"size\", \"sm\", [\n\t\t\t\t\t\tpi(\"0.75rem\"),\n\t\t\t\t\t\tpb(\"0.375rem\"),\n\t\t\t\t\t\ttext(\"xs\"),\n\t\t\t\t\t\tminBs(\"2rem\"),\n\t\t\t\t\t\twhen(\"& > svg\", [is(3), bs(3)]),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"size\", \"lg\", [pi(\"1.25rem\"), pb(\"0.625rem\"), text(\"base\"), minBs(\"3rem\")]),\n\n\t\t\t\t\tdata(\"variant\", \"solid\", [\n\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t\thover(bg(\"brand.bg-solid-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"brand.bg-solid-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\thover(bg(\"neutral.bg-solid-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"neutral.bg-solid-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\thover(bg(\"success.bg-solid-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"success.bg-solid-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\thover(bg(\"warning.bg-solid-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"warning.bg-solid-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\thover(bg(\"danger.bg-solid-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"danger.bg-solid-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\n\t\t\t\t\tdata(\"variant\", \"outline\", [\n\t\t\t\t\t\tborder({ width: 1, noStyleDefault: true }),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\tborder(\"brand\"),\n\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\thover([bg(\"brand.tint\"), border(\"brand.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\thover([bg(\"neutral.tint\"), border(\"neutral.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\tborder(\"success\"),\n\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\thover([bg(\"success.tint\"), border(\"success.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\tborder(\"warning\"),\n\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\thover([bg(\"warning.tint\"), border(\"warning.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\thover([bg(\"danger.tint\"), border(\"danger.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\n\t\t\t\t\tdata(\"variant\", \"ghost\", [\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\thover(bg(\"brand.tint\")),\n\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\thover(bg(\"success.tint\")),\n\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\thover(bg(\"warning.tint\")),\n\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\thover(bg(\"danger.tint\")),\n\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\n\t\t\t\t\tparts?.trigger,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t<input\n\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t{...rest}\n\t\t\t\t\tmix={[acceptDirectory && attrs({ webkitdirectory: true }), visuallyHidden(), mix]}\n\t\t\t\t/>\n\t\t\t</label>\n\t\t);\n\t};\n}\n"
11
11
  },
12
12
  "test": null
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heading-scope",
3
- "changedIn": "2026.10.2",
3
+ "changedIn": "2026.10.20",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "HeadingLevel",
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "source": {
13
13
  "path": "heading-scope.tsx",
14
- "content": "/**\n * Establishes an ambient heading level read by nested headings and scopes,\n * keeping a document outline sequential without passing a level by hand.\n * Nesting moves one level deeper unless an explicit `level` fixes it, and\n * renders a `display: contents` host so composing it adds no layout box\n * while still exposing the depth via `data-heading-level`.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { contents } from \"@sdxc/u/layout\";\n\n/**\n * Semantic depth, from `1` (`<h1>`) through `6` (`<h6>`), shared by every\n * heading-related component's level resolution.\n */\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * Native tag rendered for each supported {@link HeadingLevel}, as a single\n * level-to-element lookup table.\n */\nexport const TAG_BY_LEVEL: Record<HeadingLevel, \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"> = {\n\t1: \"h1\",\n\t2: \"h2\",\n\t3: \"h3\",\n\t4: \"h4\",\n\t5: \"h5\",\n\t6: \"h6\",\n};\n\nconst DEFAULT_LEVEL: HeadingLevel = 1;\n\n/** Deepest semantic depth the native heading elements support; a resolution past this clamps down to it. */\nconst MAX_LEVEL: HeadingLevel = 6;\n\n/**\n * Prop and context types for {@link HeadingScope}.\n */\nexport namespace HeadingScope {\n\t/** Value {@link HeadingScope} provides to descendants through context. */\n\texport interface Context {\n\t\t/** Semantic depth this scope establishes for the headings and nested scopes rendered inside it. */\n\t\tlevel: HeadingLevel;\n\t}\n\n\t/**\n\t * Native `<div>` attributes, plus `mix` and an optional `level` that\n\t * fixes this scope's depth outright, overriding the ambient\n\t * one-level-deeper default.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Explicit semantic depth for this scope. Defaults to one level past\n\t\t * the nearest ancestor scope's depth, or `1` where no scope wraps\n\t\t * this one at all.\n\t\t */\n\t\tlevel?: HeadingLevel;\n\t}\n}\n\n/**\n * Reads the semantic depth from the nearest ancestor {@link HeadingScope},\n * always resolving safely to `undefined` when no ancestor scope exists,\n * regardless of how that absence surfaces.\n *\n * @param handle Runtime handle of the component performing the lookup.\n * @returns The nearest ancestor scope's depth, or `undefined` where nothing wraps the caller.\n * @example\n * let ambient = readAmbientLevel(handle); // 2, nested inside a HeadingScope holding level 2\n */\nexport function readAmbientLevel(handle: Handle<unknown, any>): HeadingLevel | undefined {\n\ttry {\n\t\tlet ambient = handle.context.get(HeadingScope) as HeadingScope.Context | undefined;\n\n\t\treturn ambient?.level;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Resolves the semantic depth a heading renders at: an explicit level wins,\n * then the nearest ancestor {@link HeadingScope}'s depth, then `1`, clamped\n * to `6` with a dev-mode warning to flatten or restart the nesting.\n *\n * @param handle Runtime handle of the component resolving its depth.\n * @param explicitLevel A `level` passed directly to the component, if any.\n * @returns The resolved, clamped {@link HeadingLevel}.\n * @example\n * let level = resolveHeadingLevel(handle, handle.props.level); // an explicit level always wins\n */\nexport function resolveHeadingLevel(\n\thandle: Handle<unknown, any>,\n\texplicitLevel?: HeadingLevel,\n): HeadingLevel {\n\tlet resolved: number = explicitLevel ?? readAmbientLevel(handle) ?? DEFAULT_LEVEL;\n\n\tif (resolved > MAX_LEVEL) {\n\t\tif (import.meta.env.DEV) {\n\t\t\tconsole.warn(\n\t\t\t\t`Heading nesting resolved to level ${resolved}, past the native \"h1\"–\"h6\" range. Flatten the nesting, or start a new top-level HeadingScope instead of nesting further.`,\n\t\t\t);\n\t\t}\n\n\t\treturn MAX_LEVEL;\n\t}\n\n\treturn resolved as HeadingLevel;\n}\n\n/**\n * Establishes an ambient heading level for descendants: an explicit `level`\n * fixes it, otherwise one level past the nearest ancestor {@link HeadingScope},\n * read before this scope publishes its own depth, or `1` with no ancestor.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link HeadingScope.Context} to descendants.\n * @returns The render function producing the scope's markup.\n * @example\n * <HeadingScope>\n * \t<Heading>Document title</Heading>\n * \t<HeadingScope>\n * \t\t<Heading>Section title</Heading>\n * \t</HeadingScope>\n * </HeadingScope>\n */\nexport function HeadingScope(handle: Handle<HeadingScope.Props, HeadingScope.Context>) {\n\treturn () => {\n\t\tlet { level, mix, ...rest } = handle.props;\n\t\tlet ambient = readAmbientLevel(handle);\n\t\tlet requested = level ?? (ambient === undefined ? undefined : ((ambient + 1) as HeadingLevel));\n\t\tlet resolved = resolveHeadingLevel(handle, requested);\n\n\t\thandle.context.set({ level: resolved });\n\n\t\treturn <div {...rest} data-heading-level={resolved} mix={[contents(), mix]} />;\n\t};\n}\n"
14
+ "content": "/**\n * Establishes an ambient heading level read by nested headings and scopes,\n * keeping a document outline sequential without passing a level by hand.\n * Nesting moves one level deeper unless an explicit `level` fixes it, and\n * renders a `display: contents` host so composing it adds no layout box\n * while still exposing the depth via `data-heading-level`.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { contents } from \"@sdxc/u/layout\";\n\n/**\n * Semantic depth, from `1` (`<h1>`) through `6` (`<h6>`), shared by every\n * heading-related component's level resolution.\n */\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * Native tag rendered for each supported {@link HeadingLevel}, as a single\n * level-to-element lookup table.\n */\nexport const TAG_BY_LEVEL: Record<HeadingLevel, \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"> = {\n\t1: \"h1\",\n\t2: \"h2\",\n\t3: \"h3\",\n\t4: \"h4\",\n\t5: \"h5\",\n\t6: \"h6\",\n};\n\nconst DEFAULT_LEVEL: HeadingLevel = 1;\n\n/** Deepest semantic depth the native heading elements support; a resolution past this clamps down to it. */\nconst MAX_LEVEL: HeadingLevel = 6;\n\n/**\n * Prop and context types for {@link HeadingScope}.\n */\nexport namespace HeadingScope {\n\t/** Value {@link HeadingScope} provides to descendants through context. */\n\texport interface Context {\n\t\t/** Semantic depth this scope establishes for the headings and nested scopes rendered inside it. */\n\t\tlevel: HeadingLevel;\n\t}\n\n\t/**\n\t * Native `<div>` attributes, plus `mix` and an optional `level` that\n\t * fixes this scope's depth outright, overriding the ambient\n\t * one-level-deeper default.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Explicit semantic depth for this scope. Defaults to one level past\n\t\t * the nearest ancestor scope's depth, or `1` where no scope wraps\n\t\t * this one at all.\n\t\t */\n\t\tlevel?: HeadingLevel;\n\t}\n}\n\n/**\n * Reads the semantic depth from the nearest ancestor {@link HeadingScope},\n * always resolving safely to `undefined` when no ancestor scope exists,\n * regardless of how that absence surfaces.\n *\n * @param handle Runtime handle of the component performing the lookup.\n * @returns The nearest ancestor scope's depth, or `undefined` where nothing wraps the caller.\n * @example\n * let ambient = readAmbientLevel(handle); // 2, nested inside a HeadingScope holding level 2\n */\nexport function readAmbientLevel(handle: Handle<unknown, any>): HeadingLevel | undefined {\n\ttry {\n\t\tlet ambient = handle.context.get(HeadingScope) as HeadingScope.Context | undefined;\n\n\t\treturn ambient?.level;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Resolves the semantic depth a heading renders at: an explicit level wins,\n * then the nearest ancestor {@link HeadingScope}'s depth, then `1`, clamped\n * to `6` with a dev-mode warning to flatten or restart the nesting.\n *\n * @param handle Runtime handle of the component resolving its depth.\n * @param explicitLevel A `level` passed directly to the component, if any.\n * @returns The resolved, clamped {@link HeadingLevel}.\n * @example\n * let level = resolveHeadingLevel(handle, handle.props.level); // an explicit level always wins\n */\nexport function resolveHeadingLevel(\n\thandle: Handle<unknown, any>,\n\texplicitLevel?: HeadingLevel,\n): HeadingLevel {\n\tlet resolved: number = explicitLevel ?? readAmbientLevel(handle) ?? DEFAULT_LEVEL;\n\n\tif (resolved > MAX_LEVEL) {\n\t\tif (import.meta.env?.DEV) {\n\t\t\tconsole.warn(\n\t\t\t\t`Heading nesting resolved to level ${resolved}, past the native \"h1\"–\"h6\" range. Flatten the nesting, or start a new top-level HeadingScope instead of nesting further.`,\n\t\t\t);\n\t\t}\n\n\t\treturn MAX_LEVEL;\n\t}\n\n\treturn resolved as HeadingLevel;\n}\n\n/**\n * Establishes an ambient heading level for descendants: an explicit `level`\n * fixes it, otherwise one level past the nearest ancestor {@link HeadingScope},\n * read before this scope publishes its own depth, or `1` with no ancestor.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link HeadingScope.Context} to descendants.\n * @returns The render function producing the scope's markup.\n * @example\n * <HeadingScope>\n * \t<Heading>Document title</Heading>\n * \t<HeadingScope>\n * \t\t<Heading>Section title</Heading>\n * \t</HeadingScope>\n * </HeadingScope>\n */\nexport function HeadingScope(handle: Handle<HeadingScope.Props, HeadingScope.Context>) {\n\treturn () => {\n\t\tlet { level, mix, ...rest } = handle.props;\n\t\tlet ambient = readAmbientLevel(handle);\n\t\tlet requested = level ?? (ambient === undefined ? undefined : ((ambient + 1) as HeadingLevel));\n\t\tlet resolved = resolveHeadingLevel(handle, requested);\n\n\t\thandle.context.set({ level: resolved });\n\n\t\treturn <div {...rest} data-heading-level={resolved} mix={[contents(), mix]} />;\n\t};\n}\n"
15
15
  },
16
16
  "test": {
17
17
  "path": "heading-scope.test.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-scroller",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.10.20",
4
4
  "dependencies": [
5
5
  "button",
6
6
  "scroll-area"
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "source": {
12
12
  "path": "message-scroller.tsx",
13
- "content": "/**\n * A scrollable frame for a conversational message log. Its viewport reuses\n * the same scrollbar treatment every scrolling surface in this catalog\n * shares and fades its own edges to hint at history above and replies still\n * below; its content region announces newly appended rows through the ARIA\n * log role; each row carries the message id and anchor data a scroll-follow\n * behavior reads; and a static jump-to-latest control sits ready for that\n * same behavior to reveal.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { border } from \"@sdxc/u/color\";\nimport { rounded, shadow } from \"@sdxc/u/effects\";\nimport { raw } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tcontainer,\n\tflex,\n\tflexCol,\n\tgap,\n\tinsIe,\n\tinsIs,\n\tinset,\n\tjustify,\n\trelative,\n} from \"@sdxc/u/layout\";\nimport { pb, pi } from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { when } from \"@sdxc/u/state\";\nimport { translateProperty } from \"@sdxc/u/transform\";\nimport { attrs } from \"remix/component\";\n\nimport { Button } from \"@sdxc/ui/button\";\nimport { ScrollArea } from \"@sdxc/ui/scroll-area\";\n\n/**\n * Named container {@link MessageScroller} declares on its own host, so\n * {@link MessageScroller.Button} can size its own placement to the\n * frame's own width.\n */\nconst CONTAINER_NAME = \"ui-message-scroller\";\n\n/**\n * Container width under which {@link MessageScroller.Button} switches from a\n * centered floating pill to a bar stretched across the frame's own inline\n * size. It is measured against the frame's own width, which a conversation\n * column keeps well under a viewport's, so only a phone-width column reaches it.\n */\nconst BUTTON_NARROW_QUERY = `@container ${CONTAINER_NAME} (max-width: 20rem)`;\n\n/**\n * `role=\"log\"` applied to {@link MessageScroller.Content} through\n * {@link attrs} unless a consumer supplies its own `role`, whose implicit\n * `aria-live=\"polite\"` behavior announces each newly appended row.\n */\nconst DEFAULT_CONTENT_ROLE = \"log\";\n\n/**\n * `aria-relevant=\"additions\"` applied to {@link MessageScroller.Content}\n * through {@link attrs} unless overridden, scoping assistive-technology\n * announcements to newly appended rows.\n */\nconst DEFAULT_CONTENT_ARIA_RELEVANT = \"additions\";\n\n/** Semantic color role {@link MessageScroller.Button} falls back to when `color` is omitted. */\nconst DEFAULT_BUTTON_COLOR: Button.Color = \"neutral\";\n\n/**\n * Visual weight {@link MessageScroller.Button} falls back to when `variant` is omitted.\n * The control floats over a conversation it points at rather than competing with it, so\n * it reads as a surface of its own carrying an arrow.\n */\nconst DEFAULT_BUTTON_VARIANT: Button.Variant = \"outline\";\n\n/** Size variant {@link MessageScroller.Button} falls back to when `size` is omitted. */\nconst DEFAULT_BUTTON_SIZE: Button.Size = \"sm\";\n\n/**\n * `hidden` applied to {@link MessageScroller.Button} when a consumer omits\n * it: the control starts absent from rendering and the accessibility tree\n * until a paired scroll-follow behavior reveals it.\n */\nconst DEFAULT_BUTTON_HIDDEN = true;\n\n/**\n * Prop types for {@link MessageScroller} and its compound parts.\n */\nexport namespace MessageScroller {\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * Size the frame through `mix` since {@link MessageScroller.Viewport}\n\t * fills whatever block size this host resolves to.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** The frame's compound parts: {@link MessageScroller.Viewport} and, optionally, {@link MessageScroller.Button}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ViewportProps extends TagProps<\"div\"> {\n\t\t/** {@link MessageScroller.Content}, scrolling inside the viewport. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Marks the log as busy while a row inside it is still being written\n\t\t * to — a reply still streaming in, for instance — forwarded to the host's\n\t\t * native `aria-busy` attribute. Clear it once the row settles.\n\t\t */\n\t\t\"aria-busy\"?: TagProps<\"div\">[\"aria-busy\"];\n\t\t/** The {@link MessageScroller.Item} rows to render in document order. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ItemProps extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Stable id of the message this row renders, mirrored onto the host's\n\t\t * `data-message-id` attribute so a scroll-follow behavior can find,\n\t\t * measure, and scroll to this exact row directly.\n\t\t */\n\t\tmessageId: string;\n\t\t/**\n\t\t * Marks this row as a candidate anchor point — typically the first row\n\t\t * of a new turn — mirrored onto `data-scroll-anchor` so a scroll-follow\n\t\t * behavior can tell which rows are worth anchoring the viewport to.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\tscrollAnchor?: boolean;\n\t\t/** The row's own content, typically a conversational row composed inside it. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every {@link Button.Props} field, unchanged, except `hidden`, which\n\t * defaults to `true`.\n\t */\n\texport interface ButtonProps extends Button.Props {\n\t\t/**\n\t\t * Whether the control is absent from rendering and the accessibility tree.\n\t\t * A paired scroll-follow behavior clears this attribute as the reader\n\t\t * scrolls away from the live edge and sets it again on return or press.\n\t\t *\n\t\t * @default true\n\t\t */\n\t\thidden?: boolean;\n\t}\n}\n\n/**\n * Renders the frame's root host: a bordered, rounded `<div>` that\n * declares the `ui-message-scroller` container queried by\n * {@link MessageScroller.Button} for its own placement.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the frame's markup.\n * @example\n * <MessageScroller mix={css({ blockSize: \"32rem\" })}>\n * \t<MessageScroller.Viewport>\n * \t\t<MessageScroller.Content aria-busy={isStreaming}>\n * \t\t\t<MessageScroller.Item messageId={turn.id} scrollAnchor>\n * \t\t\t\t{turn.content}\n * \t\t\t</MessageScroller.Item>\n * \t\t</MessageScroller.Content>\n * \t</MessageScroller.Viewport>\n * \t<MessageScroller.Button aria-label={t(\"chat.jumpToLatest\")} />\n * </MessageScroller>\n */\nexport function MessageScroller(handle: Handle<MessageScroller.Props>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"message-scroller\"\n\t\t\t\tmix={[\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\trelative(),\n\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders the frame's scrolling surface as {@link ScrollArea.Viewport},\n * fixed to the block axis. Compose `scrollFade()` through `mix` to fade\n * this viewport's edges when more content is off-screen.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the viewport's markup.\n * @example\n * <MessageScroller.Viewport mix={scrollFade({ axis: \"block\" })}>\n * \t<MessageScroller.Content>...</MessageScroller.Content>\n * </MessageScroller.Viewport>\n */\nMessageScroller.Viewport = function MessageScrollerViewport(\n\thandle: Handle<MessageScroller.ViewportProps>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <ScrollArea.Viewport {...rest} orientation=\"vertical\" mix={mix} />;\n\t};\n};\n\n/**\n * Renders the frame's live region: a `<div>` carrying the ARIA log role,\n * stacking its {@link MessageScroller.Item} rows in a column and\n * announcing each added row via `aria-relevant=\"additions\"`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the log region's markup.\n * @example\n * <MessageScroller.Content aria-busy={isStreaming}>\n * \t<MessageScroller.Item messageId={turn.id}>{turn.content}</MessageScroller.Item>\n * </MessageScroller.Content>\n */\nMessageScroller.Content = function MessageScrollerContent(\n\thandle: Handle<MessageScroller.ContentProps>,\n) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"content\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_CONTENT_ROLE, \"aria-relevant\": DEFAULT_CONTENT_ARIA_RELEVANT }),\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tgap(4),\n\t\t\t\t\tpb(4),\n\t\t\t\t\tpi(4),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single message row: a `<div>` mirroring `messageId` onto\n * `data-message-id` and, when `scrollAnchor` is set, an empty\n * `data-scroll-anchor` attribute for a scroll-follow behavior to read.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <MessageScroller.Item messageId={turn.id} scrollAnchor={turn.startsNewTurn}>\n * \t{turn.content}\n * </MessageScroller.Item>\n */\nMessageScroller.Item = function MessageScrollerItem(handle: Handle<MessageScroller.ItemProps>) {\n\treturn () => {\n\t\tlet { messageId, scrollAnchor, children, mix, ...rest } = handle.props;\n\n\t\tif (import.meta.env.DEV && !messageId) {\n\t\t\tconsole.warn(\n\t\t\t\t'MessageScroller.Item: needs a \"messageId\" — a scroll-follow behavior matches rows against this instead of parsing rendered children.',\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tdata-message-id={messageId}\n\t\t\t\tdata-scroll-anchor={scrollAnchor || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\traw({\n\t\t\t\t\t\tscrollMarginBlockStart: \"var(--ui-message-scroller-anchor-offset, 0px)\",\n\t\t\t\t\t}),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders a static jump-to-latest control as {@link Button}, floating\n * over the frame's block-end edge and starting `hidden` until a paired\n * scroll-follow behavior clears the attribute.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <MessageScroller.Button aria-label={t(\"chat.jumpToLatest\")}>\n * \t{t(\"chat.jumpToLatest\")}\n * </MessageScroller.Button>\n */\nMessageScroller.Button = function MessageScrollerButton(\n\thandle: Handle<MessageScroller.ButtonProps>,\n) {\n\treturn () => {\n\t\tlet { hidden, color, variant, size, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\t{...rest}\n\t\t\t\ttype=\"button\"\n\t\t\t\tcolor={color ?? DEFAULT_BUTTON_COLOR}\n\t\t\t\tvariant={variant ?? DEFAULT_BUTTON_VARIANT}\n\t\t\t\tsize={size ?? DEFAULT_BUTTON_SIZE}\n\t\t\t\thidden={hidden ?? DEFAULT_BUTTON_HIDDEN}\n\t\t\t\tdata-slot=\"jump-button\"\n\t\t\t\tmix={[\n\t\t\t\t\tz(1),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tinset(\"auto\", \"auto\", \"1rem\", \"50%\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The control floats over the log, so it carries an opaque surface of its own to stay\n\t\t\t\t\t * legible. `!important` settles it: each mix entry gets its own cascade sublayer, and\n\t\t\t\t\t * the variant's own fill may land in a later one.\n\t\t\t\t\t */\n\t\t\t\t\traw({ backgroundColor: \"var(--ui-bg, Canvas) !important\" }),\n\t\t\t\t\tshadow(\"md\"),\n\t\t\t\t\ttranslateProperty(\"-50% 0\"),\n\t\t\t\t\twhen(BUTTON_NARROW_QUERY, [\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\tinsIs(\"1rem\"),\n\t\t\t\t\t\tinsIe(\"1rem\"),\n\t\t\t\t\t\ttranslateProperty(\"0 0\"),\n\t\t\t\t\t]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n"
13
+ "content": "/**\n * A scrollable frame for a conversational message log. Its viewport reuses\n * the same scrollbar treatment every scrolling surface in this catalog\n * shares and fades its own edges to hint at history above and replies still\n * below; its content region announces newly appended rows through the ARIA\n * log role; each row carries the message id and anchor data a scroll-follow\n * behavior reads; and a static jump-to-latest control sits ready for that\n * same behavior to reveal.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { border } from \"@sdxc/u/color\";\nimport { rounded, shadow } from \"@sdxc/u/effects\";\nimport { raw } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tcontainer,\n\tflex,\n\tflexCol,\n\tgap,\n\tinsIe,\n\tinsIs,\n\tinset,\n\tjustify,\n\trelative,\n} from \"@sdxc/u/layout\";\nimport { pb, pi } from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { when } from \"@sdxc/u/state\";\nimport { translateProperty } from \"@sdxc/u/transform\";\nimport { attrs } from \"remix/component\";\n\nimport { Button } from \"@sdxc/ui/button\";\nimport { ScrollArea } from \"@sdxc/ui/scroll-area\";\n\n/**\n * Named container {@link MessageScroller} declares on its own host, so\n * {@link MessageScroller.Button} can size its own placement to the\n * frame's own width.\n */\nconst CONTAINER_NAME = \"ui-message-scroller\";\n\n/**\n * Container width under which {@link MessageScroller.Button} switches from a\n * centered floating pill to a bar stretched across the frame's own inline\n * size. It is measured against the frame's own width, which a conversation\n * column keeps well under a viewport's, so only a phone-width column reaches it.\n */\nconst BUTTON_NARROW_QUERY = `@container ${CONTAINER_NAME} (max-width: 20rem)`;\n\n/**\n * `role=\"log\"` applied to {@link MessageScroller.Content} through\n * {@link attrs} unless a consumer supplies its own `role`, whose implicit\n * `aria-live=\"polite\"` behavior announces each newly appended row.\n */\nconst DEFAULT_CONTENT_ROLE = \"log\";\n\n/**\n * `aria-relevant=\"additions\"` applied to {@link MessageScroller.Content}\n * through {@link attrs} unless overridden, scoping assistive-technology\n * announcements to newly appended rows.\n */\nconst DEFAULT_CONTENT_ARIA_RELEVANT = \"additions\";\n\n/** Semantic color role {@link MessageScroller.Button} falls back to when `color` is omitted. */\nconst DEFAULT_BUTTON_COLOR: Button.Color = \"neutral\";\n\n/**\n * Visual weight {@link MessageScroller.Button} falls back to when `variant` is omitted.\n * The control floats over a conversation it points at rather than competing with it, so\n * it reads as a surface of its own carrying an arrow.\n */\nconst DEFAULT_BUTTON_VARIANT: Button.Variant = \"outline\";\n\n/** Size variant {@link MessageScroller.Button} falls back to when `size` is omitted. */\nconst DEFAULT_BUTTON_SIZE: Button.Size = \"sm\";\n\n/**\n * `hidden` applied to {@link MessageScroller.Button} when a consumer omits\n * it: the control starts absent from rendering and the accessibility tree\n * until a paired scroll-follow behavior reveals it.\n */\nconst DEFAULT_BUTTON_HIDDEN = true;\n\n/**\n * Prop types for {@link MessageScroller} and its compound parts.\n */\nexport namespace MessageScroller {\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * Size the frame through `mix` since {@link MessageScroller.Viewport}\n\t * fills whatever block size this host resolves to.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** The frame's compound parts: {@link MessageScroller.Viewport} and, optionally, {@link MessageScroller.Button}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ViewportProps extends TagProps<\"div\"> {\n\t\t/** {@link MessageScroller.Content}, scrolling inside the viewport. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Marks the log as busy while a row inside it is still being written\n\t\t * to — a reply still streaming in, for instance — forwarded to the host's\n\t\t * native `aria-busy` attribute. Clear it once the row settles.\n\t\t */\n\t\t\"aria-busy\"?: TagProps<\"div\">[\"aria-busy\"];\n\t\t/** The {@link MessageScroller.Item} rows to render in document order. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ItemProps extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Stable id of the message this row renders, mirrored onto the host's\n\t\t * `data-message-id` attribute so a scroll-follow behavior can find,\n\t\t * measure, and scroll to this exact row directly.\n\t\t */\n\t\tmessageId: string;\n\t\t/**\n\t\t * Marks this row as a candidate anchor point — typically the first row\n\t\t * of a new turn — mirrored onto `data-scroll-anchor` so a scroll-follow\n\t\t * behavior can tell which rows are worth anchoring the viewport to.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\tscrollAnchor?: boolean;\n\t\t/** The row's own content, typically a conversational row composed inside it. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every {@link Button.Props} field, unchanged, except `hidden`, which\n\t * defaults to `true`.\n\t */\n\texport interface ButtonProps extends Button.Props {\n\t\t/**\n\t\t * Whether the control is absent from rendering and the accessibility tree.\n\t\t * A paired scroll-follow behavior clears this attribute as the reader\n\t\t * scrolls away from the live edge and sets it again on return or press.\n\t\t *\n\t\t * @default true\n\t\t */\n\t\thidden?: boolean;\n\t}\n}\n\n/**\n * Renders the frame's root host: a bordered, rounded `<div>` that\n * declares the `ui-message-scroller` container queried by\n * {@link MessageScroller.Button} for its own placement.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the frame's markup.\n * @example\n * <MessageScroller mix={css({ blockSize: \"32rem\" })}>\n * \t<MessageScroller.Viewport>\n * \t\t<MessageScroller.Content aria-busy={isStreaming}>\n * \t\t\t<MessageScroller.Item messageId={turn.id} scrollAnchor>\n * \t\t\t\t{turn.content}\n * \t\t\t</MessageScroller.Item>\n * \t\t</MessageScroller.Content>\n * \t</MessageScroller.Viewport>\n * \t<MessageScroller.Button aria-label={t(\"chat.jumpToLatest\")} />\n * </MessageScroller>\n */\nexport function MessageScroller(handle: Handle<MessageScroller.Props>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"message-scroller\"\n\t\t\t\tmix={[\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\trelative(),\n\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders the frame's scrolling surface as {@link ScrollArea.Viewport},\n * fixed to the block axis. Compose `scrollFade()` through `mix` to fade\n * this viewport's edges when more content is off-screen.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the viewport's markup.\n * @example\n * <MessageScroller.Viewport mix={scrollFade({ axis: \"block\" })}>\n * \t<MessageScroller.Content>...</MessageScroller.Content>\n * </MessageScroller.Viewport>\n */\nMessageScroller.Viewport = function MessageScrollerViewport(\n\thandle: Handle<MessageScroller.ViewportProps>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <ScrollArea.Viewport {...rest} orientation=\"vertical\" mix={mix} />;\n\t};\n};\n\n/**\n * Renders the frame's live region: a `<div>` carrying the ARIA log role,\n * stacking its {@link MessageScroller.Item} rows in a column and\n * announcing each added row via `aria-relevant=\"additions\"`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the log region's markup.\n * @example\n * <MessageScroller.Content aria-busy={isStreaming}>\n * \t<MessageScroller.Item messageId={turn.id}>{turn.content}</MessageScroller.Item>\n * </MessageScroller.Content>\n */\nMessageScroller.Content = function MessageScrollerContent(\n\thandle: Handle<MessageScroller.ContentProps>,\n) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"content\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_CONTENT_ROLE, \"aria-relevant\": DEFAULT_CONTENT_ARIA_RELEVANT }),\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tgap(4),\n\t\t\t\t\tpb(4),\n\t\t\t\t\tpi(4),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single message row: a `<div>` mirroring `messageId` onto\n * `data-message-id` and, when `scrollAnchor` is set, an empty\n * `data-scroll-anchor` attribute for a scroll-follow behavior to read.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <MessageScroller.Item messageId={turn.id} scrollAnchor={turn.startsNewTurn}>\n * \t{turn.content}\n * </MessageScroller.Item>\n */\nMessageScroller.Item = function MessageScrollerItem(handle: Handle<MessageScroller.ItemProps>) {\n\treturn () => {\n\t\tlet { messageId, scrollAnchor, children, mix, ...rest } = handle.props;\n\n\t\tif (import.meta.env?.DEV && !messageId) {\n\t\t\tconsole.warn(\n\t\t\t\t'MessageScroller.Item: needs a \"messageId\" — a scroll-follow behavior matches rows against this instead of parsing rendered children.',\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tdata-message-id={messageId}\n\t\t\t\tdata-scroll-anchor={scrollAnchor || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\traw({\n\t\t\t\t\t\tscrollMarginBlockStart: \"var(--ui-message-scroller-anchor-offset, 0px)\",\n\t\t\t\t\t}),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders a static jump-to-latest control as {@link Button}, floating\n * over the frame's block-end edge and starting `hidden` until a paired\n * scroll-follow behavior clears the attribute.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <MessageScroller.Button aria-label={t(\"chat.jumpToLatest\")}>\n * \t{t(\"chat.jumpToLatest\")}\n * </MessageScroller.Button>\n */\nMessageScroller.Button = function MessageScrollerButton(\n\thandle: Handle<MessageScroller.ButtonProps>,\n) {\n\treturn () => {\n\t\tlet { hidden, color, variant, size, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\t{...rest}\n\t\t\t\ttype=\"button\"\n\t\t\t\tcolor={color ?? DEFAULT_BUTTON_COLOR}\n\t\t\t\tvariant={variant ?? DEFAULT_BUTTON_VARIANT}\n\t\t\t\tsize={size ?? DEFAULT_BUTTON_SIZE}\n\t\t\t\thidden={hidden ?? DEFAULT_BUTTON_HIDDEN}\n\t\t\t\tdata-slot=\"jump-button\"\n\t\t\t\tmix={[\n\t\t\t\t\tz(1),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tinset(\"auto\", \"auto\", \"1rem\", \"50%\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The control floats over the log, so it carries an opaque surface of its own to stay\n\t\t\t\t\t * legible. `!important` settles it: each mix entry gets its own cascade sublayer, and\n\t\t\t\t\t * the variant's own fill may land in a later one.\n\t\t\t\t\t */\n\t\t\t\t\traw({ backgroundColor: \"var(--ui-bg, Canvas) !important\" }),\n\t\t\t\t\tshadow(\"md\"),\n\t\t\t\t\ttranslateProperty(\"-50% 0\"),\n\t\t\t\t\twhen(BUTTON_NARROW_QUERY, [\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\tinsIs(\"1rem\"),\n\t\t\t\t\t\tinsIe(\"1rem\"),\n\t\t\t\t\t\ttranslateProperty(\"0 0\"),\n\t\t\t\t\t]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n"
14
14
  },
15
15
  "test": null
16
16
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "number-field",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.10.20",
4
4
  "dependencies": [
5
5
  "input"
6
6
  ],
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "source": {
11
11
  "path": "number-field.tsx",
12
- "content": "/**\n * A numeric field pairing a native `<input type=\"number\">` control with a\n * decrement and an increment button, all three sharing one bordered,\n * rounded frame. The frame draws its own box styling and keyboard focus\n * ring, so the input inside sits flush against its neighboring buttons\n * instead of carrying a competing border of its own.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { MinusIcon, PlusIcon } from \"@sdxc/icons\";\nimport { bg, border, borderEdge, fg, outline, outlineWidth } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, raw } from \"@sdxc/u/general\";\nimport { basis, flex, grow, inlineFlex, items, justify, shrink } from \"@sdxc/u/layout\";\nimport { bs, is } from \"@sdxc/u/size\";\nimport { active, focusVisible, hover, invalid, when } from \"@sdxc/u/state\";\nimport { tabularNums, textAlign } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { fieldStackLayout } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\n\nimport { Input } from \"@sdxc/ui/input\";\n\n/**\n * ARIA role applied to {@link NumberField.Group} through {@link attrs}\n * unless a consumer supplies its own `role`, announcing the frame as one\n * related unit to assistive technology.\n */\nconst DEFAULT_ROLE = \"group\";\n\n/**\n * Native `<button>` `type` {@link NumberField.DecrementButton} and\n * {@link NumberField.IncrementButton} fall back to when a consumer doesn't\n * supply one, keeping a click on either from submitting a surrounding `<form>`.\n */\nconst DEFAULT_BUTTON_TYPE: NonNullable<NumberField.DecrementButtonProps[\"type\"]> = \"button\";\n\n/**\n * Shared box, color, and interaction-state styling for\n * {@link NumberField.DecrementButton} and {@link NumberField.IncrementButton},\n * differing only in which inline edge carries the divider border.\n *\n * @param dividerEdge Which inline edge carries the divider border: `\"end\"` for the control preceding the input, `\"start\"` for the one following it.\n * @returns The mixins shared by both stepper buttons.\n */\nfunction stepperButtonMix(dividerEdge: \"start\" | \"end\") {\n\treturn [\n\t\tinteractiveTransition(),\n\t\tflex(),\n\t\titems(\"center\"),\n\t\tjustify(\"center\"),\n\t\tis(\"2.5rem\"),\n\t\tfg(\"neutral\"),\n\t\tborder(\"neutral\"),\n\t\tborderEdge(dividerEdge === \"start\" ? \"inline-start\" : \"inline-end\", { width: 1 }),\n\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\trounded(\"none\"),\n\t\tbg(\"transparent\"),\n\t\twhen(\"& svg\", [is(\"1rem\"), bs(\"1rem\")]),\n\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t];\n}\n\n/**\n * Prop types for {@link NumberField} and its compound parts.\n */\nexport namespace NumberField {\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * `children` composes this field's parts — typically a caption, the\n\t * {@link NumberField.Group} row, and any supporting or validation copy.\n\t */\n\texport interface Props extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * `children` composes {@link NumberField.DecrementButton},\n\t * {@link NumberField.Input}, and {@link NumberField.IncrementButton}.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every prop {@link Input.Props} accepts except `type` and `role`, fixed to\n\t * `\"number\"` and the platform's own `spinbutton` role, and `color`, unexposed\n\t * since the keyboard focus ring is deferred to {@link NumberField.Group}.\n\t */\n\texport interface InputProps extends Omit<Input.Props, \"type\" | \"role\" | \"color\"> {}\n\n\t/**\n\t * Every native `<button>` attribute except `children`, which stays fixed\n\t * to this button's own decrement glyph, plus the `mix` passthrough.\n\t * `type` defaults to {@link DEFAULT_BUTTON_TYPE}.\n\t */\n\texport interface DecrementButtonProps extends Omit<TagProps<\"button\">, \"children\"> {}\n\n\t/**\n\t * Every native `<button>` attribute except `children`, which stays fixed\n\t * to this button's own increment glyph, plus the `mix` passthrough.\n\t * `type` defaults to {@link DEFAULT_BUTTON_TYPE}.\n\t */\n\texport interface IncrementButtonProps extends Omit<TagProps<\"button\">, \"children\"> {}\n}\n\n/**\n * Renders a plain host stacking this field's compound parts in a single\n * column with a small gap between them: typically a caption, the\n * {@link NumberField.Group} row, and any supporting or validation copy.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the field's markup.\n * @example\n * <NumberField>\n * \t<Label htmlFor=\"quantity\">{t(\"form.quantity.label\")}</Label>\n * \t<NumberField.Group>\n * \t\t<NumberField.DecrementButton aria-label={t(\"stepper.decrement\")} />\n * \t\t<NumberField.Input id=\"quantity\" name=\"quantity\" min={0} max={10} defaultValue={1} />\n * \t\t<NumberField.IncrementButton aria-label={t(\"stepper.increment\")} />\n * \t</NumberField.Group>\n * </NumberField>\n */\nexport function NumberField(handle: Handle<NumberField.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} data-slot=\"number-field\" mix={[fieldStackLayout(), mix]} />;\n\t};\n}\n\n/**\n * Renders {@link NumberField}'s frame: a `role=\"group\"` `<div>` drawing a\n * bordered, rounded, tinted-background box that reads as one seamless\n * control, ringing the whole frame via `:focus-within` when a child gains focus.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the frame's markup.\n * @example\n * <NumberField.Group>\n * \t<NumberField.DecrementButton aria-label={t(\"stepper.decrement\")} />\n * \t<NumberField.Input aria-label={t(\"form.quantity.label\")} />\n * \t<NumberField.IncrementButton aria-label={t(\"stepper.increment\")} />\n * </NumberField.Group>\n */\nNumberField.Group = function NumberFieldGroup(handle: Handle<NumberField.GroupProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_ROLE }),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"stretch\"),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\thover(border(\"neutral.border-hover\")),\n\t\t\t\t\t/**\n\t\t\t\t\t * The wrapper wears the focus of whichever part holds it as a ring standing off the\n\t\t\t\t\t * field, as every button here does; the border steps only to its hover weight, since a\n\t\t\t\t\t * darkened border flush with the ring reads as one thick slab.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&:focus-within\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\tborder(\"neutral.border-hover\"),\n\t\t\t\t\t]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link NumberField}'s control: a native `<input type=\"number\">`\n * built on {@link Input}. The stepper buttons need a separately wired\n * `stepUp()`/`stepDown()` for press-and-hold repeat; typed entry works without it.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <NumberField.Input aria-label={t(\"form.quantity.label\")} min={0} max={10} defaultValue={1} />\n * @example\n * <NumberField.Input id=\"price\" name=\"price\" step={0.01} aria-invalid=\"true\" />\n */\nNumberField.Input = function NumberFieldInput(handle: Handle<NumberField.InputProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<Input\n\t\t\t\ttype=\"number\"\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\ttextAlign(\"center\"),\n\t\t\t\t\ttabularNums(),\n\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tshrink(1),\n\t\t\t\t\tbasis(\"0%\"),\n\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\n\t\t\t\t\traw({\n\t\t\t\t\t\t\"-moz-appearance\": \"textfield\",\n\n\t\t\t\t\t\t\"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button\": {\n\t\t\t\t\t\t\t\"-webkit-appearance\": \"none\",\n\t\t\t\t\t\t\tmargin: \"0\",\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\tfg(\"inherit\"),\n\t\t\t\t\twhen(\"&:disabled\", bg(\"transparent\")),\n\t\t\t\t\tfocusVisible(outlineWidth(\"0\")),\n\t\t\t\t\tinvalid([outlineWidth(\"0\"), fg(\"danger\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a native `<button>` decrementing {@link NumberField.Input}'s\n * value; its glyph is `aria-hidden`, so callers must supply an `aria-label`.\n * In dev mode, a missing `aria-label`/`aria-labelledby` logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <NumberField.DecrementButton aria-label={t(\"stepper.decrement\")} />\n * @example\n * <NumberField.DecrementButton aria-label={t(\"stepper.decrement\")} disabled={quantity <= 0} />\n */\nNumberField.DecrementButton = function NumberFieldDecrementButton(\n\thandle: Handle<NumberField.DecrementButtonProps>,\n) {\n\treturn () => {\n\t\tlet { type, mix, ...rest } = handle.props;\n\n\t\tif (import.meta.env.DEV && !handle.props[\"aria-label\"] && !handle.props[\"aria-labelledby\"]) {\n\t\t\tconsole.warn(\n\t\t\t\t\"NumberField.DecrementButton: needs an `aria-label` describing what it does — its content is a decorative glyph with no accessible name of its own.\",\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={type ?? DEFAULT_BUTTON_TYPE}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"decrement\"\n\t\t\t\tmix={[stepperButtonMix(\"end\"), mix]}\n\t\t\t>\n\t\t\t\t<MinusIcon />\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders a native `<button>` incrementing {@link NumberField.Input}'s\n * value; its glyph is `aria-hidden`, so callers must supply an `aria-label`.\n * In dev mode, a missing `aria-label`/`aria-labelledby` logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <NumberField.IncrementButton aria-label={t(\"stepper.increment\")} />\n * @example\n * <NumberField.IncrementButton aria-label={t(\"stepper.increment\")} disabled={quantity >= 10} />\n */\nNumberField.IncrementButton = function NumberFieldIncrementButton(\n\thandle: Handle<NumberField.IncrementButtonProps>,\n) {\n\treturn () => {\n\t\tlet { type, mix, ...rest } = handle.props;\n\n\t\tif (import.meta.env.DEV && !handle.props[\"aria-label\"] && !handle.props[\"aria-labelledby\"]) {\n\t\t\tconsole.warn(\n\t\t\t\t\"NumberField.IncrementButton: needs an `aria-label` describing what it does — its content is a decorative glyph with no accessible name of its own.\",\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={type ?? DEFAULT_BUTTON_TYPE}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"increment\"\n\t\t\t\tmix={[stepperButtonMix(\"start\"), mix]}\n\t\t\t>\n\t\t\t\t<PlusIcon />\n\t\t\t</button>\n\t\t);\n\t};\n};\n"
12
+ "content": "/**\n * A numeric field pairing a native `<input type=\"number\">` control with a\n * decrement and an increment button, all three sharing one bordered,\n * rounded frame. The frame draws its own box styling and keyboard focus\n * ring, so the input inside sits flush against its neighboring buttons\n * instead of carrying a competing border of its own.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { MinusIcon, PlusIcon } from \"@sdxc/icons\";\nimport { bg, border, borderEdge, fg, outline, outlineWidth } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, raw } from \"@sdxc/u/general\";\nimport { basis, flex, grow, inlineFlex, items, justify, shrink } from \"@sdxc/u/layout\";\nimport { bs, is } from \"@sdxc/u/size\";\nimport { active, focusVisible, hover, invalid, when } from \"@sdxc/u/state\";\nimport { tabularNums, textAlign } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { fieldStackLayout } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\n\nimport { Input } from \"@sdxc/ui/input\";\n\n/**\n * ARIA role applied to {@link NumberField.Group} through {@link attrs}\n * unless a consumer supplies its own `role`, announcing the frame as one\n * related unit to assistive technology.\n */\nconst DEFAULT_ROLE = \"group\";\n\n/**\n * Native `<button>` `type` {@link NumberField.DecrementButton} and\n * {@link NumberField.IncrementButton} fall back to when a consumer doesn't\n * supply one, keeping a click on either from submitting a surrounding `<form>`.\n */\nconst DEFAULT_BUTTON_TYPE: NonNullable<NumberField.DecrementButtonProps[\"type\"]> = \"button\";\n\n/**\n * Shared box, color, and interaction-state styling for\n * {@link NumberField.DecrementButton} and {@link NumberField.IncrementButton},\n * differing only in which inline edge carries the divider border.\n *\n * @param dividerEdge Which inline edge carries the divider border: `\"end\"` for the control preceding the input, `\"start\"` for the one following it.\n * @returns The mixins shared by both stepper buttons.\n */\nfunction stepperButtonMix(dividerEdge: \"start\" | \"end\") {\n\treturn [\n\t\tinteractiveTransition(),\n\t\tflex(),\n\t\titems(\"center\"),\n\t\tjustify(\"center\"),\n\t\tis(\"2.5rem\"),\n\t\tfg(\"neutral\"),\n\t\tborder(\"neutral\"),\n\t\tborderEdge(dividerEdge === \"start\" ? \"inline-start\" : \"inline-end\", { width: 1 }),\n\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\trounded(\"none\"),\n\t\tbg(\"transparent\"),\n\t\twhen(\"& svg\", [is(\"1rem\"), bs(\"1rem\")]),\n\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t];\n}\n\n/**\n * Prop types for {@link NumberField} and its compound parts.\n */\nexport namespace NumberField {\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * `children` composes this field's parts — typically a caption, the\n\t * {@link NumberField.Group} row, and any supporting or validation copy.\n\t */\n\texport interface Props extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * `children` composes {@link NumberField.DecrementButton},\n\t * {@link NumberField.Input}, and {@link NumberField.IncrementButton}.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every prop {@link Input.Props} accepts except `type` and `role`, fixed to\n\t * `\"number\"` and the platform's own `spinbutton` role, and `color`, unexposed\n\t * since the keyboard focus ring is deferred to {@link NumberField.Group}.\n\t */\n\texport interface InputProps extends Omit<Input.Props, \"type\" | \"role\" | \"color\"> {}\n\n\t/**\n\t * Every native `<button>` attribute except `children`, which stays fixed\n\t * to this button's own decrement glyph, plus the `mix` passthrough.\n\t * `type` defaults to {@link DEFAULT_BUTTON_TYPE}.\n\t */\n\texport interface DecrementButtonProps extends Omit<TagProps<\"button\">, \"children\"> {}\n\n\t/**\n\t * Every native `<button>` attribute except `children`, which stays fixed\n\t * to this button's own increment glyph, plus the `mix` passthrough.\n\t * `type` defaults to {@link DEFAULT_BUTTON_TYPE}.\n\t */\n\texport interface IncrementButtonProps extends Omit<TagProps<\"button\">, \"children\"> {}\n}\n\n/**\n * Renders a plain host stacking this field's compound parts in a single\n * column with a small gap between them: typically a caption, the\n * {@link NumberField.Group} row, and any supporting or validation copy.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the field's markup.\n * @example\n * <NumberField>\n * \t<Label htmlFor=\"quantity\">{t(\"form.quantity.label\")}</Label>\n * \t<NumberField.Group>\n * \t\t<NumberField.DecrementButton aria-label={t(\"stepper.decrement\")} />\n * \t\t<NumberField.Input id=\"quantity\" name=\"quantity\" min={0} max={10} defaultValue={1} />\n * \t\t<NumberField.IncrementButton aria-label={t(\"stepper.increment\")} />\n * \t</NumberField.Group>\n * </NumberField>\n */\nexport function NumberField(handle: Handle<NumberField.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} data-slot=\"number-field\" mix={[fieldStackLayout(), mix]} />;\n\t};\n}\n\n/**\n * Renders {@link NumberField}'s frame: a `role=\"group\"` `<div>` drawing a\n * bordered, rounded, tinted-background box that reads as one seamless\n * control, ringing the whole frame via `:focus-within` when a child gains focus.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the frame's markup.\n * @example\n * <NumberField.Group>\n * \t<NumberField.DecrementButton aria-label={t(\"stepper.decrement\")} />\n * \t<NumberField.Input aria-label={t(\"form.quantity.label\")} />\n * \t<NumberField.IncrementButton aria-label={t(\"stepper.increment\")} />\n * </NumberField.Group>\n */\nNumberField.Group = function NumberFieldGroup(handle: Handle<NumberField.GroupProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_ROLE }),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"stretch\"),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\thover(border(\"neutral.border-hover\")),\n\t\t\t\t\t/**\n\t\t\t\t\t * The wrapper wears the focus of whichever part holds it as a ring standing off the\n\t\t\t\t\t * field, as every button here does; the border steps only to its hover weight, since a\n\t\t\t\t\t * darkened border flush with the ring reads as one thick slab.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&:focus-within\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\tborder(\"neutral.border-hover\"),\n\t\t\t\t\t]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link NumberField}'s control: a native `<input type=\"number\">`\n * built on {@link Input}. The stepper buttons need a separately wired\n * `stepUp()`/`stepDown()` for press-and-hold repeat; typed entry works without it.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <NumberField.Input aria-label={t(\"form.quantity.label\")} min={0} max={10} defaultValue={1} />\n * @example\n * <NumberField.Input id=\"price\" name=\"price\" step={0.01} aria-invalid=\"true\" />\n */\nNumberField.Input = function NumberFieldInput(handle: Handle<NumberField.InputProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<Input\n\t\t\t\ttype=\"number\"\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\ttextAlign(\"center\"),\n\t\t\t\t\ttabularNums(),\n\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tshrink(1),\n\t\t\t\t\tbasis(\"0%\"),\n\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\n\t\t\t\t\traw({\n\t\t\t\t\t\t\"-moz-appearance\": \"textfield\",\n\n\t\t\t\t\t\t\"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button\": {\n\t\t\t\t\t\t\t\"-webkit-appearance\": \"none\",\n\t\t\t\t\t\t\tmargin: \"0\",\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\tfg(\"inherit\"),\n\t\t\t\t\twhen(\"&:disabled\", bg(\"transparent\")),\n\t\t\t\t\tfocusVisible(outlineWidth(\"0\")),\n\t\t\t\t\tinvalid([outlineWidth(\"0\"), fg(\"danger\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a native `<button>` decrementing {@link NumberField.Input}'s\n * value; its glyph is `aria-hidden`, so callers must supply an `aria-label`.\n * In dev mode, a missing `aria-label`/`aria-labelledby` logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <NumberField.DecrementButton aria-label={t(\"stepper.decrement\")} />\n * @example\n * <NumberField.DecrementButton aria-label={t(\"stepper.decrement\")} disabled={quantity <= 0} />\n */\nNumberField.DecrementButton = function NumberFieldDecrementButton(\n\thandle: Handle<NumberField.DecrementButtonProps>,\n) {\n\treturn () => {\n\t\tlet { type, mix, ...rest } = handle.props;\n\n\t\tif (import.meta.env?.DEV && !handle.props[\"aria-label\"] && !handle.props[\"aria-labelledby\"]) {\n\t\t\tconsole.warn(\n\t\t\t\t\"NumberField.DecrementButton: needs an `aria-label` describing what it does — its content is a decorative glyph with no accessible name of its own.\",\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={type ?? DEFAULT_BUTTON_TYPE}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"decrement\"\n\t\t\t\tmix={[stepperButtonMix(\"end\"), mix]}\n\t\t\t>\n\t\t\t\t<MinusIcon />\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders a native `<button>` incrementing {@link NumberField.Input}'s\n * value; its glyph is `aria-hidden`, so callers must supply an `aria-label`.\n * In dev mode, a missing `aria-label`/`aria-labelledby` logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <NumberField.IncrementButton aria-label={t(\"stepper.increment\")} />\n * @example\n * <NumberField.IncrementButton aria-label={t(\"stepper.increment\")} disabled={quantity >= 10} />\n */\nNumberField.IncrementButton = function NumberFieldIncrementButton(\n\thandle: Handle<NumberField.IncrementButtonProps>,\n) {\n\treturn () => {\n\t\tlet { type, mix, ...rest } = handle.props;\n\n\t\tif (import.meta.env?.DEV && !handle.props[\"aria-label\"] && !handle.props[\"aria-labelledby\"]) {\n\t\t\tconsole.warn(\n\t\t\t\t\"NumberField.IncrementButton: needs an `aria-label` describing what it does — its content is a decorative glyph with no accessible name of its own.\",\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={type ?? DEFAULT_BUTTON_TYPE}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"increment\"\n\t\t\t\tmix={[stepperButtonMix(\"start\"), mix]}\n\t\t\t>\n\t\t\t\t<PlusIcon />\n\t\t\t</button>\n\t\t);\n\t};\n};\n"
13
13
  },
14
14
  "test": null
15
15
  }