@eluan/core 0.5.0 → 0.6.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 (340) hide show
  1. package/README.md +33 -1
  2. package/dist/{action-popover-D6K9aVFk.cjs → action-popover-DrHKPGqw.cjs} +1 -1
  3. package/dist/{action-popover-BVJQBuky.js → action-popover-NkXDAHJT.js} +1 -1
  4. package/dist/action-popover.cjs +1 -1
  5. package/dist/action-popover.js +1 -1
  6. package/dist/{avatar-Co-k8KqV.cjs → avatar-B-t3ctR4.cjs} +1 -1
  7. package/dist/{avatar-CS5f1irF.js → avatar-kDEa0rjF.js} +1 -1
  8. package/dist/avatar.cjs +1 -1
  9. package/dist/avatar.js +1 -1
  10. package/dist/{badge-D9NYZFWH.js → badge-BLZ8V-KC.js} +10 -10
  11. package/dist/{badge-DXKWztL-.cjs → badge-D1A0Tc79.cjs} +1 -1
  12. package/dist/badge.cjs +1 -1
  13. package/dist/badge.js +1 -1
  14. package/dist/{banner-COlEFRuK.cjs → banner-CNdwDPqA.cjs} +1 -1
  15. package/dist/{banner-CyYFLZXw.js → banner-DzSp5WfQ.js} +9 -9
  16. package/dist/banner.cjs +1 -1
  17. package/dist/banner.js +1 -1
  18. package/dist/box-DG-tkaYi.cjs +1 -0
  19. package/dist/box-DKbNgGGG.js +17 -0
  20. package/dist/box.cjs +1 -0
  21. package/dist/box.d.ts +1 -0
  22. package/dist/box.js +5 -0
  23. package/dist/{breadcrumb-NWXeCH5q.cjs → breadcrumb-BuxXkm6O.cjs} +1 -1
  24. package/dist/{breadcrumb-Cm1nb9Xj.js → breadcrumb-C6qj-tDx.js} +1 -1
  25. package/dist/breadcrumb.cjs +1 -1
  26. package/dist/breadcrumb.js +1 -1
  27. package/dist/button--_WI-fM6.cjs +1 -0
  28. package/dist/{button-ANAPDrvs.js → button-DNSNShUc.js} +28 -26
  29. package/dist/button.cjs +1 -1
  30. package/dist/button.js +1 -1
  31. package/dist/{calendar-BpBsomy5.js → calendar-BA2tSwZD.js} +6 -6
  32. package/dist/{calendar-7LX5YGGT.cjs → calendar-DS5821-k.cjs} +3 -3
  33. package/dist/calendar.cjs +1 -1
  34. package/dist/calendar.js +1 -1
  35. package/dist/{card-C88--zB4.cjs → card-BNdR5aDa.cjs} +1 -1
  36. package/dist/{card-BC_4C3ns.js → card-BSgN7WSe.js} +1 -1
  37. package/dist/card.cjs +1 -1
  38. package/dist/card.js +1 -1
  39. package/dist/{carousel-BfL7oy_q.cjs → carousel-4AERgboz.cjs} +1 -1
  40. package/dist/{carousel-DuP0hvF-.js → carousel-Bb7jpzep.js} +1 -1
  41. package/dist/carousel.cjs +1 -1
  42. package/dist/carousel.js +1 -1
  43. package/dist/{checkbox-Bi0Kmuut.js → checkbox-CGUTGery.js} +1 -1
  44. package/dist/{checkbox-M8DmWKiC.cjs → checkbox-Cq9sHU_S.cjs} +1 -1
  45. package/dist/{checkbox-group-KBwPhjmW.cjs → checkbox-group-DGXZ4o2-.cjs} +1 -1
  46. package/dist/{checkbox-group-CQMEJnhD.js → checkbox-group-Tkio3IhK.js} +1 -1
  47. package/dist/checkbox-group.cjs +1 -1
  48. package/dist/checkbox-group.js +1 -1
  49. package/dist/checkbox.cjs +1 -1
  50. package/dist/checkbox.js +1 -1
  51. package/dist/{command-BCl0seLL.cjs → command-D02vvta9.cjs} +1 -1
  52. package/dist/{command-Chs5VlBL.js → command-sUMAxm8S.js} +1 -1
  53. package/dist/command.cjs +1 -1
  54. package/dist/command.js +1 -1
  55. package/dist/components/box.d.ts +12 -0
  56. package/dist/components/grid.d.ts +35 -0
  57. package/dist/components/hover-card.d.ts +14 -2
  58. package/dist/components/icon.d.ts +26 -0
  59. package/dist/components/layout-shared.d.ts +307 -0
  60. package/dist/components/multi-select.d.ts +1 -1
  61. package/dist/components/navigation-drawer.d.ts +25 -5
  62. package/dist/components/row.d.ts +18 -0
  63. package/dist/components/stack.d.ts +14 -0
  64. package/dist/components/tone-shared.d.ts +39 -0
  65. package/dist/components/tooltip.d.ts +14 -2
  66. package/dist/components/typography.d.ts +22 -2
  67. package/dist/components/visually-hidden.d.ts +11 -0
  68. package/dist/{credit-card-input-DN-8vaFj.js → credit-card-input-9VPlzvDm.js} +1 -1
  69. package/dist/{credit-card-input-CUqA9CX3.cjs → credit-card-input-DppPJBne.cjs} +1 -1
  70. package/dist/credit-card-input.cjs +1 -1
  71. package/dist/credit-card-input.js +1 -1
  72. package/dist/{date-picker-ni8td8Ru.js → date-picker-M5hLx_1s.js} +2 -2
  73. package/dist/{date-picker-DGBsfZXx.cjs → date-picker-hE7cDg2B.cjs} +1 -1
  74. package/dist/date-picker.cjs +1 -1
  75. package/dist/date-picker.js +1 -1
  76. package/dist/{datetime-picker-C1d63MaA.cjs → datetime-picker-BeRUPJ7s.cjs} +1 -1
  77. package/dist/{datetime-picker-DsnHYRK-.js → datetime-picker-CIqBZYMH.js} +3 -3
  78. package/dist/datetime-picker.cjs +1 -1
  79. package/dist/datetime-picker.js +1 -1
  80. package/dist/{decimal-input-yTk35W_5.js → decimal-input-Bg2BPKIr.js} +38 -38
  81. package/dist/decimal-input-CkTEjo2J.cjs +1 -0
  82. package/dist/decimal-input.cjs +1 -1
  83. package/dist/decimal-input.js +1 -1
  84. package/dist/{dialog-B8eWKqzS.js → dialog-Bsfviqvy.js} +2 -2
  85. package/dist/dialog-DRAoumvB.cjs +1 -0
  86. package/dist/dialog.cjs +1 -1
  87. package/dist/dialog.js +1 -1
  88. package/dist/{email-input-DFI4h_KN.cjs → email-input-CehmtNUq.cjs} +1 -1
  89. package/dist/{email-input-pX0hlYV3.js → email-input-DIiY9Q3S.js} +1 -1
  90. package/dist/email-input.cjs +1 -1
  91. package/dist/email-input.js +1 -1
  92. package/dist/{footer-DB0_-IwN.cjs → footer-fovIsy-0.cjs} +1 -1
  93. package/dist/{footer-B3KUIwXW.js → footer-jWaFq3qk.js} +9 -9
  94. package/dist/footer.cjs +1 -1
  95. package/dist/footer.js +1 -1
  96. package/dist/grid-BDz4Xs6M.cjs +1 -0
  97. package/dist/grid-BX5vZjDo.js +612 -0
  98. package/dist/grid.cjs +1 -0
  99. package/dist/grid.d.ts +1 -0
  100. package/dist/grid.js +5 -0
  101. package/dist/{header-CDOWlOAR.js → header-Dnf8AnIx.js} +2 -2
  102. package/dist/{header-CiZQY_7S.cjs → header-DzItWqW4.cjs} +1 -1
  103. package/dist/header.cjs +1 -1
  104. package/dist/header.js +1 -1
  105. package/dist/hover-card-C5KsTSZR.cjs +1 -0
  106. package/dist/hover-card-C_FCzE41.js +21 -0
  107. package/dist/hover-card.cjs +1 -1
  108. package/dist/hover-card.js +1 -1
  109. package/dist/icon-BmLOodCQ.cjs +1 -0
  110. package/dist/icon-BwDfkIdR.js +153 -0
  111. package/dist/icon.cjs +1 -0
  112. package/dist/icon.d.ts +1 -0
  113. package/dist/icon.js +5 -0
  114. package/dist/index.cjs +10 -5
  115. package/dist/index.d.ts +6 -0
  116. package/dist/index.js +612 -541
  117. package/dist/{input-BrGJn-D9.cjs → input-BcjL2oxv.cjs} +1 -1
  118. package/dist/{input-Cccufiqn.js → input-CPb9yVU5.js} +8 -8
  119. package/dist/input-otp-BhJ3ERrY.cjs +1 -0
  120. package/dist/{input-otp-DmEGB1nu.js → input-otp-CTvJztkH.js} +32 -32
  121. package/dist/input-otp.cjs +1 -1
  122. package/dist/input-otp.js +1 -1
  123. package/dist/input.cjs +1 -1
  124. package/dist/input.js +1 -1
  125. package/dist/layout-shared-B_1iX4Hj.js +319 -0
  126. package/dist/layout-shared-CsBZcT4V.cjs +1 -0
  127. package/dist/multi-select-CVxkWW29.js +85 -0
  128. package/dist/multi-select-DBFINH3F.cjs +1 -0
  129. package/dist/multi-select.cjs +1 -1
  130. package/dist/multi-select.js +1 -1
  131. package/dist/navigation-drawer-BCBFtLEq.cjs +1 -0
  132. package/dist/navigation-drawer-BMyHXhhX.js +198 -0
  133. package/dist/navigation-drawer.cjs +1 -1
  134. package/dist/navigation-drawer.js +1 -1
  135. package/dist/{number-input-vICbRc2y.js → number-input-Cm9YPBOX.js} +1 -1
  136. package/dist/{number-input-Bc7jUsu-.cjs → number-input-Dr9MbuRV.cjs} +1 -1
  137. package/dist/number-input.cjs +1 -1
  138. package/dist/number-input.js +1 -1
  139. package/dist/{pagination-DTWRjiOm.js → pagination-D2tjMpVU.js} +2 -2
  140. package/dist/{pagination-4IuE_APs.cjs → pagination-yKmFlFMR.cjs} +1 -1
  141. package/dist/pagination.cjs +1 -1
  142. package/dist/pagination.js +1 -1
  143. package/dist/{password-input-BwnlHPbX.cjs → password-input-CmHubHuU.cjs} +1 -1
  144. package/dist/{password-input-B9V45d3Q.js → password-input-ljwdGCO6.js} +2 -2
  145. package/dist/password-input.cjs +1 -1
  146. package/dist/password-input.js +1 -1
  147. package/dist/{phone-input-BQjZj5jI.cjs → phone-input-B8VksCer.cjs} +1 -1
  148. package/dist/{phone-input-CSBpGHvI.js → phone-input-qTL6K8rT.js} +2 -2
  149. package/dist/phone-input.cjs +1 -1
  150. package/dist/phone-input.js +1 -1
  151. package/dist/progress-BpdmBGaX.cjs +1 -0
  152. package/dist/{progress-Dz_it5I-.js → progress-ChFf9bIq.js} +1 -1
  153. package/dist/progress.cjs +1 -1
  154. package/dist/progress.js +1 -1
  155. package/dist/providers/create-theme.d.ts +10 -1
  156. package/dist/providers/eluan-provider.d.ts +2 -1
  157. package/dist/providers/portal-container.d.ts +1 -1
  158. package/dist/{radio-group-C--1neiq.cjs → radio-group-9gozRouT.cjs} +1 -1
  159. package/dist/{radio-group-CNMPZx_2.js → radio-group-Bs9933bk.js} +6 -6
  160. package/dist/radio-group.cjs +1 -1
  161. package/dist/radio-group.js +1 -1
  162. package/dist/{rich-text-BZSyuYSo.js → rich-text-DImwK9hN.js} +1 -1
  163. package/dist/{rich-text-DerWxzdn.cjs → rich-text-DzHLeG7W.cjs} +1 -1
  164. package/dist/rich-text.cjs +1 -1
  165. package/dist/rich-text.js +1 -1
  166. package/dist/row-BYAk7G5d.js +37 -0
  167. package/dist/row-Bjn-GQAC.cjs +1 -0
  168. package/dist/row.cjs +1 -0
  169. package/dist/row.d.ts +1 -0
  170. package/dist/row.js +5 -0
  171. package/dist/{search-input-Dmmo-BEL.cjs → search-input-BKTjebg7.cjs} +1 -1
  172. package/dist/{search-input-bFNW6oiE.js → search-input-Dgr9kT1a.js} +1 -1
  173. package/dist/search-input.cjs +1 -1
  174. package/dist/search-input.js +1 -1
  175. package/dist/select-Cdh991T-.cjs +1 -0
  176. package/dist/{select-DDSYjKtj.js → select-Dp5AJ6I-.js} +15 -15
  177. package/dist/select.cjs +1 -1
  178. package/dist/select.js +1 -1
  179. package/dist/sheet-CkXjinUG.cjs +1 -0
  180. package/dist/{sheet-D5HWF66e.js → sheet-uiyHNKEw.js} +6 -6
  181. package/dist/sheet.cjs +1 -1
  182. package/dist/sheet.js +1 -1
  183. package/dist/{slider-CZQBAXup.js → slider-BQmbh0Nl.js} +1 -1
  184. package/dist/{slider-DdEOapYP.cjs → slider-DK2yk-YK.cjs} +1 -1
  185. package/dist/slider.cjs +1 -1
  186. package/dist/slider.js +1 -1
  187. package/dist/stack-Ck1w2iJu.cjs +1 -0
  188. package/dist/stack-D2btWM1t.js +27 -0
  189. package/dist/stack.cjs +1 -0
  190. package/dist/stack.d.ts +1 -0
  191. package/dist/stack.js +5 -0
  192. package/dist/{stepper-D5nDwJUz.cjs → stepper-ByYKX7qw.cjs} +1 -1
  193. package/dist/{stepper-BtlKiHtd.js → stepper-Copsj87A.js} +4 -4
  194. package/dist/stepper.cjs +1 -1
  195. package/dist/stepper.js +1 -1
  196. package/dist/styles.css +935 -59
  197. package/dist/{switch-KzBijHMJ.cjs → switch-C2OPCq5Z.cjs} +1 -1
  198. package/dist/{switch-C7EBLT5H.js → switch-CXBWUZcq.js} +3 -3
  199. package/dist/switch.cjs +1 -1
  200. package/dist/switch.js +1 -1
  201. package/dist/{tabs-DztJ2iVc.cjs → tabs-D8p6Tr5i.cjs} +1 -1
  202. package/dist/{tabs-C9NKBmH0.js → tabs-TV4_2wi1.js} +9 -9
  203. package/dist/tabs.cjs +1 -1
  204. package/dist/tabs.js +1 -1
  205. package/dist/{textarea-Dl-daLHR.cjs → textarea-BnpQmE74.cjs} +1 -1
  206. package/dist/{textarea-DXUk1b_-.js → textarea-CJRmnazN.js} +1 -1
  207. package/dist/textarea.cjs +1 -1
  208. package/dist/textarea.js +1 -1
  209. package/dist/{time-input-BPoFvoeM.js → time-input-A603mEFQ.js} +38 -38
  210. package/dist/time-input-qxljhdEb.cjs +1 -0
  211. package/dist/time-input.cjs +1 -1
  212. package/dist/time-input.js +1 -1
  213. package/dist/{toggle-Dv1VZ5Le.js → toggle-Bx3q15Pu.js} +6 -6
  214. package/dist/{toggle-Bvh1v32T.cjs → toggle-Z3t4jPdv.cjs} +1 -1
  215. package/dist/{toggle-group-SyHMwO90.cjs → toggle-group-BZIW4wJp.cjs} +1 -1
  216. package/dist/{toggle-group-DE8BPZih.js → toggle-group-LaZmOMx_.js} +7 -7
  217. package/dist/toggle-group.cjs +1 -1
  218. package/dist/toggle-group.js +1 -1
  219. package/dist/toggle.cjs +1 -1
  220. package/dist/toggle.js +1 -1
  221. package/dist/tooltip-DZqn4wKl.js +23 -0
  222. package/dist/tooltip-faf1dIXp.cjs +1 -0
  223. package/dist/tooltip.cjs +1 -1
  224. package/dist/tooltip.js +1 -1
  225. package/dist/{tree-view-CyeJR7cW.js → tree-view-DRmm6oL6.js} +23 -23
  226. package/dist/tree-view-DVQyRQDg.cjs +1 -0
  227. package/dist/tree-view.cjs +1 -1
  228. package/dist/tree-view.js +1 -1
  229. package/dist/visually-hidden-BQMRYGxP.js +14 -0
  230. package/dist/visually-hidden-DzxxOswl.cjs +1 -0
  231. package/dist/visually-hidden.cjs +1 -0
  232. package/dist/visually-hidden.d.ts +1 -0
  233. package/dist/visually-hidden.js +5 -0
  234. package/package.json +8 -8
  235. package/skills/eluan/DESIGN.md +409 -0
  236. package/skills/eluan/SKILL.md +166 -0
  237. package/skills/eluan/components/accordion.md +212 -0
  238. package/skills/eluan/components/action-popover.md +266 -0
  239. package/skills/eluan/components/aspect-ratio.md +169 -0
  240. package/skills/eluan/components/avatar.md +277 -0
  241. package/skills/eluan/components/badge.md +190 -0
  242. package/skills/eluan/components/banner.md +247 -0
  243. package/skills/eluan/components/box.md +166 -0
  244. package/skills/eluan/components/breadcrumb.md +240 -0
  245. package/skills/eluan/components/button.md +214 -0
  246. package/skills/eluan/components/calendar.md +192 -0
  247. package/skills/eluan/components/card.md +270 -0
  248. package/skills/eluan/components/carousel.md +274 -0
  249. package/skills/eluan/components/checkbox-group.md +228 -0
  250. package/skills/eluan/components/checkbox.md +226 -0
  251. package/skills/eluan/components/code-block.md +193 -0
  252. package/skills/eluan/components/collapsible.md +240 -0
  253. package/skills/eluan/components/command.md +359 -0
  254. package/skills/eluan/components/context-menu.md +296 -0
  255. package/skills/eluan/components/credit-card-input.md +217 -0
  256. package/skills/eluan/components/date-picker.md +255 -0
  257. package/skills/eluan/components/date-time-picker.md +196 -0
  258. package/skills/eluan/components/decimal-input.md +232 -0
  259. package/skills/eluan/components/dialog.md +322 -0
  260. package/skills/eluan/components/drawer.md +292 -0
  261. package/skills/eluan/components/dropdown-menu.md +450 -0
  262. package/skills/eluan/components/email-input.md +200 -0
  263. package/skills/eluan/components/fieldset.md +219 -0
  264. package/skills/eluan/components/file-input.md +249 -0
  265. package/skills/eluan/components/footer.md +290 -0
  266. package/skills/eluan/components/form-label.md +254 -0
  267. package/skills/eluan/components/grid.md +192 -0
  268. package/skills/eluan/components/header.md +242 -0
  269. package/skills/eluan/components/hover-card.md +215 -0
  270. package/skills/eluan/components/icon.md +161 -0
  271. package/skills/eluan/components/input-otp.md +227 -0
  272. package/skills/eluan/components/input.md +249 -0
  273. package/skills/eluan/components/kbd.md +216 -0
  274. package/skills/eluan/components/media.md +244 -0
  275. package/skills/eluan/components/menubar.md +300 -0
  276. package/skills/eluan/components/multi-select.md +221 -0
  277. package/skills/eluan/components/navigation-drawer.md +297 -0
  278. package/skills/eluan/components/navigation-menu.md +291 -0
  279. package/skills/eluan/components/number-input.md +190 -0
  280. package/skills/eluan/components/pagination.md +262 -0
  281. package/skills/eluan/components/password-input.md +218 -0
  282. package/skills/eluan/components/phone-input.md +205 -0
  283. package/skills/eluan/components/popover.md +250 -0
  284. package/skills/eluan/components/progress.md +185 -0
  285. package/skills/eluan/components/radio-group.md +232 -0
  286. package/skills/eluan/components/rich-text.md +195 -0
  287. package/skills/eluan/components/row.md +174 -0
  288. package/skills/eluan/components/scroll-area.md +203 -0
  289. package/skills/eluan/components/search-input.md +281 -0
  290. package/skills/eluan/components/segmented-control.md +201 -0
  291. package/skills/eluan/components/select.md +296 -0
  292. package/skills/eluan/components/separator.md +179 -0
  293. package/skills/eluan/components/sheet.md +326 -0
  294. package/skills/eluan/components/skeleton.md +202 -0
  295. package/skills/eluan/components/slider.md +195 -0
  296. package/skills/eluan/components/spinner.md +187 -0
  297. package/skills/eluan/components/stack.md +158 -0
  298. package/skills/eluan/components/stepper.md +236 -0
  299. package/skills/eluan/components/switch.md +218 -0
  300. package/skills/eluan/components/table.md +348 -0
  301. package/skills/eluan/components/tabs.md +277 -0
  302. package/skills/eluan/components/textarea.md +202 -0
  303. package/skills/eluan/components/time-input.md +181 -0
  304. package/skills/eluan/components/toast.md +251 -0
  305. package/skills/eluan/components/toggle-group.md +241 -0
  306. package/skills/eluan/components/toggle.md +198 -0
  307. package/skills/eluan/components/tooltip.md +222 -0
  308. package/skills/eluan/components/tree-view.md +213 -0
  309. package/skills/eluan/components/typography.md +207 -0
  310. package/skills/eluan/components/visually-hidden.md +132 -0
  311. package/skills/eluan/foundations/colour.md +252 -0
  312. package/skills/eluan/foundations/elevation.md +57 -0
  313. package/skills/eluan/foundations/iconography.md +70 -0
  314. package/skills/eluan/foundations/motion.md +60 -0
  315. package/skills/eluan/foundations/radius.md +61 -0
  316. package/skills/eluan/foundations/spacing.md +98 -0
  317. package/skills/eluan/foundations/theming.md +197 -0
  318. package/skills/eluan/foundations/typography.md +163 -0
  319. package/skills/eluan/patterns/empty-states.md +84 -0
  320. package/skills/eluan/patterns/feedback.md +95 -0
  321. package/skills/eluan/patterns/forms.md +138 -0
  322. package/skills/eluan/patterns/navigation.md +95 -0
  323. package/skills/eluan/patterns/page-layout.md +101 -0
  324. package/dist/button-Ny6OF8Un.cjs +0 -1
  325. package/dist/decimal-input-BLmifKF2.cjs +0 -1
  326. package/dist/dialog-DWYtFhZl.cjs +0 -1
  327. package/dist/hover-card-BN7Ew2Y1.js +0 -16
  328. package/dist/hover-card-Dft-08Ha.cjs +0 -1
  329. package/dist/input-otp-DcZ7wyjs.cjs +0 -1
  330. package/dist/multi-select-DPoOHWSC.js +0 -74
  331. package/dist/multi-select-fX5FXYEY.cjs +0 -1
  332. package/dist/navigation-drawer-BbeDYPhu.js +0 -171
  333. package/dist/navigation-drawer-DOOHfbY3.cjs +0 -1
  334. package/dist/progress-DpQjGEyn.cjs +0 -1
  335. package/dist/select-1Eb3NSrR.cjs +0 -1
  336. package/dist/sheet-7NP1LuHy.cjs +0 -1
  337. package/dist/time-input-DR2snTgB.cjs +0 -1
  338. package/dist/tooltip-BlCQKhUE.js +0 -18
  339. package/dist/tooltip-Cyu7fWYZ.cjs +0 -1
  340. package/dist/tree-view-CNvEc1TT.cjs +0 -1
@@ -0,0 +1,232 @@
1
+ ---
2
+ name: DecimalInput
3
+ use_when: The user enters money, a percentage, a measurement or another decimal that should display with fixed decimals and thousands separators.
4
+ instead_of: NumberInput for counts with steppers; Slider for approximate values on a range; Input for text that isn't a number.
5
+ source: packages/core/src/components/decimal-input.tsx
6
+ ---
7
+
8
+ # DecimalInput
9
+
10
+ ## 1. Overview
11
+
12
+ DecimalInput is a right-aligned, monospaced field for decimal amounts. While the user types it keeps only digits, one decimal separator and, if allowed, a leading minus, and caps the number of decimal places. On blur it shows the controlled value with thousands separators and fixed decimals. Prefix and suffix text (a currency symbol, `%`, a unit) sit inside the field. Three presets ship with it: CurrencyInput, PercentageInput and UnitInput.
13
+
14
+ ## 2. When to use
15
+
16
+ - Money: prices, budgets, invoice lines (CurrencyInput).
17
+ - Rates and shares: discount, tax rate, allocation (PercentageInput).
18
+ - Measurements: weight, length, duration (UnitInput).
19
+ - Any decimal with a fixed precision (DecimalInput).
20
+
21
+ ### When not to use
22
+
23
+ - Plain text → use [Input](./input.md).
24
+ - A whole-number count with minus and plus buttons → use [NumberInput](./number-input.md).
25
+ - A value on a continuous range where close enough is fine → use [Slider](./slider.md).
26
+
27
+ DecimalInput earns its place through formatting: separators and fixed decimals on blur, the decimal-place cap while typing, and the currency, percent and unit affixes. It only formats when controlled.
28
+
29
+ ## 3. Anatomy
30
+
31
+ 1. **Field**: a native `<input type="text" inputMode="decimal">`, right-aligned in `--font-mono`.
32
+ 2. **Prefix** (optional): the currency symbol, `prefix`, or a prefix `unit`, in `--interactive-fg-alt` at the leading edge.
33
+ 3. **Suffix** (optional): `suffix`, `%`, or a suffix `unit`, at the trailing edge.
34
+
35
+ The field's padding grows to fit the affixes. Affixes are visual text; they aren't part of the field's accessible name.
36
+
37
+ ## 4. Variants
38
+
39
+ | Export | Use for |
40
+ | --- | --- |
41
+ | `DecimalInput` | Any decimal; you set decimals, affixes, separators and bounds. |
42
+ | `CurrencyInput` | Money. `currency` is required and sets the symbol prefix and the decimal places. |
43
+ | `PercentageInput` | Percentages. Fixed `%` suffix; defaults to `min={0}`, `max={100}`, `decimals={1}`. |
44
+ | `UnitInput` | Measurements. `unit` is required and shows as a suffix by default. |
45
+
46
+ ## 5. Sizes
47
+
48
+ No size prop. The field is `--size-lg` tall and follows density.
49
+
50
+ ## 6. States
51
+
52
+ | State | Looks like | Notes |
53
+ | --- | --- | --- |
54
+ | Default | `--container-bg` surface, `--interactive-border-alt` border, affixes and placeholder in `--interactive-fg-alt` | DecimalInput draws its own field rather than using Input; the surface token differs from Input's `--interactive-bg` but looks the same in the default theme. |
55
+ | Focus | Border and 1px outline in `--focus-ring`, 1px offset; value shown unformatted | Never remove or restyle the focus ring. |
56
+ | Disabled | `--interactive-bg-disabled` surface, `--interactive-fg-disabled` text, not-allowed cursor | |
57
+ | Error | No visual change | `aria-invalid` has no style here, unlike Input. Show a FormMessage and still set `aria-invalid` for assistive tech. |
58
+
59
+ ## 7. Content guidelines
60
+
61
+ - Put the currency or unit in the label when the affix carries meaning: "Price (USD)", "Weight (kg)". Screen readers don't hear the affix.
62
+ - Use a placeholder that shows the expected precision, such as "0.00", or none.
63
+ - State bounds in a description: "Up to 100%".
64
+
65
+ | Do | Don't |
66
+ | --- | --- |
67
+ | Monthly budget (USD) | Amount |
68
+ | Discount, up to 100% | Enter a percentage value |
69
+
70
+ ## 8. Rules
71
+
72
+ 1. Always control it: pass `value` and update it from `onValueChange`. Uncontrolled, it never formats; with a `value` that doesn't update, the field snaps back to that value on blur.
73
+ 2. Give the field a visible [Label](./form-label.md) tied with `htmlFor` and `id`, including the currency or unit.
74
+ 3. Use CurrencyInput for money rather than a hand-written `prefix="$"` with `decimals={2}`. It takes the symbol and decimal places from `currencies`.
75
+ 4. Set separators yourself; nothing is locale-aware. CurrencyInput doesn't change separators: pass `thousandsSeparator="."` and `decimalSeparator=","` where that's the convention.
76
+ 5. Expect `currency` to win over `decimals`. To show a currency with other precision, use DecimalInput with `prefix`.
77
+ 6. Validate bounds on submit. `min` and `max` clamp the number sent to `onValueChange` as the user types, but the field shows what they typed until blur.
78
+ 7. Set `allowNegative` for refunds and adjustments; it's off by default.
79
+ 8. Never pass `className` or `style`; they're dropped. Put width on a wrapper.
80
+
81
+ ## 9. Dos and don'ts
82
+
83
+ **Do:** control the value and name the currency in the label.
84
+
85
+ ```tsx
86
+ <Label htmlFor="budget">Monthly budget (USD)</Label>
87
+ <CurrencyInput id="budget" currency="USD" value={budget} onValueChange={setBudget} />
88
+ ```
89
+
90
+ **Don't:** leave it uncontrolled, or pin a value without updating it.
91
+
92
+ ```tsx
93
+ <CurrencyInput currency="USD" />
94
+ <CurrencyInput currency="USD" value={99.99} />
95
+ ```
96
+
97
+ **Do:** set separators for the format your users expect.
98
+
99
+ ```tsx
100
+ <CurrencyInput currency="EUR" thousandsSeparator="." decimalSeparator="," value={amount} onValueChange={setAmount} />
101
+ ```
102
+
103
+ **Don't:** fake a unit with an icon or text outside the field.
104
+
105
+ ```tsx
106
+ <div style={{ display: "flex" }}>
107
+ <DecimalInput value={weight} onValueChange={setWeight} />
108
+ <span>kg</span>
109
+ </div>
110
+ ```
111
+
112
+ ## 10. Accessibility
113
+
114
+ - Role: `textbox` (`type="text"` with `inputMode="decimal"`, so mobile shows a decimal keypad).
115
+ - Label: a Label tied by `htmlFor`/`id`. Include the currency or unit in it; the prefix and suffix text isn't part of the name.
116
+ - Keyboard: standard text input. There's no arrow-key stepping.
117
+ - Focus: native focus. On focus the value switches to its raw form (for example `1234.5`) for editing.
118
+ - Contrast: handled by the theme. Don't override colours.
119
+
120
+ ## 11. Behaviour
121
+
122
+ - Typing: anything other than digits, the decimal separator and (with `allowNegative`) one leading minus is removed. Extra decimal separators are dropped, and digits past the allowed decimal places are cut off. Thousands separators can't be typed; they're added on blur.
123
+ - Focus and blur: with a controlled `value`, focus shows the raw number and blur shows it formatted, for example `1,234.50`.
124
+ - `onValueChange` sends a JS `number` on every change, clamped to `min` and `max`, or `undefined` when the field can't be parsed.
125
+ - Setting `value` back to `undefined` doesn't clear the field. Set a number, or remount with a new `key` to reset.
126
+ - Responsive: fills its container's width. Constrain it with a wrapper.
127
+ - Motion: colour transitions over 150ms. Don't add your own.
128
+
129
+ ## 12. API
130
+
131
+ <!-- api:start -->
132
+ ### DecimalInput
133
+
134
+ | Prop | Type | Default | Description |
135
+ | --- | --- | --- | --- |
136
+ | `value` | `number` | | Controlled value. Required for formatting. |
137
+ | `onValueChange` | `(value: number \| undefined) => void` | | Fires on every change with the clamped number, or `undefined`. |
138
+ | `decimals` | `number` | `2` | Decimal places allowed while typing and shown on blur. Ignored when `currency` is set. |
139
+ | `min` | `number` | | Lower bound for the emitted value. |
140
+ | `max` | `number` | | Upper bound for the emitted value. |
141
+ | `prefix` | `string` | | Text at the leading edge. Overrides the currency symbol. |
142
+ | `suffix` | `string` | | Text at the trailing edge. |
143
+ | `currency` | `CurrencyCode` | | One of `currencies`' keys; sets the symbol prefix and decimal places. |
144
+ | `unit` | `string` | | Unit text, placed by `unitPosition`. |
145
+ | `unitPosition` | `"prefix" \| "suffix"` | `"prefix"` | Where `unit` shows. |
146
+ | `thousandsSeparator` | `string` | `","` | Inserted between groups of three digits on blur. |
147
+ | `decimalSeparator` | `string` | `"."` | Separates whole and fractional parts, typed and displayed. |
148
+ | `allowNegative` | `boolean` | `false` | Allows one leading minus sign. |
149
+ | `disabled` | `boolean` | | Disables the field. |
150
+ | `...props` | `InputHTMLAttributes` without `className`, `style`, `size`, `type`, `value`, `onChange` | | Native input attributes: `id`, `name`, `placeholder`, `required`, `aria-*`. `ref` reaches the `<input>`. |
151
+
152
+ ### CurrencyInput
153
+
154
+ | Prop | Type | Default | Description |
155
+ | --- | --- | --- | --- |
156
+ | `currency` | `CurrencyCode` | required | Sets the symbol prefix and decimal places. |
157
+ | `...props` | DecimalInput props | | Everything else as DecimalInput. |
158
+
159
+ ### PercentageInput
160
+
161
+ | Prop | Type | Default | Description |
162
+ | --- | --- | --- | --- |
163
+ | `min` | `number` | `0` | Lower bound. |
164
+ | `max` | `number` | `100` | Upper bound. |
165
+ | `decimals` | `number` | `1` | Decimal places. |
166
+ | `...props` | DecimalInput props without `suffix` | | The `%` suffix is fixed. |
167
+
168
+ ### UnitInput
169
+
170
+ | Prop | Type | Default | Description |
171
+ | --- | --- | --- | --- |
172
+ | `unit` | `string` | required | Unit text, for example `"kg"`. |
173
+ | `unitPosition` | `"prefix" \| "suffix"` | `"suffix"` | Where the unit shows. |
174
+ | `...props` | DecimalInput props | | Everything else as DecimalInput. |
175
+
176
+ ### currencies
177
+
178
+ `Record<CurrencyCode, { code, symbol, name, decimals }>` for the eleven supported currencies: USD, EUR, GBP, JPY, CNY, KRW, INR, BRL, CAD, AUD, CHF. JPY and KRW have 0 decimals; the rest have 2. The `CurrencyCode` and `CurrencyInfo` types are exported too.
179
+ <!-- api:end -->
180
+
181
+ ## 13. Examples
182
+
183
+ ```tsx
184
+ import { useState } from "react";
185
+ import { CurrencyInput, FormDescription, Label, PercentageInput } from "@eluan/core";
186
+
187
+ export function PricingFields() {
188
+ const [price, setPrice] = useState<number | undefined>(49);
189
+ const [discount, setDiscount] = useState<number | undefined>(10);
190
+
191
+ const field = { display: "flex", flexDirection: "column", gap: "var(--spacing-sm)" } as const;
192
+
193
+ return (
194
+ <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: "var(--spacing-lg)" }}>
195
+ <div style={field}>
196
+ <Label htmlFor="plan-price" required>Price per month (USD)</Label>
197
+ <CurrencyInput
198
+ id="plan-price"
199
+ name="price"
200
+ currency="USD"
201
+ min={0}
202
+ placeholder="0.00"
203
+ value={price}
204
+ onValueChange={setPrice}
205
+ />
206
+ </div>
207
+ <div style={field}>
208
+ <Label htmlFor="plan-discount">Annual discount</Label>
209
+ <PercentageInput
210
+ id="plan-discount"
211
+ name="discount"
212
+ value={discount}
213
+ onValueChange={setDiscount}
214
+ aria-describedby="plan-discount-hint"
215
+ />
216
+ <FormDescription id="plan-discount-hint">Up to 100%. Applied when billed yearly.</FormDescription>
217
+ </div>
218
+ </div>
219
+ );
220
+ }
221
+ ```
222
+
223
+ ## 14. Related components
224
+
225
+ - [NumberInput](./number-input.md): whole-number counts with steppers.
226
+ - [Slider](./slider.md): approximate values on a range.
227
+ - [Input](./input.md): the field family DecimalInput is styled to match.
228
+ - [Forms pattern](../patterns/forms.md): field structure and validation.
229
+
230
+ ## 15. Common agent mistakes
231
+
232
+ _Filled from evals._
@@ -0,0 +1,322 @@
1
+ ---
2
+ name: Dialog
3
+ use_when: The user must confirm or finish one short task before going back to the page, including destructive confirmations.
4
+ instead_of: Sheet for long or form-heavy secondary content; Popover for a small non-blocking panel; Toast or Banner to report an outcome; never window.confirm or a custom modal.
5
+ source: packages/core/src/components/dialog.tsx
6
+ ---
7
+
8
+ # Dialog
9
+
10
+ ## 1. Overview
11
+
12
+ Dialog is a modal window built on Radix Dialog. `DialogContent` portals a centred panel and a scrim over the page, traps focus inside, and returns focus to the trigger when it closes. Eluan has no AlertDialog: a confirmation, destructive or not, is a Dialog with the right Button in its footer.
13
+
14
+ ## 2. When to use
15
+
16
+ - Confirming a destructive or irreversible action: delete a project, remove a teammate, revoke a key.
17
+ - A short, focused task the user must finish or cancel before continuing: rename, invite one person.
18
+ - Warning about unsaved changes before the user leaves.
19
+ - A command palette, through [Command](./command.md)'s `CommandDialog` (which renders `DialogContent layout="command"` for you).
20
+
21
+ ### When not to use
22
+
23
+ - Long forms, record details or filters that need room → use [Sheet](./sheet.md).
24
+ - A side panel the user keeps open while working → use [Drawer](./drawer.md).
25
+ - A small panel anchored to a control that doesn't block the page → use [Popover](./popover.md).
26
+ - Telling the user something happened → use [Toast](./toast.md) for a transient confirmation, [Banner](./banner.md) for a persistent message. See `../patterns/feedback.md`.
27
+ - Offering a list of actions → use [DropdownMenu](./dropdown-menu.md) or [ActionPopover](./action-popover.md).
28
+ - Revealing more content in the page flow → use [Collapsible](./collapsible.md) or [Accordion](./accordion.md).
29
+
30
+ ### Choosing a confirmation pattern
31
+
32
+ | Situation | Use |
33
+ | --- | --- |
34
+ | Destructive or irreversible: delete, remove, revoke | Dialog. Title asks the question, description states the consequence, footer has Cancel and a `destructive` Button that repeats the verb. |
35
+ | Consequential but reversible: publish, send to 40 people | Dialog with a `default` (primary) confirm Button. |
36
+ | Low risk and easy to undo: archive, remove from a list | No Dialog. Run the action, then show a [Toast](./toast.md) with an Undo action. |
37
+ | Leaving with unsaved changes | Dialog: "Discard changes?" with Keep editing and a `destructive` Discard. |
38
+
39
+ ## 3. Anatomy
40
+
41
+ 1. **Dialog**: the root. Holds open state; renders nothing itself.
42
+ 2. **DialogTrigger**: the control that opens the dialog. Wrap a Button with `asChild`. Focus returns here on close.
43
+ 3. **DialogContent**: the panel. Renders the portal, the overlay (scrim in `--overlay-bg` at 80% opacity) and the panel (`--container-bg`, `--container-border`, `--curves-lg` corners, `--spacing-lg` padding, `--spacing-md` gap between children). Adds a close button (X icon, "Close" for screen readers) in the top-right corner, after your content in the DOM.
44
+ 4. **DialogHeader**: a column holding the title and description, `--spacing-xs` apart.
45
+ 5. **DialogTitle**: required. Renders an `h2` and names the dialog.
46
+ 6. **DialogDescription**: a `p` in `--font-size-sm` that describes the dialog to screen readers.
47
+ 7. **Body** (optional): your own content between header and footer.
48
+ 8. **DialogFooter**: the button row.
49
+ 9. **DialogClose**: closes the dialog. Wrap the Cancel Button with `asChild`.
50
+ 10. **DialogOverlay**, **DialogPortal**: exported, but DialogContent already renders both. Don't add them yourself.
51
+
52
+ ## 4. Variants
53
+
54
+ No `variant` prop. `layout` on DialogContent changes the panel:
55
+
56
+ | Layout | Use for |
57
+ | --- | --- |
58
+ | `default` | Every confirmation and task dialog. |
59
+ | `command` | Command palettes only: removes the padding and the close button. Use [Command](./command.md)'s `CommandDialog` rather than setting this yourself. |
60
+
61
+ ## 5. Sizes
62
+
63
+ No size prop. The panel is the full viewport width minus `--spacing-2xl`, up to 32rem. If the content needs more room, use [Sheet](./sheet.md).
64
+
65
+ ## 6. States
66
+
67
+ | State | Looks like | Notes |
68
+ | --- | --- | --- |
69
+ | Closed | Only the trigger renders | DialogContent is unmounted. |
70
+ | Open | Scrim over the page, panel centred | The page behind is inert: hidden from screen readers, not clickable, not scrollable. |
71
+ | Hover (close button) | Close icon goes from 70% to full opacity | No background change. |
72
+ | Focus (close button) | 1px outline in `--focus-ring`, 1px offset | Never remove or restyle the focus ring. |
73
+
74
+ The title declares no colour of its own and inherits; Sheet and Drawer titles each use a different token. It looks the same in the default theme; don't recolour titles to compensate.
75
+
76
+ ## 7. Content guidelines
77
+
78
+ - Title: ask the question, naming the action and the object: "Delete Q3 roadmap?", "Remove Maya Chen from Acme?".
79
+ - Description: say what happens and whether it can be undone, in one or two sentences. Include what else is lost: "This deletes 14 environments and all deploy history."
80
+ - Confirm button: repeat the title's verb and object: "Delete project", not "OK" or "Yes".
81
+ - Dismiss button: "Cancel". For unsaved changes, "Keep editing".
82
+ - Sentence case everywhere. No exclamation marks.
83
+
84
+ | Do | Don't |
85
+ | --- | --- |
86
+ | Delete Q3 roadmap? | Are you sure? |
87
+ | This permanently deletes the roadmap and its 12 milestones. You can't undo this. | This action cannot be undone. |
88
+ | Delete roadmap | OK |
89
+ | Cancel | No |
90
+
91
+ ## 8. Rules
92
+
93
+ 1. Always render a DialogTitle. Radix logs an error without one.
94
+ 2. Render a DialogDescription, or pass `aria-describedby={undefined}` to DialogContent when there's nothing to describe. Radix warns otherwise.
95
+ 3. Open the dialog from a `DialogTrigger asChild` wrapping a Button. That's what returns focus on close.
96
+ 4. When there's no DialogTrigger (a controlled dialog opened from a menu item or a keyboard shortcut), pass `onCloseAutoFocus` to DialogContent, call `event.preventDefault()`, and focus the control that opened it.
97
+ 5. For a destructive confirmation, put Cancel (`DialogClose asChild` around an `outline` Button) first and the `destructive` Button last in DialogFooter. When the body has no fields, Cancel then receives focus as the dialog opens.
98
+ 6. Use one `destructive` or `default` Button per dialog: the confirm action.
99
+ 7. Always include a visible Cancel or Close Button in the footer. Don't rely on the built-in X alone.
100
+ 8. Never build a modal from a `div`, and never use `window.confirm`.
101
+ 9. Never pass `className` or `style` to any Dialog part; they're dropped. Lay out the body with your own wrapper element.
102
+
103
+ ## 9. Dos and don'ts
104
+
105
+ **Do:** confirm a destructive action with a specific title and a matching button.
106
+
107
+ ```tsx
108
+ <Dialog>
109
+ <DialogTrigger asChild>
110
+ <Button type="button" variant="dangerGhost">Delete roadmap</Button>
111
+ </DialogTrigger>
112
+ <DialogContent>
113
+ <DialogHeader>
114
+ <DialogTitle>Delete Q3 roadmap?</DialogTitle>
115
+ <DialogDescription>This permanently deletes the roadmap and its 12 milestones.</DialogDescription>
116
+ </DialogHeader>
117
+ <DialogFooter>
118
+ <DialogClose asChild>
119
+ <Button type="button" variant="outline">Cancel</Button>
120
+ </DialogClose>
121
+ <Button type="button" variant="destructive" onClick={deleteRoadmap}>Delete roadmap</Button>
122
+ </DialogFooter>
123
+ </DialogContent>
124
+ </Dialog>
125
+ ```
126
+
127
+ **Don't:** use a browser confirm or a vague, generic dialog.
128
+
129
+ ```tsx
130
+ <Button onClick={() => window.confirm("Are you sure?") && deleteRoadmap()}>Delete</Button>
131
+
132
+ <DialogContent>
133
+ <DialogTitle>Are you sure?</DialogTitle>
134
+ <DialogFooter>
135
+ <Button>OK</Button>
136
+ </DialogFooter>
137
+ </DialogContent>
138
+ ```
139
+
140
+ **Do:** return focus yourself when a menu item opens the dialog.
141
+
142
+ ```tsx
143
+ const menuTriggerRef = React.useRef<HTMLButtonElement>(null);
144
+
145
+ <DialogContent
146
+ onCloseAutoFocus={(event) => {
147
+ event.preventDefault();
148
+ menuTriggerRef.current?.focus();
149
+ }}
150
+ >
151
+ {/* … */}
152
+ </DialogContent>
153
+ ```
154
+
155
+ **Don't:** open a dialog from a bare `onClick` with no DialogTrigger and no `onCloseAutoFocus`. Focus is lost when it closes.
156
+
157
+ ```tsx
158
+ <Button onClick={() => setOpen(true)}>Delete roadmap</Button>
159
+ <Dialog open={open} onOpenChange={setOpen}>
160
+ <DialogContent>{/* … */}</DialogContent>
161
+ </Dialog>
162
+ ```
163
+
164
+ ## 10. Accessibility
165
+
166
+ - Role: `dialog` on DialogContent. DialogTrigger gets `aria-haspopup="dialog"`, `aria-expanded` and `aria-controls`.
167
+ - Label: DialogTitle names the dialog (`aria-labelledby`); DialogDescription describes it (`aria-describedby`). The close button's name is "Close".
168
+ - Keyboard: Escape closes. Tab and Shift+Tab cycle through the dialog's controls and wrap at the ends. Enter and Space activate buttons.
169
+ - Focus: on open, focus moves to the first focusable element in your content (links are skipped). The close button comes last in the DOM, so it's only focused first when your content has no controls. Focus is trapped while open and returns to DialogTrigger on close. Everything outside the dialog is hidden from assistive technology and blocked from pointer input.
170
+ - Contrast: handled by the theme. Don't override colours.
171
+ - The built-in close button is a `--size-xxs` icon with no padding, a small pointer target. Rule 7's footer button is the reliable way to dismiss.
172
+
173
+ ## 11. Behaviour
174
+
175
+ - Responsive: below 640px the header centres its text and the footer stacks its buttons full width with the last button (the confirm action) on top; from 640px the header aligns left and the footer is a right-aligned row.
176
+ - Overflow and truncation: the panel has no maximum height and doesn't scroll. Keep dialog content short; move anything long to a [Sheet](./sheet.md).
177
+ - Motion: the dialog appears and disappears without animation. Don't add your own.
178
+ - Dismissal: Escape, a click on the scrim, the close button or a DialogClose all close it and fire `onOpenChange(false)`. To keep it open while a request runs, ignore `onOpenChange` in that window (see the example).
179
+ - Portal: DialogContent mounts in `document.body`. In a scoped theme, pass `portalContainer` to the scoped EluanProvider or wrap the region in `PortalContainerProvider` so the dialog inherits the scope's tokens; `container` overrides it for one dialog. See `../foundations/theming.md`.
180
+
181
+ ## 12. API
182
+
183
+ <!-- api:start -->
184
+ ### Dialog
185
+
186
+ | Prop | Type | Default | Description |
187
+ | --- | --- | --- | --- |
188
+ | `open` | `boolean` | | Controlled open state. |
189
+ | `defaultOpen` | `boolean` | `false` | Initial state when uncontrolled. |
190
+ | `onOpenChange` | `(open: boolean) => void` | | Called on every open and close. |
191
+ | `modal` | `boolean` | `true` | `false` removes the overlay, focus trap, scroll lock and page hiding. Keep `true`. |
192
+
193
+ ### DialogTrigger, DialogClose
194
+
195
+ | Prop | Type | Default | Description |
196
+ | --- | --- | --- | --- |
197
+ | `asChild` | `boolean` | `false` | Renders the child (a Button) instead of a bare `<button type="button">`. |
198
+ | `...props` | Radix `Dialog.Trigger` / `Dialog.Close` props | | Native button attributes. |
199
+
200
+ ### DialogContent
201
+
202
+ | Prop | Type | Default | Description |
203
+ | --- | --- | --- | --- |
204
+ | `layout` | `"default" \| "command"` | `"default"` | `"command"` removes padding and the close button, for CommandDialog. |
205
+ | `container` | `HTMLElement \| null` | nearest `PortalContainerProvider`, then `document.body` | Element to portal into. |
206
+ | `onOpenAutoFocus` | `(event: Event) => void` | | Runs as focus moves in. `preventDefault()` and focus another element to change the target. |
207
+ | `onCloseAutoFocus` | `(event: Event) => void` | | Runs as focus returns. `preventDefault()` and focus the opener when there's no DialogTrigger. |
208
+ | `onEscapeKeyDown` | `(event: KeyboardEvent) => void` | | `preventDefault()` keeps the dialog open. |
209
+ | `onPointerDownOutside` | `(event: CustomEvent) => void` | | `preventDefault()` keeps the dialog open on a scrim click. |
210
+ | `aria-describedby` | `string \| undefined` | DialogDescription's id | Pass `undefined` when there's no description. |
211
+ | `forceMount` | `true` | | Keeps the content mounted while closed. |
212
+ | `...props` | Radix `Dialog.Content` props without `className`, `style` | | |
213
+
214
+ ### DialogHeader, DialogFooter
215
+
216
+ | Prop | Type | Default | Description |
217
+ | --- | --- | --- | --- |
218
+ | `...props` | `HTMLAttributes<HTMLDivElement>` without `className`, `style` | | Layout wrappers. |
219
+
220
+ ### DialogTitle, DialogDescription
221
+
222
+ | Prop | Type | Default | Description |
223
+ | --- | --- | --- | --- |
224
+ | `asChild` | `boolean` | `false` | Renders the child element instead of the `h2` / `p`. |
225
+ | `...props` | Radix `Dialog.Title` / `Dialog.Description` props without `className`, `style` | | |
226
+
227
+ ### DialogOverlay, DialogPortal
228
+
229
+ Rendered by DialogContent. Radix `Dialog.Overlay` (without `className`, `style`) and `Dialog.Portal` props.
230
+ <!-- api:end -->
231
+
232
+ ## 13. Examples
233
+
234
+ A destructive confirmation that stays open while the delete runs and returns focus to its trigger.
235
+
236
+ ```tsx
237
+ import * as React from "react";
238
+ import {
239
+ Button,
240
+ Dialog,
241
+ DialogClose,
242
+ DialogContent,
243
+ DialogDescription,
244
+ DialogFooter,
245
+ DialogHeader,
246
+ DialogTitle,
247
+ DialogTrigger,
248
+ } from "@eluan/core";
249
+ import { Trash2 } from "lucide-react";
250
+
251
+ export function DeleteProjectDialog({
252
+ projectName,
253
+ environmentCount,
254
+ onDelete,
255
+ }: {
256
+ projectName: string;
257
+ environmentCount: number;
258
+ onDelete: () => Promise<void>;
259
+ }) {
260
+ const [open, setOpen] = React.useState(false);
261
+ const [deleting, setDeleting] = React.useState(false);
262
+
263
+ async function handleDelete() {
264
+ if (deleting) return;
265
+ setDeleting(true);
266
+ try {
267
+ await onDelete();
268
+ setOpen(false);
269
+ } finally {
270
+ setDeleting(false);
271
+ }
272
+ }
273
+
274
+ return (
275
+ <Dialog open={open} onOpenChange={(next) => !deleting && setOpen(next)}>
276
+ <DialogTrigger asChild>
277
+ <Button type="button" variant="dangerGhost">
278
+ <Trash2 aria-hidden="true" style={{ width: "var(--size-xxs)", height: "var(--size-xxs)" }} />
279
+ Delete project
280
+ </Button>
281
+ </DialogTrigger>
282
+ <DialogContent>
283
+ <DialogHeader>
284
+ <DialogTitle>Delete {projectName}?</DialogTitle>
285
+ <DialogDescription>
286
+ This permanently deletes the project, its {environmentCount} environments and all deploy
287
+ history. You can't undo this.
288
+ </DialogDescription>
289
+ </DialogHeader>
290
+ <DialogFooter>
291
+ <DialogClose asChild>
292
+ <Button type="button" variant="outline" disabled={deleting}>
293
+ Cancel
294
+ </Button>
295
+ </DialogClose>
296
+ <Button
297
+ type="button"
298
+ variant="destructive"
299
+ onClick={handleDelete}
300
+ aria-busy={deleting}
301
+ aria-disabled={deleting}
302
+ >
303
+ Delete project
304
+ </Button>
305
+ </DialogFooter>
306
+ </DialogContent>
307
+ </Dialog>
308
+ );
309
+ }
310
+ ```
311
+
312
+ ## 14. Related components
313
+
314
+ - [Button](./button.md): the trigger and the footer actions; `destructive` for the confirm action.
315
+ - [Sheet](./sheet.md): a modal panel from the screen edge for longer content.
316
+ - [Command](./command.md): `CommandDialog` builds a command palette on Dialog.
317
+ - [ActionPopover](./action-popover.md) and [DropdownMenu](./dropdown-menu.md): row actions that often open a confirmation Dialog.
318
+ - [Toast](./toast.md): confirm that the action finished.
319
+
320
+ ## 15. Common agent mistakes
321
+
322
+ _Filled from evals._