@metamorph-labs/polymorph 1.0.18 → 1.0.19

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 (319) hide show
  1. package/CHANGELOG.md +242 -0
  2. package/dist/design/systems/desktop.json +1 -1
  3. package/dist/design/systems/dew.json +1 -1
  4. package/dist/design/systems/flint.json +1 -1
  5. package/dist/design/systems/glassmorphic.json +1 -1
  6. package/dist/design/systems/harbor.json +1 -1
  7. package/dist/design/systems/journal.json +1 -1
  8. package/dist/design/systems/pastel.json +1 -1
  9. package/dist/design/systems/pebble.json +1 -1
  10. package/dist/design/systems/plain.json +1 -1
  11. package/dist/design/systems/pop.json +1 -1
  12. package/dist/design/systems/press.json +1 -1
  13. package/dist/packages/angular-ui/src/ai/ArtifactPane.ts +15 -4
  14. package/dist/packages/angular-ui/src/ai/PromptInput.ts +3 -1
  15. package/dist/packages/angular-ui/src/archetypes/Dashboard.ts +38 -20
  16. package/dist/packages/angular-ui/src/archetypes/dashboard.states.ts +52 -0
  17. package/dist/packages/angular-ui/src/controls/ColorInput.ts +62 -34
  18. package/dist/packages/angular-ui/src/controls/Combobox.ts +28 -7
  19. package/dist/packages/angular-ui/src/controls/DatePicker.ts +12 -11
  20. package/dist/packages/angular-ui/src/controls/DateRangePicker.ts +22 -17
  21. package/dist/packages/angular-ui/src/controls/DateRangePickerRangeCalendar.ts +3 -2
  22. package/dist/packages/angular-ui/src/controls/FileUpload.ts +18 -12
  23. package/dist/packages/angular-ui/src/controls/FileUploadRow.ts +24 -4
  24. package/dist/packages/angular-ui/src/controls/MultiSelect.ts +49 -12
  25. package/dist/packages/angular-ui/src/controls/NumberInput.ts +27 -3
  26. package/dist/packages/angular-ui/src/controls/PhoneInput.ts +9 -5
  27. package/dist/packages/angular-ui/src/controls/Select.ts +36 -7
  28. package/dist/packages/angular-ui/src/controls/TagInput.ts +61 -7
  29. package/dist/packages/angular-ui/src/controls/TimeInput.ts +15 -1
  30. package/dist/packages/angular-ui/src/controls/select.states.ts +79 -58
  31. package/dist/packages/angular-ui/src/overlays/Command.ts +50 -13
  32. package/dist/packages/angular-ui/src/overlays/CommandPanel.ts +11 -7
  33. package/dist/packages/angular-ui/src/overlays/ToastViewport.ts +1 -1
  34. package/dist/packages/angular-ui/src/structure/CodeBlock.ts +18 -4
  35. package/dist/packages/angular-ui/src/structure/Stat.ts +295 -84
  36. package/dist/packages/angular-ui/src/structure/stat.states.ts +116 -0
  37. package/dist/packages/cli/src/agents.js +4 -3
  38. package/dist/packages/cli/src/apply.js +43 -18
  39. package/dist/packages/cli/src/check.js +4 -0
  40. package/dist/packages/cli/src/cli.js +6 -2
  41. package/dist/packages/cli/src/elements.js +12 -2
  42. package/dist/packages/cli/src/emit.js +43 -8
  43. package/dist/packages/cli/src/readings.js +29 -3
  44. package/dist/packages/cli/src/skills/bridge.js +1197 -0
  45. package/dist/packages/cli/src/skills/facts.js +190 -0
  46. package/dist/packages/cli/src/skills/native.js +1580 -0
  47. package/dist/packages/cli/src/skills/rules.js +199 -0
  48. package/dist/packages/cli/src/skills/runtime.js +1020 -0
  49. package/dist/packages/cli/src/skills/screen-charts.js +334 -0
  50. package/dist/packages/cli/src/skills/screen-chat.js +247 -0
  51. package/dist/packages/cli/src/skills/screen-code.js +565 -0
  52. package/dist/packages/cli/src/skills/screen-rich-text.js +305 -0
  53. package/dist/packages/cli/src/skills/screen.js +378 -0
  54. package/dist/packages/cli/src/skills/setup-packages.js +307 -0
  55. package/dist/packages/cli/src/skills/setup.js +125 -0
  56. package/dist/packages/cli/src/skills/theme-documents.js +351 -0
  57. package/dist/packages/cli/src/skills/theme.js +208 -0
  58. package/dist/packages/cli/src/skills.js +13 -794
  59. package/dist/packages/cli/src/theme.js +42 -1
  60. package/dist/packages/cli/src/tool-verbs.js +19 -4
  61. package/dist/packages/cli/src/verbs.js +28 -2
  62. package/dist/packages/elements-ui/dist/cdn/chunks/{AppShellUserCard-0eCCnnN_.js → AppShellUserCard-XT4br4fr.js} +1 -1
  63. package/dist/packages/elements-ui/dist/cdn/chunks/{AreaChart-DftfzLG0.js → AreaChart-CXNFfbJ8.js} +1 -1
  64. package/dist/packages/elements-ui/dist/cdn/chunks/ArtifactPane-Pr9_K2uM.js +1 -0
  65. package/dist/packages/elements-ui/dist/cdn/chunks/{Avatar-DcdMgxgY.js → Avatar-3WXoBPLv.js} +1 -1
  66. package/dist/packages/elements-ui/dist/cdn/chunks/{Avatar-DcuvZwe7.js → Avatar-BKqjM8qW.js} +1 -1
  67. package/dist/packages/elements-ui/dist/cdn/chunks/{AvatarButton-D5XKVduu.js → AvatarButton-BasMQCSM.js} +1 -1
  68. package/dist/packages/elements-ui/dist/cdn/chunks/{AvatarGroup-DgFwJUNO.js → AvatarGroup-COch2-O0.js} +1 -1
  69. package/dist/packages/elements-ui/dist/cdn/chunks/{BarChart-myuR0aHc.js → BarChart-ugae8zfr.js} +1 -1
  70. package/dist/packages/elements-ui/dist/cdn/chunks/{ChatMessage-CgQ1h_JP.js → ChatMessage-Bx4yrF2x.js} +1 -1
  71. package/dist/packages/elements-ui/dist/cdn/chunks/CodeBlock-B_e5ma3K.js +1 -0
  72. package/dist/packages/elements-ui/dist/cdn/chunks/CodeBlock-Fgtr48Vb.js +1 -0
  73. package/dist/packages/elements-ui/dist/cdn/chunks/ColorInput-CD7rsWRp.js +1 -0
  74. package/dist/packages/elements-ui/dist/cdn/chunks/Combobox-CUw7z6TS.js +1 -0
  75. package/dist/packages/elements-ui/dist/cdn/chunks/{Combobox-DB2FT7so.js → Combobox-hWIFU9X_.js} +1 -1
  76. package/dist/packages/elements-ui/dist/cdn/chunks/Command-BXgqRd3I.js +1 -0
  77. package/dist/packages/elements-ui/dist/cdn/chunks/{ConfirmDialog-BtQOAHY2.js → ConfirmDialog-CAaBRKxl.js} +1 -1
  78. package/dist/packages/elements-ui/dist/cdn/chunks/{Dashboard-ChMPH4_Q.js → Dashboard-DwNw5Wnd.js} +1 -1
  79. package/dist/packages/elements-ui/dist/cdn/chunks/DatePicker-DjqtswQR.js +1 -0
  80. package/dist/packages/elements-ui/dist/cdn/chunks/DateRangePicker-LsXFHOzm.js +1 -0
  81. package/dist/packages/elements-ui/dist/cdn/chunks/{DonutChart-BEK89BeL.js → DonutChart-DYXx6eTe.js} +1 -1
  82. package/dist/packages/elements-ui/dist/cdn/chunks/FileUpload-3gbZTSSx.js +1 -0
  83. package/dist/packages/elements-ui/dist/cdn/chunks/{FormField-PlLLDKqc.js → FormField-Bvw4cLBc.js} +1 -1
  84. package/dist/packages/elements-ui/dist/cdn/chunks/{FormField-C6L3vYp4.js → FormField-DzhcinED.js} +1 -1
  85. package/dist/packages/elements-ui/dist/cdn/chunks/{FunnelChart-DVQz_gad.js → FunnelChart-D24XhrGw.js} +1 -1
  86. package/dist/packages/elements-ui/dist/cdn/chunks/{Heading-fAcu6Vrw.js → Heading-Cvfyu8pc.js} +1 -1
  87. package/dist/packages/elements-ui/dist/cdn/chunks/{Heading-CgzEi9OQ.js → Heading-XDJzlwt9.js} +1 -1
  88. package/dist/packages/elements-ui/dist/cdn/chunks/{Heatmap-BRwR-n-V.js → Heatmap-BQoUS6gY.js} +1 -1
  89. package/dist/packages/elements-ui/dist/cdn/chunks/{Hero-CV2YWeb4.js → Hero-CXuuFceS.js} +1 -1
  90. package/dist/packages/elements-ui/dist/cdn/chunks/{Histogram-CCYwlinB.js → Histogram-DW_ZPHpR.js} +1 -1
  91. package/dist/packages/elements-ui/dist/cdn/chunks/{LineChart-BH6Pq1P1.js → LineChart-kf-zlNWe.js} +1 -1
  92. package/dist/packages/elements-ui/dist/cdn/chunks/{Markdown-DmZEch4i.js → Markdown-C3rjhIbt.js} +1 -1
  93. package/dist/packages/elements-ui/dist/cdn/chunks/ModeSwitch-DQ86CK9h.js +1 -0
  94. package/dist/packages/elements-ui/dist/cdn/chunks/MultiSelect-DbSx9QtV.js +1 -0
  95. package/dist/packages/elements-ui/dist/cdn/chunks/NumberInput-B4ZZOGLl.js +7 -0
  96. package/dist/packages/elements-ui/dist/cdn/chunks/PhoneInput-BsMfbNi6.js +210 -0
  97. package/dist/packages/elements-ui/dist/cdn/chunks/PromptInput-l_-zAXSZ.js +1 -0
  98. package/dist/packages/elements-ui/dist/cdn/chunks/{RadarChart-Coje7Sb0.js → RadarChart-CwJAWRki.js} +1 -1
  99. package/dist/packages/elements-ui/dist/cdn/chunks/{RichTextContent-CufjptHF.js → RichTextContent-D51UfuWk.js} +1 -1
  100. package/dist/packages/elements-ui/dist/cdn/chunks/{RichTextInput-Dz7yBFUA.js → RichTextInput-B32fN_p9.js} +3 -3
  101. package/dist/packages/elements-ui/dist/cdn/chunks/{ScatterChart-Do5tQTC5.js → ScatterChart-Mps7l5-i.js} +1 -1
  102. package/dist/packages/elements-ui/dist/cdn/chunks/Select-CpsRP0NR.js +1 -0
  103. package/dist/packages/elements-ui/dist/cdn/chunks/Stat-CXR6bP7X.js +1 -0
  104. package/dist/packages/elements-ui/dist/cdn/chunks/Stat-DGcx2ZZq.js +1 -0
  105. package/dist/packages/elements-ui/dist/cdn/chunks/TagInput-BhkLU4gE.js +1 -0
  106. package/dist/packages/elements-ui/dist/cdn/chunks/TimeInput-r2jNTOLN.js +1 -0
  107. package/dist/packages/elements-ui/dist/cdn/chunks/{Toast-CAYGbn7g.js → Toast-BTfcZn0I.js} +1 -1
  108. package/dist/packages/elements-ui/dist/cdn/chunks/{ToastViewport-CFslglYc.js → ToastViewport-BBQMRCQT.js} +1 -1
  109. package/dist/packages/elements-ui/dist/cdn/chunks/{ToolCall-DUCoKsoE.js → ToolCall-DNU5kk9_.js} +1 -1
  110. package/dist/packages/elements-ui/dist/cdn/chunks/{Treemap-Bh3ruYGJ.js → Treemap-BV8TlZHB.js} +1 -1
  111. package/dist/packages/elements-ui/dist/cdn/chunks/agent-DfOqpL9c.js +1 -0
  112. package/dist/packages/elements-ui/dist/cdn/chunks/api-DJBiUXxK.js +4 -0
  113. package/dist/packages/elements-ui/dist/cdn/chunks/avatar.module-D4YdFevY.js +1 -0
  114. package/dist/packages/elements-ui/dist/cdn/chunks/cap-DA71oFHt.js +1 -0
  115. package/dist/packages/elements-ui/dist/cdn/chunks/{cartesian-I5uPfyqv.js → cartesian-CEn2lJCc.js} +1 -1
  116. package/dist/packages/elements-ui/dist/cdn/chunks/{chart-annotations.module-xUExw4pu.js → chart-annotations.module-hA_KO_Pe.js} +1 -1
  117. package/dist/packages/elements-ui/dist/cdn/chunks/chart-brush.module-C_8txUW5.js +1 -0
  118. package/dist/packages/elements-ui/dist/cdn/chunks/chart-twin.module-BpfyTQ9R.js +1 -0
  119. package/dist/packages/elements-ui/dist/cdn/chunks/check-CHvc4yHL.js +1 -0
  120. package/dist/packages/elements-ui/dist/cdn/chunks/css-vars-DeZ4TCna.js +1 -0
  121. package/dist/packages/elements-ui/dist/cdn/chunks/draw-BiQ3Of6N.js +1 -0
  122. package/dist/packages/elements-ui/dist/cdn/chunks/drawing-nhJNBahV.js +1 -0
  123. package/dist/packages/elements-ui/dist/cdn/chunks/field-labels-Df5HuYC5.js +1 -0
  124. package/dist/packages/elements-ui/dist/cdn/chunks/frame-CtTY4oCn.js +1 -0
  125. package/dist/packages/elements-ui/dist/cdn/chunks/on-call-YKLF3-FH.js +1 -0
  126. package/dist/packages/elements-ui/dist/cdn/chunks/runtime-QRQ3CjZg.js +1 -0
  127. package/dist/packages/elements-ui/dist/cdn/chunks/series-uUg6_JtL.js +1 -0
  128. package/dist/packages/elements-ui/dist/cdn/chunks/src-XnWjGSDr.js +67 -0
  129. package/dist/packages/elements-ui/dist/cdn/chunks/toast-pwGvxH2T.js +1 -0
  130. package/dist/packages/elements-ui/dist/cdn/chunks/urls-Qks0KJ_p.js +6 -0
  131. package/dist/packages/elements-ui/dist/cdn/chunks/webmcp-Dro53ATH.js +1 -0
  132. package/dist/packages/elements-ui/dist/cdn/polymorph-all.js +52 -50
  133. package/dist/packages/elements-ui/dist/cdn/polymorph.css +1 -1
  134. package/dist/packages/elements-ui/dist/cdn/polymorph.js +1 -1
  135. package/dist/packages/elements-ui/dist/cdn/prepaint.js +1 -1
  136. package/dist/packages/elements-ui/dist/cdn/themes/desktop.css +5 -4
  137. package/dist/packages/elements-ui/dist/cdn/themes/dew.css +5 -4
  138. package/dist/packages/elements-ui/dist/cdn/themes/flint.css +5 -4
  139. package/dist/packages/elements-ui/dist/cdn/themes/glassmorphic.css +5 -4
  140. package/dist/packages/elements-ui/dist/cdn/themes/harbor.css +5 -4
  141. package/dist/packages/elements-ui/dist/cdn/themes/journal.css +5 -4
  142. package/dist/packages/elements-ui/dist/cdn/themes/pastel.css +5 -4
  143. package/dist/packages/elements-ui/dist/cdn/themes/pebble.css +5 -4
  144. package/dist/packages/elements-ui/dist/cdn/themes/plain.css +5 -4
  145. package/dist/packages/elements-ui/dist/cdn/themes/pop.css +5 -4
  146. package/dist/packages/elements-ui/dist/cdn/themes/press.css +5 -4
  147. package/dist/packages/elements-ui/dist/cdn/themes/terminal.css +5 -4
  148. package/dist/packages/elements-ui/src/ai/ArtifactPane.ts +2 -0
  149. package/dist/packages/elements-ui/src/archetypes/dashboard.states.ts +9 -0
  150. package/dist/packages/elements-ui/src/controls/ColorInput.ts +2 -0
  151. package/dist/packages/elements-ui/src/controls/NumberInput.ts +2 -0
  152. package/dist/packages/elements-ui/src/controls/TagInput.ts +4 -0
  153. package/dist/packages/elements-ui/src/controls/TimeInput.ts +2 -0
  154. package/dist/packages/elements-ui/src/controls/select.states.ts +10 -0
  155. package/dist/packages/elements-ui/src/overlays/Command.ts +2 -0
  156. package/dist/packages/elements-ui/src/structure/CodeBlock.ts +5 -2
  157. package/dist/packages/elements-ui/src/structure/Stat.ts +6 -0
  158. package/dist/packages/elements-ui/src/structure/stat.states.ts +33 -0
  159. package/dist/packages/mcp/src/propose.js +92 -15
  160. package/dist/packages/mcp/src/server.js +19 -8
  161. package/dist/packages/mcp/src/tools.js +80 -5
  162. package/dist/packages/mcp/src/write.js +95 -13
  163. package/dist/packages/react-ui/src/ai/ArtifactPane.tsx +5 -2
  164. package/dist/packages/react-ui/src/ai/PromptInput.tsx +5 -2
  165. package/dist/packages/react-ui/src/archetypes/dashboard.states.tsx +28 -0
  166. package/dist/packages/react-ui/src/controls/ColorInput.tsx +69 -13
  167. package/dist/packages/react-ui/src/controls/Combobox.tsx +13 -5
  168. package/dist/packages/react-ui/src/controls/DatePicker.tsx +3 -0
  169. package/dist/packages/react-ui/src/controls/DateRangePicker.tsx +22 -5
  170. package/dist/packages/react-ui/src/controls/FileUpload.tsx +2 -0
  171. package/dist/packages/react-ui/src/controls/MultiSelect.tsx +30 -6
  172. package/dist/packages/react-ui/src/controls/NumberInput.tsx +19 -1
  173. package/dist/packages/react-ui/src/controls/PhoneInput.tsx +3 -3
  174. package/dist/packages/react-ui/src/controls/Select.tsx +59 -23
  175. package/dist/packages/react-ui/src/controls/TagInput.tsx +43 -10
  176. package/dist/packages/react-ui/src/controls/TimeInput.tsx +10 -0
  177. package/dist/packages/react-ui/src/controls/date-segments.tsx +16 -0
  178. package/dist/packages/react-ui/src/controls/select.states.tsx +13 -0
  179. package/dist/packages/react-ui/src/overlays/Command.tsx +23 -2
  180. package/dist/packages/react-ui/src/overlays/Toaster.tsx +2 -2
  181. package/dist/packages/react-ui/src/structure/CodeBlock.tsx +7 -3
  182. package/dist/packages/react-ui/src/structure/Stat.tsx +90 -13
  183. package/dist/packages/react-ui/src/structure/stat.states.tsx +68 -0
  184. package/dist/packages/recipes/src/ai/artifact-pane.module.css +4 -4
  185. package/dist/packages/recipes/src/controls/rich-text-input.module.css +1 -1
  186. package/dist/packages/recipes/src/structure/avatar.module.css +3 -1
  187. package/dist/packages/recipes/src/structure/heading.module.css +5 -4
  188. package/dist/packages/recipes/src/structure/hero.module.css +3 -1
  189. package/dist/packages/recipes/src/structure/stat.module.css +7 -0
  190. package/dist/packages/registry/src/card.js +4 -3
  191. package/dist/packages/registry/src/frameworks.js +28 -1
  192. package/dist/packages/registry/src/runtime-card.js +300 -0
  193. package/dist/packages/registry/src/runtime-members.js +176 -0
  194. package/dist/packages/registry/src/screen-table.js +166 -0
  195. package/dist/packages/rules/package.js +1 -1
  196. package/dist/packages/solid-ui/src/ai/ArtifactPane.tsx +11 -3
  197. package/dist/packages/solid-ui/src/ai/PromptInput.tsx +3 -1
  198. package/dist/packages/solid-ui/src/archetypes/Dashboard.tsx +3 -0
  199. package/dist/packages/solid-ui/src/archetypes/dashboard.states.tsx +39 -0
  200. package/dist/packages/solid-ui/src/controls/ColorInput.tsx +38 -17
  201. package/dist/packages/solid-ui/src/controls/Combobox.tsx +27 -6
  202. package/dist/packages/solid-ui/src/controls/DatePicker.tsx +12 -11
  203. package/dist/packages/solid-ui/src/controls/DateRangePicker.tsx +21 -16
  204. package/dist/packages/solid-ui/src/controls/DateRangePickerRangeCalendar.tsx +3 -4
  205. package/dist/packages/solid-ui/src/controls/FileUpload.tsx +1 -0
  206. package/dist/packages/solid-ui/src/controls/FileUploadRow.tsx +6 -0
  207. package/dist/packages/solid-ui/src/controls/MultiSelect.tsx +51 -11
  208. package/dist/packages/solid-ui/src/controls/NumberInput.tsx +21 -2
  209. package/dist/packages/solid-ui/src/controls/PhoneInput.tsx +8 -4
  210. package/dist/packages/solid-ui/src/controls/Select.tsx +37 -6
  211. package/dist/packages/solid-ui/src/controls/TagInput.tsx +26 -5
  212. package/dist/packages/solid-ui/src/controls/TimeInput.tsx +10 -1
  213. package/dist/packages/solid-ui/src/controls/select.states.tsx +18 -0
  214. package/dist/packages/solid-ui/src/overlays/Command.tsx +15 -2
  215. package/dist/packages/solid-ui/src/overlays/CommandPanel.tsx +7 -7
  216. package/dist/packages/solid-ui/src/overlays/ToastViewport.tsx +1 -1
  217. package/dist/packages/solid-ui/src/structure/CodeBlock.tsx +9 -5
  218. package/dist/packages/solid-ui/src/structure/Stat.tsx +86 -25
  219. package/dist/packages/solid-ui/src/structure/stat.states.tsx +73 -0
  220. package/dist/packages/svelte-ui/src/ai/ArtifactPane.svelte +8 -2
  221. package/dist/packages/svelte-ui/src/ai/PromptInput.svelte +3 -1
  222. package/dist/packages/svelte-ui/src/archetypes/Dashboard.svelte +3 -0
  223. package/dist/packages/svelte-ui/src/archetypes/dashboard.states.svelte +2 -0
  224. package/dist/packages/svelte-ui/src/controls/ColorInput.svelte +29 -8
  225. package/dist/packages/svelte-ui/src/controls/Combobox.svelte +26 -5
  226. package/dist/packages/svelte-ui/src/controls/DatePicker.svelte +7 -5
  227. package/dist/packages/svelte-ui/src/controls/DateRangePicker.svelte +15 -9
  228. package/dist/packages/svelte-ui/src/controls/DateRangePickerRangeCalendar.svelte +3 -2
  229. package/dist/packages/svelte-ui/src/controls/FileUpload.svelte +1 -0
  230. package/dist/packages/svelte-ui/src/controls/FileUploadRow.svelte +8 -1
  231. package/dist/packages/svelte-ui/src/controls/MultiSelect.svelte +36 -10
  232. package/dist/packages/svelte-ui/src/controls/NumberInput.svelte +14 -1
  233. package/dist/packages/svelte-ui/src/controls/PhoneInput.svelte +3 -3
  234. package/dist/packages/svelte-ui/src/controls/Select.svelte +20 -6
  235. package/dist/packages/svelte-ui/src/controls/TagInput.svelte +21 -3
  236. package/dist/packages/svelte-ui/src/controls/TimeInput.svelte +11 -1
  237. package/dist/packages/svelte-ui/src/controls/select.states.svelte +26 -24
  238. package/dist/packages/svelte-ui/src/overlays/Command.svelte +13 -1
  239. package/dist/packages/svelte-ui/src/overlays/CommandPanel.svelte +11 -6
  240. package/dist/packages/svelte-ui/src/overlays/ToastViewport.svelte +1 -1
  241. package/dist/packages/svelte-ui/src/structure/CodeBlock.svelte +7 -2
  242. package/dist/packages/svelte-ui/src/structure/Stat.svelte +70 -17
  243. package/dist/packages/svelte-ui/src/structure/stat.states.svelte +27 -0
  244. package/dist/packages/theme/src/admit.js +6 -3
  245. package/dist/packages/theme/src/color/resolve.js +19 -2
  246. package/dist/packages/theme/src/derive.js +13 -6
  247. package/dist/packages/theme/src/emit.js +1 -1
  248. package/dist/packages/theme/src/runtime.js +58 -0
  249. package/dist/packages/theme/src/seeds.js +30 -4
  250. package/dist/packages/theme/src/systems.js +1 -1
  251. package/dist/packages/theme/src/tokens.js +15 -6
  252. package/dist/packages/vue-ui/src/ai/ArtifactPane.vue +11 -2
  253. package/dist/packages/vue-ui/src/ai/PromptInput.vue +3 -1
  254. package/dist/packages/vue-ui/src/archetypes/Dashboard.vue +3 -0
  255. package/dist/packages/vue-ui/src/archetypes/dashboard.states.ts +49 -0
  256. package/dist/packages/vue-ui/src/controls/ColorInput.vue +33 -12
  257. package/dist/packages/vue-ui/src/controls/Combobox.vue +26 -5
  258. package/dist/packages/vue-ui/src/controls/DatePicker.vue +12 -11
  259. package/dist/packages/vue-ui/src/controls/DateRangePicker.vue +20 -15
  260. package/dist/packages/vue-ui/src/controls/DateRangePickerRangeCalendar.vue +3 -4
  261. package/dist/packages/vue-ui/src/controls/FileUpload.vue +1 -0
  262. package/dist/packages/vue-ui/src/controls/FileUploadRow.vue +6 -0
  263. package/dist/packages/vue-ui/src/controls/MultiSelect.vue +37 -10
  264. package/dist/packages/vue-ui/src/controls/NumberInput.vue +17 -1
  265. package/dist/packages/vue-ui/src/controls/PhoneInput.vue +7 -3
  266. package/dist/packages/vue-ui/src/controls/Select.vue +22 -7
  267. package/dist/packages/vue-ui/src/controls/TagInput.vue +21 -3
  268. package/dist/packages/vue-ui/src/controls/TimeInput.vue +10 -1
  269. package/dist/packages/vue-ui/src/controls/select.states.ts +17 -0
  270. package/dist/packages/vue-ui/src/overlays/Command.vue +13 -1
  271. package/dist/packages/vue-ui/src/overlays/CommandPanel.vue +7 -7
  272. package/dist/packages/vue-ui/src/overlays/ToastViewport.vue +1 -1
  273. package/dist/packages/vue-ui/src/structure/CodeBlock.vue +7 -2
  274. package/dist/packages/vue-ui/src/structure/Stat.vue +71 -18
  275. package/dist/packages/vue-ui/src/structure/stat.states.ts +67 -0
  276. package/dist/platforms/android/ui/src/generated/kotlin/dev/polymorph/ui/Contracts.kt +144 -33
  277. package/dist/platforms/android/ui/src/generated/kotlin/dev/polymorph/ui/Members.kt +17 -7
  278. package/dist/platforms/ios/Sources/PolymorphUI/Generated/Contracts.swift +204 -31
  279. package/dist/registry/registry.json +371 -75
  280. package/dist/screen/assets/{screen-CuQbskb8.css → screen-B22PTPwF.css} +1 -1
  281. package/dist/screen/assets/screen-Cpbh7XMb.js +372 -0
  282. package/dist/screen/screen.html +3 -3
  283. package/package.json +1 -1
  284. package/dist/packages/elements-ui/dist/cdn/chunks/ArtifactPane-DsmRlr6d.js +0 -1
  285. package/dist/packages/elements-ui/dist/cdn/chunks/CodeBlock-BqP8HZKM.js +0 -1
  286. package/dist/packages/elements-ui/dist/cdn/chunks/CodeBlock-D8VARz0a.js +0 -1
  287. package/dist/packages/elements-ui/dist/cdn/chunks/ColorInput-BrzZOVeL.js +0 -1
  288. package/dist/packages/elements-ui/dist/cdn/chunks/Combobox-BiUq0h-w.js +0 -1
  289. package/dist/packages/elements-ui/dist/cdn/chunks/Command-hmxVRdFg.js +0 -1
  290. package/dist/packages/elements-ui/dist/cdn/chunks/DatePicker-C8prGbJ2.js +0 -1
  291. package/dist/packages/elements-ui/dist/cdn/chunks/DateRangePicker-CO1ioqwN.js +0 -1
  292. package/dist/packages/elements-ui/dist/cdn/chunks/FileUpload-HPQe-ttb.js +0 -1
  293. package/dist/packages/elements-ui/dist/cdn/chunks/ModeSwitch-CerqbGv3.js +0 -1
  294. package/dist/packages/elements-ui/dist/cdn/chunks/MultiSelect-CQq7jPgI.js +0 -1
  295. package/dist/packages/elements-ui/dist/cdn/chunks/NumberInput-Dre9GwBy.js +0 -7
  296. package/dist/packages/elements-ui/dist/cdn/chunks/PhoneInput-D6_J6Es_.js +0 -210
  297. package/dist/packages/elements-ui/dist/cdn/chunks/PromptInput-BXcsUQ5W.js +0 -1
  298. package/dist/packages/elements-ui/dist/cdn/chunks/Select-DxGQgv2q.js +0 -1
  299. package/dist/packages/elements-ui/dist/cdn/chunks/Stat-FsMUWigK.js +0 -1
  300. package/dist/packages/elements-ui/dist/cdn/chunks/Stat-WS8v6BQv.js +0 -1
  301. package/dist/packages/elements-ui/dist/cdn/chunks/TagInput-D-uIQEGS.js +0 -1
  302. package/dist/packages/elements-ui/dist/cdn/chunks/TimeInput-Dho571vA.js +0 -1
  303. package/dist/packages/elements-ui/dist/cdn/chunks/agent-DBDk4wLH.js +0 -1
  304. package/dist/packages/elements-ui/dist/cdn/chunks/api-B9sGZiYn.js +0 -4
  305. package/dist/packages/elements-ui/dist/cdn/chunks/avatar.module-CQwnWhWo.js +0 -1
  306. package/dist/packages/elements-ui/dist/cdn/chunks/cap-Ct4k7zNC.js +0 -1
  307. package/dist/packages/elements-ui/dist/cdn/chunks/chart-brush.module-DycBfben.js +0 -1
  308. package/dist/packages/elements-ui/dist/cdn/chunks/chart-twin.module-Cks7VwS5.js +0 -1
  309. package/dist/packages/elements-ui/dist/cdn/chunks/check-dOfCSYFA.js +0 -1
  310. package/dist/packages/elements-ui/dist/cdn/chunks/draw-DclRgiWM.js +0 -1
  311. package/dist/packages/elements-ui/dist/cdn/chunks/drawing-DjkZr0z8.js +0 -1
  312. package/dist/packages/elements-ui/dist/cdn/chunks/frame-BSvl4y47.js +0 -1
  313. package/dist/packages/elements-ui/dist/cdn/chunks/on-call-Jk1sYJc_.js +0 -1
  314. package/dist/packages/elements-ui/dist/cdn/chunks/receivers-BpRfF6dV.js +0 -4
  315. package/dist/packages/elements-ui/dist/cdn/chunks/series-C_1TNd2n.js +0 -1
  316. package/dist/packages/elements-ui/dist/cdn/chunks/src-Bub3C9YP.js +0 -67
  317. package/dist/packages/elements-ui/dist/cdn/chunks/toast-AarMGYJn.js +0 -1
  318. package/dist/packages/elements-ui/dist/cdn/chunks/webmcp-eEPzSqph.js +0 -1
  319. package/dist/screen/assets/screen-Clj2u6_s.js +0 -372
@@ -48,7 +48,7 @@ import { DateSegments, type SegmentStyles } from './date-segments'
48
48
  import styles from '@polymorph/recipes/controls/date-range-picker.module.css'
49
49
 
50
50
  /**
51
- * A date range *field* with two segmented entries and a calendar popup
51
+ * A date range *field*: two segmented dates and a calendar popup
52
52
  * (`design/components/date-range-picker.md`). A range changes the value shape, the cell states and
53
53
  * the keyboard model together, so it is a separate member rather than a DatePicker mode.
54
54
  *
@@ -80,6 +80,12 @@ export interface DateRangePickerMessages extends CalendarMessages {
80
80
  clear: string
81
81
  /** The popup's accessible name. */
82
82
  chooseRange: string
83
+ /** What an unfilled segment says as its value. Default: React Aria's `Empty`, in the locale. */
84
+ empty?: string
85
+ /** The start's name, said with each of its segments. Default: React Aria's `Start Date`. */
86
+ start?: string
87
+ /** The end's name, said with each of its segments. Default: React Aria's `End Date`. */
88
+ end?: string
83
89
  }
84
90
 
85
91
  const DEFAULT_MESSAGES: DateRangePickerMessages = {
@@ -334,26 +340,37 @@ function RangeField({
334
340
  })}
335
341
  {...memberAttr('DateRangePicker')}
336
342
  >
343
+ {/* React Aria names each half in the page's locale; a host's word replaces its name. */}
337
344
  <DateSegments
338
- fieldProps={startFieldProps}
345
+ fieldProps={
346
+ messages.start === undefined
347
+ ? startFieldProps
348
+ : { ...startFieldProps, 'aria-label': messages.start }
349
+ }
339
350
  locale={resolvedLocale}
340
351
  size={size}
341
352
  disabled={disabled}
342
353
  styles={segmentStyles}
354
+ empty={messages.empty}
343
355
  />
344
356
 
345
- {/* A visual separator only. React Aria names the halves for screen readers ("Start Date" /
346
- "End Date"), so the punctuation carries no meaning. */}
357
+ {/* A visual separator only. Each half's segments are named by the half, so the punctuation
358
+ carries no meaning. */}
347
359
  <span className={styles.dash} aria-hidden="true">
348
360
  –
349
361
  </span>
350
362
 
351
363
  <DateSegments
352
- fieldProps={endFieldProps}
364
+ fieldProps={
365
+ messages.end === undefined
366
+ ? endFieldProps
367
+ : { ...endFieldProps, 'aria-label': messages.end }
368
+ }
353
369
  locale={resolvedLocale}
354
370
  size={size}
355
371
  disabled={disabled}
356
372
  styles={segmentStyles}
373
+ empty={messages.empty}
357
374
  />
358
375
 
359
376
  <span className={styles.spacer} />
@@ -334,6 +334,7 @@ export function FileUpload({
334
334
  iconOnly
335
335
  icon="refresh"
336
336
  label={messages.retry}
337
+ disabled={disabled}
337
338
  onClick={() => onRetry(file.id)}
338
339
  />
339
340
  ) : null}
@@ -347,6 +348,7 @@ export function FileUpload({
347
348
  iconOnly
348
349
  icon="close"
349
350
  label={messages.remove(file.name)}
351
+ disabled={disabled}
350
352
  onClick={() => requestRemoval(file.id)}
351
353
  />
352
354
  </MotionSurface>
@@ -2,6 +2,7 @@
2
2
 
3
3
  import * as PopoverPrimitive from '@radix-ui/react-popover'
4
4
  import {
5
+ useCallback,
5
6
  useEffect,
6
7
  useId,
7
8
  useRef,
@@ -21,6 +22,7 @@ import {
21
22
  type ControlSize,
22
23
  dataAttrs,
23
24
  dataFlag,
25
+ fieldLabelIds,
24
26
  holdFieldEscape,
25
27
  Icon,
26
28
  lineStartKey,
@@ -33,7 +35,8 @@ import { Skeleton } from '../structure/Skeleton'
33
35
  import styles from '@polymorph/recipes/controls/multi-select.module.css'
34
36
 
35
37
  /**
36
- * Picks several values from a filterable closed list (`design/components/multi-select.md`).
38
+ * Filtered multiple choice (`design/components/multi-select.md`). The reader picks several values
39
+ * from a filterable closed list.
37
40
  *
38
41
  * Typical uses are assignees, labels and watchers. The value type changes (`string` to
39
42
  * `string[]`), so this is a separate member and not a Combobox mode.
@@ -88,7 +91,7 @@ export interface MultiSelectMessages {
88
91
  remove?: (label: string) => string
89
92
  /** The async status while the list loads. Default: `Loading options…`. */
90
93
  loadingOptions?: string
91
- /** The async status naming the result count. Default: `{count} options`. */
94
+ /** The async status naming the result count. Default: `{count} options`, `1 option` for one. */
92
95
  options?: (count: number) => string
93
96
  }
94
97
 
@@ -103,7 +106,7 @@ const MESSAGES = {
103
106
  showOptions: 'Show options',
104
107
  remove: (label: string) => `Remove ${label}`,
105
108
  loadingOptions: 'Loading options…',
106
- options: (count: number) => `${count} options`,
109
+ options: (count: number) => (count === 1 ? '1 option' : `${count} options`),
107
110
  } satisfies Required<MultiSelectMessages>
108
111
 
109
112
  export interface MultiSelectProps {
@@ -708,6 +711,7 @@ export function MultiSelect({
708
711
  state={state}
709
712
  listBoxRef={listBoxRef}
710
713
  listboxId={listboxId}
714
+ inputRef={inputRef}
711
715
  label={ariaLabel}
712
716
  labelledBy={labelledBy}
713
717
  mintKey={mint}
@@ -951,11 +955,19 @@ export function MultiSelect({
951
955
  /**
952
956
  * The listbox, mounted with the panel, split out as in Combobox. `useListBox`'s mount
953
957
  * effects must run when the popup exists, not once while the field is closed.
958
+ *
959
+ * It takes the field's own name, as the input has it: `aria-labelledby`, else `aria-label`,
960
+ * else the labels that name the input. A `<label for>` names the input alone, as FormField's
961
+ * label does, so the list refers to those labels by id (`fieldLabelIds`), and a label whose
962
+ * words change is heard with its new words. The ids are read once the list is in the document,
963
+ * each time it opens, so a label drawn after the field mounted names it too. A second render
964
+ * names the list, and React makes it before the browser paints.
954
965
  */
955
966
  function MultiSelectListBox({
956
967
  state,
957
968
  listBoxRef,
958
969
  listboxId,
970
+ inputRef,
959
971
  label,
960
972
  labelledBy,
961
973
  mintKey,
@@ -964,11 +976,22 @@ function MultiSelectListBox({
964
976
  state: ListState<MultiSelectOption>
965
977
  listBoxRef: RefObject<HTMLUListElement | null>
966
978
  listboxId: string
979
+ inputRef: RefObject<HTMLInputElement | null>
967
980
  label: string | undefined
968
981
  labelledBy: string | undefined
969
982
  mintKey: string | null
970
983
  onScroll?: (event: UIEvent<HTMLUListElement>) => void
971
984
  }) {
985
+ const unnamed = label === undefined && labelledBy === undefined
986
+ const [fieldLabels, setFieldLabels] = useState<string>()
987
+ const attachList = useCallback(
988
+ (node: HTMLUListElement | null) => {
989
+ listBoxRef.current = node
990
+ if (node !== null && unnamed) setFieldLabels(fieldLabelIds(inputRef.current, listboxId))
991
+ },
992
+ [listBoxRef, inputRef, listboxId, unnamed],
993
+ )
994
+
972
995
  const { listBoxProps } = useListBox(
973
996
  {
974
997
  id: listboxId,
@@ -988,15 +1011,16 @@ function MultiSelectListBox({
988
1011
  * Aria documents this option for rows that disappear when selected.
989
1012
  */
990
1013
  shouldSelectOnPressUp: true,
991
- 'aria-label': label,
992
- 'aria-labelledby': labelledBy,
1014
+ // One of the two, never both: React Aria would join them into a name the input lacks.
1015
+ 'aria-label': labelledBy === undefined ? label : undefined,
1016
+ 'aria-labelledby': unnamed ? fieldLabels : labelledBy,
993
1017
  },
994
1018
  state,
995
1019
  listBoxRef,
996
1020
  )
997
1021
 
998
1022
  return (
999
- <ul {...listBoxProps} ref={listBoxRef} className={styles.listbox} onScroll={onScroll}>
1023
+ <ul {...listBoxProps} ref={attachList} className={styles.listbox} onScroll={onScroll}>
1000
1024
  {[...state.collection].map((node) => (
1001
1025
  <MultiSelectItem
1002
1026
  key={node.key}
@@ -16,7 +16,8 @@ import {
16
16
  import styles from '@polymorph/recipes/controls/number-input.module.css'
17
17
 
18
18
  /**
19
- * A field that holds, formats and steps a number (`design/components/number-input.md`).
19
+ * A number field that formats and steps (`design/components/number-input.md`). It holds the
20
+ * value as a number.
20
21
  *
21
22
  * It formats values as the chart tier does. The boundary comes from `input.md`: Input's
22
23
  * `onChange` returns a string for every `type`, including `number`. Once the app holds
@@ -54,6 +55,17 @@ export interface NumberFormat extends Omit<ValueFormat, 'style' | 'granularity'>
54
55
  style?: Exclude<ValueFormat['style'], 'date' | 'compact'> // 'decimal' | 'percent' | 'currency'
55
56
  }
56
57
 
58
+ /**
59
+ * The steppers' names, the localization seam. Partial: an omitted name keeps React Aria's, which
60
+ * React Aria says in the page's locale with the field's label after it ("Increase Seats").
61
+ */
62
+ export interface NumberInputMessages {
63
+ /** The step-up button's name. */
64
+ increment?: string
65
+ /** The step-down button's name. */
66
+ decrement?: string
67
+ }
68
+
57
69
  export interface NumberInputProps {
58
70
  /** `null` is the empty field. */
59
71
  value?: number | null
@@ -88,6 +100,8 @@ export interface NumberInputProps {
88
100
  id?: string
89
101
  /** Posts the **plain number** on a hidden input, never the formatted text. */
90
102
  name?: string
103
+ /** The steppers' names in the host's words. */
104
+ messages?: NumberInputMessages
91
105
  /** Wired by FormField; set directly only when there is no visible label. */
92
106
  'aria-label'?: string
93
107
  'aria-labelledby'?: string
@@ -137,6 +151,7 @@ export function NumberInput({
137
151
  invalid = false,
138
152
  id,
139
153
  name,
154
+ messages,
140
155
  'aria-label': ariaLabel,
141
156
  'aria-labelledby': labelledBy,
142
157
  'aria-describedby': describedBy,
@@ -189,6 +204,9 @@ export function NumberInput({
189
204
  : (event: FocusEvent<Element>) => onFocus(event as FocusEvent<HTMLInputElement>),
190
205
  /* Disables the wheel. The spec names this prop so the choice is documented. */
191
206
  isWheelDisabled: true,
207
+ /* A host's names only: absent, React Aria names each stepper in the page's locale. */
208
+ incrementAriaLabel: messages?.increment,
209
+ decrementAriaLabel: messages?.decrement,
192
210
  'aria-label': ariaLabel,
193
211
  'aria-labelledby': labelledBy,
194
212
  'aria-describedby': describedBy,
@@ -24,7 +24,7 @@ import { Input } from './Input'
24
24
  import styles from '@polymorph/recipes/controls/phone-input.module.css'
25
25
 
26
26
  /**
27
- * A phone number, reported as one E.164 string (`design/components/phone-input.md`).
27
+ * A phone number as one E.164 string (`design/components/phone-input.md`).
28
28
  *
29
29
  * The reader chooses a country, which gives the calling code, and types the national number. It
30
30
  * is a Combobox for the country and an Input for the number in one group. The engine's phone
@@ -42,7 +42,7 @@ export interface PhoneInputMessages {
42
42
  country?: string
43
43
  /** The country list button's name. Default: `Show countries`. */
44
44
  showCountries?: string
45
- /** Announced while the list is open. Default: `{count} countries`. */
45
+ /** Announced while the list is open. Default: `{count} countries`, `1 country` for one. */
46
46
  countriesShown?: (count: number) => string
47
47
  /** The list's one row when nothing matches the typed text. Default: `No matching country`. */
48
48
  noCountry?: string
@@ -51,7 +51,7 @@ export interface PhoneInputMessages {
51
51
  const MESSAGES = {
52
52
  country: 'Country calling code',
53
53
  showCountries: 'Show countries',
54
- countriesShown: (count: number) => `${count} countries`,
54
+ countriesShown: (count: number) => (count === 1 ? '1 country' : `${count} countries`),
55
55
  noCountry: 'No matching country',
56
56
  } satisfies Required<PhoneInputMessages>
57
57
 
@@ -1,7 +1,7 @@
1
1
  'use client'
2
2
 
3
3
  import * as SelectPrimitive from '@radix-ui/react-select'
4
- import { useEffect, useId, useRef, useState, type KeyboardEvent } from 'react'
4
+ import { useCallback, useEffect, useId, useRef, useState, type KeyboardEvent } from 'react'
5
5
  import { useListBox, useListBoxSection, useOption } from 'react-aria'
6
6
  import {
7
7
  Item,
@@ -15,6 +15,7 @@ import {
15
15
 
16
16
  import {
17
17
  type ControlSize,
18
+ fieldLabelIds,
18
19
  Icon,
19
20
  memberAttr,
20
21
  useAgentMember,
@@ -81,7 +82,12 @@ export interface SelectProps {
81
82
  emptyOption?: string
82
83
  invalid?: boolean
83
84
  disabled?: boolean
84
- /** `null` is the empty choice, which is allowed only when `emptyOption` is set. */
85
+ /**
86
+ * The chosen option's value. Controlled when given. `null` is nothing chosen: the trigger
87
+ * shows the placeholder, or the empty choice when `emptyOption` is set. A caller clears the
88
+ * choice with `null`, because `undefined` is no value, which hands the choice back to the
89
+ * member.
90
+ */
85
91
  value?: string | null
86
92
  defaultValue?: string | null
87
93
  onChange?: (value: string | null) => void
@@ -169,10 +175,16 @@ export function Select({
169
175
  'Select: `placeholder` and `emptyOption` are mutually exclusive — a placeholder is the ' +
170
176
  'absence of a value and the empty choice is one. `emptyOption` wins; drop the placeholder.',
171
177
  )
178
+ // Whether the caller has passed a value since the member mounted. React reads `undefined` as
179
+ // "uncontrolled", so a caller that held a value and then passes `undefined` hands the choice
180
+ // back to the member, which shows its own last pick: a form that resets to `undefined` keeps
181
+ // showing the old choice. The warning names `null`, which clears it.
182
+ const [held, setHeld] = useState(value !== undefined)
183
+ if (value !== undefined && !held) setHeld(true)
172
184
  useDevWarning(
173
- !offersEmpty && (value === null || defaultValue === null),
174
- 'Select: `null` means the empty choice, which exists only when `emptyOption` is set. ' +
175
- 'Give the empty choice a label, or pass one of `options`.',
185
+ held && value === undefined,
186
+ 'Select: `value` went from a value to `undefined`, which hands the choice back to the ' +
187
+ 'member, and it keeps showing its last pick. Pass `null` to clear the choice.',
176
188
  )
177
189
 
178
190
  // The empty choice is always the first item. Screens cannot reorder it, so every
@@ -194,18 +206,10 @@ export function Select({
194
206
  // Radix is always controlled by the member's value: by `value` when the caller gives it, and
195
207
  // by the mirror when not. So one setter changes the value in both forms, for a person's pick
196
208
  // and for an agent's `choose`, and crossing the `30rem` breakpoint, which remounts the other
197
- // version, keeps the current selection. A controlled `null` is the empty choice. An
198
- // uncontrolled one is too when `emptyOption` is set, because a filter that opens with a blank
199
- // trigger is the bug the empty choice prevents; without it, it is Radix's `''`, nothing chosen,
200
- // so the placeholder shows.
201
- const radixValue =
202
- value !== undefined
203
- ? (value ?? EMPTY_CHOICE)
204
- : chosen === null
205
- ? offersEmpty
206
- ? EMPTY_CHOICE
207
- : ''
208
- : chosen
209
+ // version, keeps the current selection. `null`, controlled or not, is nothing chosen. With
210
+ // `emptyOption` set it is the empty choice, because a filter that opens with a blank trigger is
211
+ // the bug the empty choice prevents; without it, it is Radix's `''`, so the placeholder shows.
212
+ const radixValue = selected === null ? (offersEmpty ? EMPTY_CHOICE : '') : selected
209
213
 
210
214
  /**
211
215
  * Open state is always mirrored here, as in ContextMenu. The root is always controlled,
@@ -224,6 +228,24 @@ export function Select({
224
228
  const generatedId = useId()
225
229
  const listboxId = `${generatedId}-listbox`
226
230
 
231
+ /**
232
+ * The list's name, in the popper and in the sheet, is the field's own: `aria-labelledby`,
233
+ * else `aria-label`, else the labels that name the trigger. A `<label for>` names the
234
+ * trigger alone, as FormField's label does, so the list refers to those labels by id
235
+ * (`fieldLabelIds`), read once the list is in the document, each time it opens. Radix names
236
+ * its list from nothing, so the popper's takes the name as props, which Radix sets on it.
237
+ */
238
+ const unnamed = ariaLabel === undefined && labelledBy === undefined
239
+ const [fieldLabels, setFieldLabels] = useState<string>()
240
+ const readLabels = useCallback(
241
+ (list: HTMLElement | null) => {
242
+ if (list !== null && unnamed) setFieldLabels(fieldLabelIds(triggerRef.current, generatedId))
243
+ },
244
+ [unnamed, generatedId],
245
+ )
246
+ const listLabel = labelledBy === undefined ? ariaLabel : undefined
247
+ const listLabelledBy = unnamed ? fieldLabels : labelledBy
248
+
227
249
  /**
228
250
  * Focus returns to the trigger whenever the sheet closes (Escape, the scrim, or a
229
251
  * selection), as Radix does for the popper. Only this member restores focus (sheet.tsx
@@ -291,10 +313,10 @@ export function Select({
291
313
  if (sheeting) {
292
314
  // The trigger shows a real value whenever an item is selected, including the empty
293
315
  // choice, because "All" is a chosen state, not a missing value. `data-placeholder`
294
- // matches Radix's rule exactly: present only while no item is selected, which never
316
+ // follows Radix's rule exactly: present while Radix's value would be `''`, which never
295
317
  // happens when an empty choice is offered.
296
- const shownOption = flat.find((option) => option.value === (selected ?? EMPTY_CHOICE))
297
- const placeholderShown = shownOption === undefined && selected === null
318
+ const shownOption = flat.find((option) => option.value === radixValue)
319
+ const placeholderShown = radixValue === ''
298
320
 
299
321
  // Closing only sets state. The effect above restores focus after the containment
300
322
  // is released.
@@ -358,8 +380,9 @@ export function Select({
358
380
  offersEmpty={offersEmpty}
359
381
  size={size}
360
382
  id={listboxId}
361
- label={ariaLabel}
362
- labelledBy={labelledBy}
383
+ label={listLabel}
384
+ labelledBy={listLabelledBy}
385
+ onList={readLabels}
363
386
  onPick={(reported) => {
364
387
  // As in Radix, choosing the current value closes without reporting a
365
388
  // change.
@@ -418,6 +441,9 @@ export function Select({
418
441
  hairline gap, deliberately not a density-scaled token. It keeps the panel's
419
442
  border from merging with the trigger's into one double-thickness line. */}
420
443
  <SelectPrimitive.Content
444
+ ref={readLabels}
445
+ aria-label={listLabel}
446
+ aria-labelledby={listLabelledBy}
421
447
  className={styles.content}
422
448
  position="popper"
423
449
  side="bottom"
@@ -482,6 +508,7 @@ function SelectSheetList({
482
508
  id,
483
509
  label,
484
510
  labelledBy,
511
+ onList,
485
512
  onPick,
486
513
  }: {
487
514
  items: (SelectOption | SelectOptionGroup)[]
@@ -491,9 +518,18 @@ function SelectSheetList({
491
518
  id: string
492
519
  label: string | undefined
493
520
  labelledBy: string | undefined
521
+ /** Called with the list once it is in the document, and with `null` once it leaves. */
522
+ onList: (list: HTMLUListElement | null) => void
494
523
  onPick: (reported: string | null) => void
495
524
  }) {
496
525
  const listRef = useRef<HTMLUListElement>(null)
526
+ const attachList = useCallback(
527
+ (node: HTMLUListElement | null) => {
528
+ listRef.current = node
529
+ onList(node)
530
+ },
531
+ [onList],
532
+ )
497
533
  const emptyKey = useId()
498
534
 
499
535
  const keyFor = (optionValue: string): string =>
@@ -557,7 +593,7 @@ function SelectSheetList({
557
593
  return (
558
594
  <ul
559
595
  {...listBoxProps}
560
- ref={listRef}
596
+ ref={attachList}
561
597
  className={styles.sheetList}
562
598
  data-size={size}
563
599
  {...memberAttr('Select')}
@@ -28,13 +28,13 @@ import { MotionPresence, MotionSurface } from '@polymorph/react/motion'
28
28
  import styles from '@polymorph/recipes/controls/tag-input.module.css'
29
29
 
30
30
  /**
31
- * Free-text entry of several values, shown as chips (`design/components/tag-input.md`).
31
+ * Free-text tags (`design/components/tag-input.md`).
32
32
  *
33
- * Typical uses are emails to invite and labels to attach. There is no substrate: it is
34
- * an Input-styled container holding a list of chips and one real `<input>`. The
35
- * component is mostly its commit rules (what counts as a tag, what happens to a
36
- * duplicate, what Backspace removes). Those are design decisions, not behaviour a library
37
- * could supply.
33
+ * It takes several values, each typed and shown as a chip. Typical uses are emails to invite
34
+ * and labels to attach. There is no substrate: it is an Input-styled container holding a list
35
+ * of chips and one real `<input>`. The component is mostly its commit rules (what counts as a
36
+ * tag, what happens to a duplicate, what Backspace removes). Those are design decisions, not
37
+ * behaviour a library could supply.
38
38
  *
39
39
  * Choosing from a closed list is Combobox's job. This member never suggests values.
40
40
  * Every value in it was typed.
@@ -49,6 +49,19 @@ function trimNonEmpty(raw: string): string | null {
49
49
  return tag === '' ? null : tag
50
50
  }
51
51
 
52
+ /**
53
+ * The count sentence, given how many tags the field holds, its `max`, and whether it holds
54
+ * that many (`atMax`, resolved by the member). A function, not two words, because the plural
55
+ * and the order of the words belong to the catalog.
56
+ */
57
+ export type TagInputCountLabel = (tags: { count: number; max?: number; atMax: boolean }) => string
58
+
59
+ /**
60
+ * The sentence announced when a tag is removed, given the tag and how many tags remain. A
61
+ * named type because the cards print the name in fewer characters than the signature.
62
+ */
63
+ export type TagInputRemovedLabel = (tag: string, count: number) => string
64
+
52
65
  export interface TagInputProps {
53
66
  value?: string[]
54
67
  defaultValue?: string[]
@@ -84,6 +97,16 @@ export interface TagInputProps {
84
97
  * `Remove {tag}`.
85
98
  */
86
99
  removeLabel?: (tag: string) => string
100
+ /**
101
+ * The count sentence in the host's words, part of the field's description, the localization
102
+ * seam; the default is `{count} added`, or `Maximum of {max} added` at the maximum.
103
+ */
104
+ countLabel?: TagInputCountLabel
105
+ /**
106
+ * What a removal announces in the host's words, the localization seam; the default is
107
+ * `{tag} removed, {count} remain`, and `{tag} removed, 1 remains` when one tag remains.
108
+ */
109
+ removedLabel?: TagInputRemovedLabel
87
110
  /** Wired by FormField; set directly only when there is no visible label. */
88
111
  'aria-label'?: string
89
112
  'aria-labelledby'?: string
@@ -93,6 +116,12 @@ export interface TagInputProps {
93
116
 
94
117
  const defaultRemoveLabel = (tag: string) => `Remove ${tag}`
95
118
 
119
+ const defaultCountLabel: TagInputCountLabel = ({ count, max, atMax }) =>
120
+ atMax ? `Maximum of ${max} added` : `${count} added`
121
+
122
+ const defaultRemovedLabel: TagInputRemovedLabel = (tag, count) =>
123
+ count === 1 ? `${tag} removed, 1 remains` : `${tag} removed, ${count} remain`
124
+
96
125
  export function TagInput({
97
126
  value,
98
127
  defaultValue,
@@ -107,6 +136,8 @@ export function TagInput({
107
136
  name,
108
137
  id,
109
138
  removeLabel = defaultRemoveLabel,
139
+ countLabel = defaultCountLabel,
140
+ removedLabel = defaultRemovedLabel,
110
141
  'aria-label': ariaLabel,
111
142
  'aria-labelledby': labelledBy,
112
143
  'aria-describedby': describedBy,
@@ -214,7 +245,7 @@ export function TagInput({
214
245
  flushSync(() => setRemoving(tag))
215
246
  setRemoving(null)
216
247
  commit(values.filter((value) => value !== tag))
217
- setAnnouncement(`${tag} removed, ${values.length - 1} remain`)
248
+ setAnnouncement(removedLabel(tag, values.length - 1))
218
249
 
219
250
  // Focus moves to the chip that took its place, or back to the field. Never to
220
251
  // `<body>`, which is where focus goes by default when a focused button is removed.
@@ -420,14 +451,16 @@ export function TagInput({
420
451
  * associations while a screen-reader user is in it.
421
452
  *
422
453
  * `Maximum of N added` is derived from `max`, so the announced number is the number
423
- * the field enforces. There is no second copy of the maximum to go out of sync.
454
+ * the field enforces. There is no second copy of the maximum to go out of sync. The
455
+ * words are the host's from `countLabel`.
424
456
  */}
425
457
  <span className={styles.reader} id={countId}>
426
- {atMax ? `Maximum of ${max} added` : `${values.length} added`}
458
+ {countLabel({ count: values.length, max, atMax })}
427
459
  </span>
428
460
 
429
461
  {/* Removals are announced because screen-reader users cannot see them happen:
430
- the chip is gone, and so is the focus that was on it. */}
462
+ the chip is gone, and so is the focus that was on it. The words are the host's
463
+ from `removedLabel`. */}
431
464
  <span className={styles.reader} aria-live="polite">
432
465
  {announcement}
433
466
  </span>
@@ -31,6 +31,12 @@ import styles from '@polymorph/recipes/controls/time-input.module.css'
31
31
  * nothing, which would mislead users.
32
32
  */
33
33
 
34
+ /** The one word the field says that `Intl` cannot supply, localizable by passing (WCAG 3.1.2). */
35
+ export interface TimeInputMessages {
36
+ /** What an unfilled segment says as its value. Without `messages`, React Aria's `Empty`. */
37
+ empty: string
38
+ }
39
+
34
40
  export interface TimeInputProps {
35
41
  /**
36
42
  * `@internationalized/date`'s `Time`: a plain time of day with no date and no time
@@ -62,6 +68,8 @@ export interface TimeInputProps {
62
68
  /** Serializes the ISO-8601 time in `Time`'s own format, such as `"09:30:00"`. */
63
69
  name?: string
64
70
  id?: string
71
+ /** Defaults to generic English (`Empty`). Localized hosts pass strings from their catalog. */
72
+ messages?: TimeInputMessages
65
73
  /** Wired by FormField; set directly only when there is no visible label. */
66
74
  'aria-label'?: string
67
75
  'aria-labelledby'?: string
@@ -103,6 +111,7 @@ function TimeField({
103
111
  invalid = false,
104
112
  name,
105
113
  id,
114
+ messages,
106
115
  'aria-label': ariaLabel,
107
116
  'aria-labelledby': labelledBy,
108
117
  'aria-describedby': describedBy,
@@ -194,6 +203,7 @@ function TimeField({
194
203
  state={state}
195
204
  disabled={disabled}
196
205
  styles={segmentStyles}
206
+ empty={messages?.empty}
197
207
  />
198
208
  ))}
199
209
  </div>
@@ -37,20 +37,31 @@ export interface SegmentStyles {
37
37
  * omission. `useDateFieldState` clamps each segment to its calendar's range as it is typed, so a
38
38
  * `31` in February is never entered and no segment is ever invalid on its own. Only the value can
39
39
  * be wrong, and the value carries `data-invalid`.
40
+ *
41
+ * `empty` is what an unfilled segment says as its value, where the host gives a word for it.
42
+ * Without one, the segment says React Aria's word, which React Aria says in the page's locale.
43
+ * A segment React Aria draws with no value text (a text box on iOS, which VoiceOver cannot focus
44
+ * as a spinbutton) keeps none.
40
45
  */
41
46
  export function Segment({
42
47
  segment,
43
48
  state,
44
49
  disabled,
45
50
  styles,
51
+ empty,
46
52
  }: {
47
53
  segment: DateSegment
48
54
  state: DateFieldState
49
55
  disabled: boolean
50
56
  styles: SegmentStyles
57
+ empty?: string
51
58
  }) {
52
59
  const ref = useRef<HTMLDivElement>(null)
53
60
  const { segmentProps } = useDateSegment(segment, state, ref)
61
+ const said =
62
+ empty !== undefined && segment.isPlaceholder && segmentProps['aria-valuetext'] != null
63
+ ? { 'aria-valuetext': empty }
64
+ : {}
54
65
 
55
66
  if (segment.type === 'literal') {
56
67
  return (
@@ -63,6 +74,7 @@ export function Segment({
63
74
  return (
64
75
  <div
65
76
  {...segmentProps}
77
+ {...said}
66
78
  ref={ref}
67
79
  className={styles.segment}
68
80
  data-segment={segment.type}
@@ -89,12 +101,15 @@ export function DateSegments({
89
101
  size,
90
102
  disabled,
91
103
  styles,
104
+ empty,
92
105
  }: {
93
106
  fieldProps: Parameters<typeof useDateField>[0]
94
107
  locale: string
95
108
  size: ControlSize
96
109
  disabled: boolean
97
110
  styles: SegmentStyles
111
+ /** What an unfilled segment says as its value, where the host gives it (`Segment`). */
112
+ empty?: string
98
113
  }) {
99
114
  const ref = useRef<HTMLDivElement>(null)
100
115
  const state = useDateFieldState({ ...fieldProps, locale, createCalendar })
@@ -109,6 +124,7 @@ export function DateSegments({
109
124
  state={state}
110
125
  disabled={disabled}
111
126
  styles={styles}
127
+ empty={empty}
112
128
  />
113
129
  ))}
114
130
  {inputProps.name == null ? null : <input {...inputProps} />}
@@ -64,6 +64,19 @@ export const states: ComponentStates = {
64
64
  render: () => <Select options={PRIORITIES} defaultValue="high" aria-label="Priority" />,
65
65
  expect: { 'data-placeholder': null },
66
66
  },
67
+ {
68
+ // `null` held by the application is nothing chosen, so the placeholder shows.
69
+ name: 'nothing chosen, held as null',
70
+ render: () => (
71
+ <Select
72
+ options={PRIORITIES}
73
+ placeholder="Choose a priority"
74
+ value={null}
75
+ aria-label="Priority"
76
+ />
77
+ ),
78
+ expect: { 'data-placeholder': '' },
79
+ },
67
80
  {
68
81
  name: 'sizes side by side',
69
82
  render: () => (