@sdxc/kit 0.0.0-stage → 2026.10.17

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 (298) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +93 -2
  3. package/changelog.jsonl +1097 -0
  4. package/config.schema.json +89 -0
  5. package/dist/author.d.ts +36 -0
  6. package/dist/author.js +107 -0
  7. package/dist/bin.d.ts +9 -0
  8. package/dist/bin.js +10 -0
  9. package/dist/cli.d.ts +33 -0
  10. package/dist/cli.js +58 -0
  11. package/dist/commands/create.d.ts +20 -0
  12. package/dist/commands/create.js +169 -0
  13. package/dist/commands/init.d.ts +16 -0
  14. package/dist/commands/init.js +27 -0
  15. package/dist/commands/make.d.ts +335 -0
  16. package/dist/commands/make.js +152 -0
  17. package/dist/commands/run.d.ts +23 -0
  18. package/dist/commands/run.js +53 -0
  19. package/dist/commands/ui/add.d.ts +23 -0
  20. package/dist/commands/ui/add.js +50 -0
  21. package/dist/commands/ui/diff.d.ts +20 -0
  22. package/dist/commands/ui/diff.js +28 -0
  23. package/dist/commands/ui/list.d.ts +24 -0
  24. package/dist/commands/ui/list.js +45 -0
  25. package/dist/commands/ui/remove.d.ts +22 -0
  26. package/dist/commands/ui/remove.js +48 -0
  27. package/dist/commands/ui/update.d.ts +23 -0
  28. package/dist/commands/ui/update.js +37 -0
  29. package/dist/commands/upgrade.d.ts +30 -0
  30. package/dist/commands/upgrade.js +184 -0
  31. package/dist/config.d.ts +81 -0
  32. package/dist/config.js +157 -0
  33. package/dist/contract.d.ts +161 -0
  34. package/dist/contract.js +308 -0
  35. package/dist/create/github.d.ts +63 -0
  36. package/dist/create/github.js +172 -0
  37. package/dist/create/target.d.ts +31 -0
  38. package/dist/create/target.js +56 -0
  39. package/dist/create/templates.d.ts +69 -0
  40. package/dist/create/templates.js +251 -0
  41. package/dist/dependencies.d.ts +34 -0
  42. package/dist/dependencies.js +76 -0
  43. package/dist/diff.d.ts +14 -0
  44. package/dist/diff.js +103 -0
  45. package/dist/format.d.ts +21 -0
  46. package/dist/format.js +40 -0
  47. package/dist/init.d.ts +40 -0
  48. package/dist/init.js +100 -0
  49. package/dist/lock.d.ts +74 -0
  50. package/dist/lock.js +214 -0
  51. package/dist/make/declare.d.ts +54 -0
  52. package/dist/make/declare.js +598 -0
  53. package/dist/make/generate.d.ts +62 -0
  54. package/dist/make/generate.js +160 -0
  55. package/dist/make/imports.d.ts +43 -0
  56. package/dist/make/imports.js +105 -0
  57. package/dist/make/index.d.ts +43 -0
  58. package/dist/make/index.js +140 -0
  59. package/dist/make/kinds.d.ts +40 -0
  60. package/dist/make/kinds.js +96 -0
  61. package/dist/make/migrations.d.ts +41 -0
  62. package/dist/make/migrations.js +116 -0
  63. package/dist/make/names.d.ts +31 -0
  64. package/dist/make/names.js +47 -0
  65. package/dist/make/stubs.d.ts +44 -0
  66. package/dist/make/stubs.js +89 -0
  67. package/dist/middleware.d.ts +44 -0
  68. package/dist/middleware.js +49 -0
  69. package/dist/package-manager.d.ts +41 -0
  70. package/dist/package-manager.js +80 -0
  71. package/dist/project.d.ts +19 -0
  72. package/dist/project.js +42 -0
  73. package/dist/releases.d.ts +40 -0
  74. package/dist/releases.js +110 -0
  75. package/dist/testing.d.ts +60 -0
  76. package/dist/testing.js +148 -0
  77. package/dist/ui/commands.d.ts +114 -0
  78. package/dist/ui/commands.js +432 -0
  79. package/dist/ui/imports.d.ts +46 -0
  80. package/dist/ui/imports.js +160 -0
  81. package/dist/ui/layout.d.ts +48 -0
  82. package/dist/ui/layout.js +138 -0
  83. package/dist/ui/registry.d.ts +58 -0
  84. package/dist/ui/registry.js +82 -0
  85. package/dist/upgrade/changelog.d.ts +50 -0
  86. package/dist/upgrade/changelog.js +69 -0
  87. package/dist/upgrade/project.d.ts +62 -0
  88. package/dist/upgrade/project.js +132 -0
  89. package/dist/upgrade/prompt.d.ts +51 -0
  90. package/dist/upgrade/prompt.js +227 -0
  91. package/dist/upgrade/registry.d.ts +33 -0
  92. package/dist/upgrade/registry.js +50 -0
  93. package/lock.schema.json +60 -0
  94. package/package.json +44 -5
  95. package/registry/ui/accordion.json +15 -0
  96. package/registry/ui/alert-dialog.json +20 -0
  97. package/registry/ui/alert.json +15 -0
  98. package/registry/ui/aspect-ratio.json +13 -0
  99. package/registry/ui/attachment.json +15 -0
  100. package/registry/ui/avatar.json +15 -0
  101. package/registry/ui/badge.json +13 -0
  102. package/registry/ui/breadcrumbs.json +15 -0
  103. package/registry/ui/bubble.json +13 -0
  104. package/registry/ui/button.json +16 -0
  105. package/registry/ui/calendar.json +16 -0
  106. package/registry/ui/card.json +18 -0
  107. package/registry/ui/carousel.json +15 -0
  108. package/registry/ui/chart.json +13 -0
  109. package/registry/ui/checkbox-group.json +13 -0
  110. package/registry/ui/checkbox.json +16 -0
  111. package/registry/ui/color-area.json +13 -0
  112. package/registry/ui/color-field.json +20 -0
  113. package/registry/ui/color-picker.json +17 -0
  114. package/registry/ui/color-slider.json +13 -0
  115. package/registry/ui/color-swatch-picker.json +15 -0
  116. package/registry/ui/color-swatch.json +13 -0
  117. package/registry/ui/color-wheel.json +13 -0
  118. package/registry/ui/combobox.json +15 -0
  119. package/registry/ui/command.json +13 -0
  120. package/registry/ui/confirm.json +19 -0
  121. package/registry/ui/context-menu.json +16 -0
  122. package/registry/ui/date-field.json +19 -0
  123. package/registry/ui/date-picker.json +15 -0
  124. package/registry/ui/date-range-picker.json +16 -0
  125. package/registry/ui/description.json +13 -0
  126. package/registry/ui/dialog.json +19 -0
  127. package/registry/ui/disclosure.json +18 -0
  128. package/registry/ui/drawer.json +18 -0
  129. package/registry/ui/drop-indicator.json +13 -0
  130. package/registry/ui/drop-zone.json +13 -0
  131. package/registry/ui/empty.json +15 -0
  132. package/registry/ui/field-error.json +13 -0
  133. package/registry/ui/file-trigger.json +13 -0
  134. package/registry/ui/form.json +21 -0
  135. package/registry/ui/grid-list.json +18 -0
  136. package/registry/ui/group.json +13 -0
  137. package/registry/ui/header.json +13 -0
  138. package/registry/ui/heading-scope.json +20 -0
  139. package/registry/ui/heading.json +15 -0
  140. package/registry/ui/highlight.json +16 -0
  141. package/registry/ui/hover-card.json +13 -0
  142. package/registry/ui/image-placeholder.json +16 -0
  143. package/registry/ui/input.json +13 -0
  144. package/registry/ui/item.json +13 -0
  145. package/registry/ui/keyboard.json +13 -0
  146. package/registry/ui/label.json +13 -0
  147. package/registry/ui/link-button.json +16 -0
  148. package/registry/ui/link.json +13 -0
  149. package/registry/ui/listbox.json +15 -0
  150. package/registry/ui/logo.json +15 -0
  151. package/registry/ui/marker.json +13 -0
  152. package/registry/ui/menu.json +19 -0
  153. package/registry/ui/menubar.json +13 -0
  154. package/registry/ui/message-scroller.json +16 -0
  155. package/registry/ui/message.json +13 -0
  156. package/registry/ui/meter.json +13 -0
  157. package/registry/ui/modal.json +15 -0
  158. package/registry/ui/nav-link.json +13 -0
  159. package/registry/ui/navigation-menu.json +15 -0
  160. package/registry/ui/number-field.json +15 -0
  161. package/registry/ui/otp-field.json +15 -0
  162. package/registry/ui/overlay-arrow.json +13 -0
  163. package/registry/ui/pagination.json +16 -0
  164. package/registry/ui/popover.json +13 -0
  165. package/registry/ui/progress-bar.json +13 -0
  166. package/registry/ui/radio-group.json +13 -0
  167. package/registry/ui/range-calendar.json +16 -0
  168. package/registry/ui/resizable.json +13 -0
  169. package/registry/ui/scroll-area.json +13 -0
  170. package/registry/ui/search-field.json +16 -0
  171. package/registry/ui/section.json +13 -0
  172. package/registry/ui/select.json +13 -0
  173. package/registry/ui/selection-indicator.json +13 -0
  174. package/registry/ui/sentinel-row.json +16 -0
  175. package/registry/ui/separator.json +13 -0
  176. package/registry/ui/shared-element.json +13 -0
  177. package/registry/ui/sheet.json +15 -0
  178. package/registry/ui/shortcut-list.json +18 -0
  179. package/registry/ui/sidebar.json +20 -0
  180. package/registry/ui/skeleton.json +13 -0
  181. package/registry/ui/slider.json +16 -0
  182. package/registry/ui/spinner.json +13 -0
  183. package/registry/ui/switch.json +16 -0
  184. package/registry/ui/table.json +16 -0
  185. package/registry/ui/tabs.json +17 -0
  186. package/registry/ui/tag-group.json +18 -0
  187. package/registry/ui/text-field.json +19 -0
  188. package/registry/ui/text.json +13 -0
  189. package/registry/ui/textarea.json +13 -0
  190. package/registry/ui/time-field.json +19 -0
  191. package/registry/ui/toast.json +16 -0
  192. package/registry/ui/toggle-button.json +17 -0
  193. package/registry/ui/toolbar.json +13 -0
  194. package/registry/ui/tooltip.json +16 -0
  195. package/registry/ui/tree.json +18 -0
  196. package/registry/ui/typeset.json +16 -0
  197. package/registry/ui/youtube-embed.json +16 -0
  198. package/stubs/command.stub +16 -0
  199. package/stubs/command.test.stub +21 -0
  200. package/stubs/controller.api.stub +21 -0
  201. package/stubs/controller.api.test.stub +18 -0
  202. package/stubs/controller.form.stub +63 -0
  203. package/stubs/controller.form.test.stub +61 -0
  204. package/stubs/controller.stub +24 -0
  205. package/stubs/controller.test.stub +18 -0
  206. package/stubs/email.stub +26 -0
  207. package/stubs/email.test.stub +21 -0
  208. package/stubs/factory.stub +13 -0
  209. package/stubs/initializer.stub +9 -0
  210. package/stubs/initializer.test.stub +16 -0
  211. package/stubs/job.cron.stub +16 -0
  212. package/stubs/job.stub +15 -0
  213. package/stubs/job.test.stub +18 -0
  214. package/stubs/mcp.resource.stub +15 -0
  215. package/stubs/mcp.stub +13 -0
  216. package/stubs/mcp.test.stub +18 -0
  217. package/stubs/middleware.stub +16 -0
  218. package/stubs/middleware.test.stub +16 -0
  219. package/stubs/migration.stub +1 -0
  220. package/stubs/model.stub +33 -0
  221. package/stubs/model.test.stub +18 -0
  222. package/stubs/policy.stub +16 -0
  223. package/stubs/policy.test.stub +20 -0
  224. package/stubs/service.stub +17 -0
  225. package/stubs/service.test.stub +17 -0
  226. package/stubs/validator.stub +17 -0
  227. package/stubs/validator.test.stub +25 -0
  228. package/templates/app/.env.example +16 -0
  229. package/templates/app/README.md +84 -0
  230. package/templates/app/app/commands/about.test.ts +29 -0
  231. package/templates/app/app/commands/about.ts +34 -0
  232. package/templates/app/app/commands/db/console.ts +6 -0
  233. package/templates/app/app/commands/db/migrate.test.ts +30 -0
  234. package/templates/app/app/commands/db/migrate.ts +55 -0
  235. package/templates/app/app/commands/index.ts +31 -0
  236. package/templates/app/app/commands/typegen.test.ts +17 -0
  237. package/templates/app/app/commands/typegen.ts +16 -0
  238. package/templates/app/app/http/controllers/api/health.tsx +15 -0
  239. package/templates/app/app/http/controllers/api/not-found.tsx +16 -0
  240. package/templates/app/app/http/controllers/api/openapi.tsx +17 -0
  241. package/templates/app/app/http/controllers/home.tsx +30 -0
  242. package/templates/app/app/http/controllers/mcp.tsx +16 -0
  243. package/templates/app/app/http/controllers/not-found.tsx +30 -0
  244. package/templates/app/app/http/controllers/robots.test.ts +18 -0
  245. package/templates/app/app/http/controllers/robots.ts +24 -0
  246. package/templates/app/app/http/controllers/sitemap.test.ts +28 -0
  247. package/templates/app/app/http/controllers/sitemap.ts +25 -0
  248. package/templates/app/app/http/middleware/api.ts +10 -0
  249. package/templates/app/app/http/middleware/page.test.ts +40 -0
  250. package/templates/app/app/http/middleware/page.ts +49 -0
  251. package/templates/app/app/http/middleware/server-timing.test.ts +15 -0
  252. package/templates/app/app/http/middleware/server-timing.ts +42 -0
  253. package/templates/app/app/initializers/assets.ts +11 -0
  254. package/templates/app/app/initializers/captcha.ts +11 -0
  255. package/templates/app/app/initializers/cli.ts +75 -0
  256. package/templates/app/app/initializers/database.test.ts +18 -0
  257. package/templates/app/app/initializers/database.ts +18 -0
  258. package/templates/app/app/initializers/dispatcher.ts +36 -0
  259. package/templates/app/app/initializers/honeypot.ts +11 -0
  260. package/templates/app/app/initializers/i18n.test.ts +16 -0
  261. package/templates/app/app/initializers/i18n.ts +28 -0
  262. package/templates/app/app/initializers/local-database.test.ts +33 -0
  263. package/templates/app/app/initializers/local-database.ts +53 -0
  264. package/templates/app/app/initializers/logger.ts +10 -0
  265. package/templates/app/app/initializers/mail.test.ts +27 -0
  266. package/templates/app/app/initializers/mail.ts +11 -0
  267. package/templates/app/app/initializers/mcp.ts +16 -0
  268. package/templates/app/app/initializers/openapi.ts +21 -0
  269. package/templates/app/app/initializers/router.test.ts +61 -0
  270. package/templates/app/app/initializers/router.tsx +111 -0
  271. package/templates/app/app/initializers/seo.ts +15 -0
  272. package/templates/app/app/initializers/session.test.ts +34 -0
  273. package/templates/app/app/initializers/session.ts +29 -0
  274. package/templates/app/app/initializers/spam.ts +10 -0
  275. package/templates/app/app/jobs/index.ts +10 -0
  276. package/templates/app/app/mcp/resources/index.ts +9 -0
  277. package/templates/app/app/mcp/tools/index.ts +10 -0
  278. package/templates/app/app/models/index.ts +10 -0
  279. package/templates/app/app/services/migrations.test.ts +45 -0
  280. package/templates/app/app/services/migrations.ts +60 -0
  281. package/templates/app/app/test/cloudflare-workers.ts +25 -0
  282. package/templates/app/bootstrap/browser.ts +27 -0
  283. package/templates/app/bootstrap/cli.ts +9 -0
  284. package/templates/app/bootstrap/worker.ts +31 -0
  285. package/templates/app/cloudflare.config.ts +56 -0
  286. package/templates/app/config/constants.ts +19 -0
  287. package/templates/app/config/problems.ts +24 -0
  288. package/templates/app/config/security-policy.ts +34 -0
  289. package/templates/app/config/security-txt.ts +28 -0
  290. package/templates/app/database/migrations/.gitkeep +0 -0
  291. package/templates/app/gitignore +9 -0
  292. package/templates/app/package.json +68 -0
  293. package/templates/app/resources/layouts/document.tsx +79 -0
  294. package/templates/app/resources/locales/en.json +10 -0
  295. package/templates/app/routes/api.ts +29 -0
  296. package/templates/app/routes/web.ts +14 -0
  297. package/templates/app/tsconfig.json +40 -0
  298. package/templates/app/vite.config.ts +44 -0
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "checkbox",
3
+ "changedIn": "2026.10.13",
4
+ "dependencies": [],
5
+ "exports": [
6
+ "Checkbox"
7
+ ],
8
+ "source": {
9
+ "path": "checkbox.tsx",
10
+ "content": "/**\n * A styled native checkbox: an `<input type=\"checkbox\">` paired with a\n * decorative glyph box that renders its check or dash mark purely from the\n * input's own state, wrapped in a `<label>` so clicking or tapping anywhere\n * in the row — box, glyph, or label text alike — toggles the control.\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 { CheckIcon, MinusIcon } from \"@sdxc/icons\";\nimport { visuallyHidden } from \"@sdxc/u/a11y\";\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor } from \"@sdxc/u/general\";\nimport { block, center, hidden, hstack, relative, shrink } from \"@sdxc/u/layout\";\nimport { bs, is } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { warnIfNoAccessibleName } from \"@sdxc/ui/utils\";\n\n/** Semantic color role {@link Checkbox} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Checkbox.Color = \"neutral\";\n\n/**\n * Prop types for {@link Checkbox}.\n */\nexport namespace Checkbox {\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 * Per-part styling for the elements this convenience wrapper composes\n\t * internally alongside its own host `<input>`.\n\t */\n\texport interface PartsProps {\n\t\t/** Styling for the decorative box rendering the checkmark or dash glyph. */\n\t\tbox?: TagProps<\"span\">[\"mix\"];\n\t}\n\n\t/**\n\t * Props accepted by {@link Checkbox}. Extends every native `<input>`\n\t * attribute except `type`, fixed to `\"checkbox\"`; `mix` styles that same\n\t * `<input>` host, and `role` is narrowed to what a checkbox input allows.\n\t */\n\texport interface Props extends Omit<TagProps<\"input\">, \"type\" | \"role\"> {\n\t\t/** ARIA role override, restricted to what a checkbox input may carry. */\n\t\trole?: \"checkbox\" | \"button\" | \"menuitemcheckbox\" | \"option\" | \"switch\";\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/**\n\t\t * Label content rendered after the box, inside the same native\n\t\t * `<label>` wrapping the row — clicking any of it toggles the checkbox\n\t\t * natively, with no separate `htmlFor`/`id` pair required.\n\t\t */\n\t\tchildren?: RemixNode;\n\t\t/** Per-part styling for this wrapper's internally composed elements. */\n\t\tparts?: PartsProps;\n\t}\n}\n\n/**\n * The box precedes the input in source order so its `:has(~ input:…)` rules\n * can read state directly off it, keeping the whole control CSS-driven;\n * `shrink(0)` also keeps the box square regardless of label length.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the checkbox's markup.\n * @example\n * <Checkbox name=\"terms\" required>{t(\"signup.acceptTerms\")}</Checkbox>\n * @example\n * <Checkbox color=\"danger\" checked={row.flagged} aria-label={t(\"table.flagRow\")} />\n * @example\n * <Checkbox disabled defaultChecked>{t(\"settings.legacyOptIn\")}</Checkbox>\n */\nexport function Checkbox(handle: Handle<Checkbox.Props>) {\n\treturn () => {\n\t\tlet { color, children, parts, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"Checkbox: a checkbox with no visible label text needs an `aria-label` describing what it toggles — assistive technology has no accessible name to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<label mix={[relative(), hstack({ gap: 2, align: \"center\" })]}>\n\t\t\t\t<span\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tdata-slot=\"box\"\n\t\t\t\t\tdata-color={resolvedColor}\n\t\t\t\t\tmix={[\n\t\t\t\t\t\tcenter(),\n\t\t\t\t\t\tis(\"var(--ui-checkbox-size, 1.25rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-checkbox-size, 1.25rem)\"),\n\t\t\t\t\t\tshrink(0),\n\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\tborder({ width: 2, color: \"neutral.strong\" }),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tinteractiveTransition(),\n\n\t\t\t\t\t\twhen(\"& > svg\", [hidden(), is(\"0.75rem\"), bs(\"0.75rem\")]),\n\t\t\t\t\t\twhen(\"&:has(~ input:checked) > svg:first-child\", block()),\n\t\t\t\t\t\twhen(\"&:has(~ input:indeterminate) > svg:last-child\", block()),\n\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-color=\"brand\"]',\n\t\t\t\t\t\t\twhen(\"&:has(~ input:checked), &:has(~ input:indeterminate)\", [\n\t\t\t\t\t\t\t\tborder(\"brand.solid\"),\n\t\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-color=\"neutral\"]',\n\t\t\t\t\t\t\twhen(\"&:has(~ input:checked), &:has(~ input:indeterminate)\", [\n\t\t\t\t\t\t\t\tborder(\"neutral.solid\"),\n\t\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-color=\"success\"]',\n\t\t\t\t\t\t\twhen(\"&:has(~ input:checked), &:has(~ input:indeterminate)\", [\n\t\t\t\t\t\t\t\tborder(\"success.solid\"),\n\t\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-color=\"warning\"]',\n\t\t\t\t\t\t\twhen(\"&:has(~ input:checked), &:has(~ input:indeterminate)\", [\n\t\t\t\t\t\t\t\tborder(\"warning.solid\"),\n\t\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-color=\"danger\"]',\n\t\t\t\t\t\t\twhen(\"&:has(~ input:checked), &:has(~ input:indeterminate)\", [\n\t\t\t\t\t\t\t\tborder(\"danger.solid\"),\n\t\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\n\t\t\t\t\t\twhen(\"&:has(~ input:focus-visible)\", [\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\twhen('&[data-color=\"neutral\"]', outline(\"neutral.ring\")),\n\t\t\t\t\t\t\twhen('&[data-color=\"success\"]', outline(\"success.ring\")),\n\t\t\t\t\t\t\twhen('&[data-color=\"warning\"]', outline(\"warning.ring\")),\n\t\t\t\t\t\t\twhen('&[data-color=\"danger\"]', outline(\"danger.ring\")),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen(\"&:has(~ input:disabled)\", [cursor(\"not-allowed\"), opacity(50)]),\n\n\t\t\t\t\t\tparts?.box,\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t<CheckIcon />\n\t\t\t\t\t<MinusIcon />\n\t\t\t\t</span>\n\t\t\t\t<input type=\"checkbox\" {...rest} mix={[visuallyHidden(), mix]} />\n\t\t\t\t{children}\n\t\t\t</label>\n\t\t);\n\t};\n}\n"
11
+ },
12
+ "test": {
13
+ "path": "checkbox.test.tsx",
14
+ "content": "/**\n * Tests for {@link Checkbox}'s glyph box: it is a fixed-size flex item sitting next to\n * label content of arbitrary length, and a flex item gives up its declared size unless it\n * is told not to — which squashed the box into a sliver beside a long, wrapping label.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Checkbox } from \"@sdxc/ui/checkbox\";\n\ndescribe(Checkbox.name, () => {\n\ttest(\"refuses to be compressed by a long label sharing its row\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Checkbox name=\"record_ids\" value=\"1\">\n\t\t\t\t{\"v=DKIM1; k=rsa; p=\".concat(\"A\".repeat(400))}\n\t\t\t</Checkbox>,\n\t\t);\n\n\t\texpect(html).toContain(\"flex-shrink: 0;\");\n\t});\n});\n"
15
+ }
16
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "color-area",
3
+ "changedIn": "2026.10.2",
4
+ "dependencies": [],
5
+ "exports": [
6
+ "ColorArea"
7
+ ],
8
+ "source": {
9
+ "path": "color-area.tsx",
10
+ "content": "/**\n * A two-dimensional saturation/brightness picking square for a given hue,\n * built from two overlaid native `<input type=\"range\">` elements — one\n * horizontal for saturation, one rotated vertical for brightness — whose\n * native thumbs, each reshaped into a thin line, cross at the picked point.\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 { bg, border, linearGradient, outline, outlineStyle } from \"@sdxc/u/color\";\nimport { opacity, ringShadow, rounded, transition, transitionDuration } from \"@sdxc/u/effects\";\nimport { cursor, pointerEvents, raw } from \"@sdxc/u/general\";\nimport { absolute, appearance, inlineBlock, inset, relative } from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { media } from \"@sdxc/u/responsive\";\nimport { bs, is, m } from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { when } from \"@sdxc/u/state\";\nimport { scaleProperty } from \"@sdxc/u/transform\";\nimport { attrs } from \"remix/component\";\n\nimport { mergeStyle } from \"@sdxc/ui/utils\";\nimport { warnIfNoAccessibleLabel } from \"@sdxc/ui/utils\";\n\n/** Hue, in degrees, {@link ColorArea} falls back to when `hue` is omitted. */\nconst DEFAULT_HUE = 0;\n\n/** Lower bound shared by both axis inputs' native `min`. */\nconst DEFAULT_MIN = 0;\n\n/** Upper bound shared by both axis inputs' native `max`. */\nconst DEFAULT_MAX = 100;\n\n/** Step shared by both axis inputs' native `step`, applied when a thumb's own `step` is omitted. */\nconst DEFAULT_STEP = 1;\n\n/**\n * Saturation (x-axis) {@link ColorArea} falls back to when neither\n * `saturation` nor `defaultSaturation` is set — full saturation, so the\n * default picked point starts at the pure-hue edge of the square.\n */\nconst DEFAULT_SATURATION = 100;\n\n/**\n * Brightness (y-axis) {@link ColorArea} falls back to when neither `value`\n * nor `defaultValue` is set — full brightness, pairing with\n * {@link DEFAULT_SATURATION} for a default picked point at the pure-hue corner.\n */\nconst DEFAULT_VALUE = 100;\n\n/**\n * `role=\"group\"` applied through {@link attrs} unless a consumer supplies\n * its own `role`, announcing the root as one grouped control to assistive\n * technology despite its two axes riding two separate native inputs.\n */\nconst DEFAULT_ROLE = \"group\";\n\n/**\n * Prop types for {@link ColorArea} and its compound parts.\n */\nexport namespace ColorArea {\n\t/**\n\t * Value {@link ColorArea} stores in component context so its\n\t * {@link ColorArea.SaturationThumb} and {@link ColorArea.ValueThumb} share\n\t * the same resolved hue, position, and stable ids without repeating them.\n\t */\n\texport interface Context {\n\t\t/** Resolved hue, in degrees, the square's background paints for. */\n\t\thue: number;\n\t\t/** Resolved saturation (x-axis position), `0`–`100`. */\n\t\tsaturation: number;\n\t\t/** Resolved brightness (y-axis position), `0`–`100`. */\n\t\tvalue: number;\n\t\t/** Id shared by {@link ColorArea.SaturationThumb} as its own `id`. */\n\t\tsaturationThumbId: string;\n\t\t/** Id shared by {@link ColorArea.ValueThumb} as its own `id`. */\n\t\tvalueThumbId: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link ColorArea}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Hue, in degrees `0`–`360`, the square's background renders every reachable\n\t\t * saturation/brightness combination for. Defaults to {@link DEFAULT_HUE}.\n\t\t * Typically driven by a hue control alongside this one, re-rendering on change.\n\t\t */\n\t\thue?: number;\n\t\t/** Current saturation (x-axis position), `0`–`100`, for a square whose position the consumer tracks itself. */\n\t\tsaturation?: number;\n\t\t/** Starting saturation (x-axis position), `0`–`100`, for a square that never tracks its own position. */\n\t\tdefaultSaturation?: number;\n\t\t/** Current brightness (y-axis position), `0`–`100`, for a square whose position the consumer tracks itself. */\n\t\tvalue?: number;\n\t\t/** Starting brightness (y-axis position), `0`–`100`, for a square that never tracks its own position. */\n\t\tdefaultValue?: number;\n\t}\n\n\t/**\n\t * Every native `<input>` attribute except `type` (fixed to `\"range\"`) and\n\t * `role` (the platform's implicit `\"slider\"`), plus `mix`. Use\n\t * `value`/`defaultValue`, `min`/`max`/`step`, and `aria-label` as usual.\n\t */\n\texport interface SaturationThumbProps extends Omit<TagProps<\"input\">, \"type\" | \"role\"> {}\n\n\t/**\n\t * Every native `<input>` attribute except `type` (fixed to `\"range\"`) and\n\t * `role` (the platform's implicit `\"slider\"`), plus `mix`. Use\n\t * `value`/`defaultValue`, `min`/`max`/`step`, and `aria-label` as usual.\n\t */\n\texport interface ValueThumbProps extends Omit<TagProps<\"input\">, \"type\" | \"role\"> {}\n}\n\n/**\n * Renders the root `<div>`'s picking-square background: literal `black`/`white`\n * gradient stops are the fixed brightness/saturation math primaries, and the\n * hue's `hsl()` composes through `bg()`, since it passes `(`-values unchanged.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link ColorArea.Context}.\n * @returns The render function producing the root's markup.\n * @example\n * <ColorArea aria-label={t(\"colorPicker.area\")} hue={210} defaultSaturation={80} defaultValue={70}>\n * \t<ColorArea.SaturationThumb aria-label={t(\"colorPicker.saturation\")} />\n * \t<ColorArea.ValueThumb aria-label={t(\"colorPicker.brightness\")} />\n * </ColorArea>\n */\nexport function ColorArea(handle: Handle<ColorArea.Props, ColorArea.Context>) {\n\treturn () => {\n\t\tlet { hue, saturation, defaultSaturation, value, defaultValue, mix, style, ...rest } =\n\t\t\thandle.props;\n\t\tlet resolvedHue = hue ?? DEFAULT_HUE;\n\t\tlet resolvedSaturation = saturation ?? defaultSaturation ?? DEFAULT_SATURATION;\n\t\tlet resolvedValue = value ?? defaultValue ?? DEFAULT_VALUE;\n\t\tlet resolvedStyle = mergeStyle(style, { \"--ui-color-area-hue\": resolvedHue });\n\n\t\twarnIfNoAccessibleLabel(\n\t\t\thandle.props,\n\t\t\t\"ColorArea: this group needs an `aria-label` describing what it picks — assistive technology has no accessible name for the group its two axis inputs are announced under otherwise.\",\n\t\t);\n\n\t\thandle.context.set({\n\t\t\thue: resolvedHue,\n\t\t\tsaturation: resolvedSaturation,\n\t\t\tvalue: resolvedValue,\n\t\t\tsaturationThumbId: `${handle.id}-saturation`,\n\t\t\tvalueThumbId: `${handle.id}-value`,\n\t\t});\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"area\"\n\t\t\t\t{...rest}\n\t\t\t\tstyle={resolvedStyle}\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_ROLE }),\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineBlock(),\n\t\t\t\t\tis(\"var(--ui-color-area-size, 16rem)\"),\n\t\t\t\t\tbs(\"var(--ui-color-area-size, 16rem)\"),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tborder({ width: 1, color: \"neutral\" }),\n\t\t\t\t\toverflow(),\n\t\t\t\t\tbg({\n\t\t\t\t\t\timage: `${linearGradient(\"to top\", \"black\", \"transparent\")}, ${linearGradient(\"to right\", \"white\", \"transparent\")}`,\n\t\t\t\t\t}),\n\t\t\t\t\tbg(\"hsl(var(--ui-color-area-hue, 0) 100% 50%)\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n}\n\n/**\n * `direction` stays fixed left-to-right regardless of the page's own `dir`,\n * matching the root gradient's physical axes; only this thumb's own line\n * accepts pointer input, so elsewhere a click reaches the axis line beneath it.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the thumb's markup.\n * @example\n * <ColorArea.SaturationThumb aria-label={t(\"colorPicker.saturation\")} />\n */\nColorArea.SaturationThumb = function ColorAreaSaturationThumb(\n\thandle: Handle<ColorArea.SaturationThumbProps>,\n) {\n\treturn () => {\n\t\tlet { id, min, max, step, value, defaultValue, mix, ...rest } = handle.props;\n\t\tlet context = handle.context.get(ColorArea);\n\t\tlet resolvedStep = step ?? DEFAULT_STEP;\n\t\tlet resolvedValue = value ?? defaultValue ?? context.saturation;\n\n\t\twarnIfNoAccessibleLabel(\n\t\t\thandle.props,\n\t\t\t\"ColorArea.SaturationThumb: this thumb needs an `aria-label` describing the saturation axis — assistive technology has no accessible name for it otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\t{...rest}\n\t\t\t\ttype=\"range\"\n\t\t\t\tid={id ?? context.saturationThumbId}\n\t\t\t\tmin={min ?? DEFAULT_MIN}\n\t\t\t\tmax={max ?? DEFAULT_MAX}\n\t\t\t\tstep={resolvedStep}\n\t\t\t\tdefaultValue={resolvedValue}\n\t\t\t\tmix={[\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tz(10),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\tbs(\"full\"),\n\n\t\t\t\t\twhen(\"&::-webkit-slider-thumb\", [\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\tborder({ width: 2, color: \"neutral.tint\" }),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\ttransition(\"scale\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&::-moz-range-thumb\", [\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\tborder({ width: 2, color: \"neutral.tint\" }),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\ttransition(\"scale\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t\"&:focus-visible::-webkit-slider-thumb\",\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\"&:focus-visible::-moz-range-thumb\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\twhen(\"&:disabled::-webkit-slider-thumb\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\twhen(\"&:disabled::-moz-range-thumb\", [cursor(\"not-allowed\"), opacity(50)]),\n\n\t\t\t\t\tinset(\"0\"),\n\t\t\t\t\tm(\"0\"),\n\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\tappearance(\"none\", { moz: false }),\n\t\t\t\t\traw({ direction: \"ltr\" }),\n\t\t\t\t\tpointerEvents(),\n\t\t\t\t\toutlineStyle(\"none\"),\n\n\t\t\t\t\twhen(\"&::-webkit-slider-runnable-track\", [\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tappearance(\"none\", { moz: false }),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&::-moz-range-track\", [\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tappearance(\"none\", { webkit: false, moz: false }),\n\t\t\t\t\t\tborder({ style: \"none\" }),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen(\"&::-webkit-slider-thumb\", [\n\t\t\t\t\t\tis(\"var(--ui-color-area-thumb-thickness, 0.1875rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-color-area-size, 16rem)\"),\n\t\t\t\t\t\tappearance(\"none\", { moz: false }),\n\t\t\t\t\t\tpointerEvents(\"auto\"),\n\t\t\t\t\t\tringShadow(\"rgb(0 0 0 / 0.4)\", 1),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&::-moz-range-thumb\", [\n\t\t\t\t\t\tis(\"var(--ui-color-area-thumb-thickness, 0.1875rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-color-area-size, 16rem)\"),\n\t\t\t\t\t\tpointerEvents(\"auto\"),\n\t\t\t\t\t\tringShadow(\"rgb(0 0 0 / 0.4)\", 1),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen(\"&:active::-webkit-slider-thumb\", scaleProperty(1.2)),\n\t\t\t\t\twhen(\"&:active::-moz-range-thumb\", scaleProperty(1.2)),\n\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", [\n\t\t\t\t\t\twhen(\"&::-webkit-slider-thumb\", transitionDuration(\"0s\")),\n\t\t\t\t\t\twhen(\"&::-moz-range-thumb\", transitionDuration(\"0s\")),\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 * `writing-mode`/`direction` stay fixed regardless of the page's own `dir`,\n * so this line travels block-end (black) to block-start, the low-at-the-\n * bottom convention; pointer layering matches {@link ColorArea.SaturationThumb}.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the thumb's markup.\n * @example\n * <ColorArea.ValueThumb aria-label={t(\"colorPicker.brightness\")} />\n */\nColorArea.ValueThumb = function ColorAreaValueThumb(handle: Handle<ColorArea.ValueThumbProps>) {\n\treturn () => {\n\t\tlet { id, min, max, step, value, defaultValue, mix, ...rest } = handle.props;\n\t\tlet context = handle.context.get(ColorArea);\n\t\tlet resolvedStep = step ?? DEFAULT_STEP;\n\t\tlet resolvedValue = value ?? defaultValue ?? context.value;\n\n\t\twarnIfNoAccessibleLabel(\n\t\t\thandle.props,\n\t\t\t\"ColorArea.ValueThumb: this thumb needs an `aria-label` describing the brightness axis — assistive technology has no accessible name for it otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\t{...rest}\n\t\t\t\ttype=\"range\"\n\t\t\t\tid={id ?? context.valueThumbId}\n\t\t\t\tmin={min ?? DEFAULT_MIN}\n\t\t\t\tmax={max ?? DEFAULT_MAX}\n\t\t\t\tstep={resolvedStep}\n\t\t\t\tdefaultValue={resolvedValue}\n\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\tmix={[\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tz(10),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\tbs(\"full\"),\n\n\t\t\t\t\twhen(\"&::-webkit-slider-thumb\", [\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\tborder({ width: 2, color: \"neutral.tint\" }),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\ttransition(\"scale\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&::-moz-range-thumb\", [\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\tborder({ width: 2, color: \"neutral.tint\" }),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\ttransition(\"scale\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t\"&:focus-visible::-webkit-slider-thumb\",\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\"&:focus-visible::-moz-range-thumb\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\twhen(\"&:disabled::-webkit-slider-thumb\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\twhen(\"&:disabled::-moz-range-thumb\", [cursor(\"not-allowed\"), opacity(50)]),\n\n\t\t\t\t\tinset(\"0\"),\n\t\t\t\t\tm(\"0\"),\n\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\tappearance(\"none\", { moz: false }),\n\t\t\t\t\traw({ writingMode: \"vertical-lr\", direction: \"rtl\" }),\n\t\t\t\t\tpointerEvents(),\n\t\t\t\t\toutlineStyle(\"none\"),\n\n\t\t\t\t\twhen(\"&::-webkit-slider-runnable-track\", [\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tappearance(\"none\", { moz: false }),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&::-moz-range-track\", [\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tappearance(\"none\", { webkit: false, moz: false }),\n\t\t\t\t\t\tborder({ style: \"none\" }),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen(\"&::-webkit-slider-thumb\", [\n\t\t\t\t\t\tis(\"var(--ui-color-area-thumb-thickness, 0.1875rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-color-area-size, 16rem)\"),\n\t\t\t\t\t\tappearance(\"none\", { moz: false }),\n\t\t\t\t\t\tpointerEvents(\"auto\"),\n\t\t\t\t\t\tringShadow(\"rgb(0 0 0 / 0.4)\", 1),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&::-moz-range-thumb\", [\n\t\t\t\t\t\tis(\"var(--ui-color-area-thumb-thickness, 0.1875rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-color-area-size, 16rem)\"),\n\t\t\t\t\t\tpointerEvents(\"auto\"),\n\t\t\t\t\t\tringShadow(\"rgb(0 0 0 / 0.4)\", 1),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen(\"&:active::-webkit-slider-thumb\", scaleProperty(1.2)),\n\t\t\t\t\twhen(\"&:active::-moz-range-thumb\", scaleProperty(1.2)),\n\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", [\n\t\t\t\t\t\twhen(\"&::-webkit-slider-thumb\", transitionDuration(\"0s\")),\n\t\t\t\t\t\twhen(\"&::-moz-range-thumb\", transitionDuration(\"0s\")),\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"
11
+ },
12
+ "test": null
13
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "color-field",
3
+ "changedIn": "2026.10.2",
4
+ "dependencies": [
5
+ "color-swatch",
6
+ "description",
7
+ "field-error",
8
+ "form",
9
+ "input",
10
+ "label"
11
+ ],
12
+ "exports": [
13
+ "ColorField"
14
+ ],
15
+ "source": {
16
+ "path": "color-field.tsx",
17
+ "content": "/**\n * A labeled, described, and validated color field in one call: every id and\n * `aria-describedby` relationship comes from this instance's own stable\n * identifier, so the composed parts stay associated on their own. The preview\n * paints the resolved value at render time, so it matches the control on\n * first paint and on every server round-trip.\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 { spacer, hstack } from \"@sdxc/u/layout\";\nimport { minIs } from \"@sdxc/u/size\";\n\nimport type { FieldPartsProps } from \"@sdxc/ui/utils\";\n\nimport { fieldStackLayout } from \"@sdxc/ui/styles\";\nimport { resolveFieldWiring } from \"@sdxc/ui/utils\";\n\nimport { ColorSwatch } from \"@sdxc/ui/color-swatch\";\nimport { Description } from \"@sdxc/ui/description\";\nimport { FieldError } from \"@sdxc/ui/field-error\";\nimport { resolveFieldIssue } from \"@sdxc/ui/form\";\nimport { Input } from \"@sdxc/ui/input\";\nimport { Label } from \"@sdxc/ui/label\";\n\n/** Notation {@link ColorField} falls back to when `format` is omitted. */\nconst DEFAULT_FORMAT: ColorField.Format = \"hex\";\n\n/**\n * Preview value {@link ColorField} falls back to when neither `value` nor\n * `defaultValue` is set, painting the preview's checkerboard fully so an\n * empty field reads as empty.\n */\nconst DEFAULT_SWATCH_VALUE = \"transparent\";\n\n/**\n * Native `pattern` constraint for each supported notation, keyed off\n * {@link ColorField.Format}. Every pattern accepts the notation's short and\n * long forms, its optional alpha channel, and either component separator.\n */\nconst FORMAT_PATTERNS: Record<ColorField.Format, string> = {\n\thex: \"#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\",\n\trgb: \"rgba?\\\\(\\\\s*\\\\d{1,3}%?\\\\s*,?\\\\s*\\\\d{1,3}%?\\\\s*,?\\\\s*\\\\d{1,3}%?\\\\s*([,/]\\\\s*[0-9.]+%?\\\\s*)?\\\\)\",\n\thsl: \"hsla?\\\\(\\\\s*-?\\\\d{1,3}(\\\\.\\\\d+)?(deg)?\\\\s*,?\\\\s*\\\\d{1,3}(\\\\.\\\\d+)?%\\\\s*,?\\\\s*\\\\d{1,3}(\\\\.\\\\d+)?%\\\\s*([,/]\\\\s*[0-9.]+%?\\\\s*)?\\\\)\",\n};\n\n/**\n * Prop types for {@link ColorField}.\n */\nexport namespace ColorField {\n\t/**\n\t * Semantic color role for the control's keyboard focus ring, each mapped\n\t * to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Notation the control's typed value is constrained to through its native\n\t * `pattern`: `\"hex\"` for `#rgb`/`#rrggbb` and their alpha forms, `\"rgb\"`\n\t * for `rgb()`/`rgba()`, and `\"hsl\"` for `hsl()`/`hsla()`.\n\t */\n\texport type Format = \"hex\" | \"rgb\" | \"hsl\";\n\n\t/**\n\t * Per-part styling for the elements this convenience wrapper composes in\n\t * one call, layered after each part's own built-in styling.\n\t */\n\texport interface PartsProps extends FieldPartsProps {\n\t\t/** Styling for the row grouping the control and its preview. */\n\t\tcontrol?: TagProps<\"div\">[\"mix\"];\n\t\t/** Styling for the live preview, rendered through {@link ColorSwatch}. */\n\t\tswatch?: TagProps<\"span\">[\"mix\"];\n\t}\n\n\t/**\n\t * Props accepted by {@link ColorField}. `mix` styles the root element\n\t * grouping the field's parts; style the composed label, control, preview,\n\t * description, and error individually through `parts` instead.\n\t */\n\texport interface Props extends Omit<TagProps<\"div\">, \"children\"> {\n\t\t/** Semantic color role for the control's focus ring. Defaults to `\"neutral\"` when omitted. */\n\t\tcolor?: Color;\n\t\t/**\n\t\t * The field's caption, rendered through {@link Label} and associated\n\t\t * with the control through a native `for`/`id` relationship computed\n\t\t * from this instance's own identifier.\n\t\t */\n\t\tlabel: RemixNode;\n\t\t/**\n\t\t * Supporting copy rendered through {@link Description} beneath the\n\t\t * control and referenced by the control's `aria-describedby`.\n\t\t */\n\t\tdescription?: RemixNode;\n\t\t/**\n\t\t * Validation message rendered through {@link FieldError} beneath the\n\t\t * control, referenced by its `aria-describedby`; its presence alone\n\t\t * marks `aria-invalid`. Inside a {@link Form} carrying `issues`, this prop wins.\n\t\t */\n\t\terrorMessage?: RemixNode;\n\t\t/**\n\t\t * Native `autofocus`. Defaults to `true` for the first invalid field of\n\t\t * an enclosing {@link Form}'s `issues`, so a server round-trip lands\n\t\t * keyboard focus on the first problem while staying script-free.\n\t\t */\n\t\tautoFocus?: boolean;\n\t\t/**\n\t\t * Notation the control's `pattern` constrains typed entry to. Defaults\n\t\t * to {@link DEFAULT_FORMAT}.\n\t\t */\n\t\tformat?: Format;\n\t\t/** Native `name` submitted with an enclosing form. */\n\t\tname?: string;\n\t\t/**\n\t\t * Current value, as a literal color string in `format`'s notation, for a\n\t\t * control a consumer tracks itself. This same string paints the\n\t\t * preview directly.\n\t\t */\n\t\tvalue?: string;\n\t\t/**\n\t\t * Initial value, as a literal color string in `format`'s notation, for a\n\t\t * control left to the platform's own uncontrolled state. This same\n\t\t * string paints the preview directly whenever `value` is unset.\n\t\t */\n\t\tdefaultValue?: string;\n\t\t/** Placeholder copy shown while the control is empty. */\n\t\tplaceholder?: string;\n\t\t/** Marks the control required for its enclosing form. */\n\t\trequired?: boolean;\n\t\t/** Marks the control inert and excluded from the tab order. */\n\t\tdisabled?: boolean;\n\t\t/** Marks the control's value fixed, while keeping it focusable and included in form submission. */\n\t\treadOnly?: boolean;\n\t\t/** Native autofill hint. */\n\t\tautoComplete?: string;\n\t\t/** Per-part styling for this wrapper's internally composed elements. */\n\t\tparts?: PartsProps;\n\t}\n}\n\n/**\n * Composes {@link Label}, an {@link Input} constrained by `format`'s native\n * `pattern`, a live {@link ColorSwatch} preview of the resolved value, and\n * any {@link Description} or {@link FieldError}, wired to this instance's own id.\n *\n * @param handle Runtime handle carrying the root element's props and this instance's stable identifier.\n * @returns The render function producing the field's markup.\n * @example\n * <ColorField label={t(\"form.accentColor.label\")} name=\"accentColor\" defaultValue=\"#3b82f6\" />\n * @example\n * <ColorField\n * \tlabel={t(\"form.brandColor.label\")}\n * \tname=\"brandColor\"\n * \tformat=\"rgb\"\n * \tdefaultValue=\"rgb(16, 185, 129)\"\n * \tdescription={t(\"form.brandColor.hint\")}\n * />\n * @example\n * <ColorField\n * \tlabel={t(\"form.themeColor.label\")}\n * \tname=\"themeColor\"\n * \tformat=\"hsl\"\n * \tvalue=\"hsl(210, 90%, 55%)\"\n * \terrorMessage={t(\"form.themeColor.invalid\")}\n * />\n */\nexport function ColorField(handle: Handle<ColorField.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor,\n\t\t\tlabel,\n\t\t\tdescription,\n\t\t\terrorMessage: errorMessageProp,\n\t\t\tautoFocus,\n\t\t\tformat,\n\t\t\tname,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tplaceholder,\n\t\t\trequired,\n\t\t\tdisabled,\n\t\t\treadOnly,\n\t\t\tautoComplete,\n\t\t\t\"aria-invalid\": ariaInvalidProp,\n\t\t\tparts,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet { errorMessage, isFirstInvalid } = resolveFieldIssue(handle, name, errorMessageProp);\n\t\tlet resolvedAutoFocus = autoFocus ?? (isFirstInvalid || undefined);\n\t\tlet { resolvedColor, resolvedInvalid, descriptionId, errorId, describedBy } =\n\t\t\tresolveFieldWiring(handle.id, {\n\t\t\t\tcolor,\n\t\t\t\terrorMessage,\n\t\t\t\tdescription,\n\t\t\t\tariaInvalid: ariaInvalidProp,\n\t\t\t});\n\t\tlet resolvedFormat = format ?? DEFAULT_FORMAT;\n\t\tlet resolvedSwatchValue = value ?? defaultValue ?? DEFAULT_SWATCH_VALUE;\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"color-field\" mix={[fieldStackLayout(), mix]}>\n\t\t\t\t<Label htmlFor={handle.id} mix={parts?.label}>\n\t\t\t\t\t{label}\n\t\t\t\t</Label>\n\t\t\t\t<div data-slot=\"control\" mix={[hstack({ gap: 2, align: \"center\" }), parts?.control]}>\n\t\t\t\t\t<Input\n\t\t\t\t\t\tid={handle.id}\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tname={name}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\tpattern={FORMAT_PATTERNS[resolvedFormat]}\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\t// oxlint-disable-next-line jsx-a11y/no-autofocus -- Not a focus grab on page load: this only ever resolves true for the first field an enclosing Form reports as invalid, so a failed submit lands the user on the problem instead of leaving them to hunt for it.\n\t\t\t\t\t\tautoFocus={resolvedAutoFocus}\n\t\t\t\t\t\taria-invalid={resolvedInvalid}\n\t\t\t\t\t\taria-describedby={describedBy}\n\t\t\t\t\t\tcolor={resolvedColor}\n\t\t\t\t\t\tmix={[spacer(), minIs(0), parts?.input]}\n\t\t\t\t\t/>\n\t\t\t\t\t<ColorSwatch value={resolvedSwatchValue} size=\"lg\" mix={parts?.swatch} />\n\t\t\t\t</div>\n\t\t\t\t{description ? (\n\t\t\t\t\t<Description id={descriptionId} mix={parts?.description}>\n\t\t\t\t\t\t{description}\n\t\t\t\t\t</Description>\n\t\t\t\t) : null}\n\t\t\t\t{errorMessage ? (\n\t\t\t\t\t<FieldError id={errorId} mix={parts?.error}>\n\t\t\t\t\t\t{errorMessage}\n\t\t\t\t\t</FieldError>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t);\n\t};\n}\n"
18
+ },
19
+ "test": null
20
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "color-picker",
3
+ "changedIn": "2026.10.13",
4
+ "dependencies": [
5
+ "color-field",
6
+ "color-swatch",
7
+ "popover"
8
+ ],
9
+ "exports": [
10
+ "ColorPicker"
11
+ ],
12
+ "source": {
13
+ "path": "color-picker.tsx",
14
+ "content": "/**\n * A labeled color field composing {@link ColorField}'s plain fallback with\n * an optional {@link ColorPicker.Group} trigger row and\n * {@link ColorPicker.Dialog} picking surface swapped in via `children`.\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 { opacity, rounded, transition } from \"@sdxc/u/effects\";\nimport { cursor, raw } from \"@sdxc/u/general\";\nimport { hstack, inlineFlex, items, justify, relative, shrink, vstack } from \"@sdxc/u/layout\";\nimport { media } from \"@sdxc/u/responsive\";\nimport { bs, is, p } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { attrs } from \"remix/component\";\n\nimport { warnIfNoAccessibleLabel } from \"@sdxc/ui/utils\";\n\nimport { ColorField } from \"@sdxc/ui/color-field\";\nimport { ColorSwatch } from \"@sdxc/ui/color-swatch\";\nimport { Popover } from \"@sdxc/ui/popover\";\n\n/**\n * Native `<button>` `type` {@link ColorPicker.Trigger} falls back to,\n * keeping an omitted `type` from implicitly submitting an enclosing\n * `<form>` the way a bare `<button>` would.\n */\nconst DEFAULT_BUTTON_TYPE: NonNullable<ColorPicker.TriggerProps[\"type\"]> = \"button\";\n\n/**\n * Shape variant {@link ColorPicker.Trigger} falls back to when `shape` is\n * omitted, mirroring {@link ColorSwatch}'s own default so a trigger left\n * unstyled reads the same as a bare swatch.\n */\nconst DEFAULT_TRIGGER_SHAPE: ColorSwatch.Shape = \"rounded\";\n\n/**\n * `role` applied to {@link ColorPicker.Dialog}'s host through {@link attrs}\n * unless a consumer supplies its own `role`, identifying the surface as a\n * non-modal dialog layered above the page rather than a full-screen modal.\n */\nconst DEFAULT_DIALOG_ROLE = \"dialog\";\n\n/**\n * Side of the trigger {@link ColorPicker.Dialog} renders against when\n * `placement` is left unset, reading down and start-ward the way a dropdown\n * conventionally does.\n */\nconst DEFAULT_DIALOG_PLACEMENT: Popover.Placement = \"bottom-start\";\n\n/**\n * Prop types for {@link ColorPicker} and its compound parts.\n */\nexport namespace ColorPicker {\n\t/**\n\t * Semantic color role for the fallback field's keyboard focus ring,\n\t * mirroring {@link ColorField.Color}. The composed layout carries no\n\t * `color` prop of its own, since a consumer renders it directly.\n\t */\n\texport type Color = ColorField.Color;\n\n\t/**\n\t * Every prop {@link ColorField.PartsProps} accepts, unchanged, applied\n\t * only to the fallback field's internally composed parts — the composed\n\t * layout styles its own parts individually instead.\n\t */\n\texport interface PartsProps extends ColorField.PartsProps {}\n\n\t/**\n\t * Props accepted by {@link ColorPicker}. Leaving `children` unset renders\n\t * {@link ColorField}'s plain fallback using every field below; composing\n\t * {@link ColorPicker.Group} and {@link ColorPicker.Dialog} instead skips them.\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 ColorField}. 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/** Notation the fallback field's typed entry is constrained to. Read only when `children` is unset. */\n\t\tformat?: ColorField.Format;\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, as a literal color string, for a fallback field a consumer tracks itself. */\n\t\tvalue?: string;\n\t\t/** Initial value, as a literal color string, for a fallback field left to the platform's own uncontrolled state. */\n\t\tdefaultValue?: string;\n\t\t/** Placeholder copy shown while the fallback field is empty. */\n\t\tplaceholder?: string;\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. */\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 trigger-and-panel layout — typically a `Label`,\n\t\t * {@link ColorPicker.Group}, and {@link ColorPicker.Dialog} — rendered in\n\t\t * place of {@link ColorField}'s plain fallback. Unset renders that fallback.\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\n\t * {@link ColorPicker.Trigger} into one visual row.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<button>` attribute except `children`, fixed to this\n\t * button's own {@link ColorSwatch}. Point `commandfor` at\n\t * {@link ColorPicker.Dialog}'s `id` with `command=\"toggle-popover\"` to wire it up.\n\t */\n\texport interface TriggerProps extends Omit<TagProps<\"button\">, \"children\"> {\n\t\t/**\n\t\t * The color this trigger previews, already resolved to a literal CSS\n\t\t * color value — the same value its inner {@link ColorSwatch} paints.\n\t\t * Required, since a trigger with nothing to preview has no reason to render.\n\t\t */\n\t\tvalue: string;\n\t\t/** Shape variant for the inner {@link ColorSwatch}, mirrored onto the button host so its own corners match. Defaults to {@link DEFAULT_TRIGGER_SHAPE}. */\n\t\tshape?: ColorSwatch.Shape;\n\t}\n\n\t/**\n\t * Every prop {@link Popover.Props} accepts, since {@link ColorPicker.Dialog}\n\t * renders one directly as its host. `placement` defaults to\n\t * {@link DEFAULT_DIALOG_PLACEMENT}.\n\t */\n\texport interface DialogProps extends Popover.Props {}\n}\n\n/**\n * Renders {@link ColorPicker}'s root: {@link ColorField}'s plain fallback\n * when `children` is unset, or the trigger-and-panel layout composed from\n * {@link ColorPicker.Group} and {@link ColorPicker.Dialog} otherwise.\n *\n * @param handle Runtime handle carrying the root element's props.\n * @returns The render function producing the color picker's markup.\n * @example\n * <ColorPicker label={t(\"form.accentColor.label\")} name=\"accentColor\" defaultValue=\"#3b82f6\" />\n * @example\n * <ColorPicker>\n * \t<Label htmlFor=\"brandColor\">{t(\"form.brandColor.label\")}</Label>\n * \t<ColorPicker.Group>\n * \t\t<Input id=\"brandColor\" type=\"text\" name=\"brandColor\" defaultValue=\"#3b82f6\" />\n * \t\t<ColorPicker.Trigger\n * \t\t\tcommandfor=\"brandColor-panel\"\n * \t\t\tcommand=\"toggle-popover\"\n * \t\t\taria-label={t(\"form.brandColor.toggle\")}\n * \t\t\tvalue=\"#3b82f6\"\n * \t\t/>\n * \t</ColorPicker.Group>\n * \t<ColorPicker.Dialog id=\"brandColor-panel\">\n * \t\t{...the picking surface — see ColorPicker.Dialog's own doc comment}\n * \t</ColorPicker.Dialog>\n * </ColorPicker>\n */\nexport function ColorPicker(handle: Handle<ColorPicker.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\tformat,\n\t\t\tname,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tplaceholder,\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'ColorPicker: falling back to ColorField\\'s plain color-notation field 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<ColorField\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\tformat={format}\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\tplaceholder={placeholder}\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=\"color-picker\" mix={[vstack({ 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 ColorPicker}'s control row: a plain flex host laying the\n * field's own control and {@link ColorPicker.Trigger} side by side, with a\n * keyboard focus ring on the whole row the moment focus lands anywhere inside.\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 * <ColorPicker.Group>\n * \t<Input id=\"brandColor\" type=\"text\" name=\"brandColor\" defaultValue=\"#3b82f6\" />\n * \t<ColorPicker.Trigger\n * \t\tcommandfor=\"brandColor-panel\"\n * \t\tcommand=\"toggle-popover\"\n * \t\taria-label={t(\"form.brandColor.toggle\")}\n * \t\tvalue=\"#3b82f6\"\n * \t/>\n * </ColorPicker.Group>\n */\nColorPicker.Group = function ColorPickerGroup(handle: Handle<ColorPicker.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\t/**\n\t\t\t\t\t * Focus is shown by the control that holds it, the way `Group` shows it: a ring\n\t\t\t\t\t * around the row says the group is focused without saying whether the field or\n\t\t\t\t\t * the preview has it, and it stacks with the ring that control draws for itself.\n\t\t\t\t\t */\n\t\t\t\t\thstack({ gap: 2, align: \"center\" }),\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 ColorPicker}'s trailing trigger: a `<button>` housing a\n * {@link ColorSwatch} that fills it as a live preview, wired via\n * `commandfor`/`command=\"toggle-popover\"` to {@link ColorPicker.Dialog}'s `id`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the trigger's markup.\n * @example\n * <ColorPicker.Trigger\n * \tcommandfor=\"brandColor-panel\"\n * \tcommand=\"toggle-popover\"\n * \taria-label={t(\"form.brandColor.toggle\")}\n * \tvalue=\"#3b82f6\"\n * />\n */\nColorPicker.Trigger = function ColorPickerTrigger(handle: Handle<ColorPicker.TriggerProps>) {\n\treturn () => {\n\t\tlet { type, value, shape, mix, ...rest } = handle.props;\n\t\tlet resolvedType = type ?? DEFAULT_BUTTON_TYPE;\n\t\tlet resolvedShape = shape ?? DEFAULT_TRIGGER_SHAPE;\n\n\t\twarnIfNoAccessibleLabel(\n\t\t\thandle.props,\n\t\t\t\"ColorPicker.Trigger: this button needs an `aria-label` describing what it does — its content is a color preview with no accessible name of its own.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={resolvedType}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"trigger\"\n\t\t\t\tdata-shape={resolvedShape}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\trelative(),\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\tis(\"var(--ui-color-picker-trigger-size, 2.25rem)\"),\n\t\t\t\t\tbs(\"var(--ui-color-picker-trigger-size, 2.25rem)\"),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\ttransition(\"box-shadow\"),\n\t\t\t\t\twhen('&[data-shape=\"circle\"]', rounded(\"full\")),\n\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\tp(0),\n\t\t\t\t\tshrink(),\n\t\t\t\t\twhen('&[data-shape=\"square\"]', rounded(\"none\")),\n\t\t\t\t\t/**\n\t\t\t\t\t * The swatch grows through the size variable it reads itself: a size passed down as\n\t\t\t\t\t * `mix` compiles into its own cascade layer, which can land before the swatch's own\n\t\t\t\t\t * and leave the preview at its default size in a corner of the button.\n\t\t\t\t\t */\n\t\t\t\t\traw({ \"--ui-color-swatch-size-md\": \"100%\" }),\n\t\t\t\t\t/**\n\t\t\t\t\t * Hover steps the preview's edge one shade darker, so the edge the swatch already\n\t\t\t\t\t * draws stays the only one and the border reads once.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&:hover\", raw({ boxShadow: \"0 0 0 1px var(--ui-neutral-border-hover)\" })),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", raw({ transitionDuration: \"0s\" })),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t<ColorSwatch value={value} shape={resolvedShape} />\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link ColorPicker}'s picking surface: a Popover, defaulting\n * `placement` to bottom-start and `role` to `\"dialog\"`, padding whatever\n * picking controls a consumer composes as `children` in a single column.\n *\n * @param handle Runtime handle carrying the host's `Popover` props.\n * @returns The render function producing the surface's markup.\n * @example\n * <ColorPicker.Dialog id=\"brandColor-panel\">\n * \t<ColorArea aria-label={t(\"colorPicker.area\")} hue={hue} defaultSaturation={saturation} defaultValue={brightness} mix={colorAreaDrag()}>\n * \t\t<ColorArea.SaturationThumb data-color-area-axis=\"x\" aria-label={t(\"colorPicker.saturation\")} />\n * \t\t<ColorArea.ValueThumb data-color-area-axis=\"y\" aria-label={t(\"colorPicker.brightness\")} />\n * \t</ColorArea>\n * \t<ColorWheel aria-label={t(\"colorPicker.hue\")} defaultValue={hue} mix={colorWheelDrag()} />\n * \t<ColorSlider channel=\"alpha\" defaultValue={alpha}>\n * \t\t<ColorSlider.Track hue={hue}>\n * \t\t\t<ColorSlider.Thumb aria-label={t(\"colorPicker.alpha\")} />\n * \t\t</ColorSlider.Track>\n * \t</ColorSlider>\n * \t<ColorField label={t(\"colorPicker.hex\")} format=\"hex\" defaultValue=\"#3b82f6\" mix={colorPreview()} />\n * \t<ColorSwatchPicker aria-label={t(\"colorPicker.presets\")}>\n * \t\t<ColorSwatchPicker.Swatch value=\"#ef4444\" aria-label={t(\"color.red\")} />\n * \t\t<ColorSwatchPicker.Swatch value=\"#3b82f6\" aria-label={t(\"color.blue\")} defaultChecked />\n * \t</ColorSwatchPicker>\n * </ColorPicker.Dialog>\n */\nColorPicker.Dialog = function ColorPickerDialog(handle: Handle<ColorPicker.DialogProps>) {\n\treturn () => {\n\t\tlet { placement, children, mix, ...rest } = handle.props;\n\t\tlet resolvedPlacement = placement ?? DEFAULT_DIALOG_PLACEMENT;\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\t{...rest}\n\t\t\t\tplacement={resolvedPlacement}\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_DIALOG_ROLE }),\n\t\t\t\t\tvstack({ gap: 4 }),\n\t\t\t\t\tp(4),\n\t\t\t\t\traw({ outline: \"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</Popover>\n\t\t);\n\t};\n};\n"
15
+ },
16
+ "test": null
17
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "color-slider",
3
+ "changedIn": "2026.10.13",
4
+ "dependencies": [],
5
+ "exports": [
6
+ "ColorSlider"
7
+ ],
8
+ "source": {
9
+ "path": "color-slider.tsx",
10
+ "content": "/**\n * A single-channel color control on a native `<input type=\"range\">`, pairing\n * a track painting the channel's gradient with a thumb reporting the current\n * value and an `<output>` for its formatted display. The root shares the\n * resolved channel, range, and value with every part through context.\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 { bg, border, outlineStyle } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { cursor, pseudoContent } from \"@sdxc/u/general\";\nimport { absolute, appearance, insBe, insBs, inset, relative, vstack } from \"@sdxc/u/layout\";\nimport { bs, is, m, minIs } from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { when } from \"@sdxc/u/state\";\n\nimport { outputCaptionText } from \"@sdxc/ui/styles\";\nimport { rangeThumbAppearance } from \"@sdxc/ui/styles\";\nimport { rtlAwareGradientDirection } from \"@sdxc/ui/styles\";\nimport { HUE_GRADIENT_STOPS } from \"@sdxc/ui/utils\";\nimport { mergeStyle } from \"@sdxc/ui/utils\";\n\n/**\n * Custom property carrying a {@link ColorSlider.Track}'s gradient direction,\n * mirrored under `:dir(rtl)` so one gradient string paints correctly in both\n * writing directions.\n */\nconst TRACK_DIRECTION_PROPERTY = \"--ui-color-slider-track-direction\";\n\n/**\n * Custom property carrying the color's current hue, in degrees, that a\n * `\"saturation\"`, `\"lightness\"`, or `\"alpha\"` {@link ColorSlider.Track} reads\n * its gradient formula from.\n */\nconst TRACK_HUE_PROPERTY = \"--ui-color-slider-hue\";\n\n/** Hue {@link ColorSlider.Track} falls back to when its `hue` prop is omitted. */\nconst DEFAULT_HUE = 0;\n\n/** Lower bound every {@link ColorSlider.Channel} shares, applied when `min` is omitted. */\nconst DEFAULT_MIN = 0;\n\n/** Upper bound {@link ColorSlider.Props} falls back to, keyed by {@link ColorSlider.Channel}, when `max` is omitted. */\nconst DEFAULT_MAX_BY_CHANNEL: Record<ColorSlider.Channel, number> = {\n\thue: 360,\n\tsaturation: 100,\n\tlightness: 100,\n\talpha: 1,\n};\n\n/** Native `step` {@link ColorSlider.Thumb} falls back to, keyed by {@link ColorSlider.Channel}, when `step` is omitted. */\nconst DEFAULT_STEP_BY_CHANNEL: Record<ColorSlider.Channel, number> = {\n\thue: 1,\n\tsaturation: 1,\n\tlightness: 1,\n\talpha: 0.01,\n};\n\n/**\n * Negative inset growing {@link ColorSlider.Thumb}'s native input across the track's\n * block axis to the larger of the thumb and `--ui-target-size`, clamped at zero so a\n * track already that thick keeps its own box.\n */\nconst THUMB_HIT_INSET =\n\t\"min(0px, calc((100% - max(var(--ui-color-slider-thumb-size, 1.25rem), var(--ui-target-size, 1.5rem))) / 2))\";\n\n/**\n * Builds one {@link ColorSlider.Track} gradient string from its color stops,\n * reading {@link TRACK_DIRECTION_PROPERTY} for its direction so the same\n * stops mirror correctly under `:dir(rtl)` from one shared gradient string.\n */\nfunction trackGradient(stops: string): string {\n\treturn `linear-gradient(to var(${TRACK_DIRECTION_PROPERTY}, right), ${stops})`;\n}\n\n/** The full, fixed rainbow a `\"hue\"` {@link ColorSlider.Track} always paints. */\nconst HUE_GRADIENT = trackGradient(HUE_GRADIENT_STOPS);\n\n/** A `\"saturation\"` {@link ColorSlider.Track}'s gradient: fully desaturated through fully saturated, at {@link TRACK_HUE_PROPERTY}'s hue. */\nconst SATURATION_GRADIENT = trackGradient(\n\t`hsl(var(${TRACK_HUE_PROPERTY}, 0) 0% 50%), hsl(var(${TRACK_HUE_PROPERTY}, 0) 100% 50%)`,\n);\n\n/** A `\"lightness\"` {@link ColorSlider.Track}'s gradient: black through {@link TRACK_HUE_PROPERTY}'s hue through white. */\nconst LIGHTNESS_GRADIENT = trackGradient(\n\t`black, hsl(var(${TRACK_HUE_PROPERTY}, 0) 100% 50%), white`,\n);\n\n/** An `\"alpha\"` {@link ColorSlider.Track}'s gradient: fully transparent through {@link TRACK_HUE_PROPERTY}'s hue at full opacity, over the track's own checkerboard backdrop. */\nconst ALPHA_GRADIENT = trackGradient(`transparent, hsl(var(${TRACK_HUE_PROPERTY}, 0) 100% 50%)`);\n\n/**\n * Prop types for {@link ColorSlider} and its compound parts.\n */\nexport namespace ColorSlider {\n\t/**\n\t * The single color channel one {@link ColorSlider} instance edits. Every\n\t * channel but `\"hue\"` itself also shares its live color through the `hue`\n\t * prop its {@link Track} reads.\n\t */\n\texport type Channel = \"hue\" | \"saturation\" | \"lightness\" | \"alpha\";\n\n\t/**\n\t * Value {@link ColorSlider} stores in component context so every\n\t * {@link ColorSlider.Track} and {@link ColorSlider.Thumb} nested inside\n\t * shares the same resolved channel, range, and value.\n\t */\n\texport interface Context {\n\t\t/** The channel this instance edits. Mirrored onto the root's own `data-channel` attribute, which {@link ColorSlider.Track} reads to pick its gradient formula. */\n\t\tchannel: Channel;\n\t\t/** Resolved lower bound of the channel's range, shared with {@link ColorSlider.Thumb}. */\n\t\tmin: number;\n\t\t/** Resolved upper bound of the channel's range, shared with {@link ColorSlider.Thumb}. */\n\t\tmax: number;\n\t\t/** Resolved current value, used as {@link ColorSlider.Thumb}'s own default value. */\n\t\tvalue: number;\n\t}\n\n\t/**\n\t * Props accepted by {@link ColorSlider}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** The single channel this instance edits. */\n\t\tchannel: Channel;\n\t\t/** Lower bound of the channel's range. Defaults to {@link DEFAULT_MIN}. */\n\t\tmin?: number;\n\t\t/** Upper bound of the channel's range. Defaults to `channel`'s entry in {@link DEFAULT_MAX_BY_CHANNEL}. */\n\t\tmax?: number;\n\t\t/** Current value, for an instance whose value the consumer tracks itself. */\n\t\tvalue?: number;\n\t\t/** Starting value, for an instance that never tracks its own value. */\n\t\tdefaultValue?: number;\n\t}\n\n\t/**\n\t * Props accepted by {@link ColorSlider.Track}.\n\t */\n\texport interface TrackProps extends TagProps<\"div\"> {\n\t\t/**\n\t\t * The color's current hue, in degrees `0`–`360`, read into\n\t\t * {@link TRACK_HUE_PROPERTY} at render time so a `\"saturation\"`,\n\t\t * `\"lightness\"`, or `\"alpha\"` track's gradient matches it. Defaults to {@link DEFAULT_HUE}.\n\t\t */\n\t\thue?: number;\n\t}\n\n\t/**\n\t * Every native `<input>` attribute except `type` and `role`, fixed to\n\t * `\"range\"` and the platform's implicit `\"slider\"` role, plus the `mix`\n\t * passthrough. `min`/`max`/`step` override the range inherited from the nearest ancestor {@link ColorSlider}.\n\t */\n\texport interface ThumbProps extends Omit<TagProps<\"input\">, \"type\" | \"role\"> {}\n\n\t/**\n\t * Props accepted by {@link ColorSlider.Output}. Associate it with a thumb\n\t * by passing the paired {@link ColorSlider.Thumb}'s own `id` explicitly as\n\t * `htmlFor`.\n\t */\n\texport interface OutputProps extends TagProps<\"output\"> {}\n}\n\n/**\n * Renders the root host: a `<div>` stacking its children with a small gap,\n * resolving the channel, range, and value into component context and\n * mirroring the channel onto its own `data-channel` attribute.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link ColorSlider.Context}.\n * @returns The render function producing the root's markup.\n * @example\n * <ColorSlider channel=\"hue\" defaultValue={210}>\n * \t<ColorSlider.Output htmlFor=\"accent-hue-thumb\">210°</ColorSlider.Output>\n * \t<ColorSlider.Track>\n * \t\t<ColorSlider.Thumb id=\"accent-hue-thumb\" aria-label={t(\"colorPicker.hue\")} />\n * \t</ColorSlider.Track>\n * </ColorSlider>\n * @example\n * <ColorSlider channel=\"alpha\" min={0} max={1} defaultValue={1}>\n * \t<ColorSlider.Track hue={210}>\n * \t\t<ColorSlider.Thumb aria-label={t(\"colorPicker.alpha\")} />\n * \t</ColorSlider.Track>\n * </ColorSlider>\n */\nexport function ColorSlider(handle: Handle<ColorSlider.Props, ColorSlider.Context>) {\n\treturn () => {\n\t\tlet { channel, min, max, value, defaultValue, mix, ...rest } = handle.props;\n\t\tlet resolvedMin = min ?? DEFAULT_MIN;\n\t\tlet resolvedMax = max ?? DEFAULT_MAX_BY_CHANNEL[channel];\n\t\tlet resolvedValue = value ?? defaultValue ?? resolvedMin;\n\n\t\thandle.context.set({ channel, min: resolvedMin, max: resolvedMax, value: resolvedValue });\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-channel={channel}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tvstack({ gap: 2 }),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The slider takes the width it is given, so a narrow panel keeps the track inside it\n\t\t\t\t\t * instead of overflowing with the track running off the edge.\n\t\t\t\t\t */\n\t\t\t\t\tminIs(0),\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 the visual track: a `position: relative` `<div>` painting its\n * whole length with the gradient the nearest ancestor {@link ColorSlider}'s\n * `data-channel` attribute selects, over a checkerboard backdrop.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the track's markup.\n * @example\n * <ColorSlider.Track>\n * \t<ColorSlider.Thumb aria-label={t(\"colorPicker.hue\")} />\n * </ColorSlider.Track>\n * @example\n * <ColorSlider.Track hue={210}>\n * \t<ColorSlider.Thumb aria-label={t(\"colorPicker.lightness\")} />\n * </ColorSlider.Track>\n */\nColorSlider.Track = function ColorSliderTrack(handle: Handle<ColorSlider.TrackProps>) {\n\treturn () => {\n\t\tlet { hue, mix, style, ...rest } = handle.props;\n\t\tlet resolvedHue = hue ?? DEFAULT_HUE;\n\t\tlet resolvedStyle = mergeStyle(style, { [TRACK_HUE_PROPERTY]: `${resolvedHue}` });\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tstyle={resolvedStyle}\n\t\t\t\tmix={[\n\t\t\t\t\trtlAwareGradientDirection(TRACK_DIRECTION_PROPERTY),\n\t\t\t\t\trelative(),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\tbs(\"var(--ui-color-slider-thumb-size, 1.25rem)\"),\n\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\twhen(\"&::before\", [\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tinset(\"0\"),\n\t\t\t\t\t\trounded(\"inherit\"),\n\t\t\t\t\t\tbg({\n\t\t\t\t\t\t\timage:\n\t\t\t\t\t\t\t\t\"repeating-conic-gradient(var(--ui-neutral-border) 0% 25%, var(--ui-neutral-bg-tint) 0% 50%)\",\n\t\t\t\t\t\t\tsize: \"var(--ui-color-slider-checker-size, 0.625rem) var(--ui-color-slider-checker-size, 0.625rem)\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tpseudoContent('\"\"'),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&::after\", [absolute(), inset(\"0\"), rounded(\"inherit\"), pseudoContent('\"\"')]),\n\n\t\t\t\t\twhen('[data-channel=\"hue\"] &::after', bg({ image: HUE_GRADIENT })),\n\t\t\t\t\twhen('[data-channel=\"saturation\"] &::after', bg({ image: SATURATION_GRADIENT })),\n\t\t\t\t\twhen('[data-channel=\"lightness\"] &::after', bg({ image: LIGHTNESS_GRADIENT })),\n\t\t\t\t\twhen('[data-channel=\"alpha\"] &::after', bg({ image: ALPHA_GRADIENT })),\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 the interactive thumb: a native `<input type=\"range\">` reset to\n * cover its enclosing {@link ColorSlider.Track}'s entire box, so drag,\n * arrow-key, and click-to-jump behavior spans the track's whole length.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the thumb's markup.\n * @example\n * <ColorSlider.Thumb aria-label={t(\"colorPicker.hue\")} />\n * @example\n * <ColorSlider.Thumb aria-label={t(\"colorPicker.alpha\")} disabled />\n */\nColorSlider.Thumb = function ColorSliderThumb(handle: Handle<ColorSlider.ThumbProps>) {\n\treturn () => {\n\t\tlet { id, min, max, step, value, defaultValue, mix, ...rest } = handle.props;\n\t\tlet context = handle.context.get(ColorSlider);\n\t\tlet resolvedStep = step ?? DEFAULT_STEP_BY_CHANNEL[context.channel];\n\t\tlet resolvedValue = value ?? defaultValue ?? context.value;\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\t{...rest}\n\t\t\t\ttype=\"range\"\n\t\t\t\tid={id ?? handle.id}\n\t\t\t\tmin={min ?? context.min}\n\t\t\t\tmax={max ?? context.max}\n\t\t\t\tstep={resolvedStep}\n\t\t\t\tdefaultValue={resolvedValue}\n\t\t\t\tmix={[\n\t\t\t\t\trangeThumbAppearance(\n\t\t\t\t\t\t\"--ui-color-slider-thumb-size\",\n\t\t\t\t\t\t\"--ui-color-slider-thumb-border-width\",\n\t\t\t\t\t),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tz(10),\n\t\t\t\t\tappearance(),\n\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\twhen(\"&:disabled\", cursor(\"not-allowed\")),\n\t\t\t\t\tinset(\"0\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The native input reaches past the track's block axis to a full pointer target,\n\t\t\t\t\t * centred so the thumb stays on the visible gradient.\n\t\t\t\t\t */\n\t\t\t\t\tinsBs(THUMB_HIT_INSET),\n\t\t\t\t\tinsBe(THUMB_HIT_INSET),\n\t\t\t\t\tm(\"0\"),\n\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\toutlineStyle(\"none\"),\n\n\t\t\t\t\twhen(\"&::-webkit-slider-runnable-track\", [\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tappearance(\"none\", { moz: false }),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&::-moz-range-track\", [\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tborder({ style: \"none\" }),\n\t\t\t\t\t\tappearance(\"none\", { webkit: false, moz: false }),\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 a live readout: a native `<output>` reporting the formatted value\n * passed as `children`. Pass the paired {@link ColorSlider.Thumb}'s own `id`\n * explicitly as `htmlFor` to associate the two.\n *\n * @param handle Runtime handle carrying the host `<output>`'s props.\n * @returns The render function producing the readout's markup.\n * @example\n * <ColorSlider.Output htmlFor=\"accent-hue-thumb\">\n * \t{new Intl.NumberFormat(locale, { style: \"unit\", unit: \"degree\" }).format(210)}\n * </ColorSlider.Output>\n */\nColorSlider.Output = function ColorSliderOutput(handle: Handle<ColorSlider.OutputProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <output {...rest} mix={[outputCaptionText(), mix]} />;\n\t};\n};\n"
11
+ },
12
+ "test": null
13
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "color-swatch-picker",
3
+ "changedIn": "2026.10.13",
4
+ "dependencies": [
5
+ "color-swatch"
6
+ ],
7
+ "exports": [
8
+ "ColorSwatchPicker"
9
+ ],
10
+ "source": {
11
+ "path": "color-swatch-picker.tsx",
12
+ "content": "/**\n * A set of mutually exclusive color options built from native `<input\n * type=\"radio\">` controls sharing one grouping name, rendered as a\n * `role=\"radiogroup\"` host wrapping {@link ColorSwatchPicker.Swatch}\n * instances styled from each input's own `:checked` state.\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 { visuallyHidden } from \"@sdxc/u/a11y\";\nimport { border, outline } from \"@sdxc/u/color\";\nimport { opacity, ringShadow, transition } from \"@sdxc/u/effects\";\nimport { cursor } from \"@sdxc/u/general\";\nimport { flexWrap, hstack, inlineFlex, relative } from \"@sdxc/u/layout\";\nimport { precededBy, when } from \"@sdxc/u/state\";\nimport { attrs } from \"remix/component\";\n\nimport { hitArea } from \"@sdxc/ui/styles\";\n\nimport { ColorSwatch } from \"@sdxc/ui/color-swatch\";\n\n/**\n * `role=\"radiogroup\"` applied through {@link attrs} unless a consumer\n * supplies its own `role`, announcing the host as a radio group landmark to\n * assistive technology.\n */\nconst DEFAULT_ROLE = \"radiogroup\";\n\n/**\n * Prop types for {@link ColorSwatchPicker} and its\n * {@link ColorSwatchPicker.Swatch} compound part.\n */\nexport namespace ColorSwatchPicker {\n\t/**\n\t * Value {@link ColorSwatchPicker} stores in component context so every\n\t * {@link ColorSwatchPicker.Swatch} nested inside shares the same native\n\t * grouping name without a consumer repeating it on each option.\n\t */\n\texport interface Context {\n\t\t/** Shared `name` every {@link ColorSwatchPicker.Swatch} reads unless it sets its own. */\n\t\tname: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link ColorSwatchPicker}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Native grouping name shared by every {@link ColorSwatchPicker.Swatch}\n\t\t * nested inside. Defaults to the group's own\n\t\t * {@link Handle.id | stable instance id} when omitted.\n\t\t */\n\t\tname?: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link ColorSwatchPicker.Swatch}.\n\t */\n\texport interface SwatchProps extends Omit<TagProps<\"label\">, \"children\" | \"aria-label\"> {\n\t\t/**\n\t\t * The color this option submits and previews, already resolved to a\n\t\t * literal CSS color value — the same value {@link ColorSwatch} paints\n\t\t * its indicator with and submits with the enclosing form.\n\t\t */\n\t\tvalue: string;\n\t\t/**\n\t\t * Accessible name announced for this option in place of visible text —\n\t\t * a color's name, for instance. Required, since the indicator identifies\n\t\t * the option to assistive technology through this text alone.\n\t\t */\n\t\t\"aria-label\": string;\n\t\t/**\n\t\t * Native grouping name for this option's underlying input. Defaults to\n\t\t * the name provided by the nearest ancestor {@link ColorSwatchPicker} —\n\t\t * set this only to opt a single option out of its group's shared name.\n\t\t */\n\t\tname?: string;\n\t\t/** The indicator's shape variant, forwarded to {@link ColorSwatch}. */\n\t\tshape?: ColorSwatch.Shape;\n\t\t/** The indicator's size variant, forwarded to {@link ColorSwatch}. */\n\t\tsize?: ColorSwatch.Size;\n\t\t/** Whether this option starts selected, for a form that never tracks selection itself. */\n\t\tdefaultChecked?: boolean;\n\t\t/** Whether this option is selected, for a form that tracks selection itself. */\n\t\tchecked?: boolean;\n\t\t/** Whether this option is inert and excluded from the group's tab order. */\n\t\tdisabled?: boolean;\n\t\t/** Marks the enclosing native radio group as requiring one option selected. */\n\t\trequired?: boolean;\n\t\t/**\n\t\t * Per-part styling for the option's hidden `input` and its\n\t\t * {@link ColorSwatch} indicator, layered after each part's own built-in\n\t\t * styling. The `mix` prop styles the option's outer `<label>` host.\n\t\t */\n\t\tparts?: {\n\t\t\t/** Additional mixin(s) applied to the hidden native `<input type=\"radio\">`. */\n\t\t\tinput?: TagProps<\"input\">[\"mix\"];\n\t\t\t/** Additional mixin(s) applied to the {@link ColorSwatch} indicator. */\n\t\t\tindicator?: TagProps<\"span\">[\"mix\"];\n\t\t};\n\t}\n}\n\n/**\n * Renders the group host: a `role=\"radiogroup\"` `<div>` laying its\n * {@link ColorSwatchPicker.Swatch} options out in a wrapping row, sharing its\n * `name` through context so each option defaults to the group's own identifier.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link ColorSwatchPicker.Context}.\n * @returns The render function producing the group's markup.\n * @example\n * <ColorSwatchPicker aria-label={t(\"form.accentColor.label\")} name=\"accentColor\">\n * \t<ColorSwatchPicker.Swatch value=\"#ef4444\" aria-label={t(\"color.red\")} />\n * \t<ColorSwatchPicker.Swatch value=\"#3b82f6\" aria-label={t(\"color.blue\")} defaultChecked />\n * \t<ColorSwatchPicker.Swatch value=\"#22c55e\" aria-label={t(\"color.green\")} />\n * </ColorSwatchPicker>\n * @example\n * <ColorSwatchPicker aria-label={t(\"form.brandColor.label\")}>\n * \t<ColorSwatchPicker.Swatch value=\"#f97316\" aria-label={t(\"color.orange\")} shape=\"circle\" size=\"lg\" />\n * \t<ColorSwatchPicker.Swatch value=\"#a855f7\" aria-label={t(\"color.purple\")} shape=\"circle\" size=\"lg\" />\n * </ColorSwatchPicker>\n */\nexport function ColorSwatchPicker(\n\thandle: Handle<ColorSwatchPicker.Props, ColorSwatchPicker.Context>,\n) {\n\treturn () => {\n\t\tlet { name, mix, ...rest } = handle.props;\n\t\tlet resolvedName = name ?? handle.id;\n\n\t\thandle.context.set({ name: resolvedName });\n\n\t\treturn (\n\t\t\t<div {...rest} mix={[attrs({ role: DEFAULT_ROLE }), hstack({ gap: 2 }), flexWrap(), mix]} />\n\t\t);\n\t};\n}\n\n/**\n * Renders a single option: a hidden `<input type=\"radio\">` paired with a {@link ColorSwatch}\n * styled through `precededBy()` (a bare element-first selector serializes as a declaration),\n * with the option's pointer target grown to `--ui-target-size` around smaller swatches.\n *\n * @param handle Runtime handle carrying the host `<label>`'s props.\n * @returns The render function producing the option's markup.\n * @example\n * <ColorSwatchPicker.Swatch value=\"#ef4444\" aria-label={t(\"color.red\")} />\n * @example\n * <ColorSwatchPicker.Swatch value=\"#3b82f6\" aria-label={t(\"color.blue\")} defaultChecked shape=\"circle\" />\n * @example\n * <ColorSwatchPicker.Swatch value=\"#22c55e\" aria-label={t(\"color.green\")} disabled />\n */\nColorSwatchPicker.Swatch = function ColorSwatchPickerSwatch(\n\thandle: Handle<ColorSwatchPicker.SwatchProps>,\n) {\n\treturn () => {\n\t\tlet {\n\t\t\tvalue,\n\t\t\t\"aria-label\": ariaLabel,\n\t\t\tname,\n\t\t\tshape,\n\t\t\tsize,\n\t\t\tchecked,\n\t\t\tdefaultChecked,\n\t\t\tdisabled,\n\t\t\trequired,\n\t\t\tparts,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet context = handle.context.get(ColorSwatchPicker);\n\t\tlet resolvedName = name ?? context.name;\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\thitArea(),\n\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\twhen(\"&:has(input:disabled)\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t<input\n\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\tid={handle.id}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tname={resolvedName}\n\t\t\t\t\tchecked={checked}\n\t\t\t\t\tdefaultChecked={defaultChecked}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\trequired={required}\n\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\tmix={[visuallyHidden(), parts?.input]}\n\t\t\t\t/>\n\t\t\t\t<ColorSwatch\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tshape={shape}\n\t\t\t\t\tsize={size}\n\t\t\t\t\tmix={[\n\t\t\t\t\t\ttransition(\"border-color, box-shadow\"),\n\t\t\t\t\t\tprecededBy(\"input:checked\", border(\"brand.solid\")),\n\t\t\t\t\t\tprecededBy(\"input:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\tprecededBy(\"input:checked\", ringShadow(\"brand\")),\n\t\t\t\t\t\tparts?.indicator,\n\t\t\t\t\t]}\n\t\t\t\t/>\n\t\t\t</label>\n\t\t);\n\t};\n};\n"
13
+ },
14
+ "test": null
15
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "color-swatch",
3
+ "changedIn": "2026.10.10",
4
+ "dependencies": [],
5
+ "exports": [
6
+ "ColorSwatch"
7
+ ],
8
+ "source": {
9
+ "path": "color-swatch.tsx",
10
+ "content": "/**\n * A static preview box rendering one color value as a filled, shaped\n * swatch, backed by a fixed checkerboard so a translucent value always\n * reads correctly against whatever sits behind it on the page rather than\n * blending invisibly away. The value paints through two stacked layers: a\n * checkerboard base and a color fill on top, clipped together to a circular,\n * square, or softly rounded shape at one of three fixed sizes. Every other\n * color preview in this component family composes this box for its own\n * preview instead of redrawing the checkerboard-plus-fill technique itself.\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 { bg, border } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { raw, userSelect } from \"@sdxc/u/general\";\nimport { absolute, inlineFlex, inset, items, justify, relative, shrink } from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { bs, is } from \"@sdxc/u/size\";\nimport { after, before, data } from \"@sdxc/u/state\";\nimport { verticalAlign } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { mergeStyle } from \"@sdxc/ui/utils\";\n\n/** Shape variant {@link ColorSwatch} falls back to when `shape` is omitted. */\nconst DEFAULT_SHAPE: ColorSwatch.Shape = \"rounded\";\n\n/** Size variant {@link ColorSwatch} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: ColorSwatch.Size = \"md\";\n\n/**\n * Applied through {@link attrs} so the host is hidden from assistive\n * technology by default, since composed uses supply their own accessible\n * name; pass `aria-hidden=\"false\"` and `aria-label` to render standalone.\n */\nconst DEFAULT_ARIA_HIDDEN = \"true\";\n\n/**\n * Prop types for {@link ColorSwatch}.\n */\nexport namespace ColorSwatch {\n\t/**\n\t * Shape variant controlling the swatch's corner rounding: `\"circle\"`\n\t * renders a fully rounded disc, `\"square\"` renders sharp corners, and\n\t * `\"rounded\"` renders a softly rounded square.\n\t */\n\texport type Shape = \"circle\" | \"square\" | \"rounded\";\n\n\t/**\n\t * Size variant controlling the swatch's rendered dimensions.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * Props accepted by {@link ColorSwatch}.\n\t */\n\texport interface Props extends TagProps<\"span\"> {\n\t\t/**\n\t\t * The color to preview, already resolved to a literal CSS value — a hex\n\t\t * string, `rgb()`/`hsl()`/`oklch()` function, or named color. Required,\n\t\t * since a swatch with nothing to preview has no reason to render.\n\t\t */\n\t\tvalue: string;\n\t\t/** Shape variant. Defaults to {@link DEFAULT_SHAPE}. */\n\t\tshape?: Shape;\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t}\n}\n\n/**\n * Renders a fixed-size `<span>` that paints `value` through a local\n * `--ui-color-swatch-value` custom property, layered over a `::before`\n * checkerboard so any transparency in `value` reads correctly.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the swatch's markup.\n * @example\n * <ColorSwatch value=\"#3b82f6\" />\n * @example\n * <ColorSwatch value=\"rgb(16 185 129 / 0.4)\" shape=\"circle\" size=\"lg\" />\n */\nexport function ColorSwatch(handle: Handle<ColorSwatch.Props>) {\n\treturn () => {\n\t\tlet { value, shape, size, mix, style, ...rest } = handle.props;\n\t\tlet resolvedShape = shape ?? DEFAULT_SHAPE;\n\t\tlet resolvedSize = size ?? DEFAULT_SIZE;\n\t\tlet resolvedStyle = mergeStyle(style, { \"--ui-color-swatch-value\": value });\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"swatch\"\n\t\t\t\tdata-shape={resolvedShape}\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tstyle={resolvedStyle}\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ \"aria-hidden\": DEFAULT_ARIA_HIDDEN }),\n\t\t\t\t\trelative(),\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\toverflow(\"hidden\"),\n\t\t\t\t\tborder({ width: 1, color: \"neutral\" }),\n\t\t\t\t\tis(\"var(--ui-color-swatch-size-md, 1.75rem)\"),\n\t\t\t\t\tbs(\"var(--ui-color-swatch-size-md, 1.75rem)\"),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tdata(\"size\", \"sm\", [\n\t\t\t\t\t\tis(\"var(--ui-color-swatch-size-sm, 1.25rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-color-swatch-size-sm, 1.25rem)\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\tis(\"var(--ui-color-swatch-size-lg, 2.5rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-color-swatch-size-lg, 2.5rem)\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"shape\", \"circle\", rounded(\"full\")),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tverticalAlign(\"middle\"),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\tdata(\"shape\", \"square\", rounded(\"none\")),\n\t\t\t\t\tbefore([\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tinset(0),\n\t\t\t\t\t\tbg({\n\t\t\t\t\t\t\timage:\n\t\t\t\t\t\t\t\t\"repeating-conic-gradient(var(--ui-neutral-border) 0% 25%, var(--ui-neutral-bg-tint) 0% 50%)\",\n\t\t\t\t\t\t\tsize: \"var(--ui-color-swatch-checker-size, 0.625rem) var(--ui-color-swatch-checker-size, 0.625rem)\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t\traw({ content: '\"\"' }),\n\t\t\t\t\t]),\n\t\t\t\t\tafter([\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tinset(0),\n\t\t\t\t\t\tbg(\"var(--ui-color-swatch-value, transparent)\"),\n\t\t\t\t\t\traw({ content: '\"\"' }),\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"
11
+ },
12
+ "test": null
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "color-wheel",
3
+ "changedIn": "2026.10.13",
4
+ "dependencies": [],
5
+ "exports": [
6
+ "ColorWheel"
7
+ ],
8
+ "source": {
9
+ "path": "color-wheel.tsx",
10
+ "content": "/**\n * A circular hue picker. Hue's natural domain is an angle swept around a\n * circle, so the pointer math is polar: a center point and an angle in, a\n * hue out. A single native `<input type=\"range\">` carries every value this\n * control reports; `colorWheelDrag()` reshapes the root into a ring when a\n * consumer attaches it through the root's `mix` prop.\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 { bg, border, outline, outlineStyle } from \"@sdxc/u/color\";\nimport { mask, opacity, rounded, shadow, transition, transitionDuration } from \"@sdxc/u/effects\";\nimport { cursor, pointerEvents, pseudoContent, raw } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tappearance,\n\tblock,\n\tinlineBlock,\n\tinsBs,\n\tinsIs,\n\tinset,\n\trelative,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { media } from \"@sdxc/u/responsive\";\nimport { bs, is, m, mbs, minIs, mis } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\n\nimport { rangeThumbAppearance } from \"@sdxc/ui/styles\";\nimport { rtlAwareGradientDirection } from \"@sdxc/ui/styles\";\nimport { clampChannel, roundChannel } from \"@sdxc/ui/utils\";\nimport { HUE_GRADIENT_STOPS } from \"@sdxc/ui/utils\";\nimport { mergeStyle } from \"@sdxc/ui/utils\";\nimport { warnIfNoAccessibleLabel } from \"@sdxc/ui/utils\";\n\n/** Lower bound of {@link ColorWheel}'s fixed hue domain, in degrees — fixed, since the full domain is what makes this control a hue wheel. */\nconst DEFAULT_MIN = 0;\n\n/** Upper bound of {@link ColorWheel}'s fixed hue domain, in degrees; reaching it wraps back to the same red {@link DEFAULT_MIN} starts from, since hue is continuous around the circle. */\nconst DEFAULT_MAX = 360;\n\n/** Degrees a single keypress moves {@link ColorWheel}'s value by, applied when `step` is omitted. */\nconst DEFAULT_STEP = 1;\n\n/** Hue, in degrees, {@link ColorWheel} falls back to when both `value` and `defaultValue` are omitted. */\nconst DEFAULT_VALUE = 0;\n\n/**\n * Custom property naming the plain-bar track gradient's sweep direction,\n * flipped from `\"right\"` to `\"left\"` under `:dir(rtl)` so the gradient\n * always reads in the same direction as the surrounding text.\n */\nconst TRACK_DIRECTION_PROPERTY = \"--ui-color-wheel-track-direction\";\n\n/**\n * The plain-bar track background, sweeping {@link HUE_GRADIENT_STOPS}\n * toward {@link TRACK_DIRECTION_PROPERTY}'s current direction — shared\n * verbatim between the WebKit and Gecko track pseudo-elements.\n */\nconst HUE_TRACK_GRADIENT = `linear-gradient(to var(${TRACK_DIRECTION_PROPERTY}, right), ${HUE_GRADIENT_STOPS})`;\n\n/**\n * The ring rendering's background: {@link HUE_GRADIENT_STOPS} swept\n * clockwise from twelve o'clock, matching the convention the ring's own\n * drag math measures angles by, so painted position always matches value.\n */\nconst WHEEL_CONIC_GRADIENT = `conic-gradient(from 0deg, ${HUE_GRADIENT_STOPS})`;\n\n/**\n * An alpha mask cutting the ring's filled disc down to a\n * `--ui-color-wheel-thumb-size` band at the outer edge, the same width the\n * plain bar's track and thumb share, so only a ring remains visible.\n */\nconst RING_MASK =\n\t\"radial-gradient(circle, transparent calc(50% - var(--ui-color-wheel-thumb-size, 1.25rem)), black calc(50% - var(--ui-color-wheel-thumb-size, 1.25rem) + 1px))\";\n\n/**\n * Prop types for {@link ColorWheel}.\n */\nexport namespace ColorWheel {\n\t/**\n\t * Per-part styling for the underlying native hue control this convenience\n\t * wrapper composes alongside its own host `<div>`.\n\t */\n\texport interface PartsProps {\n\t\t/** Styling for the native `<input type=\"range\">` reporting the current hue. */\n\t\tinput?: TagProps<\"input\">[\"mix\"];\n\t}\n\n\t/**\n\t * Props accepted by {@link ColorWheel}. `mix` styles the root element that\n\t * the plain-bar or ring rendering paints itself on; style the nested hue\n\t * input individually through `parts` instead.\n\t */\n\texport interface Props extends Omit<TagProps<\"div\">, \"children\"> {\n\t\t/** Current hue, in degrees `0`–`360`, for a wheel a consumer tracks itself. */\n\t\tvalue?: number;\n\t\t/** Starting hue, in degrees `0`–`360`, for a wheel left to the platform's own uncontrolled state. */\n\t\tdefaultValue?: number;\n\t\t/** Degrees a single keypress moves the value by. Defaults to {@link DEFAULT_STEP}. */\n\t\tstep?: number;\n\t\t/** Native `name` submitted with an enclosing form. */\n\t\tname?: string;\n\t\t/** Native `id` of the form the underlying hue input associates with, when it sits outside that form's own markup. */\n\t\tform?: string;\n\t\t/** Marks the underlying hue input inert and excluded from the tab order. */\n\t\tdisabled?: boolean;\n\t\t/** Per-part styling for this wrapper's internally composed hue input. */\n\t\tparts?: PartsProps;\n\t}\n}\n\n/**\n * Renders a root `<div>` around a single `<input type=\"range\">` across\n * hue's `0`–`360` domain, carrying every accessibility and form semantic\n * this wheel exposes; `colorWheelDrag()` enables the ring rendering.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the wheel's markup.\n * @example\n * <ColorWheel aria-label={t(\"colorPicker.hue\")} defaultValue={210} />\n * @example\n * <ColorWheel aria-label={t(\"theme.accentHue\")} value={hue} name=\"hue\" disabled={isLocked} />\n */\nexport function ColorWheel(handle: Handle<ColorWheel.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tstep,\n\t\t\tname,\n\t\t\tdisabled,\n\t\t\tform,\n\t\t\t\"aria-label\": ariaLabel,\n\t\t\t\"aria-labelledby\": ariaLabelledby,\n\t\t\t\"aria-describedby\": ariaDescribedby,\n\t\t\tparts,\n\t\t\tstyle,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet resolvedValue = value ?? defaultValue ?? DEFAULT_VALUE;\n\t\tlet resolvedStep = step ?? DEFAULT_STEP;\n\t\tlet resolvedHue = roundChannel(clampChannel(resolvedValue, DEFAULT_MIN, DEFAULT_MAX));\n\t\tlet resolvedStyle = mergeStyle(style, {\n\t\t\t\"--ui-color-wheel-value\": `hsl(${resolvedHue} 100% 50%)`,\n\t\t\t\"--ui-color-wheel-hue\": `${resolvedHue}`,\n\t\t});\n\n\t\twarnIfNoAccessibleLabel(\n\t\t\thandle.props,\n\t\t\t\"ColorWheel: a wheel with no `aria-label` or `aria-labelledby` needs one describing the hue it picks — assistive technology has no accessible name to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"color-wheel\"\n\t\t\t\tstyle={resolvedStyle}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\t/**\n\t\t\t\t\t * Each shape sizes itself under a selector excluding the other: a bare `is(\"full\")`\n\t\t\t\t\t * compiles into its own cascade layer, which can land after the circular rule and\n\t\t\t\t\t * stretch the wheel into an ellipse.\n\t\t\t\t\t */\n\t\t\t\t\twhen('&:not([data-shape=\"circular\"])', [block(), is(\"full\"), minIs(\"10rem\")]),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'&[data-shape=\"circular\"]',\n\t\t\t\t\t\twhen(\"&:has(> input:focus-visible)\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t),\n\t\t\t\t\twhen('&[data-shape=\"circular\"]', [\n\t\t\t\t\t\tinlineBlock(),\n\t\t\t\t\t\tis(\"var(--ui-color-wheel-size, 12rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-color-wheel-size, 12rem)\"),\n\t\t\t\t\t\tminIs(\"0\"),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * A wheel holds its one measure on both axes; as a flex item it would shrink on the\n\t\t\t\t\t\t * inline axis alone when the row runs short, and a circle squeezed on one axis is an ellipse.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\tbg({ image: WHEEL_CONIC_GRADIENT }),\n\t\t\t\t\t\tmask(RING_MASK),\n\n\t\t\t\t\t\twhen(\"&::after\", [\n\t\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\t\tis(\"var(--ui-color-wheel-thumb-size, 1.25rem)\"),\n\t\t\t\t\t\t\tbs(\"var(--ui-color-wheel-thumb-size, 1.25rem)\"),\n\t\t\t\t\t\t\tmbs(\"calc(var(--ui-color-wheel-thumb-size, 1.25rem) / -2)\"),\n\t\t\t\t\t\t\tmis(\"calc(var(--ui-color-wheel-thumb-size, 1.25rem) / -2)\"),\n\t\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\t\tborder({\n\t\t\t\t\t\t\t\twidth: \"var(--ui-color-wheel-thumb-border-width, 2px)\",\n\t\t\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\t\t\tcolor: \"var(--ui-color-wheel-value, var(--ui-brand-bg-solid))\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\t\ttransition(\"transform\"),\n\t\t\t\t\t\t\tinsBs(\"50%\"),\n\t\t\t\t\t\t\tinsIs(\"50%\"),\n\t\t\t\t\t\t\tshadow(\"base\"),\n\t\t\t\t\t\t\tpointerEvents(),\n\t\t\t\t\t\t\tpseudoContent('\"\"'),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttransform:\n\t\t\t\t\t\t\t\t\t\"rotate(calc(var(--ui-color-wheel-hue, 0) * 1deg)) translateY(calc(var(--ui-color-wheel-size, 12rem) / -2 + var(--ui-color-wheel-thumb-size, 1.25rem) / 2))\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen(\"&:has(> input:disabled)\", [\n\t\t\t\t\t\t\topacity(50),\n\t\t\t\t\t\t\twhen(\"&::after\", [border(\"neutral\"), raw({ boxShadow: \"none\" })]),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen(\"& > input\", [absolute(), inset(\"0\"), is(\"full\"), bs(\"full\"), opacity(0)]),\n\n\t\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", when(\"&::after\", transitionDuration(\"0s\"))),\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<input\n\t\t\t\t\ttype=\"range\"\n\t\t\t\t\tmin={DEFAULT_MIN}\n\t\t\t\t\tmax={DEFAULT_MAX}\n\t\t\t\t\tstep={resolvedStep}\n\t\t\t\t\tdefaultValue={resolvedValue}\n\t\t\t\t\tname={name}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tform={form}\n\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\taria-labelledby={ariaLabelledby}\n\t\t\t\t\taria-describedby={ariaDescribedby}\n\t\t\t\t\tdata-slot=\"input\"\n\t\t\t\t\tmix={[\n\t\t\t\t\t\trtlAwareGradientDirection(TRACK_DIRECTION_PROPERTY),\n\t\t\t\t\t\trangeThumbAppearance(\n\t\t\t\t\t\t\t\"--ui-color-wheel-thumb-size\",\n\t\t\t\t\t\t\t\"--ui-color-wheel-thumb-border-width\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\tblock(),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\twhen(\"&:disabled\", cursor(\"not-allowed\")),\n\t\t\t\t\t\tbs(\"var(--ui-color-wheel-thumb-size, 1.25rem)\"),\n\t\t\t\t\t\tm(\"0\"),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tappearance(\"none\", { moz: false }),\n\t\t\t\t\t\toutlineStyle(\"none\"),\n\n\t\t\t\t\t\twhen(\"&::-webkit-slider-runnable-track\", [\n\t\t\t\t\t\t\tbs(\"var(--ui-color-wheel-thumb-size, 1.25rem)\"),\n\t\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\t\tbg({ image: HUE_TRACK_GRADIENT }),\n\t\t\t\t\t\t\tappearance(\"none\", { moz: false }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(\"&::-moz-range-track\", [\n\t\t\t\t\t\t\tbs(\"var(--ui-color-wheel-thumb-size, 1.25rem)\"),\n\t\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\t\tbg({ image: HUE_TRACK_GRADIENT }),\n\t\t\t\t\t\t\tborder({ style: \"none\" }),\n\t\t\t\t\t\t\tappearance(\"none\", { webkit: false, moz: false }),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen('[data-shape=\"circular\"] &', [\n\t\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\t\tappearance(\"none\", { moz: false }),\n\n\t\t\t\t\t\t\twhen(\"&::-webkit-slider-runnable-track\", bg({ image: \"none\", color: \"transparent\" })),\n\t\t\t\t\t\t\twhen(\"&::-moz-range-track\", bg({ image: \"none\", color: \"transparent\" })),\n\t\t\t\t\t\t\twhen(\"&::-webkit-slider-thumb\", [\n\t\t\t\t\t\t\t\tborder({ style: \"none\" }),\n\t\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\t\traw({ boxShadow: \"none\" }),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen(\"&::-moz-range-thumb\", [\n\t\t\t\t\t\t\t\tborder({ style: \"none\" }),\n\t\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\t\traw({ boxShadow: \"none\" }),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t\t\"&:focus-visible::-webkit-slider-thumb, &:focus-visible::-moz-range-thumb\",\n\t\t\t\t\t\t\t\toutlineStyle(\"none\"),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tparts?.input,\n\t\t\t\t\t]}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t};\n}\n"
11
+ },
12
+ "test": null
13
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "combobox",
3
+ "changedIn": "2026.10.13",
4
+ "dependencies": [
5
+ "input"
6
+ ],
7
+ "exports": [
8
+ "ComboBox"
9
+ ],
10
+ "source": {
11
+ "path": "combobox.tsx",
12
+ "content": "/**\n * A single-line text control paired with a native list of suggested values: a\n * {@link ComboBox.Group} row housing the {@link ComboBox.Input} control and a\n * trailing {@link ComboBox.Button} disclosure glyph, all stacked beneath a\n * caption or above supporting copy in a single column with a small gap. The\n * text control builds on {@link Input} for its box, color, and interaction\n * states, and pairs with a plain `<datalist>` of `<option>`s through its own\n * `list` attribute — the browser renders and filters that list entirely on\n * its own, with no styling opportunity across the suggestions themselves.\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 { ChevronDownIcon } from \"@sdxc/icons\";\nimport { bg, fg, outline } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { center, hstack, relative, spacer, vstack } from \"@sdxc/u/layout\";\nimport { bs, is, mis, pie } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\n\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { warnIfNoAccessibleLabel } from \"@sdxc/ui/utils\";\n\nimport { Input } from \"@sdxc/ui/input\";\n\n/**\n * Native `<button>` `type` {@link ComboBox.Button} falls back to when a\n * consumer omits one, keeping a click from submitting a surrounding\n * `<form>` the way a bare `<button>`'s own default type otherwise would.\n */\nconst DEFAULT_BUTTON_TYPE: NonNullable<ComboBox.ButtonProps[\"type\"]> = \"button\";\n\n/**\n * Prop types for {@link ComboBox} and its compound parts.\n */\nexport namespace ComboBox {\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * `children` composes this control's parts — typically a caption, the\n\t * {@link ComboBox.Group} row, a `<datalist>`, and supporting 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 ComboBox.Input} and {@link ComboBox.Button}\n\t * into one visual row.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every prop {@link Input.Props} accepts, unchanged — a type alias, since\n\t * {@link Input.Props} resolves through a conditional type only a type\n\t * alias can express. Pass `list` with a `<datalist>` id to wire suggestions.\n\t */\n\texport type InputProps = Input.Props;\n\n\t/**\n\t * Every native `<button>` attribute except `children`, which stays fixed to\n\t * this button's own disclosure glyph, plus the `mix` passthrough. `type`\n\t * defaults to {@link DEFAULT_BUTTON_TYPE}.\n\t */\n\texport interface ButtonProps extends Omit<TagProps<\"button\">, \"children\"> {}\n}\n\n/**\n * Renders a plain host stacking this control's compound parts — a caption,\n * the {@link ComboBox.Group} row, a `<datalist>` of suggested values, and\n * supporting copy — in a single column with a small gap between them.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <ComboBox>\n * \t<Label htmlFor=\"fruit\">{t(\"form.fruit.label\")}</Label>\n * \t<ComboBox.Group>\n * \t\t<ComboBox.Input id=\"fruit\" name=\"fruit\" list=\"fruit-options\" />\n * \t\t<ComboBox.Button aria-label={t(\"form.fruit.toggle\")} />\n * \t</ComboBox.Group>\n * \t<datalist id=\"fruit-options\">\n * \t\t<option value=\"Apple\" />\n * \t\t<option value=\"Banana\" />\n * \t</datalist>\n * </ComboBox>\n */\nexport function ComboBox(handle: Handle<ComboBox.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} data-slot=\"combobox\" mix={[vstack({ gap: 1 }), mix]} />;\n\t};\n}\n\n/**\n * Renders {@link ComboBox}'s control row: a plain flex host laying\n * {@link ComboBox.Input} and {@link ComboBox.Button} side by side, the\n * button pulled back over the input's padding so they read as one field.\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 * <ComboBox.Group>\n * \t<ComboBox.Input id=\"fruit\" list=\"fruit-options\" />\n * \t<ComboBox.Button aria-label={t(\"form.fruit.toggle\")} />\n * </ComboBox.Group>\n */\nComboBox.Group = function ComboBoxGroup(handle: Handle<ComboBox.GroupProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} data-slot=\"combobox-group\" mix={[hstack({ align: \"center\" }), mix]} />;\n\t};\n};\n\n/**\n * Renders {@link ComboBox}'s text control: an {@link Input} that grows to\n * fill its row, reserves inline-end padding for {@link ComboBox.Button}'s\n * glyph, and carries every {@link Input} interaction state unchanged.\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 * <ComboBox.Input id=\"fruit\" name=\"fruit\" list=\"fruit-options\" />\n * @example\n * <ComboBox.Input aria-label={t(\"form.country.label\")} color=\"brand\" list=\"country-options\" />\n */\nComboBox.Input = function ComboBoxInput(handle: Handle<ComboBox.InputProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <Input {...rest} mix={[spacer(), pie(9), mix]} />;\n\t};\n};\n\n/**\n * Renders {@link ComboBox}'s trailing disclosure glyph: a native `<button>`\n * pulled back over {@link ComboBox.Input}'s padding so it reads as part of\n * the same field, its chevron marked `aria-hidden` since it carries no text.\n * Its pointer target grows to `--ui-target-size` past its drawn 28px box.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the button's markup.\n * @example\n * <ComboBox.Button aria-label={t(\"form.fruit.toggle\")} />\n */\nComboBox.Button = function ComboBoxButton(handle: Handle<ComboBox.ButtonProps>) {\n\treturn () => {\n\t\tlet { type, mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleLabel(\n\t\t\thandle.props,\n\t\t\t\"ComboBox.Button: this button needs an `aria-label` describing what it does — its content is a decorative glyph with no accessible name of its own.\",\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\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\tcenter(),\n\t\t\t\t\trelative(),\n\t\t\t\t\thitArea(),\n\t\t\t\t\tis(\"1.75rem\"),\n\t\t\t\t\tbs(\"1.75rem\"),\n\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\twhen(\"& svg\", [is(\"1rem\"), bs(\"1rem\")]),\n\t\t\t\t\twhen(\"&:hover\", bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 0 })),\n\t\t\t\t\tmis(\"-2rem\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t<ChevronDownIcon />\n\t\t\t</button>\n\t\t);\n\t};\n};\n"
13
+ },
14
+ "test": null
15
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "command",
3
+ "changedIn": "2026.10.13",
4
+ "dependencies": [],
5
+ "exports": [
6
+ "Command"
7
+ ],
8
+ "source": {
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"
11
+ },
12
+ "test": null
13
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "confirm",
3
+ "changedIn": "2026.10.2",
4
+ "dependencies": [
5
+ "alert-dialog",
6
+ "button"
7
+ ],
8
+ "exports": [
9
+ "Confirm"
10
+ ],
11
+ "source": {
12
+ "path": "confirm.tsx",
13
+ "content": "/**\n * A convenience wrapper composing a two-control confirmation prompt in one\n * call: an {@link AlertDialog} panel prefilled with a heading, an optional\n * supporting passage, and a cancel/confirm control pair, so a single\n * consequential decision needs no compound assembly of its own. The\n * confirming control defaults to the semantic danger tone, keeping an\n * irreversible action behind an explicit confirmation step in that tone.\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 } from \"@sdxc/u/layout\";\n\nimport type { Button } from \"@sdxc/ui/button\";\n\nimport { AlertDialog } from \"@sdxc/ui/alert-dialog\";\n\n/** Semantic color role {@link Confirm} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Button.Color = \"danger\";\n\n/** HTTP method a submitting {@link Confirm} falls back to when `form.method` is omitted. */\nconst DEFAULT_METHOD: NonNullable<Confirm.FormProps[\"method\"]> = \"post\";\n\n/**\n * Column gap the wrapping `<form>` re-declares in submit mode, matching the\n * panel's own child gap — the form becomes the panel's single child, so\n * without this the header and footer would lose their spacing.\n */\nconst PANEL_GAP = 6;\n\n/**\n * Prop types for {@link Confirm}.\n */\nexport namespace Confirm {\n\t/**\n\t * Per-part styling for the elements this convenience wrapper composes in\n\t * one call, layered after each part's own built-in styling.\n\t */\n\texport interface PartsProps {\n\t\t/** Styling for the header slot wrapping the title and description, rendered through {@link AlertDialog.Header}. */\n\t\theader?: TagProps<\"div\">[\"mix\"];\n\t\t/** Styling for the heading, rendered through {@link AlertDialog.Title}, whichever heading tag its ambient level resolves to. */\n\t\ttitle?: TagProps<\"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\">[\"mix\"];\n\t\t/** Styling for the supporting description, rendered through {@link AlertDialog.Description} only when `description` is set. */\n\t\tdescription?: TagProps<\"p\">[\"mix\"];\n\t\t/** Styling for the action row wrapping the cancel and confirm controls, rendered through {@link AlertDialog.Footer}. */\n\t\tfooter?: TagProps<\"div\">[\"mix\"];\n\t\t/** Styling for the control that backs out without confirming, rendered through {@link AlertDialog.Cancel}. */\n\t\tcancel?: TagProps<\"button\">[\"mix\"];\n\t\t/** Styling for the confirming control, rendered through {@link AlertDialog.Action}. */\n\t\taction?: TagProps<\"button\">[\"mix\"];\n\t\t/** Styling for the `<form>` wrapping the panel's content, rendered only in submit mode. */\n\t\tform?: TagProps<\"form\">[\"mix\"];\n\t}\n\n\t/**\n\t * The submission a confirming control performs instead of merely closing\n\t * the panel. Passing this switches {@link Confirm} into submit mode, where\n\t * the form's response is what ends the interruption.\n\t */\n\texport interface FormProps {\n\t\t/** URL the confirmation submits to. Omit to submit to the current URL, as a native `<form>` with no `action` does. */\n\t\taction?: string;\n\t\t/** HTTP method the confirmation submits with. Defaults to {@link DEFAULT_METHOD}, since a confirmed action changes state. */\n\t\tmethod?: \"get\" | \"post\";\n\t\t/**\n\t\t * Hidden inputs submitted along with the confirmation — a CSRF token,\n\t\t * an intent discriminator, the id of the record being acted on. They\n\t\t * render first inside the form, before the panel's own content.\n\t\t */\n\t\tfields?: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Confirm}. `mix` styles the underlying\n\t * {@link AlertDialog} host directly; style the composed header, title,\n\t * description, footer, and controls individually through `parts` instead.\n\t */\n\texport interface Props extends Omit<AlertDialog.Props, \"id\" | \"children\" | \"title\"> {\n\t\t/**\n\t\t * Stable identifier the panel renders as its own `id`; a trigger\n\t\t * elsewhere on the page targets it via `commandfor`/`command=\"show-modal\"`,\n\t\t * and the cancel and confirm controls point back at it automatically.\n\t\t */\n\t\tid: string;\n\t\t/** The panel's heading, rendered through {@link AlertDialog.Title}. */\n\t\ttitle: RemixNode;\n\t\t/**\n\t\t * Supporting copy rendered through {@link AlertDialog.Description}\n\t\t * beneath the title. Omit to render no description.\n\t\t */\n\t\tdescription?: RemixNode;\n\t\t/** Label for the confirming control, rendered through {@link AlertDialog.Action}. */\n\t\tconfirmLabel: RemixNode;\n\t\t/** Label for the control that backs out without confirming, rendered through {@link AlertDialog.Cancel}. */\n\t\tcancelLabel: RemixNode;\n\t\t/** Semantic color for the confirming control. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Button.Color;\n\t\t/**\n\t\t * Submission the confirming control performs. Omitting it leaves\n\t\t * confirming as a close-only action for the page to react to; setting it\n\t\t * submits a real form instead.\n\t\t */\n\t\tform?: FormProps;\n\t\t/** Per-part styling for this wrapper's internally composed elements. */\n\t\tparts?: PartsProps;\n\t}\n}\n\n/**\n * Composes {@link AlertDialog} into a confirmation prompt, wiring title and\n * description ids to `aria-labelledby`/`aria-describedby`. Omit\n * {@link Confirm.Props.form} to close on confirm, or pass it to submit a real `<form>` instead.\n *\n * @param handle Runtime handle carrying the panel's props and this instance's stable identifier.\n * @returns The render function producing the confirmation prompt's markup.\n * @example\n * <Button commandfor=\"confirm-delete\" command=\"show-modal\" color=\"danger\">{t(\"project.delete\")}</Button>\n * <Confirm\n * \tid=\"confirm-delete\"\n * \ttitle={t(\"project.deleteTitle\")}\n * \tdescription={t(\"project.deleteDescription\")}\n * \tconfirmLabel={t(\"actions.delete\")}\n * \tcancelLabel={t(\"actions.cancel\")}\n * />\n * @example\n * <Confirm\n * \tid=\"publish-post\"\n * \ttitle={t(\"post.publishTitle\")}\n * \tconfirmLabel={t(\"actions.publish\")}\n * \tcancelLabel={t(\"actions.cancel\")}\n * \tcolor=\"brand\"\n * />\n * @example\n * <Confirm\n * \tid=\"revoke-session\"\n * \ttitle={t(\"session.revokeTitle\")}\n * \tconfirmLabel={t(\"actions.revoke\")}\n * \tcancelLabel={t(\"actions.cancel\")}\n * \tform={{ action: revokeUrl, fields: <input type=\"hidden\" name=\"csrf\" value={token} /> }}\n * />\n */\nexport function Confirm(handle: Handle<Confirm.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tid,\n\t\t\ttitle,\n\t\t\tdescription,\n\t\t\tconfirmLabel,\n\t\t\tcancelLabel,\n\t\t\tcolor,\n\t\t\tform,\n\t\t\t\"aria-labelledby\": ariaLabelledByProp,\n\t\t\t\"aria-describedby\": ariaDescribedByProp,\n\t\t\tparts,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet titleId = `${handle.id}-title`;\n\t\tlet descriptionId = description ? `${handle.id}-description` : undefined;\n\t\tlet content = (\n\t\t\t<>\n\t\t\t\t<AlertDialog.Header mix={parts?.header}>\n\t\t\t\t\t<AlertDialog.Title id={titleId} mix={parts?.title}>\n\t\t\t\t\t\t{title}\n\t\t\t\t\t</AlertDialog.Title>\n\t\t\t\t\t{description ? (\n\t\t\t\t\t\t<AlertDialog.Description id={descriptionId} mix={parts?.description}>\n\t\t\t\t\t\t\t{description}\n\t\t\t\t\t\t</AlertDialog.Description>\n\t\t\t\t\t) : null}\n\t\t\t\t</AlertDialog.Header>\n\t\t\t\t<AlertDialog.Footer mix={parts?.footer}>\n\t\t\t\t\t<AlertDialog.Cancel commandfor={id} mix={parts?.cancel}>\n\t\t\t\t\t\t{cancelLabel}\n\t\t\t\t\t</AlertDialog.Cancel>\n\t\t\t\t\t<AlertDialog.Action\n\t\t\t\t\t\ttype={form ? \"submit\" : undefined}\n\t\t\t\t\t\tcommandfor={form ? undefined : id}\n\t\t\t\t\t\tcolor={resolvedColor}\n\t\t\t\t\t\tmix={parts?.action}\n\t\t\t\t\t>\n\t\t\t\t\t\t{confirmLabel}\n\t\t\t\t\t</AlertDialog.Action>\n\t\t\t\t</AlertDialog.Footer>\n\t\t\t</>\n\t\t);\n\n\t\treturn (\n\t\t\t<AlertDialog\n\t\t\t\t{...rest}\n\t\t\t\tid={id}\n\t\t\t\taria-labelledby={ariaLabelledByProp ?? titleId}\n\t\t\t\taria-describedby={ariaDescribedByProp ?? descriptionId}\n\t\t\t\tmix={mix}\n\t\t\t>\n\t\t\t\t{form ? (\n\t\t\t\t\t<form\n\t\t\t\t\t\taction={form.action}\n\t\t\t\t\t\tmethod={form.method ?? DEFAULT_METHOD}\n\t\t\t\t\t\tmix={[flex(), flexCol(), gap(PANEL_GAP), parts?.form]}\n\t\t\t\t\t>\n\t\t\t\t\t\t{form.fields}\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</form>\n\t\t\t\t) : (\n\t\t\t\t\tcontent\n\t\t\t\t)}\n\t\t\t</AlertDialog>\n\t\t);\n\t};\n}\n"
14
+ },
15
+ "test": {
16
+ "path": "confirm.test.tsx",
17
+ "content": "/**\n * Tests for {@link Confirm}'s two modes: the default, where confirming only\n * closes the panel through an Invoker Command, and the submit mode `form`\n * switches on, where the panel's content is wrapped in a real `<form>` and\n * the confirming control becomes its submit button — the shape a\n * server-rendered destructive action needs.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Confirm } from \"@sdxc/ui/confirm\";\n\ndescribe(Confirm.name, () => {\n\ttest(\"closes the panel with a command, and renders no form, by default\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Confirm\n\t\t\t\tid=\"confirm-delete\"\n\t\t\t\ttitle=\"Delete project?\"\n\t\t\t\tconfirmLabel=\"Delete\"\n\t\t\t\tcancelLabel=\"Cancel\"\n\t\t\t/>,\n\t\t);\n\n\t\texpect(html).not.toContain(\"<form\");\n\t\texpect(html).toContain('command=\"close\"');\n\t\texpect(html).toContain('commandfor=\"confirm-delete\"');\n\t});\n\n\ttest(\"wraps its content in a real form and submits it once form is set\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Confirm\n\t\t\t\tid=\"revoke-session\"\n\t\t\t\ttitle=\"Revoke this session?\"\n\t\t\t\tconfirmLabel=\"Revoke\"\n\t\t\t\tcancelLabel=\"Cancel\"\n\t\t\t\tform={{ action: \"/account/sessions/abc/revoke\" }}\n\t\t\t/>,\n\t\t);\n\n\t\texpect(html).toContain(\"<form\");\n\t\texpect(html).toContain('action=\"/account/sessions/abc/revoke\"');\n\t\texpect(html).toContain('method=\"post\"');\n\t\texpect(html).toContain('type=\"submit\"');\n\t});\n\n\ttest(\"renders the panel's content inside the form, not beside it\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Confirm\n\t\t\t\tid=\"revoke-session\"\n\t\t\t\ttitle=\"Revoke this session?\"\n\t\t\t\tconfirmLabel=\"Revoke\"\n\t\t\t\tcancelLabel=\"Cancel\"\n\t\t\t\tform={{ action: \"/revoke\" }}\n\t\t\t/>,\n\t\t);\n\n\t\texpect(html.indexOf(\"<form\")).toBeLessThan(html.indexOf(\"Revoke this session?\"));\n\t\texpect(html.indexOf(\"Revoke this session?\")).toBeLessThan(html.indexOf(\"</form>\"));\n\t\texpect(html.indexOf('type=\"submit\"')).toBeLessThan(html.indexOf(\"</form>\"));\n\t});\n\n\ttest(\"submits the hidden fields it was given, ahead of the panel's own content\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Confirm\n\t\t\t\tid=\"delete-client\"\n\t\t\t\ttitle=\"Delete client?\"\n\t\t\t\tconfirmLabel=\"Delete\"\n\t\t\t\tcancelLabel=\"Cancel\"\n\t\t\t\tform={{\n\t\t\t\t\taction: \"/admin/clients/abc\",\n\t\t\t\t\tfields: <input type=\"hidden\" name=\"csrf\" value=\"t0ken\" />,\n\t\t\t\t}}\n\t\t\t/>,\n\t\t);\n\n\t\texpect(html).toContain('name=\"csrf\"');\n\t\texpect(html).toContain('value=\"t0ken\"');\n\t\texpect(html.indexOf('name=\"csrf\"')).toBeLessThan(html.indexOf(\"Delete client?\"));\n\t});\n\n\ttest(\"submits with the method it was given instead of the default\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Confirm\n\t\t\t\tid=\"search-again\"\n\t\t\t\ttitle=\"Run the search again?\"\n\t\t\t\tconfirmLabel=\"Search\"\n\t\t\t\tcancelLabel=\"Cancel\"\n\t\t\t\tform={{ action: \"/search\", method: \"get\" }}\n\t\t\t/>,\n\t\t);\n\n\t\texpect(html).toContain('method=\"get\"');\n\t\texpect(html).not.toContain('method=\"post\"');\n\t});\n\n\ttest(\"keeps cancel a close-command button in submit mode, so cancelling never submits\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Confirm\n\t\t\t\tid=\"revoke-session\"\n\t\t\t\ttitle=\"Revoke this session?\"\n\t\t\t\tconfirmLabel=\"Revoke\"\n\t\t\t\tcancelLabel=\"Cancel\"\n\t\t\t\tform={{ action: \"/revoke\" }}\n\t\t\t/>,\n\t\t);\n\n\t\texpect(html).toContain('type=\"button\"');\n\t\texpect(html).toContain('command=\"close\"');\n\t\texpect(html).toContain('commandfor=\"revoke-session\"');\n\t});\n});\n"
18
+ }
19
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "context-menu",
3
+ "changedIn": "2026.10.13",
4
+ "dependencies": [
5
+ "menu",
6
+ "section"
7
+ ],
8
+ "exports": [
9
+ "ContextMenu"
10
+ ],
11
+ "source": {
12
+ "path": "context-menu.tsx",
13
+ "content": "/**\n * A menu surface that opens at a right-click's pointer position, composing\n * {@link Menu}'s popover styling and `role=\"menu\"` wiring directly so its\n * rows read and behave exactly like a standard menu's. Adds the\n * {@link ContextMenu.Trigger} wrapper a pointer gesture opens the surface\n * against, plus the grouped-row parts — {@link ContextMenu.Group},\n * {@link ContextMenu.Label}, and {@link ContextMenu.Shortcut} — a context\n * menu's denser row layout tends to need.\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 { borderEdge, fg, outline } from \"@sdxc/u/color\";\nimport { mis, pb, pi, pie } from \"@sdxc/u/size\";\nimport { not } from \"@sdxc/u/state\";\nimport { tabularNums, text, weight } from \"@sdxc/u/typography\";\n\nimport { Menu } from \"@sdxc/ui/menu\";\nimport { Section } from \"@sdxc/ui/section\";\n\n/**\n * Side {@link ContextMenu.SubContent} renders against relative to its\n * {@link ContextMenu.SubTrigger} row when a consumer leaves `placement`\n * unset — the direction a nested row conventionally flies outward toward.\n */\nconst DEFAULT_SUB_PLACEMENT: NonNullable<Menu.Props[\"placement\"]> = \"right-start\";\n\n/**\n * Prop types for {@link ContextMenu} and its compound parts.\n */\nexport namespace ContextMenu {\n\t/**\n\t * Every prop {@link Menu.Props} accepts, unchanged, since {@link\n\t * ContextMenu} renders one directly as its host.\n\t */\n\texport interface Props extends Menu.Props {}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough. The area a\n\t * consumer wraps around content that should open {@link ContextMenu} at the\n\t * pointer's position — a table row, a card, a canvas region.\n\t */\n\texport interface TriggerProps extends TagProps<\"div\"> {\n\t\t/** The content the pointer gesture opens {@link ContextMenu} against. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every prop {@link Menu.ItemProps} accepts, unchanged, since {@link\n\t * ContextMenu.Item} renders one directly.\n\t */\n\texport interface ItemProps extends Menu.ItemProps {}\n\n\t/**\n\t * Every prop {@link Section.Props} accepts, since {@link\n\t * ContextMenu.Group} renders one directly as its host.\n\t */\n\texport interface GroupProps extends Section.Props {\n\t\t/** The group's rows, typically a {@link ContextMenu.Label} followed by a run of {@link ContextMenu.Item}s. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<header>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface LabelProps extends TagProps<\"header\"> {\n\t\t/** The group's visible label text. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every prop {@link Menu.SeparatorProps} accepts, unchanged, since {@link\n\t * ContextMenu.Separator} renders one directly.\n\t */\n\texport interface SeparatorProps extends Menu.SeparatorProps {}\n\n\t/**\n\t * Every prop {@link ContextMenu.Props} accepts, unchanged, since {@link\n\t * ContextMenu.SubContent} renders {@link ContextMenu} directly with a\n\t * different default `placement`.\n\t */\n\texport interface SubContentProps extends Props {}\n\n\t/**\n\t * Every native `<span>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ShortcutProps extends TagProps<\"span\"> {\n\t\t/** The shortcut hint text, typically a key combination like \"⌘⇧D\". */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders {@link Menu} unchanged; positioning against the pointer is handled\n * entirely by the `contextMenu()` mixin a consuming island applies to\n * {@link ContextMenu.Trigger}, while every nested row stays a real, tab-reachable `<a>` or `<button>`.\n *\n * @param handle Runtime handle carrying the host's {@link Menu} props.\n * @returns The render function producing the surface's markup.\n * @example\n * <ContextMenu.Trigger mix={[contextMenu(\"row-menu\")]}>\n * \t<TableRow />\n * </ContextMenu.Trigger>\n * <ContextMenu id=\"row-menu\" aria-label={t(\"table.rowActions\")}>\n * \t<ContextMenu.Item href={viewUrl}>{t(\"actions.view\")}</ContextMenu.Item>\n * \t<ContextMenu.Item href={editUrl}>{t(\"actions.edit\")}</ContextMenu.Item>\n * \t<ContextMenu.Separator />\n * \t<ContextMenu.Item danger commandfor=\"confirm-delete\" command=\"show-modal\">{t(\"actions.delete\")}</ContextMenu.Item>\n * </ContextMenu>\n */\nexport function ContextMenu(handle: Handle<ContextMenu.Props>) {\n\treturn () => <Menu {...handle.props} />;\n}\n\n/**\n * Renders {@link ContextMenu.TriggerProps.children} inside a plain `<div>`,\n * the area a pointer gesture opens the paired {@link ContextMenu} against.\n * Pair it with the `contextMenu()` mixin via `mix`; outline is suppressed since that mixin's own focus handling takes over once the surface opens.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the trigger area's markup.\n * @example\n * <ContextMenu.Trigger mix={[contextMenu(\"row-menu\")]}>\n * \t<TableRow />\n * </ContextMenu.Trigger>\n */\nContextMenu.Trigger = function ContextMenuTrigger(handle: Handle<ContextMenu.TriggerProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div {...rest} mix={[outline(\"none\"), mix]}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single row: {@link Menu.Item} unchanged, since a context menu's\n * row shares every look and state — hover, pressed, focus-visible,\n * `aria-selected`, `danger` — with a standard menu's row.\n *\n * @example\n * <ContextMenu.Item href=\"/settings/profile\">{t(\"nav.profile\")}</ContextMenu.Item>\n * @example\n * <ContextMenu.Item danger>{t(\"actions.delete\")}</ContextMenu.Item>\n */\nContextMenu.Item = Menu.Item;\n\n/**\n * Renders {@link ContextMenu.GroupProps.children} as one labeled run of rows:\n * {@link Section} restyled with a divider above every group but the first.\n * Pair a {@link ContextMenu.Label} first child with `aria-labelledby` pointing at its `id` for assistive technology.\n *\n * @param handle Runtime handle carrying the host `<section>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <ContextMenu.Group aria-labelledby=\"row-menu-view-heading\">\n * \t<ContextMenu.Label id=\"row-menu-view-heading\">{t(\"menu.view\")}</ContextMenu.Label>\n * \t<ContextMenu.Item href={viewUrl}>{t(\"actions.view\")}</ContextMenu.Item>\n * \t<ContextMenu.Item href={editUrl}>{t(\"actions.edit\")}</ContextMenu.Item>\n * </ContextMenu.Group>\n */\nContextMenu.Group = function ContextMenuGroup(handle: Handle<ContextMenu.GroupProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<Section\n\t\t\t\t{...rest}\n\t\t\t\tmix={[not(\":first-child\", borderEdge(\"block-start\", { color: \"neutral\", width: 1 })), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link ContextMenu.LabelProps.children} as a\n * {@link ContextMenu.Group}'s small, muted heading, sized and spaced to sit\n * directly above the group's first row for a dense row of actions.\n *\n * @param handle Runtime handle carrying the host `<header>`'s props.\n * @returns The render function producing the label's markup.\n * @example\n * <ContextMenu.Label id=\"row-menu-view-heading\">{t(\"menu.view\")}</ContextMenu.Label>\n */\nContextMenu.Label = function ContextMenuLabel(handle: Handle<ContextMenu.LabelProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<header\n\t\t\t\t{...rest}\n\t\t\t\tmix={[pi(2), pb(1), weight(\"semibold\"), fg(\"neutral.muted\"), text(\"xs\"), mix]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</header>\n\t\t);\n\t};\n};\n\n/**\n * Renders a hairline divider between two runs of {@link ContextMenu.Item}s:\n * {@link Menu.Separator} unchanged.\n *\n * @example\n * <ContextMenu.Item href=\"/settings/profile\">{t(\"nav.profile\")}</ContextMenu.Item>\n * <ContextMenu.Separator />\n * <ContextMenu.Item danger>{t(\"actions.signOut\")}</ContextMenu.Item>\n */\nContextMenu.Separator = Menu.Separator;\n\n/**\n * Renders a row that opens a nested {@link ContextMenu.SubContent} surface:\n * {@link Menu.Item} restyled with inline-end padding for a trailing chevron\n * icon; point `commandfor` at the nested surface's `id` with `command=\"toggle-popover\"`.\n *\n * @param handle Runtime handle carrying the host row's props.\n * @returns The render function producing the row's markup.\n * @example\n * <ContextMenu.SubTrigger commandfor=\"row-menu-share\" command=\"toggle-popover\">\n * \t{t(\"actions.share\")}\n * \t<ChevronRightIcon data-slot=\"icon\" aria-hidden />\n * </ContextMenu.SubTrigger>\n * <ContextMenu.SubContent id=\"row-menu-share\" aria-label={t(\"actions.share\")}>\n * \t<ContextMenu.Item>{t(\"share.email\")}</ContextMenu.Item>\n * \t<ContextMenu.Item>{t(\"share.link\")}</ContextMenu.Item>\n * </ContextMenu.SubContent>\n */\nContextMenu.SubTrigger = function ContextMenuSubTrigger(handle: Handle<ContextMenu.ItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <Menu.Item {...rest} mix={[pie(8), mix]} />;\n\t};\n};\n\n/**\n * Renders a nested surface opened by a {@link ContextMenu.SubTrigger} row:\n * {@link ContextMenu} itself, defaulting `placement` to\n * {@link DEFAULT_SUB_PLACEMENT} since a nested row conventionally opens beside itself.\n *\n * @param handle Runtime handle carrying the host's {@link Menu} props.\n * @returns The render function producing the nested surface's markup.\n * @example\n * <ContextMenu.SubContent id=\"row-menu-share\" aria-label={t(\"actions.share\")}>\n * \t<ContextMenu.Item>{t(\"share.email\")}</ContextMenu.Item>\n * \t<ContextMenu.Item>{t(\"share.link\")}</ContextMenu.Item>\n * </ContextMenu.SubContent>\n */\nContextMenu.SubContent = function ContextMenuSubContent(\n\thandle: Handle<ContextMenu.SubContentProps>,\n) {\n\treturn () => {\n\t\tlet { placement, ...rest } = handle.props;\n\n\t\treturn <ContextMenu {...rest} placement={placement ?? DEFAULT_SUB_PLACEMENT} />;\n\t};\n};\n\n/**\n * Renders a row that toggles a checked state: {@link ContextMenu.Item}\n * unchanged — set `aria-selected=\"true\"` directly to mark it checked, the\n * same contract {@link Menu.Item} documents.\n *\n * @example\n * <ContextMenu.CheckboxItem aria-selected={showHidden ? \"true\" : undefined}>{t(\"view.showHidden\")}</ContextMenu.CheckboxItem>\n */\nContextMenu.CheckboxItem = ContextMenu.Item;\n\n/**\n * Renders a row belonging to a mutually exclusive set: {@link\n * ContextMenu.Item} unchanged — set `aria-selected=\"true\"` directly on\n * whichever row is the current pick.\n *\n * @example\n * <ContextMenu.RadioItem aria-selected={sort === \"name\" ? \"true\" : undefined}>{t(\"sort.name\")}</ContextMenu.RadioItem>\n */\nContextMenu.RadioItem = ContextMenu.Item;\n\n/**\n * Renders a mutually exclusive set of {@link ContextMenu.RadioItem} rows:\n * {@link ContextMenu.Group} unchanged.\n *\n * @example\n * <ContextMenu.RadioGroup aria-labelledby=\"row-menu-sort-heading\">\n * \t<ContextMenu.Label id=\"row-menu-sort-heading\">{t(\"menu.sortBy\")}</ContextMenu.Label>\n * \t<ContextMenu.RadioItem aria-selected=\"true\">{t(\"sort.name\")}</ContextMenu.RadioItem>\n * \t<ContextMenu.RadioItem>{t(\"sort.date\")}</ContextMenu.RadioItem>\n * </ContextMenu.RadioGroup>\n */\nContextMenu.RadioGroup = ContextMenu.Group;\n\n/**\n * Renders {@link ContextMenu.ShortcutProps.children} as a row's trailing\n * keyboard-shortcut hint: pushed to the row's inline end, muted, and set in\n * tabular digits so the hints of a column of rows line up.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the shortcut hint's markup.\n * @example\n * <ContextMenu.Item>\n * \t{t(\"actions.duplicate\")}\n * \t<ContextMenu.Shortcut>⌘D</ContextMenu.Shortcut>\n * </ContextMenu.Item>\n */\nContextMenu.Shortcut = function ContextMenuShortcut(handle: Handle<ContextMenu.ShortcutProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span {...rest} mix={[mis(\"auto\"), fg(\"neutral.muted\"), text(\"xs\"), tabularNums(), mix]}>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n};\n"
14
+ },
15
+ "test": null
16
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "date-field",
3
+ "changedIn": "2026.10.13",
4
+ "dependencies": [
5
+ "description",
6
+ "field-error",
7
+ "form",
8
+ "input",
9
+ "label"
10
+ ],
11
+ "exports": [
12
+ "DateField"
13
+ ],
14
+ "source": {
15
+ "path": "date-field.tsx",
16
+ "content": "/**\n * A convenience wrapper composing a labeled, described, and validated date\n * field in one call: a caption through {@link Label}, a native\n * `<input type=\"date\">` styled through {@link Input}, an optional supporting\n * passage through {@link Description}, and an optional validation message\n * through {@link FieldError}. Every id and `aria-describedby` relationship\n * between the parts is computed from this instance's own stable identifier,\n * leaving no id bookkeeping to the consumer.\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 { tabularNums } from \"@sdxc/u/typography\";\n\nimport type { FieldPartsProps } from \"@sdxc/ui/utils\";\n\nimport { fieldStackLayout } from \"@sdxc/ui/styles\";\nimport { resolveFieldWiring } from \"@sdxc/ui/utils\";\n\nimport { Description } from \"@sdxc/ui/description\";\nimport { FieldError } from \"@sdxc/ui/field-error\";\nimport { resolveFieldIssue } from \"@sdxc/ui/form\";\nimport { Input } from \"@sdxc/ui/input\";\nimport { Label } from \"@sdxc/ui/label\";\n\n/**\n * Prop types for {@link DateField}.\n */\nexport namespace DateField {\n\t/**\n\t * Semantic color role for the control's keyboard focus ring, each mapped\n\t * to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Per-part styling for the elements this convenience wrapper composes in\n\t * one call, layered after each part's own built-in styling.\n\t */\n\texport type PartsProps = FieldPartsProps;\n\n\t/**\n\t * Props accepted by {@link DateField}. `mix` styles the root element\n\t * grouping the field's parts; style the composed label, control,\n\t * description, and error individually through `parts` instead.\n\t */\n\texport interface Props extends Omit<TagProps<\"div\">, \"children\"> {\n\t\t/** Semantic color role for the control's focus ring. Defaults to `\"neutral\"` when omitted. */\n\t\tcolor?: Color;\n\t\t/**\n\t\t * The field's caption, rendered through {@link Label} and associated\n\t\t * with the control through a native `for`/`id` relationship computed\n\t\t * from this instance's own identifier.\n\t\t */\n\t\tlabel: RemixNode;\n\t\t/**\n\t\t * Supporting copy rendered through {@link Description} beneath the\n\t\t * control and referenced by the control's `aria-describedby`. Omit to\n\t\t * render no description.\n\t\t */\n\t\tdescription?: RemixNode;\n\t\t/**\n\t\t * Validation message rendered through {@link FieldError} beneath the\n\t\t * control; its presence alone marks `aria-invalid` unless set\n\t\t * explicitly. Inside a {@link Form} carrying `issues`, an explicit value still wins over the field's own by-`name` lookup.\n\t\t */\n\t\terrorMessage?: RemixNode;\n\t\t/**\n\t\t * Native `autofocus`. Defaults to `true` for the first invalid field of an\n\t\t * enclosing {@link Form}'s `issues`, landing keyboard focus on the problem\n\t\t * after a server round-trip; pass it explicitly to override for this field.\n\t\t */\n\t\tautoFocus?: boolean;\n\t\t/** Native `name` submitted with an enclosing form. */\n\t\tname?: string;\n\t\t/** Current value, in `YYYY-MM-DD` form, for a control a consumer tracks itself. */\n\t\tvalue?: string;\n\t\t/** Initial value, in `YYYY-MM-DD` form, for a control left to the platform's own uncontrolled state. */\n\t\tdefaultValue?: string;\n\t\t/** Earliest accepted date, in `YYYY-MM-DD` form. */\n\t\tmin?: string;\n\t\t/** Latest accepted date, in `YYYY-MM-DD` form. */\n\t\tmax?: string;\n\t\t/** Granularity, in days, the control's value must fall on. */\n\t\tstep?: number;\n\t\t/** Marks the control required for its enclosing form. */\n\t\trequired?: boolean;\n\t\t/** Marks the control inert and excluded from the tab order. */\n\t\tdisabled?: boolean;\n\t\t/** Marks the control's value fixed, while keeping it focusable and included in form submission. */\n\t\treadOnly?: boolean;\n\t\t/** Native autofill hint, e.g. `\"bday\"`. */\n\t\tautoComplete?: string;\n\t\t/** Per-part styling for this wrapper's internally composed elements. */\n\t\tparts?: PartsProps;\n\t}\n}\n\n/**\n * Renders a complete date field in one call, stacking {@link Label},\n * {@link Input}, and, when supplied, {@link Description} and {@link FieldError}.\n * An invalid state — from `errorMessage` or an explicit `aria-invalid` override — recolors the border and ring to the semantic danger tone regardless of `color`.\n *\n * @param handle Runtime handle carrying the root element's props and this instance's stable identifier.\n * @returns The render function producing the field's markup.\n * @example\n * <DateField label={t(\"form.birthday.label\")} name=\"birthday\" autoComplete=\"bday\" />\n * @example\n * <DateField\n * \tlabel={t(\"form.startDate.label\")}\n * \tname=\"startDate\"\n * \tmin=\"2026-01-01\"\n * \tmax=\"2026-12-31\"\n * \tdescription={t(\"form.startDate.hint\")}\n * />\n * @example\n * <DateField\n * \tlabel={t(\"form.dueDate.label\")}\n * \tname=\"dueDate\"\n * \tdefaultValue=\"2026-07-20\"\n * \terrorMessage={t(\"form.dueDate.pastDate\")}\n * />\n */\nexport function DateField(handle: Handle<DateField.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor,\n\t\t\tlabel,\n\t\t\tdescription,\n\t\t\terrorMessage: errorMessageProp,\n\t\t\tautoFocus,\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\t\"aria-invalid\": ariaInvalidProp,\n\t\t\tparts,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet { errorMessage, isFirstInvalid } = resolveFieldIssue(handle, name, errorMessageProp);\n\t\tlet resolvedAutoFocus = autoFocus ?? (isFirstInvalid || undefined);\n\t\tlet { resolvedColor, resolvedInvalid, descriptionId, errorId, describedBy } =\n\t\t\tresolveFieldWiring(handle.id, {\n\t\t\t\tcolor,\n\t\t\t\terrorMessage,\n\t\t\t\tdescription,\n\t\t\t\tariaInvalid: ariaInvalidProp,\n\t\t\t});\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"date-field\" mix={[fieldStackLayout(), mix]}>\n\t\t\t\t<Label htmlFor={handle.id} mix={parts?.label}>\n\t\t\t\t\t{label}\n\t\t\t\t</Label>\n\t\t\t\t<Input\n\t\t\t\t\tid={handle.id}\n\t\t\t\t\ttype=\"date\"\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\t// oxlint-disable-next-line jsx-a11y/no-autofocus -- Not a focus grab on page load: this only ever resolves true for the first field an enclosing Form reports as invalid, so a failed submit lands the user on the problem instead of leaving them to hunt for it.\n\t\t\t\t\tautoFocus={resolvedAutoFocus}\n\t\t\t\t\taria-invalid={resolvedInvalid}\n\t\t\t\t\taria-describedby={describedBy}\n\t\t\t\t\tcolor={resolvedColor}\n\t\t\t\t\tmix={[tabularNums(), parts?.input]}\n\t\t\t\t/>\n\t\t\t\t{description ? (\n\t\t\t\t\t<Description id={descriptionId} mix={parts?.description}>\n\t\t\t\t\t\t{description}\n\t\t\t\t\t</Description>\n\t\t\t\t) : null}\n\t\t\t\t{errorMessage ? (\n\t\t\t\t\t<FieldError id={errorId} mix={parts?.error}>\n\t\t\t\t\t\t{errorMessage}\n\t\t\t\t\t</FieldError>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t);\n\t};\n}\n"
17
+ },
18
+ "test": null
19
+ }