@shware/workflow-ui 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +180 -2
  3. package/dist/assets/iphone-17-pro-DzaacWSl.png +0 -0
  4. package/dist/assets/pixel-10-pro-back-7MDj1_lz.webp +0 -0
  5. package/dist/assets/pixel-10-pro-mask-Bi1deQ9Y.webp +0 -0
  6. package/dist/cli.d.mts +1 -0
  7. package/dist/cli.mjs +673 -0
  8. package/dist/cli.mjs.map +1 -0
  9. package/dist/config.d.mts +247 -0
  10. package/dist/config.d.mts.map +1 -0
  11. package/dist/config.mjs +27 -0
  12. package/dist/config.mjs.map +1 -0
  13. package/dist/index.d.mts +451 -0
  14. package/dist/index.d.mts.map +1 -0
  15. package/dist/index.mjs +2722 -0
  16. package/dist/index.mjs.map +1 -0
  17. package/dist/postgres.d.mts +34 -0
  18. package/dist/postgres.d.mts.map +1 -0
  19. package/dist/postgres.mjs +313 -0
  20. package/dist/postgres.mjs.map +1 -0
  21. package/package.json +93 -3
  22. package/src/app/assets/devices/iphone-17-pro.png +0 -0
  23. package/src/app/assets/devices/pixel-10-pro-back.webp +0 -0
  24. package/src/app/assets/devices/pixel-10-pro-mask.webp +0 -0
  25. package/src/app/assets/flags/AC.svg +1 -0
  26. package/src/app/assets/flags/AD.svg +1 -0
  27. package/src/app/assets/flags/AE.svg +1 -0
  28. package/src/app/assets/flags/AF.svg +1 -0
  29. package/src/app/assets/flags/AG.svg +1 -0
  30. package/src/app/assets/flags/AI.svg +1 -0
  31. package/src/app/assets/flags/AL.svg +1 -0
  32. package/src/app/assets/flags/AM.svg +1 -0
  33. package/src/app/assets/flags/AO.svg +1 -0
  34. package/src/app/assets/flags/AQ.svg +1 -0
  35. package/src/app/assets/flags/AR.svg +1 -0
  36. package/src/app/assets/flags/AS.svg +1 -0
  37. package/src/app/assets/flags/AT.svg +1 -0
  38. package/src/app/assets/flags/AU.svg +1 -0
  39. package/src/app/assets/flags/AW.svg +1 -0
  40. package/src/app/assets/flags/AX.svg +1 -0
  41. package/src/app/assets/flags/AZ.svg +1 -0
  42. package/src/app/assets/flags/BA.svg +1 -0
  43. package/src/app/assets/flags/BB.svg +1 -0
  44. package/src/app/assets/flags/BD.svg +1 -0
  45. package/src/app/assets/flags/BE.svg +1 -0
  46. package/src/app/assets/flags/BF.svg +1 -0
  47. package/src/app/assets/flags/BG.svg +1 -0
  48. package/src/app/assets/flags/BH.svg +1 -0
  49. package/src/app/assets/flags/BI.svg +1 -0
  50. package/src/app/assets/flags/BJ.svg +1 -0
  51. package/src/app/assets/flags/BL.svg +1 -0
  52. package/src/app/assets/flags/BM.svg +1 -0
  53. package/src/app/assets/flags/BN.svg +1 -0
  54. package/src/app/assets/flags/BO.svg +1 -0
  55. package/src/app/assets/flags/BQ-BO.svg +1 -0
  56. package/src/app/assets/flags/BQ-SA.svg +1 -0
  57. package/src/app/assets/flags/BQ-SE.svg +1 -0
  58. package/src/app/assets/flags/BQ.svg +1 -0
  59. package/src/app/assets/flags/BR.svg +1 -0
  60. package/src/app/assets/flags/BS.svg +1 -0
  61. package/src/app/assets/flags/BT.svg +1 -0
  62. package/src/app/assets/flags/BV.svg +1 -0
  63. package/src/app/assets/flags/BW.svg +1 -0
  64. package/src/app/assets/flags/BY.svg +1 -0
  65. package/src/app/assets/flags/BZ.svg +1 -0
  66. package/src/app/assets/flags/CA.svg +1 -0
  67. package/src/app/assets/flags/CC.svg +1 -0
  68. package/src/app/assets/flags/CD.svg +1 -0
  69. package/src/app/assets/flags/CF.svg +1 -0
  70. package/src/app/assets/flags/CG.svg +1 -0
  71. package/src/app/assets/flags/CH.svg +1 -0
  72. package/src/app/assets/flags/CI.svg +1 -0
  73. package/src/app/assets/flags/CK.svg +1 -0
  74. package/src/app/assets/flags/CL.svg +1 -0
  75. package/src/app/assets/flags/CM.svg +1 -0
  76. package/src/app/assets/flags/CN.svg +1 -0
  77. package/src/app/assets/flags/CO.svg +1 -0
  78. package/src/app/assets/flags/CR.svg +1 -0
  79. package/src/app/assets/flags/CU.svg +1 -0
  80. package/src/app/assets/flags/CV.svg +1 -0
  81. package/src/app/assets/flags/CW.svg +1 -0
  82. package/src/app/assets/flags/CX.svg +1 -0
  83. package/src/app/assets/flags/CY.svg +1 -0
  84. package/src/app/assets/flags/CZ.svg +1 -0
  85. package/src/app/assets/flags/DE.svg +1 -0
  86. package/src/app/assets/flags/DJ.svg +1 -0
  87. package/src/app/assets/flags/DK.svg +1 -0
  88. package/src/app/assets/flags/DM.svg +1 -0
  89. package/src/app/assets/flags/DO.svg +1 -0
  90. package/src/app/assets/flags/DZ.svg +1 -0
  91. package/src/app/assets/flags/EC.svg +1 -0
  92. package/src/app/assets/flags/EE.svg +1 -0
  93. package/src/app/assets/flags/EG.svg +1 -0
  94. package/src/app/assets/flags/EH.svg +1 -0
  95. package/src/app/assets/flags/ER.svg +1 -0
  96. package/src/app/assets/flags/ES-CT.svg +1 -0
  97. package/src/app/assets/flags/ES.svg +1 -0
  98. package/src/app/assets/flags/ET.svg +1 -0
  99. package/src/app/assets/flags/EU.svg +1 -0
  100. package/src/app/assets/flags/FI.svg +1 -0
  101. package/src/app/assets/flags/FJ.svg +1 -0
  102. package/src/app/assets/flags/FK.svg +1 -0
  103. package/src/app/assets/flags/FM.svg +1 -0
  104. package/src/app/assets/flags/FO.svg +1 -0
  105. package/src/app/assets/flags/FR.svg +1 -0
  106. package/src/app/assets/flags/GA.svg +1 -0
  107. package/src/app/assets/flags/GB-ENG.svg +1 -0
  108. package/src/app/assets/flags/GB-NIR.svg +1 -0
  109. package/src/app/assets/flags/GB-SCT.svg +1 -0
  110. package/src/app/assets/flags/GB-WLS.svg +1 -0
  111. package/src/app/assets/flags/GB.svg +1 -0
  112. package/src/app/assets/flags/GD.svg +1 -0
  113. package/src/app/assets/flags/GE.svg +1 -0
  114. package/src/app/assets/flags/GF.svg +1 -0
  115. package/src/app/assets/flags/GG.svg +1 -0
  116. package/src/app/assets/flags/GH.svg +1 -0
  117. package/src/app/assets/flags/GI.svg +1 -0
  118. package/src/app/assets/flags/GL.svg +1 -0
  119. package/src/app/assets/flags/GM.svg +1 -0
  120. package/src/app/assets/flags/GN.svg +1 -0
  121. package/src/app/assets/flags/GP.svg +1 -0
  122. package/src/app/assets/flags/GQ.svg +1 -0
  123. package/src/app/assets/flags/GR.svg +1 -0
  124. package/src/app/assets/flags/GS.svg +1 -0
  125. package/src/app/assets/flags/GT.svg +1 -0
  126. package/src/app/assets/flags/GU.svg +1 -0
  127. package/src/app/assets/flags/GW.svg +1 -0
  128. package/src/app/assets/flags/GY.svg +1 -0
  129. package/src/app/assets/flags/HK.svg +1 -0
  130. package/src/app/assets/flags/HM.svg +1 -0
  131. package/src/app/assets/flags/HN.svg +1 -0
  132. package/src/app/assets/flags/HR.svg +1 -0
  133. package/src/app/assets/flags/HT.svg +1 -0
  134. package/src/app/assets/flags/HU.svg +1 -0
  135. package/src/app/assets/flags/IC.svg +1 -0
  136. package/src/app/assets/flags/ID.svg +1 -0
  137. package/src/app/assets/flags/IE.svg +1 -0
  138. package/src/app/assets/flags/IL.svg +1 -0
  139. package/src/app/assets/flags/IM.svg +1 -0
  140. package/src/app/assets/flags/IN.svg +1 -0
  141. package/src/app/assets/flags/IO.svg +1 -0
  142. package/src/app/assets/flags/IQ.svg +1 -0
  143. package/src/app/assets/flags/IR.svg +1 -0
  144. package/src/app/assets/flags/IS.svg +1 -0
  145. package/src/app/assets/flags/IT.svg +1 -0
  146. package/src/app/assets/flags/JE.svg +1 -0
  147. package/src/app/assets/flags/JM.svg +1 -0
  148. package/src/app/assets/flags/JO.svg +1 -0
  149. package/src/app/assets/flags/JP.svg +1 -0
  150. package/src/app/assets/flags/KE.svg +1 -0
  151. package/src/app/assets/flags/KG.svg +1 -0
  152. package/src/app/assets/flags/KH.svg +1 -0
  153. package/src/app/assets/flags/KI.svg +1 -0
  154. package/src/app/assets/flags/KM.svg +1 -0
  155. package/src/app/assets/flags/KN.svg +1 -0
  156. package/src/app/assets/flags/KP.svg +1 -0
  157. package/src/app/assets/flags/KR.svg +1 -0
  158. package/src/app/assets/flags/KW.svg +1 -0
  159. package/src/app/assets/flags/KY.svg +1 -0
  160. package/src/app/assets/flags/KZ.svg +1 -0
  161. package/src/app/assets/flags/LA.svg +1 -0
  162. package/src/app/assets/flags/LB.svg +1 -0
  163. package/src/app/assets/flags/LC.svg +1 -0
  164. package/src/app/assets/flags/LI.svg +1 -0
  165. package/src/app/assets/flags/LK.svg +1 -0
  166. package/src/app/assets/flags/LR.svg +1 -0
  167. package/src/app/assets/flags/LS.svg +1 -0
  168. package/src/app/assets/flags/LT.svg +1 -0
  169. package/src/app/assets/flags/LU.svg +1 -0
  170. package/src/app/assets/flags/LV.svg +1 -0
  171. package/src/app/assets/flags/LY.svg +1 -0
  172. package/src/app/assets/flags/MA.svg +1 -0
  173. package/src/app/assets/flags/MC.svg +1 -0
  174. package/src/app/assets/flags/MD.svg +1 -0
  175. package/src/app/assets/flags/ME.svg +1 -0
  176. package/src/app/assets/flags/MF.svg +1 -0
  177. package/src/app/assets/flags/MG.svg +1 -0
  178. package/src/app/assets/flags/MH.svg +1 -0
  179. package/src/app/assets/flags/MK.svg +1 -0
  180. package/src/app/assets/flags/ML.svg +1 -0
  181. package/src/app/assets/flags/MM.svg +1 -0
  182. package/src/app/assets/flags/MN.svg +1 -0
  183. package/src/app/assets/flags/MO.svg +1 -0
  184. package/src/app/assets/flags/MP.svg +1 -0
  185. package/src/app/assets/flags/MQ.svg +1 -0
  186. package/src/app/assets/flags/MR.svg +1 -0
  187. package/src/app/assets/flags/MS.svg +1 -0
  188. package/src/app/assets/flags/MT.svg +1 -0
  189. package/src/app/assets/flags/MU.svg +1 -0
  190. package/src/app/assets/flags/MV.svg +1 -0
  191. package/src/app/assets/flags/MW.svg +1 -0
  192. package/src/app/assets/flags/MX.svg +1 -0
  193. package/src/app/assets/flags/MY.svg +1 -0
  194. package/src/app/assets/flags/MZ.svg +1 -0
  195. package/src/app/assets/flags/NA.svg +1 -0
  196. package/src/app/assets/flags/NC.svg +1 -0
  197. package/src/app/assets/flags/NE.svg +1 -0
  198. package/src/app/assets/flags/NF.svg +1 -0
  199. package/src/app/assets/flags/NG.svg +1 -0
  200. package/src/app/assets/flags/NI.svg +1 -0
  201. package/src/app/assets/flags/NL.svg +1 -0
  202. package/src/app/assets/flags/NO.svg +1 -0
  203. package/src/app/assets/flags/NP.svg +1 -0
  204. package/src/app/assets/flags/NR.svg +1 -0
  205. package/src/app/assets/flags/NU.svg +1 -0
  206. package/src/app/assets/flags/NZ.svg +1 -0
  207. package/src/app/assets/flags/OM.svg +1 -0
  208. package/src/app/assets/flags/PA.svg +1 -0
  209. package/src/app/assets/flags/PE.svg +1 -0
  210. package/src/app/assets/flags/PF.svg +1 -0
  211. package/src/app/assets/flags/PG.svg +1 -0
  212. package/src/app/assets/flags/PH.svg +1 -0
  213. package/src/app/assets/flags/PK.svg +1 -0
  214. package/src/app/assets/flags/PL.svg +1 -0
  215. package/src/app/assets/flags/PM.svg +1 -0
  216. package/src/app/assets/flags/PN.svg +1 -0
  217. package/src/app/assets/flags/PR.svg +1 -0
  218. package/src/app/assets/flags/PS.svg +1 -0
  219. package/src/app/assets/flags/PT.svg +1 -0
  220. package/src/app/assets/flags/PW.svg +1 -0
  221. package/src/app/assets/flags/PY.svg +1 -0
  222. package/src/app/assets/flags/QA.svg +1 -0
  223. package/src/app/assets/flags/RE.svg +1 -0
  224. package/src/app/assets/flags/README.md +6 -0
  225. package/src/app/assets/flags/RO.svg +1 -0
  226. package/src/app/assets/flags/RS.svg +1 -0
  227. package/src/app/assets/flags/RU.svg +1 -0
  228. package/src/app/assets/flags/RW.svg +1 -0
  229. package/src/app/assets/flags/SA.svg +1 -0
  230. package/src/app/assets/flags/SB.svg +1 -0
  231. package/src/app/assets/flags/SC.svg +1 -0
  232. package/src/app/assets/flags/SD.svg +1 -0
  233. package/src/app/assets/flags/SE.svg +1 -0
  234. package/src/app/assets/flags/SG.svg +1 -0
  235. package/src/app/assets/flags/SH.svg +1 -0
  236. package/src/app/assets/flags/SI.svg +1 -0
  237. package/src/app/assets/flags/SJ.svg +1 -0
  238. package/src/app/assets/flags/SK.svg +1 -0
  239. package/src/app/assets/flags/SL.svg +1 -0
  240. package/src/app/assets/flags/SM.svg +1 -0
  241. package/src/app/assets/flags/SN.svg +1 -0
  242. package/src/app/assets/flags/SO.svg +1 -0
  243. package/src/app/assets/flags/SR.svg +1 -0
  244. package/src/app/assets/flags/SS.svg +1 -0
  245. package/src/app/assets/flags/ST.svg +1 -0
  246. package/src/app/assets/flags/SV.svg +1 -0
  247. package/src/app/assets/flags/SX.svg +1 -0
  248. package/src/app/assets/flags/SY.svg +1 -0
  249. package/src/app/assets/flags/SZ.svg +1 -0
  250. package/src/app/assets/flags/TA.svg +1 -0
  251. package/src/app/assets/flags/TC.svg +1 -0
  252. package/src/app/assets/flags/TD.svg +1 -0
  253. package/src/app/assets/flags/TF.svg +1 -0
  254. package/src/app/assets/flags/TG.svg +1 -0
  255. package/src/app/assets/flags/TH.svg +1 -0
  256. package/src/app/assets/flags/TJ.svg +1 -0
  257. package/src/app/assets/flags/TK.svg +1 -0
  258. package/src/app/assets/flags/TL.svg +1 -0
  259. package/src/app/assets/flags/TM.svg +1 -0
  260. package/src/app/assets/flags/TN.svg +1 -0
  261. package/src/app/assets/flags/TO.svg +1 -0
  262. package/src/app/assets/flags/TR.svg +1 -0
  263. package/src/app/assets/flags/TT.svg +1 -0
  264. package/src/app/assets/flags/TV.svg +1 -0
  265. package/src/app/assets/flags/TW.svg +1 -0
  266. package/src/app/assets/flags/TZ.svg +1 -0
  267. package/src/app/assets/flags/UA.svg +1 -0
  268. package/src/app/assets/flags/UG.svg +1 -0
  269. package/src/app/assets/flags/UM.svg +1 -0
  270. package/src/app/assets/flags/US.svg +1 -0
  271. package/src/app/assets/flags/UY.svg +1 -0
  272. package/src/app/assets/flags/UZ.svg +1 -0
  273. package/src/app/assets/flags/VA.svg +1 -0
  274. package/src/app/assets/flags/VC.svg +1 -0
  275. package/src/app/assets/flags/VE.svg +1 -0
  276. package/src/app/assets/flags/VG.svg +1 -0
  277. package/src/app/assets/flags/VI.svg +1 -0
  278. package/src/app/assets/flags/VN.svg +1 -0
  279. package/src/app/assets/flags/VU.svg +1 -0
  280. package/src/app/assets/flags/WF.svg +1 -0
  281. package/src/app/assets/flags/WS.svg +1 -0
  282. package/src/app/assets/flags/XA.svg +1 -0
  283. package/src/app/assets/flags/XC.svg +1 -0
  284. package/src/app/assets/flags/XK.svg +1 -0
  285. package/src/app/assets/flags/XO.svg +1 -0
  286. package/src/app/assets/flags/YE.svg +1 -0
  287. package/src/app/assets/flags/YT.svg +1 -0
  288. package/src/app/assets/flags/ZA.svg +1 -0
  289. package/src/app/assets/flags/ZM.svg +1 -0
  290. package/src/app/assets/flags/ZW.svg +1 -0
  291. package/src/app/email-preview.ts +46 -0
  292. package/src/app/index.css +203 -0
  293. package/src/app/index.html +12 -0
  294. package/src/app/integrations/i18n/react-i18next.d.ts +11 -0
  295. package/src/app/integrations/i18n/root-provider.tsx +62 -0
  296. package/src/app/integrations/tanstack-query/devtools.tsx +6 -0
  297. package/src/app/integrations/tanstack-query/root-provider.tsx +37 -0
  298. package/src/app/integrations/theme/root-provider.tsx +75 -0
  299. package/src/app/integrations/toast/toast-provider.tsx +46 -0
  300. package/src/app/locales/en-US/common.ts +268 -0
  301. package/src/app/locales/zh-CN/common.ts +263 -0
  302. package/src/app/main.tsx +40 -0
  303. package/src/app/page-chrome.tsx +79 -0
  304. package/src/app/router.tsx +40 -0
  305. package/src/app/routes/__root.tsx +293 -0
  306. package/src/app/routes/emails.tsx +199 -0
  307. package/src/app/routes/home.tsx +87 -0
  308. package/src/app/routes/index.ts +19 -0
  309. package/src/app/routes/metrics.tsx +541 -0
  310. package/src/app/routes/segment-overview.tsx +211 -0
  311. package/src/app/routes/segments.tsx +236 -0
  312. package/src/app/routes/settings.tsx +90 -0
  313. package/src/app/routes/workflows.tsx +348 -0
  314. package/src/app/studio.ts +16 -0
  315. package/src/app/svg.d.ts +17 -0
  316. package/src/app/virtual-config.d.ts +6 -0
  317. package/src/cli.ts +110 -0
  318. package/src/components/avatar.tsx +57 -0
  319. package/src/components/breadcrumb.tsx +49 -0
  320. package/src/components/button/index.tsx +86 -0
  321. package/src/components/channel-icon.ts +39 -0
  322. package/src/components/chat-markup.tsx +109 -0
  323. package/src/components/corner-shape.ts +13 -0
  324. package/src/components/date-range.tsx +181 -0
  325. package/src/components/discord-preview.tsx +165 -0
  326. package/src/components/dropdown/index.tsx +172 -0
  327. package/src/components/email-defaults.tsx +40 -0
  328. package/src/components/email-list.tsx +149 -0
  329. package/src/components/email-thumbnail.tsx +123 -0
  330. package/src/components/flag.tsx +40 -0
  331. package/src/components/input/index.tsx +40 -0
  332. package/src/components/input/search-input.tsx +24 -0
  333. package/src/components/layout.ts +403 -0
  334. package/src/components/menu/index.tsx +118 -0
  335. package/src/components/metric-card.tsx +321 -0
  336. package/src/components/modal/index.tsx +70 -0
  337. package/src/components/nav-drawer.tsx +84 -0
  338. package/src/components/node-inspector.tsx +242 -0
  339. package/src/components/profile-drawer.tsx +331 -0
  340. package/src/components/push-preview.tsx +470 -0
  341. package/src/components/push-thumbnail.tsx +78 -0
  342. package/src/components/segment-list.tsx +184 -0
  343. package/src/components/select/index.tsx +70 -0
  344. package/src/components/series-chart.tsx +120 -0
  345. package/src/components/slack-preview.tsx +223 -0
  346. package/src/components/sparkline.tsx +58 -0
  347. package/src/components/tabs/index.tsx +45 -0
  348. package/src/components/template-refs.ts +110 -0
  349. package/src/components/templates-page.tsx +601 -0
  350. package/src/components/textarea/index.tsx +37 -0
  351. package/src/components/thumbnail-window.tsx +65 -0
  352. package/src/components/workflow-canvas.tsx +503 -0
  353. package/src/components/workflow-list.tsx +231 -0
  354. package/src/config.ts +288 -0
  355. package/src/generate.ts +56 -0
  356. package/src/index.ts +35 -0
  357. package/src/postgres.ts +415 -0
  358. package/src/server/project.ts +290 -0
  359. package/src/server.ts +500 -0
  360. package/src/utils/cn.ts +6 -0
  361. package/src/utils/label.ts +12 -0
  362. package/src/utils/lookup.ts +11 -0
  363. package/src/utils/template-content.ts +213 -0
@@ -0,0 +1,601 @@
1
+ import type { DiscordTemplate, EmailTemplate, PushTemplate, SlackTemplate } from '@shware/workflow';
2
+ import { Minus, Monitor, Moon, Plus, Smartphone, Sun } from 'lucide-react';
3
+ import { type ReactNode, useState } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { cn } from '../utils/cn';
6
+ import {
7
+ type Props,
8
+ type TemplateFailure,
9
+ previewPropsOf,
10
+ resolveDiscord,
11
+ resolvePush,
12
+ resolveSlack,
13
+ } from '../utils/template-content';
14
+ import { superellipse } from './corner-shape';
15
+ import { DiscordPreview } from './discord-preview';
16
+ import { DARK_SIMULATION } from './email-thumbnail';
17
+ import { PushPreview } from './push-preview';
18
+ import { SlackPreview } from './slack-preview';
19
+ import type { TemplateRefInfo } from './template-refs';
20
+ import { Textarea } from './textarea';
21
+
22
+ /**
23
+ * Template preview page: the list on the left comes from IR, the react-email
24
+ * component renders on the right. The email render is the caller's (it owns
25
+ * the query); exactly one of `html` and `failure` describes this render.
26
+ */
27
+ export interface TemplatePreview {
28
+ html?: string;
29
+ subject?: string;
30
+ /** The template refused its props, or failed to render — field paths included. */
31
+ failure?: TemplateFailure;
32
+ /** Anything else that stopped the render. */
33
+ error?: string;
34
+ loading: boolean;
35
+ }
36
+
37
+ export type { TemplateFailure } from '../utils/template-content';
38
+
39
+ export interface TemplatesPageProps {
40
+ refs: TemplateRefInfo[];
41
+ /** The project's email registry; keys match the DSL's template keys. */
42
+ emails: Record<string, EmailTemplate | undefined>;
43
+ /** The project's push registry, same contract as `emails` for the push channel. */
44
+ pushes?: Record<string, PushTemplate | undefined>;
45
+ /** The project's Discord and Slack webhook registries. */
46
+ discords?: Record<string, DiscordTemplate | undefined>;
47
+ slacks?: Record<string, SlackTemplate | undefined>;
48
+ /** App identity on the push mockups; defaults to the project title upstream. */
49
+ appName?: string;
50
+ selected: string | undefined;
51
+ /**
52
+ * Channel of the selected template. One key can be registered in more than
53
+ * one registry (an email and a push both called `checkout_reminder`), so the
54
+ * key alone does not say which one is meant; absent picks the first match.
55
+ */
56
+ selectedChannel?: string | undefined;
57
+ /** Rendered output for the selected template, produced by the caller. */
58
+ preview: TemplatePreview;
59
+ /** The project's envelope (`emails.from` / `replyTo`): every email is sent with it. */
60
+ emailDefaults?: { from?: string; replyTo?: string };
61
+ /**
62
+ * In-memory props override for the selected template's preview; absent
63
+ * renders the template's own `preview`. Never written anywhere.
64
+ */
65
+ previewProps?: Props | undefined;
66
+ /**
67
+ * Called as the props editor changes (undefined: back to the template's
68
+ * `preview`). The editor only appears when this is provided.
69
+ */
70
+ onPreviewPropsChange?: (props: Props | undefined) => void;
71
+ /**
72
+ * The preview stage's starting light/dark, normally the studio's own theme.
73
+ * The toolbar toggle overrides it for this visit only — leaving the page
74
+ * drops the override, so the stage always reopens matching the studio.
75
+ */
76
+ defaultScheme?: 'light' | 'dark';
77
+ }
78
+
79
+ /**
80
+ * One label/value row. A fragment rather than a wrapper so the rows land
81
+ * directly in the parent grid: the label column then sizes to the longest label
82
+ * — a custom header name can be any length and must not wrap — and every row
83
+ * stays aligned with the others. One face, one size throughout.
84
+ */
85
+ function Field({ label, children }: { label: string; children: ReactNode }) {
86
+ return (
87
+ <>
88
+ <dt className="text-muted whitespace-nowrap">{label}</dt>
89
+ <dd className="text-secondary min-w-0 break-words">{children}</dd>
90
+ </>
91
+ );
92
+ }
93
+
94
+ /*
95
+ * The frame is sized to its document and never scrolls itself — the page is
96
+ * the one scroller. Without this a document whose real height has a
97
+ * fractional part overflows the integer height we set by a fraction of a
98
+ * pixel, which is nothing at all with overlay scrollbars and a permanent bar
99
+ * for anyone whose OS always shows them. The thumbnail carries the same line
100
+ * for the same reason.
101
+ */
102
+ const NO_SCROLL = '<style>html,body{overflow:hidden}</style>';
103
+
104
+ /*
105
+ * Rough dark-mode simulation, the invert-and-rotate trick: emails carry their
106
+ * own fixed colours, so this approximates what Gmail-style forced dark does to
107
+ * them. Images are re-inverted to keep their real colours.
108
+ */
109
+ /*
110
+ * The explicit white background matters: email bodies are often transparent,
111
+ * and the white behind them is the iframe element's own — outside the
112
+ * document, where the filter cannot reach. Painting it inside makes it flip.
113
+ */
114
+ /** A refused render: which phase, then every failing field path with its message. */
115
+ export function TemplateFailurePanel({ failure }: { failure: TemplateFailure }) {
116
+ const { t } = useTranslation();
117
+ return (
118
+ <div
119
+ role="alert"
120
+ className="mx-auto max-w-xl rounded-2xl border border-red-200 bg-red-50 p-6 text-sm text-red-700 dark:border-red-400/20 dark:bg-red-400/10 dark:text-red-300"
121
+ style={superellipse}
122
+ >
123
+ <p className="font-medium">{t(`emails.failure.${failure.phase}`)}</p>
124
+ <ul className="mt-2 flex flex-col gap-1">
125
+ {failure.issues.map((issue, index) => (
126
+ <li key={`${issue.path}:${index}`}>
127
+ {issue.path !== '' && <code className="mr-2 font-mono">{issue.path}</code>}
128
+ {issue.message}
129
+ </li>
130
+ ))}
131
+ </ul>
132
+ </div>
133
+ );
134
+ }
135
+
136
+ /**
137
+ * The preview props as JSON, editable in memory. Text that is not a JSON
138
+ * object is reported here and handed up as a failure, so the preview never
139
+ * goes on showing the last good render as if it were this one.
140
+ */
141
+ function PreviewPropsEditor({
142
+ initial,
143
+ onChange,
144
+ onInvalid,
145
+ onReset,
146
+ }: {
147
+ initial: Props;
148
+ onChange: (props: Props) => void;
149
+ onInvalid: (message: string) => void;
150
+ onReset: () => void;
151
+ }) {
152
+ const { t } = useTranslation();
153
+ /*
154
+ * The text is the user's once they type, and derived from `initial` until
155
+ * then — so an HMR change to the template's `preview` still shows here, and
156
+ * the component never remounts mid-edit (a remount loses the caret).
157
+ */
158
+ const [draft, setDraft] = useState<string | undefined>(undefined);
159
+ const text = draft ?? JSON.stringify(initial, null, 2);
160
+ return (
161
+ <div className="border-border bg-card border-b px-6 py-4">
162
+ <div className="flex items-center justify-between">
163
+ <label htmlFor="preview-props" className="text-muted text-sm">
164
+ {t('emails.previewProps')}
165
+ </label>
166
+ <button
167
+ type="button"
168
+ onClick={() => {
169
+ setDraft(undefined);
170
+ onReset();
171
+ }}
172
+ className="text-muted hover:text-primary text-xs transition-colors"
173
+ >
174
+ {t('emails.previewPropsReset')}
175
+ </button>
176
+ </div>
177
+ <Textarea
178
+ id="preview-props"
179
+ size="sm"
180
+ rows={Math.min(8, Math.max(2, text.split('\n').length))}
181
+ spellCheck={false}
182
+ className="mt-2 w-full font-mono text-xs"
183
+ value={text}
184
+ onChange={(event) => {
185
+ const next = event.target.value;
186
+ setDraft(next);
187
+ let parsed: unknown;
188
+ try {
189
+ parsed = JSON.parse(next);
190
+ } catch (error) {
191
+ onInvalid(error instanceof Error ? error.message : String(error));
192
+ return;
193
+ }
194
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
195
+ onInvalid(t('emails.previewPropsNotObject'));
196
+ return;
197
+ }
198
+ onChange(parsed as Props);
199
+ }}
200
+ />
201
+ <p className="text-muted mt-1.5 text-xs">{t('emails.previewPropsHint')}</p>
202
+ </div>
203
+ );
204
+ }
205
+
206
+ /** One control on the floating preview toolbar: a round 32px icon button. */
207
+ function ToolButton({
208
+ active = false,
209
+ label,
210
+ onClick,
211
+ children,
212
+ }: {
213
+ active?: boolean;
214
+ label: string;
215
+ onClick: () => void;
216
+ children: ReactNode;
217
+ }) {
218
+ return (
219
+ <button
220
+ type="button"
221
+ title={label}
222
+ aria-label={label}
223
+ aria-pressed={active}
224
+ onClick={onClick}
225
+ className={cn(
226
+ 'flex size-8 items-center justify-center rounded-full transition-colors',
227
+ active ? 'bg-selected text-primary' : 'text-muted hover:bg-hover hover:text-primary'
228
+ )}
229
+ >
230
+ {children}
231
+ </button>
232
+ );
233
+ }
234
+
235
+ export function TemplatesPage({
236
+ refs,
237
+ emails,
238
+ pushes = {},
239
+ discords = {},
240
+ slacks = {},
241
+ appName,
242
+ selected,
243
+ selectedChannel,
244
+ preview,
245
+ emailDefaults,
246
+ previewProps,
247
+ onPreviewPropsChange,
248
+ defaultScheme,
249
+ }: TemplatesPageProps) {
250
+ const { t } = useTranslation();
251
+ /* Preview chrome: how the rendered email is framed, not what is in it. */
252
+ /*
253
+ * The stage follows the studio theme until the toggle is clicked; the click
254
+ * is an override held in state only, so a fresh visit follows the theme
255
+ * again — and an untouched stage keeps following live theme switches.
256
+ */
257
+ const [schemeOverride, setSchemeOverride] = useState<'light' | 'dark' | undefined>(undefined);
258
+ const scheme = schemeOverride ?? defaultScheme ?? 'light';
259
+ const setScheme = setSchemeOverride;
260
+ const [device, setDevice] = useState<'desktop' | 'mobile'>('desktop');
261
+ const [zoom, setZoom] = useState(1);
262
+ /* Exactly the template asked for: an unknown key says so rather than showing another's content. */
263
+ const active = refs.find(
264
+ (ref) =>
265
+ ref.key === selected && (selectedChannel === undefined || ref.channel === selectedChannel)
266
+ );
267
+ /* Editor text that is not a JSON object: shown in place of any render. */
268
+ const [jsonError, setJsonError] = useState<{ for: string; message: string } | undefined>();
269
+ /* Each channel reads its own registry, so a push key never shadows an email one. */
270
+ const isPush = active?.channel === 'push';
271
+ const isEmail = active?.channel === 'email';
272
+ const activeEmail = active !== undefined && isEmail ? emails[active.key] : undefined;
273
+ const activePush = active !== undefined && isPush ? pushes[active.key] : undefined;
274
+ const isDiscord = active?.channel === 'discord';
275
+ const isSlack = active?.channel === 'slack';
276
+ const isChat = isDiscord || isSlack;
277
+ const activeDiscord = active !== undefined && isDiscord ? discords[active.key] : undefined;
278
+ const activeSlack = active !== undefined && isSlack ? slacks[active.key] : undefined;
279
+ const { html, subject, error, loading } = preview;
280
+ const activeId = active === undefined ? '' : `${active.channel}:${active.key}`;
281
+ /* Leaving a template drops its JSON error: coming back remounts the editor with fresh text. */
282
+ if (jsonError !== undefined && jsonError.for !== activeId) setJsonError(undefined);
283
+ const propsFailure: TemplateFailure | undefined =
284
+ jsonError?.for === activeId
285
+ ? { phase: 'json', issues: [{ path: '', message: jsonError.message }] }
286
+ : undefined;
287
+ /* Exactly one of these describes this render; a failure is never shown beside a success. */
288
+ const failure = propsFailure ?? preview.failure;
289
+
290
+ /*
291
+ * The notification, from the same validated content a send uses — the props
292
+ * override when there is one, the template's `preview` otherwise.
293
+ */
294
+ const pushResolution =
295
+ active !== undefined && activePush !== undefined
296
+ ? resolvePush(activePush, active.key, previewProps)
297
+ : undefined;
298
+ const push =
299
+ propsFailure === undefined && pushResolution?.ok === true ? pushResolution.push : undefined;
300
+ const pushFailure =
301
+ propsFailure ?? (pushResolution?.ok === false ? pushResolution.failure : undefined);
302
+
303
+ /* A chat message, from the same checked content a send posts. */
304
+ const discordResolution =
305
+ active !== undefined && activeDiscord !== undefined
306
+ ? resolveDiscord(activeDiscord, active.key, previewProps)
307
+ : undefined;
308
+ const slackResolution =
309
+ active !== undefined && activeSlack !== undefined
310
+ ? resolveSlack(activeSlack, active.key, previewProps)
311
+ : undefined;
312
+ const chatResolution = discordResolution ?? slackResolution;
313
+ const chatFailure =
314
+ propsFailure ?? (chatResolution?.ok === false ? chatResolution.failure : undefined);
315
+ const chatReady = propsFailure === undefined && chatResolution?.ok === true;
316
+
317
+ const editedEntry = isPush
318
+ ? activePush
319
+ : isDiscord
320
+ ? activeDiscord
321
+ : isSlack
322
+ ? activeSlack
323
+ : activeEmail;
324
+
325
+ return (
326
+ <div className="flex flex-1">
327
+ {/* Preview; the template list lives on the /emails index and the header dropdown. */}
328
+ <section className="bg-page flex min-w-0 flex-1 flex-col">
329
+ {active === undefined ? (
330
+ <div className="text-muted flex flex-1 items-center justify-center text-sm">
331
+ {selected === undefined ? t('emails.empty') : t('emails.notFound', { key: selected })}
332
+ </div>
333
+ ) : (
334
+ <>
335
+ {/*
336
+ The envelope: one face, one size, roomy rows — a read-only
337
+ summary reads better as a calm table. Every email goes out with
338
+ the project's envelope; a push's "envelope" is its content.
339
+ */}
340
+ {((isEmail && activeEmail !== undefined) || push !== undefined) && (
341
+ <div className="border-border bg-card border-b px-6 py-4">
342
+ <dl className="grid grid-cols-[max-content_1fr] gap-x-8 gap-y-2.5 text-sm">
343
+ {isEmail && activeEmail !== undefined && (
344
+ <>
345
+ <Field label={t('emails.from')}>
346
+ {emailDefaults?.from ?? t('common.none')}
347
+ </Field>
348
+ {emailDefaults?.replyTo !== undefined && (
349
+ <Field label={t('emails.replyTo')}>{emailDefaults.replyTo}</Field>
350
+ )}
351
+ <Field label={t('emails.subject')}>{subject ?? activeEmail.subject}</Field>
352
+ </>
353
+ )}
354
+ {push !== undefined && (
355
+ <>
356
+ <Field label={t('emails.contentTitle')}>{push.title}</Field>
357
+ <Field label={t('emails.contentBody')}>{push.body}</Field>
358
+ {push.image !== undefined && (
359
+ <Field label={t('emails.contentImage')}>{push.image}</Field>
360
+ )}
361
+ </>
362
+ )}
363
+ </dl>
364
+ </div>
365
+ )}
366
+
367
+ {onPreviewPropsChange !== undefined && editedEntry !== undefined && (
368
+ <PreviewPropsEditor
369
+ /* A fresh editor per template only: the key must not change while someone types. */
370
+ key={activeId}
371
+ /* What the preview renders: the props handed in, else the template's own `preview`. */
372
+ initial={previewProps ?? previewPropsOf(editedEntry)}
373
+ onChange={(next) => {
374
+ setJsonError(undefined);
375
+ onPreviewPropsChange(next);
376
+ }}
377
+ onInvalid={(message) => setJsonError({ for: activeId, message })}
378
+ onReset={() => {
379
+ setJsonError(undefined);
380
+ onPreviewPropsChange(undefined);
381
+ }}
382
+ />
383
+ )}
384
+
385
+ {/*
386
+ Dot grid with the workflow canvas's look (its two themes' exact
387
+ canvas/grid colours, 16px gap), marking everything around the
388
+ rendered email as the studio's surface. It follows the toolbar's
389
+ light/dark toggle rather than the studio theme, so flipping the
390
+ simulated client mode visibly flips the whole stage.
391
+ */}
392
+ <div
393
+ className="relative flex flex-1 flex-col"
394
+ style={{
395
+ backgroundColor: scheme === 'dark' ? '#000' : 'var(--color-gray-50)',
396
+ /* 0.5px radius: react-flow draws its dots at r=0.5 for zoom 1. */
397
+ backgroundImage: `radial-gradient(${
398
+ scheme === 'dark' ? 'var(--color-gray-700)' : 'var(--color-gray-400)'
399
+ } 0.5px, transparent 0.5px)`,
400
+ backgroundSize: '16px 16px',
401
+ }}
402
+ >
403
+ {/* The stage grows with the email and the page scrolls it (see
404
+ __root); the toolbar below rides along as `sticky`. */}
405
+ <div className="flex-1 p-6 pb-4">
406
+ {isChat ? (
407
+ (isDiscord ? activeDiscord : activeSlack) === undefined ? (
408
+ <div
409
+ className="border-border bg-card mx-auto max-w-xl rounded-2xl border border-dashed p-8 text-center"
410
+ style={superellipse}
411
+ >
412
+ <p className="text-primary text-sm font-medium">
413
+ {t('emails.notRegistered')}
414
+ </p>
415
+ <p className="text-muted mt-2 text-sm">
416
+ {t('emails.chatNotRegisteredHint', {
417
+ key: active.key,
418
+ channel: isDiscord ? 'discord' : 'slack',
419
+ })}
420
+ </p>
421
+ </div>
422
+ ) : chatFailure !== undefined ? (
423
+ <TemplateFailurePanel failure={chatFailure} />
424
+ ) : discordResolution?.ok === true ? (
425
+ <DiscordPreview
426
+ message={discordResolution.message}
427
+ appName={appName ?? 'App'}
428
+ scheme={scheme}
429
+ zoom={zoom}
430
+ />
431
+ ) : slackResolution?.ok === true ? (
432
+ <SlackPreview
433
+ message={slackResolution.message}
434
+ appName={appName ?? 'App'}
435
+ scheme={scheme}
436
+ zoom={zoom}
437
+ />
438
+ ) : null
439
+ ) : isPush ? (
440
+ activePush === undefined ? (
441
+ <div
442
+ className="border-border bg-card mx-auto max-w-xl rounded-2xl border border-dashed p-8 text-center"
443
+ style={superellipse}
444
+ >
445
+ <p className="text-primary text-sm font-medium">
446
+ {t('emails.notRegistered')}
447
+ </p>
448
+ <p className="text-muted mt-2 text-sm">
449
+ {t('emails.pushNotRegisteredHint', { key: active.key })}
450
+ </p>
451
+ </div>
452
+ ) : pushFailure !== undefined ? (
453
+ <TemplateFailurePanel failure={pushFailure} />
454
+ ) : (
455
+ <PushPreview
456
+ appName={appName ?? 'App'}
457
+ title={push?.title ?? ''}
458
+ body={push?.body ?? ''}
459
+ scheme={scheme}
460
+ zoom={zoom}
461
+ />
462
+ )
463
+ ) : activeEmail === undefined ? (
464
+ <div
465
+ className="border-border bg-card mx-auto max-w-xl rounded-2xl border border-dashed p-8 text-center"
466
+ style={superellipse}
467
+ >
468
+ <p className="text-primary text-sm font-medium">{t('emails.notRegistered')}</p>
469
+ <p className="text-muted mt-2 text-sm">
470
+ {t('emails.notRegisteredHint', { key: active.key })}
471
+ </p>
472
+ </div>
473
+ ) : failure !== undefined ? (
474
+ <TemplateFailurePanel failure={failure} />
475
+ ) : loading ? (
476
+ <div className="text-muted text-center text-sm">{t('emails.rendering')}</div>
477
+ ) : error !== undefined ? (
478
+ <div
479
+ className="mx-auto max-w-xl rounded-2xl border border-red-200 bg-red-50 p-6 text-sm text-red-700 dark:border-red-400/20 dark:bg-red-400/10 dark:text-red-300"
480
+ style={superellipse}
481
+ >
482
+ {error}
483
+ </div>
484
+ ) : (
485
+ <iframe
486
+ title={`${active.key} preview`}
487
+ srcDoc={`${html ?? ''}${NO_SCROLL}${scheme === 'dark' ? DARK_SIMULATION : ''}`}
488
+ /*
489
+ * Sized to its document rather than the pane, so long emails
490
+ * scroll in the outer container — which can pad past the
491
+ * floating toolbar; an iframe scrolling internally cannot.
492
+ */
493
+ onLoad={(event) => {
494
+ const frame = event.currentTarget;
495
+ const root = frame.contentDocument?.documentElement ?? undefined;
496
+ if (root === undefined) return;
497
+ /* getBoundingClientRect keeps the fraction scrollHeight rounds off; ceil it. */
498
+ const height = Math.ceil(root.getBoundingClientRect().height);
499
+ if (height > 0) frame.style.height = `${height}px`;
500
+ }}
501
+ /*
502
+ * Square corners — this box IS the email's viewport, not a
503
+ * studio card. Border and fill follow the toolbar's
504
+ * light/dark toggle with the stage, not the studio theme.
505
+ */
506
+ className="mx-auto min-h-40 border"
507
+ style={{
508
+ borderColor:
509
+ scheme === 'dark' ? 'var(--color-gray-700)' : 'var(--color-gray-300)',
510
+ backgroundColor: '#fff',
511
+ width: device === 'mobile' ? 375 : '100%',
512
+ maxWidth: device === 'mobile' ? 375 : 672,
513
+ transform: `scale(${zoom})`,
514
+ transformOrigin: 'top center',
515
+ }}
516
+ />
517
+ )}
518
+ </div>
519
+
520
+ {/*
521
+ Floating preview toolbar: client scheme, device width, zoom.
522
+ Sticky rather than absolute — the stage is no longer a fixed
523
+ frame, so anchoring to its bottom would park the toolbar at the
524
+ end of a long email instead of keeping it to hand. The wrapper
525
+ spans the stage and must not swallow clicks meant for it.
526
+ */}
527
+ {(isChat
528
+ ? chatReady
529
+ : isPush
530
+ ? push !== undefined
531
+ : activeEmail !== undefined &&
532
+ !loading &&
533
+ error === undefined &&
534
+ failure === undefined) && (
535
+ <div className="pointer-events-none sticky bottom-0 z-10 flex justify-center pt-2 pb-4">
536
+ <div className="border-border bg-card pointer-events-auto flex items-center gap-0.5 rounded-full border p-1 shadow-lg">
537
+ <ToolButton
538
+ active={scheme === 'light'}
539
+ label={t('emails.previewLight')}
540
+ onClick={() => setScheme('light')}
541
+ >
542
+ <Sun size={16} strokeWidth={2} aria-hidden />
543
+ </ToolButton>
544
+ <ToolButton
545
+ active={scheme === 'dark'}
546
+ label={t('emails.previewDark')}
547
+ onClick={() => setScheme('dark')}
548
+ >
549
+ <Moon size={16} strokeWidth={2} aria-hidden />
550
+ </ToolButton>
551
+ {/* Device widths are an email concern; a push shows both platforms, a chat message its client. */}
552
+ {isEmail && (
553
+ <>
554
+ <div className="bg-border mx-1 h-4 w-px" />
555
+ <ToolButton
556
+ active={device === 'desktop'}
557
+ label={t('emails.previewDesktop')}
558
+ onClick={() => setDevice('desktop')}
559
+ >
560
+ <Monitor size={16} strokeWidth={2} aria-hidden />
561
+ </ToolButton>
562
+ <ToolButton
563
+ active={device === 'mobile'}
564
+ label={t('emails.previewMobile')}
565
+ onClick={() => setDevice('mobile')}
566
+ >
567
+ <Smartphone size={16} strokeWidth={2} aria-hidden />
568
+ </ToolButton>
569
+ </>
570
+ )}
571
+ <div className="bg-border mx-1 h-4 w-px" />
572
+ <ToolButton
573
+ label={t('emails.zoomOut')}
574
+ onClick={() => setZoom((level) => Math.max(0.5, level - 0.25))}
575
+ >
576
+ <Minus size={16} strokeWidth={2} aria-hidden />
577
+ </ToolButton>
578
+ <button
579
+ type="button"
580
+ title={t('emails.zoomReset')}
581
+ onClick={() => setZoom(1)}
582
+ className="text-secondary hover:text-primary w-11 text-center text-xs font-medium tabular-nums transition-colors"
583
+ >
584
+ {Math.round(zoom * 100)}%
585
+ </button>
586
+ <ToolButton
587
+ label={t('emails.zoomIn')}
588
+ onClick={() => setZoom((level) => Math.min(1.5, level + 0.25))}
589
+ >
590
+ <Plus size={16} strokeWidth={2} aria-hidden />
591
+ </ToolButton>
592
+ </div>
593
+ </div>
594
+ )}
595
+ </div>
596
+ </>
597
+ )}
598
+ </section>
599
+ </div>
600
+ );
601
+ }
@@ -0,0 +1,37 @@
1
+ import type { ComponentProps } from 'react';
2
+ import { cn } from '../../utils/cn';
3
+
4
+ /**
5
+ * Ported from the design system in the template project — same API, so the two
6
+ * stay diffable. Colours resolve through the studio's CSS variables
7
+ * (`--color-textfield`, `--color-placeholder`, `--color-accent`).
8
+ */
9
+ export type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
10
+
11
+ interface Props extends Omit<ComponentProps<'textarea'>, 'size'> {
12
+ size?: Size;
13
+ className?: string;
14
+ }
15
+
16
+ const SIZE_STYLE: Record<Size, string> = {
17
+ xs: 'px-2 py-[5px] text-xs rounded-md focus-visible:ring-2',
18
+ sm: 'px-2 py-[7px] text-sm rounded-lg focus-visible:ring-3',
19
+ md: 'px-3 py-[9px] text-sm rounded-xl focus-visible:ring-3',
20
+ lg: 'px-4 py-[11px] text-md rounded-xl focus-visible:ring-4',
21
+ xl: 'px-4 py-[13px] text-lg rounded-2xl focus-visible:ring-4',
22
+ };
23
+
24
+ export function Textarea({ size = 'md', className, ...props }: Props) {
25
+ return (
26
+ <textarea
27
+ {...props}
28
+ className={cn(
29
+ 'transition-colors duration-100 focus:outline-none',
30
+ 'placeholder-placeholder bg-textfield focus-visible:border-accent border',
31
+ 'dark:focus-visible:ring-accent/50 focus-visible:ring-accent/40',
32
+ SIZE_STYLE[size],
33
+ className
34
+ )}
35
+ />
36
+ );
37
+ }