@eluan/core 0.5.1 → 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 (322) 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/icon.d.ts +26 -0
  58. package/dist/components/layout-shared.d.ts +307 -0
  59. package/dist/components/navigation-drawer.d.ts +25 -5
  60. package/dist/components/row.d.ts +18 -0
  61. package/dist/components/stack.d.ts +14 -0
  62. package/dist/components/tone-shared.d.ts +39 -0
  63. package/dist/components/typography.d.ts +22 -2
  64. package/dist/components/visually-hidden.d.ts +11 -0
  65. package/dist/{credit-card-input-DN-8vaFj.js → credit-card-input-9VPlzvDm.js} +1 -1
  66. package/dist/{credit-card-input-CUqA9CX3.cjs → credit-card-input-DppPJBne.cjs} +1 -1
  67. package/dist/credit-card-input.cjs +1 -1
  68. package/dist/credit-card-input.js +1 -1
  69. package/dist/{date-picker-ni8td8Ru.js → date-picker-M5hLx_1s.js} +2 -2
  70. package/dist/{date-picker-DGBsfZXx.cjs → date-picker-hE7cDg2B.cjs} +1 -1
  71. package/dist/date-picker.cjs +1 -1
  72. package/dist/date-picker.js +1 -1
  73. package/dist/{datetime-picker-C1d63MaA.cjs → datetime-picker-BeRUPJ7s.cjs} +1 -1
  74. package/dist/{datetime-picker-DsnHYRK-.js → datetime-picker-CIqBZYMH.js} +3 -3
  75. package/dist/datetime-picker.cjs +1 -1
  76. package/dist/datetime-picker.js +1 -1
  77. package/dist/{decimal-input-yTk35W_5.js → decimal-input-Bg2BPKIr.js} +38 -38
  78. package/dist/decimal-input-CkTEjo2J.cjs +1 -0
  79. package/dist/decimal-input.cjs +1 -1
  80. package/dist/decimal-input.js +1 -1
  81. package/dist/{dialog-B8eWKqzS.js → dialog-Bsfviqvy.js} +2 -2
  82. package/dist/dialog-DRAoumvB.cjs +1 -0
  83. package/dist/dialog.cjs +1 -1
  84. package/dist/dialog.js +1 -1
  85. package/dist/{email-input-DFI4h_KN.cjs → email-input-CehmtNUq.cjs} +1 -1
  86. package/dist/{email-input-pX0hlYV3.js → email-input-DIiY9Q3S.js} +1 -1
  87. package/dist/email-input.cjs +1 -1
  88. package/dist/email-input.js +1 -1
  89. package/dist/{footer-DB0_-IwN.cjs → footer-fovIsy-0.cjs} +1 -1
  90. package/dist/{footer-B3KUIwXW.js → footer-jWaFq3qk.js} +9 -9
  91. package/dist/footer.cjs +1 -1
  92. package/dist/footer.js +1 -1
  93. package/dist/grid-BDz4Xs6M.cjs +1 -0
  94. package/dist/grid-BX5vZjDo.js +612 -0
  95. package/dist/grid.cjs +1 -0
  96. package/dist/grid.d.ts +1 -0
  97. package/dist/grid.js +5 -0
  98. package/dist/{header-CDOWlOAR.js → header-Dnf8AnIx.js} +2 -2
  99. package/dist/{header-CiZQY_7S.cjs → header-DzItWqW4.cjs} +1 -1
  100. package/dist/header.cjs +1 -1
  101. package/dist/header.js +1 -1
  102. package/dist/icon-BmLOodCQ.cjs +1 -0
  103. package/dist/icon-BwDfkIdR.js +153 -0
  104. package/dist/icon.cjs +1 -0
  105. package/dist/icon.d.ts +1 -0
  106. package/dist/icon.js +5 -0
  107. package/dist/index.cjs +10 -5
  108. package/dist/index.d.ts +6 -0
  109. package/dist/index.js +612 -541
  110. package/dist/{input-BrGJn-D9.cjs → input-BcjL2oxv.cjs} +1 -1
  111. package/dist/{input-Cccufiqn.js → input-CPb9yVU5.js} +8 -8
  112. package/dist/input-otp-BhJ3ERrY.cjs +1 -0
  113. package/dist/{input-otp-DmEGB1nu.js → input-otp-CTvJztkH.js} +32 -32
  114. package/dist/input-otp.cjs +1 -1
  115. package/dist/input-otp.js +1 -1
  116. package/dist/input.cjs +1 -1
  117. package/dist/input.js +1 -1
  118. package/dist/layout-shared-B_1iX4Hj.js +319 -0
  119. package/dist/layout-shared-CsBZcT4V.cjs +1 -0
  120. package/dist/{multi-select-B6NBbDCW.js → multi-select-CVxkWW29.js} +30 -30
  121. package/dist/multi-select-DBFINH3F.cjs +1 -0
  122. package/dist/multi-select.cjs +1 -1
  123. package/dist/multi-select.js +1 -1
  124. package/dist/navigation-drawer-BCBFtLEq.cjs +1 -0
  125. package/dist/navigation-drawer-BMyHXhhX.js +198 -0
  126. package/dist/navigation-drawer.cjs +1 -1
  127. package/dist/navigation-drawer.js +1 -1
  128. package/dist/{number-input-vICbRc2y.js → number-input-Cm9YPBOX.js} +1 -1
  129. package/dist/{number-input-Bc7jUsu-.cjs → number-input-Dr9MbuRV.cjs} +1 -1
  130. package/dist/number-input.cjs +1 -1
  131. package/dist/number-input.js +1 -1
  132. package/dist/{pagination-DTWRjiOm.js → pagination-D2tjMpVU.js} +2 -2
  133. package/dist/{pagination-4IuE_APs.cjs → pagination-yKmFlFMR.cjs} +1 -1
  134. package/dist/pagination.cjs +1 -1
  135. package/dist/pagination.js +1 -1
  136. package/dist/{password-input-BwnlHPbX.cjs → password-input-CmHubHuU.cjs} +1 -1
  137. package/dist/{password-input-B9V45d3Q.js → password-input-ljwdGCO6.js} +2 -2
  138. package/dist/password-input.cjs +1 -1
  139. package/dist/password-input.js +1 -1
  140. package/dist/{phone-input-BQjZj5jI.cjs → phone-input-B8VksCer.cjs} +1 -1
  141. package/dist/{phone-input-CSBpGHvI.js → phone-input-qTL6K8rT.js} +2 -2
  142. package/dist/phone-input.cjs +1 -1
  143. package/dist/phone-input.js +1 -1
  144. package/dist/progress-BpdmBGaX.cjs +1 -0
  145. package/dist/{progress-Dz_it5I-.js → progress-ChFf9bIq.js} +1 -1
  146. package/dist/progress.cjs +1 -1
  147. package/dist/progress.js +1 -1
  148. package/dist/providers/create-theme.d.ts +10 -1
  149. package/dist/{radio-group-C--1neiq.cjs → radio-group-9gozRouT.cjs} +1 -1
  150. package/dist/{radio-group-CNMPZx_2.js → radio-group-Bs9933bk.js} +6 -6
  151. package/dist/radio-group.cjs +1 -1
  152. package/dist/radio-group.js +1 -1
  153. package/dist/{rich-text-BZSyuYSo.js → rich-text-DImwK9hN.js} +1 -1
  154. package/dist/{rich-text-DerWxzdn.cjs → rich-text-DzHLeG7W.cjs} +1 -1
  155. package/dist/rich-text.cjs +1 -1
  156. package/dist/rich-text.js +1 -1
  157. package/dist/row-BYAk7G5d.js +37 -0
  158. package/dist/row-Bjn-GQAC.cjs +1 -0
  159. package/dist/row.cjs +1 -0
  160. package/dist/row.d.ts +1 -0
  161. package/dist/row.js +5 -0
  162. package/dist/{search-input-Dmmo-BEL.cjs → search-input-BKTjebg7.cjs} +1 -1
  163. package/dist/{search-input-bFNW6oiE.js → search-input-Dgr9kT1a.js} +1 -1
  164. package/dist/search-input.cjs +1 -1
  165. package/dist/search-input.js +1 -1
  166. package/dist/select-Cdh991T-.cjs +1 -0
  167. package/dist/{select-DDSYjKtj.js → select-Dp5AJ6I-.js} +15 -15
  168. package/dist/select.cjs +1 -1
  169. package/dist/select.js +1 -1
  170. package/dist/sheet-CkXjinUG.cjs +1 -0
  171. package/dist/{sheet-D5HWF66e.js → sheet-uiyHNKEw.js} +6 -6
  172. package/dist/sheet.cjs +1 -1
  173. package/dist/sheet.js +1 -1
  174. package/dist/{slider-CZQBAXup.js → slider-BQmbh0Nl.js} +1 -1
  175. package/dist/{slider-DdEOapYP.cjs → slider-DK2yk-YK.cjs} +1 -1
  176. package/dist/slider.cjs +1 -1
  177. package/dist/slider.js +1 -1
  178. package/dist/stack-Ck1w2iJu.cjs +1 -0
  179. package/dist/stack-D2btWM1t.js +27 -0
  180. package/dist/stack.cjs +1 -0
  181. package/dist/stack.d.ts +1 -0
  182. package/dist/stack.js +5 -0
  183. package/dist/{stepper-D5nDwJUz.cjs → stepper-ByYKX7qw.cjs} +1 -1
  184. package/dist/{stepper-BtlKiHtd.js → stepper-Copsj87A.js} +4 -4
  185. package/dist/stepper.cjs +1 -1
  186. package/dist/stepper.js +1 -1
  187. package/dist/styles.css +935 -59
  188. package/dist/{switch-KzBijHMJ.cjs → switch-C2OPCq5Z.cjs} +1 -1
  189. package/dist/{switch-C7EBLT5H.js → switch-CXBWUZcq.js} +3 -3
  190. package/dist/switch.cjs +1 -1
  191. package/dist/switch.js +1 -1
  192. package/dist/{tabs-DztJ2iVc.cjs → tabs-D8p6Tr5i.cjs} +1 -1
  193. package/dist/{tabs-C9NKBmH0.js → tabs-TV4_2wi1.js} +9 -9
  194. package/dist/tabs.cjs +1 -1
  195. package/dist/tabs.js +1 -1
  196. package/dist/{textarea-Dl-daLHR.cjs → textarea-BnpQmE74.cjs} +1 -1
  197. package/dist/{textarea-DXUk1b_-.js → textarea-CJRmnazN.js} +1 -1
  198. package/dist/textarea.cjs +1 -1
  199. package/dist/textarea.js +1 -1
  200. package/dist/{time-input-BPoFvoeM.js → time-input-A603mEFQ.js} +38 -38
  201. package/dist/time-input-qxljhdEb.cjs +1 -0
  202. package/dist/time-input.cjs +1 -1
  203. package/dist/time-input.js +1 -1
  204. package/dist/{toggle-Dv1VZ5Le.js → toggle-Bx3q15Pu.js} +6 -6
  205. package/dist/{toggle-Bvh1v32T.cjs → toggle-Z3t4jPdv.cjs} +1 -1
  206. package/dist/{toggle-group-SyHMwO90.cjs → toggle-group-BZIW4wJp.cjs} +1 -1
  207. package/dist/{toggle-group-DE8BPZih.js → toggle-group-LaZmOMx_.js} +7 -7
  208. package/dist/toggle-group.cjs +1 -1
  209. package/dist/toggle-group.js +1 -1
  210. package/dist/toggle.cjs +1 -1
  211. package/dist/toggle.js +1 -1
  212. package/dist/{tree-view-CyeJR7cW.js → tree-view-DRmm6oL6.js} +23 -23
  213. package/dist/tree-view-DVQyRQDg.cjs +1 -0
  214. package/dist/tree-view.cjs +1 -1
  215. package/dist/tree-view.js +1 -1
  216. package/dist/visually-hidden-BQMRYGxP.js +14 -0
  217. package/dist/visually-hidden-DzxxOswl.cjs +1 -0
  218. package/dist/visually-hidden.cjs +1 -0
  219. package/dist/visually-hidden.d.ts +1 -0
  220. package/dist/visually-hidden.js +5 -0
  221. package/package.json +8 -8
  222. package/skills/eluan/DESIGN.md +409 -0
  223. package/skills/eluan/SKILL.md +166 -0
  224. package/skills/eluan/components/accordion.md +212 -0
  225. package/skills/eluan/components/action-popover.md +266 -0
  226. package/skills/eluan/components/aspect-ratio.md +169 -0
  227. package/skills/eluan/components/avatar.md +277 -0
  228. package/skills/eluan/components/badge.md +190 -0
  229. package/skills/eluan/components/banner.md +247 -0
  230. package/skills/eluan/components/box.md +166 -0
  231. package/skills/eluan/components/breadcrumb.md +240 -0
  232. package/skills/eluan/components/button.md +214 -0
  233. package/skills/eluan/components/calendar.md +192 -0
  234. package/skills/eluan/components/card.md +270 -0
  235. package/skills/eluan/components/carousel.md +274 -0
  236. package/skills/eluan/components/checkbox-group.md +228 -0
  237. package/skills/eluan/components/checkbox.md +226 -0
  238. package/skills/eluan/components/code-block.md +193 -0
  239. package/skills/eluan/components/collapsible.md +240 -0
  240. package/skills/eluan/components/command.md +359 -0
  241. package/skills/eluan/components/context-menu.md +296 -0
  242. package/skills/eluan/components/credit-card-input.md +217 -0
  243. package/skills/eluan/components/date-picker.md +255 -0
  244. package/skills/eluan/components/date-time-picker.md +196 -0
  245. package/skills/eluan/components/decimal-input.md +232 -0
  246. package/skills/eluan/components/dialog.md +322 -0
  247. package/skills/eluan/components/drawer.md +292 -0
  248. package/skills/eluan/components/dropdown-menu.md +450 -0
  249. package/skills/eluan/components/email-input.md +200 -0
  250. package/skills/eluan/components/fieldset.md +219 -0
  251. package/skills/eluan/components/file-input.md +249 -0
  252. package/skills/eluan/components/footer.md +290 -0
  253. package/skills/eluan/components/form-label.md +254 -0
  254. package/skills/eluan/components/grid.md +192 -0
  255. package/skills/eluan/components/header.md +242 -0
  256. package/skills/eluan/components/hover-card.md +215 -0
  257. package/skills/eluan/components/icon.md +161 -0
  258. package/skills/eluan/components/input-otp.md +227 -0
  259. package/skills/eluan/components/input.md +249 -0
  260. package/skills/eluan/components/kbd.md +216 -0
  261. package/skills/eluan/components/media.md +244 -0
  262. package/skills/eluan/components/menubar.md +300 -0
  263. package/skills/eluan/components/multi-select.md +221 -0
  264. package/skills/eluan/components/navigation-drawer.md +297 -0
  265. package/skills/eluan/components/navigation-menu.md +291 -0
  266. package/skills/eluan/components/number-input.md +190 -0
  267. package/skills/eluan/components/pagination.md +262 -0
  268. package/skills/eluan/components/password-input.md +218 -0
  269. package/skills/eluan/components/phone-input.md +205 -0
  270. package/skills/eluan/components/popover.md +250 -0
  271. package/skills/eluan/components/progress.md +185 -0
  272. package/skills/eluan/components/radio-group.md +232 -0
  273. package/skills/eluan/components/rich-text.md +195 -0
  274. package/skills/eluan/components/row.md +174 -0
  275. package/skills/eluan/components/scroll-area.md +203 -0
  276. package/skills/eluan/components/search-input.md +281 -0
  277. package/skills/eluan/components/segmented-control.md +201 -0
  278. package/skills/eluan/components/select.md +296 -0
  279. package/skills/eluan/components/separator.md +179 -0
  280. package/skills/eluan/components/sheet.md +326 -0
  281. package/skills/eluan/components/skeleton.md +202 -0
  282. package/skills/eluan/components/slider.md +195 -0
  283. package/skills/eluan/components/spinner.md +187 -0
  284. package/skills/eluan/components/stack.md +158 -0
  285. package/skills/eluan/components/stepper.md +236 -0
  286. package/skills/eluan/components/switch.md +218 -0
  287. package/skills/eluan/components/table.md +348 -0
  288. package/skills/eluan/components/tabs.md +277 -0
  289. package/skills/eluan/components/textarea.md +202 -0
  290. package/skills/eluan/components/time-input.md +181 -0
  291. package/skills/eluan/components/toast.md +251 -0
  292. package/skills/eluan/components/toggle-group.md +241 -0
  293. package/skills/eluan/components/toggle.md +198 -0
  294. package/skills/eluan/components/tooltip.md +222 -0
  295. package/skills/eluan/components/tree-view.md +213 -0
  296. package/skills/eluan/components/typography.md +207 -0
  297. package/skills/eluan/components/visually-hidden.md +132 -0
  298. package/skills/eluan/foundations/colour.md +252 -0
  299. package/skills/eluan/foundations/elevation.md +57 -0
  300. package/skills/eluan/foundations/iconography.md +70 -0
  301. package/skills/eluan/foundations/motion.md +60 -0
  302. package/skills/eluan/foundations/radius.md +61 -0
  303. package/skills/eluan/foundations/spacing.md +98 -0
  304. package/skills/eluan/foundations/theming.md +197 -0
  305. package/skills/eluan/foundations/typography.md +163 -0
  306. package/skills/eluan/patterns/empty-states.md +84 -0
  307. package/skills/eluan/patterns/feedback.md +95 -0
  308. package/skills/eluan/patterns/forms.md +138 -0
  309. package/skills/eluan/patterns/navigation.md +95 -0
  310. package/skills/eluan/patterns/page-layout.md +101 -0
  311. package/dist/button-Ny6OF8Un.cjs +0 -1
  312. package/dist/decimal-input-BLmifKF2.cjs +0 -1
  313. package/dist/dialog-DWYtFhZl.cjs +0 -1
  314. package/dist/input-otp-DcZ7wyjs.cjs +0 -1
  315. package/dist/multi-select-kcoUbSwE.cjs +0 -1
  316. package/dist/navigation-drawer-BbeDYPhu.js +0 -171
  317. package/dist/navigation-drawer-DOOHfbY3.cjs +0 -1
  318. package/dist/progress-DpQjGEyn.cjs +0 -1
  319. package/dist/select-1Eb3NSrR.cjs +0 -1
  320. package/dist/sheet-7NP1LuHy.cjs +0 -1
  321. package/dist/time-input-DR2snTgB.cjs +0 -1
  322. package/dist/tree-view-CNvEc1TT.cjs +0 -1
@@ -0,0 +1,205 @@
1
+ ---
2
+ name: PhoneInput
3
+ use_when: The user enters a phone number and you need its country calling code.
4
+ instead_of: Input type="tel" when the country is fixed; Input for any other text.
5
+ source: packages/core/src/components/phone-input.tsx
6
+ ---
7
+
8
+ # PhoneInput
9
+
10
+ ## 1. Overview
11
+
12
+ PhoneInput pairs a country calling-code [Select](./select.md) (flag and dial code) with an [Input](./input.md) `type="tel"` for the number. As the user types it removes anything that isn't a digit, space, hyphen or parenthesis, and it reports the number with the selected country. It doesn't format the number or check its length.
13
+
14
+ ## 2. When to use
15
+
16
+ - Contact, account and checkout forms that accept numbers from more than one country.
17
+ - When you need the country (dial code) stored alongside the number.
18
+
19
+ ### When not to use
20
+
21
+ - A phone number in a product that serves one country → use [Input](./input.md) `type="tel"`, which shows the phone icon and the phone keypad on mobile.
22
+ - Any other text → use [Input](./input.md).
23
+ - A verification code sent by SMS → use [InputOTP](./input-otp.md).
24
+
25
+ PhoneInput earns its place through the country picker and the character filter. It doesn't mask, format or validate numbers; do that on submit.
26
+
27
+ ## 3. Anatomy
28
+
29
+ 1. **Country trigger**: a Select trigger showing the flag and dial code, attached flush to the field.
30
+ 2. **Country list**: the Select's list of countries, each row showing flag, name and dial code, sorted by name.
31
+ 3. **Number field**: an Input `type="tel"` with its left edge attached to the trigger.
32
+ 4. **Leading icon**: Input's phone icon.
33
+
34
+ ## 4. Variants
35
+
36
+ No variant prop. `countries` narrows the list; `defaultCountry` picks the starting country.
37
+
38
+ ## 5. Sizes
39
+
40
+ No size prop. The trigger and field take their heights from Select and Input and follow density.
41
+
42
+ ## 6. States
43
+
44
+ | State | Looks like | Notes |
45
+ | --- | --- | --- |
46
+ | Default | Input surface with the trigger attached on the left | |
47
+ | Focus | 1px outline in `--focus-ring` on whichever part has focus | Never remove or restyle the focus ring. |
48
+ | Open | Country list below the trigger | Select's own surface and item styles. |
49
+ | Disabled | Trigger and field both disabled | `disabled` reaches both parts. |
50
+ | Error (`aria-invalid`) | `--destructive-border` border on the number field | Set it on PhoneInput; it reaches the field. Pair with a FormMessage. |
51
+
52
+ ## 7. Content guidelines
53
+
54
+ - Label the field "Phone number" or "Mobile number".
55
+ - Use a placeholder only as an example in the default country's format, or not at all.
56
+ - Write errors that name the fix: "Enter a phone number with area code".
57
+
58
+ | Do | Don't |
59
+ | --- | --- |
60
+ | Mobile number | Phone (required!!) |
61
+ | Enter a number with area code | Invalid phone |
62
+
63
+ ## 8. Rules
64
+
65
+ 1. Keep the accessible name in sync with the visible label. The field defaults to `aria-label="Phone number"`, which overrides a `<label htmlFor>`. Pass `aria-labelledby` with the Label's `id`, or an `aria-label` with the same words.
66
+ 2. Control the number with `value` and `onValueChange`. Don't pass `defaultValue`; the field is always controlled internally.
67
+ 3. Store the country with the number: combine `country.dialCode` and `value` yourself. PhoneInput never joins them.
68
+ 4. Submit the country yourself. Only the number field takes `name`; the country isn't in native form data.
69
+ 5. Validate length and format on submit. PhoneInput only filters characters.
70
+ 6. Narrow the list with `countries`, built from `defaultCountries`, when the product serves a known set of countries.
71
+ 7. Treat `defaultCountry` as initial only. There's no controlled country prop, and changing `defaultCountry` after mount does nothing.
72
+ 8. Never pass `className` or `style`; they're dropped. Put width on a wrapper.
73
+
74
+ ## 9. Dos and don'ts
75
+
76
+ **Do:** tie the visible label to the field and keep the country.
77
+
78
+ ```tsx
79
+ <div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-sm)" }}>
80
+ <Label id="mobile-label" htmlFor="mobile">Mobile number</Label>
81
+ <PhoneInput
82
+ id="mobile"
83
+ name="mobile"
84
+ aria-labelledby="mobile-label"
85
+ value={number}
86
+ onValueChange={(next, country) => {
87
+ setNumber(next);
88
+ setDialCode(country.dialCode);
89
+ }}
90
+ />
91
+ </div>
92
+ ```
93
+
94
+ **Don't:** rely on `htmlFor` alone, or drop the country.
95
+
96
+ ```tsx
97
+ <Label htmlFor="mobile">Mobile number</Label>
98
+ <PhoneInput id="mobile" onValueChange={(next) => setPhone(next)} />
99
+ ```
100
+
101
+ **Do:** narrow the list from `defaultCountries`.
102
+
103
+ ```tsx
104
+ const northAmerica = defaultCountries.filter((c) => ["US", "CA", "MX"].includes(c.code));
105
+
106
+ <PhoneInput countries={northAmerica} defaultCountry="CA" value={number} onValueChange={setNumber} />
107
+ ```
108
+
109
+ **Don't:** hand-write a partial country list with your own flags and codes.
110
+
111
+ ```tsx
112
+ <PhoneInput countries={[{ code: "US", name: "USA", dialCode: "1", flag: "US" }]} />
113
+ ```
114
+
115
+ ## 10. Accessibility
116
+
117
+ - Roles: the trigger is a `combobox` and the list a `listbox` of `option`s (Radix Select); the number field is a `textbox`.
118
+ - Labels: the trigger is named "Country calling code, currently {country} {dial code}" and updates with the selection. The field is named "Phone number" unless you pass `aria-label` or `aria-labelledby`.
119
+ - Keyboard: on the trigger, Enter, Space or ArrowDown opens the list; arrows move; typing jumps to a matching country name or dial code; Enter selects; Escape closes. Tab moves from the trigger to the field.
120
+ - Focus: the list returns focus to the trigger when it closes.
121
+ - The trigger's flag is hidden from assistive tech.
122
+ - Contrast: handled by the theme. Don't override colours.
123
+
124
+ ## 11. Behaviour
125
+
126
+ - Responsive: a row; the field takes the remaining width. Constrain the whole control with a wrapper.
127
+ - Filtering: letters, `+` and other symbols are removed as the user types; spaces, hyphens and parentheses stay. The dial code lives in the trigger, so users don't type it.
128
+ - `onValueChange` fires on every edit of the number and on every country change (with the current number). `onCountryChange` fires on country changes only.
129
+ - Countries: the default list covers every country in `countries-list`, sorted by English name. Countries with several calling codes show only the first.
130
+ - Motion: from Select and Input. Don't add your own.
131
+
132
+ ## 12. API
133
+
134
+ <!-- api:start -->
135
+ | Prop | Type | Default | Description |
136
+ | --- | --- | --- | --- |
137
+ | `countries` | `Country[]` | `defaultCountries` | The countries in the picker, in the order given. |
138
+ | `defaultCountry` | `string` | `"US"` | ISO 3166-1 alpha-2 code of the starting country. Falls back to the first entry if not found. Read on mount only. |
139
+ | `value` | `string` | | Controlled number, without the dial code. |
140
+ | `onValueChange` | `(value: string, country: Country) => void` | | Fires when the number or the country changes. |
141
+ | `onCountryChange` | `(country: Country) => void` | | Fires when the country changes. |
142
+ | `disabled` | `boolean` | | Disables the trigger and the field. |
143
+ | `...props` | `InputHTMLAttributes` without `className`, `style`, `size`, `type`, `value`, `onChange` | | Native attributes for the number field: `id`, `name`, `placeholder`, `required`, `autoComplete`, `aria-*`. `ref` reaches the number `<input>`. |
144
+ <!-- api:end -->
145
+
146
+ ### Country
147
+
148
+ | Field | Type | Description |
149
+ | --- | --- | --- |
150
+ | `code` | `string` | ISO 3166-1 alpha-2 code, for example `"GB"`. |
151
+ | `name` | `string` | English country name. |
152
+ | `dialCode` | `string` | Calling code with a leading `+`, for example `"+44"`. |
153
+ | `flag` | `string` | Flag emoji. |
154
+
155
+ `defaultCountries` is the full `Country[]` list PhoneInput uses by default, exported so you can filter or reorder it.
156
+
157
+ ## 13. Examples
158
+
159
+ ```tsx
160
+ import { useState } from "react";
161
+ import { FormDescription, Label, PhoneInput, defaultCountries, type Country } from "@eluan/core";
162
+
163
+ const shippingCountries = defaultCountries.filter((country) =>
164
+ ["US", "CA", "GB", "IE", "AU", "NZ"].includes(country.code)
165
+ );
166
+
167
+ export function DeliveryPhoneField({ onChange }: { onChange: (fullNumber: string) => void }) {
168
+ const [number, setNumber] = useState("");
169
+
170
+ function handleChange(next: string, country: Country) {
171
+ setNumber(next);
172
+ onChange(`${country.dialCode} ${next}`.trim());
173
+ }
174
+
175
+ return (
176
+ <div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-sm)" }}>
177
+ <Label id="delivery-phone-label" htmlFor="delivery-phone" required>
178
+ Phone number
179
+ </Label>
180
+ <PhoneInput
181
+ id="delivery-phone"
182
+ name="deliveryPhone"
183
+ aria-labelledby="delivery-phone-label"
184
+ aria-describedby="delivery-phone-hint"
185
+ countries={shippingCountries}
186
+ defaultCountry="US"
187
+ value={number}
188
+ onValueChange={handleChange}
189
+ />
190
+ <FormDescription id="delivery-phone-hint">The courier texts this number on delivery day.</FormDescription>
191
+ </div>
192
+ );
193
+ }
194
+ ```
195
+
196
+ ## 14. Related components
197
+
198
+ - [Input](./input.md): the number field; use it alone for single-country numbers.
199
+ - [Select](./select.md): the country picker.
200
+ - [Label](./form-label.md): the visible label, plus FormDescription and FormMessage.
201
+ - [Forms pattern](../patterns/forms.md): field structure and validation.
202
+
203
+ ## 15. Common agent mistakes
204
+
205
+ _Filled from evals._
@@ -0,0 +1,250 @@
1
+ ---
2
+ name: Popover
3
+ use_when: A small interactive panel (a short form, a few options) opens from a control and floats next to it without blocking the page.
4
+ instead_of: DropdownMenu or ActionPopover for a list of actions; Tooltip for a text hint; HoverCard for a hover preview; Dialog or Sheet for content that must block the page.
5
+ source: packages/core/src/components/popover.tsx
6
+ ---
7
+
8
+ # Popover
9
+
10
+ ## 1. Overview
11
+
12
+ Popover is a non-modal floating panel anchored to its trigger, built on Radix Popover. It portals, opens on click, moves focus inside, and closes on Escape or a click outside. DatePicker, DateTimePicker and MultiSelect use it for their dropdown panels.
13
+
14
+ ## 2. When to use
15
+
16
+ - A short form tied to one control: rename an item, set dimensions, add a link.
17
+ - A small set of options or settings: share settings, column visibility, notification preferences for one item.
18
+ - A custom picker anchored to a field, when no Eluan picker fits.
19
+
20
+ ### When not to use
21
+
22
+ - A list of actions → use [DropdownMenu](./dropdown-menu.md), or [ActionPopover](./action-popover.md) for row actions.
23
+ - A short text hint or label → use [Tooltip](./tooltip.md).
24
+ - A preview on hover → use [HoverCard](./hover-card.md).
25
+ - A decision that must be answered before continuing → use [Dialog](./dialog.md).
26
+ - A long form or details → use [Sheet](./sheet.md).
27
+ - Picking a date or one of several options → use [DatePicker](./date-picker.md), [Select](./select.md) or [MultiSelect](./multi-select.md).
28
+
29
+ ## 3. Anatomy
30
+
31
+ 1. **Popover**: the root. Holds open state; renders nothing itself.
32
+ 2. **PopoverTrigger**: the control that toggles the popover. Wrap a Button with `asChild`.
33
+ 3. **PopoverContent**: the floating panel. Renders in a portal with `--container-bg`, a `--container-border` border, `--curves-md` corners, `--spacing-md` padding, 18rem wide, 4px from the trigger.
34
+ 4. **Your content**: anything inside PopoverContent. Eluan exports no close, arrow or anchor parts.
35
+
36
+ ## 4. Variants
37
+
38
+ No `variant` prop. `layout` on PopoverContent changes width and padding:
39
+
40
+ | Layout | Use for |
41
+ | --- | --- |
42
+ | `default` | Every popover you build: 18rem wide with padding. |
43
+ | `matchTrigger` | A panel as wide as its trigger, with no padding, such as a list under a field. MultiSelect uses it. |
44
+ | `calendar` | DatePicker's range calendar: sized to the calendar, no padding. |
45
+ | `calendarSingle` | DatePicker's single calendar: as wide as the trigger, never narrower than the calendar. |
46
+
47
+ Use [DatePicker](./date-picker.md) rather than putting a Calendar in a Popover yourself.
48
+
49
+ ## 5. Sizes
50
+
51
+ No size prop. The `default` layout is a fixed 18rem; `matchTrigger` and `calendarSingle` follow the trigger's width.
52
+
53
+ ## 6. States
54
+
55
+ | State | Looks like | Notes |
56
+ | --- | --- | --- |
57
+ | Closed | Only the trigger renders | PopoverContent is unmounted. The trigger has `data-state="closed"`. |
58
+ | Open | Panel floats beside the trigger | The page stays usable. |
59
+ | Focus | PopoverContent draws no outline | Focus goes to the first control inside, which shows its own ring. Never remove or restyle the focus ring. |
60
+
61
+ PopoverContent sets its text colour from `--interactive-fg`, where Tooltip and HoverCard use `--container-fg`. They match in the default theme; don't set your own text colour to compensate.
62
+
63
+ ## 7. Content guidelines
64
+
65
+ - One task per popover. Lead with a short heading when it holds a form: "Rename file", "Dimensions".
66
+ - Keep it to a few fields or options. If it needs scrolling or sections, use a Sheet.
67
+ - Label the trigger with what opens: "Share", "Columns", "Edit link".
68
+ - Sentence case.
69
+
70
+ | Do | Don't |
71
+ | --- | --- |
72
+ | Rename file | Options |
73
+ | Columns | Click to configure |
74
+
75
+ ## 8. Rules
76
+
77
+ 1. Use `PopoverTrigger asChild` around a Button.
78
+ 2. Give PopoverContent an `aria-label`, or an `aria-labelledby` pointing at its heading. It has the `dialog` role and no name of its own.
79
+ 3. To close after saving, control it: pass `open` and `onOpenChange` and set `open` to `false`. There's no PopoverClose part.
80
+ 4. Keep it short. The panel has no maximum height and doesn't scroll.
81
+ 5. Never use a Popover as an action menu; DropdownMenu brings menu roles and arrow-key navigation.
82
+ 6. Never pass `className` or `style` to Popover parts; they're dropped. Lay out content with your own wrapper inside PopoverContent.
83
+
84
+ ## 9. Dos and don'ts
85
+
86
+ **Do:** use a Popover for a short, focused form.
87
+
88
+ ```tsx
89
+ <Popover>
90
+ <PopoverTrigger asChild>
91
+ <Button type="button" variant="outline">Dimensions</Button>
92
+ </PopoverTrigger>
93
+ <PopoverContent aria-labelledby="dimensions-title">
94
+ <Typography id="dimensions-title" variant="label" as="h2">Dimensions</Typography>
95
+ {/* width and height fields */}
96
+ </PopoverContent>
97
+ </Popover>
98
+ ```
99
+
100
+ **Don't:** build an action menu out of Buttons in a Popover.
101
+
102
+ ```tsx
103
+ <PopoverContent>
104
+ <Button variant="ghost">Edit</Button>
105
+ <Button variant="ghost">Duplicate</Button>
106
+ <Button variant="destructive">Delete</Button>
107
+ </PopoverContent>
108
+ ```
109
+
110
+ **Do:** use DropdownMenu for actions.
111
+
112
+ ```tsx
113
+ <DropdownMenu>
114
+ <DropdownMenuTrigger asChild>
115
+ <Button type="button" variant="outline">Actions</Button>
116
+ </DropdownMenuTrigger>
117
+ <DropdownMenuContent>
118
+ <DropdownMenuItem onSelect={editFile}>Edit</DropdownMenuItem>
119
+ <DropdownMenuItem onSelect={duplicateFile}>Duplicate</DropdownMenuItem>
120
+ </DropdownMenuContent>
121
+ </DropdownMenu>
122
+ ```
123
+
124
+ **Don't:** resize the panel by styling it.
125
+
126
+ ```tsx
127
+ <PopoverContent style={{ width: 600, padding: 0 }}>{/* … */}</PopoverContent>
128
+ ```
129
+
130
+ ## 10. Accessibility
131
+
132
+ - Role: `dialog` on PopoverContent. PopoverTrigger gets `aria-haspopup="dialog"`, `aria-expanded` and `aria-controls`.
133
+ - Label: none by default; see rule 2.
134
+ - Keyboard: Enter or Space on the trigger toggles it. Escape closes it. Tab moves through the content and then out of it.
135
+ - Focus: on open, focus moves to the first focusable element inside (or the panel itself). Focus isn't trapped. On close, focus returns to the trigger, unless the user closed it by clicking or tabbing to something outside, in which case focus stays there. With `modal`, focus is trapped and the rest of the page is hidden from assistive technology.
136
+ - Contrast: handled by the theme. Don't override colours.
137
+
138
+ ## 11. Behaviour
139
+
140
+ - Placement: below the trigger and centred on it by default (`side="bottom"`, `align="center"`, `sideOffset={4}`). It flips and shifts to stay inside the viewport.
141
+ - Overflow and truncation: no maximum height and no scroll. Long content runs off-screen.
142
+ - Motion: appears and disappears without animation. Don't add your own.
143
+ - Dismissal: Escape, a click outside or a second click on the trigger close it and fire `onOpenChange(false)`.
144
+ - Portal: PopoverContent mounts in `document.body`. In a scoped theme, pass `portalContainer` to the scoped EluanProvider or wrap the region in `PortalContainerProvider`; `container` overrides it for one popover. See `../foundations/theming.md`.
145
+
146
+ ## 12. API
147
+
148
+ <!-- api:start -->
149
+ ### Popover
150
+
151
+ | Prop | Type | Default | Description |
152
+ | --- | --- | --- | --- |
153
+ | `open` | `boolean` | | Controlled open state. |
154
+ | `defaultOpen` | `boolean` | `false` | Initial state when uncontrolled. |
155
+ | `onOpenChange` | `(open: boolean) => void` | | Called on every open and close. |
156
+ | `modal` | `boolean` | `false` | `true` traps focus and hides the rest of the page from assistive technology. |
157
+
158
+ ### PopoverTrigger
159
+
160
+ | Prop | Type | Default | Description |
161
+ | --- | --- | --- | --- |
162
+ | `asChild` | `boolean` | `false` | Renders the child (a Button) instead of a bare `<button>`. |
163
+ | `...props` | Radix `Popover.Trigger` props | | Native button attributes. |
164
+
165
+ ### PopoverContent
166
+
167
+ | Prop | Type | Default | Description |
168
+ | --- | --- | --- | --- |
169
+ | `layout` | `"default" \| "calendar" \| "calendarSingle" \| "matchTrigger"` | `"default"` | Width and padding; see Variants. |
170
+ | `side` | `"top" \| "right" \| "bottom" \| "left"` | `"bottom"` | Preferred side of the trigger. |
171
+ | `align` | `"start" \| "center" \| "end"` | `"center"` | Alignment along that side. |
172
+ | `sideOffset` | `number` | `4` | Distance from the trigger in px. |
173
+ | `collisionPadding` | `number \| Partial<Record<Side, number>>` | `0` | Space to keep from the viewport edges. |
174
+ | `container` | `HTMLElement \| null` | nearest `PortalContainerProvider`, then `document.body` | Element to portal into. |
175
+ | `onOpenAutoFocus` | `(event: Event) => void` | | `preventDefault()` to keep focus on the trigger. |
176
+ | `onCloseAutoFocus` | `(event: Event) => void` | | `preventDefault()` to stop focus returning to the trigger. |
177
+ | `onEscapeKeyDown` | `(event: KeyboardEvent) => void` | | `preventDefault()` keeps it open. |
178
+ | `onInteractOutside` | `(event: CustomEvent) => void` | | `preventDefault()` keeps it open on an outside click or focus. |
179
+ | `aria-label`, `aria-labelledby` | `string` | | Names the panel. |
180
+ | `...props` | Radix `Popover.Content` props without `className`, `style` | | |
181
+ <!-- api:end -->
182
+
183
+ ## 13. Examples
184
+
185
+ A rename popover that closes after saving and returns focus to its trigger.
186
+
187
+ ```tsx
188
+ import * as React from "react";
189
+ import { Button, Input, Label, Popover, PopoverContent, PopoverTrigger } from "@eluan/core";
190
+ import { Pencil } from "lucide-react";
191
+
192
+ export function RenameFilePopover({
193
+ fileName,
194
+ onRename,
195
+ }: {
196
+ fileName: string;
197
+ onRename: (name: string) => void;
198
+ }) {
199
+ const [open, setOpen] = React.useState(false);
200
+
201
+ return (
202
+ <Popover open={open} onOpenChange={setOpen}>
203
+ <PopoverTrigger asChild>
204
+ <Button type="button" variant="ghost" size="sm">
205
+ <Pencil aria-hidden="true" style={{ width: "var(--size-xxs)", height: "var(--size-xxs)" }} />
206
+ Rename
207
+ </Button>
208
+ </PopoverTrigger>
209
+ <PopoverContent align="start" aria-label={`Rename ${fileName}`}>
210
+ <form
211
+ onSubmit={(event) => {
212
+ event.preventDefault();
213
+ const name = String(new FormData(event.currentTarget).get("name")).trim();
214
+ if (name) {
215
+ onRename(name);
216
+ setOpen(false);
217
+ }
218
+ }}
219
+ style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-md)" }}
220
+ >
221
+ <div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-sm)" }}>
222
+ <Label htmlFor="rename-file">File name</Label>
223
+ <Input id="rename-file" name="name" defaultValue={fileName} required />
224
+ </div>
225
+ <div style={{ display: "flex", justifyContent: "flex-end", gap: "var(--spacing-sm)" }}>
226
+ <Button type="button" variant="outline" size="sm" onClick={() => setOpen(false)}>
227
+ Cancel
228
+ </Button>
229
+ <Button type="submit" size="sm">
230
+ Save
231
+ </Button>
232
+ </div>
233
+ </form>
234
+ </PopoverContent>
235
+ </Popover>
236
+ );
237
+ }
238
+ ```
239
+
240
+ ## 14. Related components
241
+
242
+ - [DropdownMenu](./dropdown-menu.md) and [ActionPopover](./action-popover.md): menus of actions.
243
+ - [HoverCard](./hover-card.md): a read-only preview on hover.
244
+ - [Tooltip](./tooltip.md): a short text hint.
245
+ - [DatePicker](./date-picker.md) and [MultiSelect](./multi-select.md): built on Popover.
246
+ - [Sheet](./sheet.md): when the content outgrows a popover.
247
+
248
+ ## 15. Common agent mistakes
249
+
250
+ _Filled from evals._
@@ -0,0 +1,185 @@
1
+ ---
2
+ name: Progress
3
+ use_when: Showing how far a task with a known amount has got, such as an upload, a sync or setup completion.
4
+ instead_of: Spinner when you can't say how long it will take; Skeleton for content loading into a layout; Stepper for steps in a flow.
5
+ source: packages/core/src/components/progress.tsx
6
+ ---
7
+
8
+ # Progress
9
+
10
+ ## 1. Overview
11
+
12
+ Progress is a horizontal bar that fills from the left to show a percentage. It wraps Radix Progress, renders `role="progressbar"`, and comes in two sizes and four tones. It has no built-in label or number; you add those as text.
13
+
14
+ ## 2. When to use
15
+
16
+ - An upload, download, import or export with a known percentage.
17
+ - Completion of a setup checklist or profile.
18
+ - Usage against a limit, such as storage used.
19
+
20
+ ### When not to use
21
+
22
+ - You can't say how long the work will take → use [Spinner](./spinner.md). Progress has no indeterminate animation.
23
+ - Content is loading into a known layout → use [Skeleton](./skeleton.md).
24
+ - The user moves through named steps → use [Stepper](./stepper.md).
25
+ - The status of an item → use [Badge](./badge.md).
26
+ - The user sets the value → use [Slider](./slider.md).
27
+
28
+ ## 3. Anatomy
29
+
30
+ 1. **Track**: the root `<div>`; full width, pill-shaped, pale grey.
31
+ 2. **Indicator**: the fill, slid in from the left to `value` percent.
32
+
33
+ There is no label part. Put a text label and the value next to the bar yourself.
34
+
35
+ ## 4. Variants
36
+
37
+ Progress has no `variant` prop. `tone` colours the fill:
38
+
39
+ | Tone | Use for |
40
+ | --- | --- |
41
+ | `default` | Every progress bar. Near-black fill in the default theme. |
42
+ | `weak` | The low end of a quality scale, in `--destructive-fg`. |
43
+ | `medium` | The middle of a quality scale, in `--cautionary-fg`. |
44
+ | `strong` | The high end of a quality scale, in `--positive-fg`. |
45
+
46
+ The non-default tones exist for scales such as password strength (PasswordInput is their only consumer), not for task progress. They're broken today; see States.
47
+
48
+ ## 5. Sizes
49
+
50
+ | Size | Use in |
51
+ | --- | --- |
52
+ | `default` | Most bars (`--spacing-sm` tall). |
53
+ | `sm` | Dense rows and inline meters (`--spacing-xs` plus `--spacing-xxs` tall). |
54
+
55
+ `sm` is the same height as `default` in standard and wide density; it's only thinner in compact density.
56
+
57
+ ## 6. States
58
+
59
+ | State | Looks like | Notes |
60
+ | --- | --- | --- |
61
+ | Empty | Track only | `value={0}`. |
62
+ | In progress | Partial fill from the left | |
63
+ | Complete | Full fill | `value={100}`. |
64
+ | Indeterminate | Track only, identical to empty | Leaving out `value` doesn't animate. Use a [Spinner](./spinner.md) for unknown progress. |
65
+ | Tone | Whole bar in the tone colour at every value | `tone` is applied to the track as well as the fill, so `weak`, `medium` and `strong` read as 100% full. Use `tone="default"` (or omit it) until this is fixed. |
66
+
67
+ ## 7. Content guidelines
68
+
69
+ - Label every bar with what's progressing, in visible text: "Uploading quarterly-report.pdf".
70
+ - Show the amount as text when it matters: "60%", "3 of 5 files", "6.2 GB of 10 GB used".
71
+ - When the task finishes, say so in text or a [Toast](./toast.md); don't leave a full bar as the only signal.
72
+
73
+ | Do | Don't |
74
+ | --- | --- |
75
+ | Uploading quarterly-report.pdf · 60% | A bar with no label |
76
+ | 3 of 5 files imported | Please wait… |
77
+ | 6.2 GB of 10 GB used | 62 |
78
+
79
+ ## 8. Rules
80
+
81
+ 1. Pass `value` from 0 to 100, clamped. The fill is computed as a percentage and ignores `max`; values outside 0 to 100 shift the fill off the track.
82
+ 2. Give every bar an accessible name with `aria-label`, or `aria-labelledby` pointing at its visible label.
83
+ 3. Pass `aria-valuenow={value}` as well as `value`, and `aria-valuetext` when a phrase reads better than a percentage. Progress doesn't pass `value` on to Radix, so the bar reports no value without them.
84
+ 4. Use `tone="default"`. The other tones currently fill the whole bar.
85
+ 5. Use a [Spinner](./spinner.md), not an empty Progress, when you don't know the amount.
86
+ 6. Never pass `className` or `style`; they're dropped. Progress fills its container, so set width on a wrapper.
87
+
88
+ ## 9. Dos and don'ts
89
+
90
+ **Do:** label the bar and expose its value.
91
+
92
+ ```tsx
93
+ <div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-xs)" }}>
94
+ <Typography variant="label" id="upload-label">Uploading quarterly-report.pdf · {percent}%</Typography>
95
+ <Progress value={percent} aria-valuenow={percent} aria-labelledby="upload-label" />
96
+ </div>
97
+ ```
98
+
99
+ **Don't:** leave it unnamed, size it by hand or use it for an unknown wait.
100
+
101
+ ```tsx
102
+ <Progress style={{ width: 200 }} />
103
+ ```
104
+
105
+ **Do:** keep the default tone for task progress.
106
+
107
+ ```tsx
108
+ <Progress value={75} aria-valuenow={75} aria-label="Profile completion" />
109
+ ```
110
+
111
+ **Don't:** colour progress with the strength tones.
112
+
113
+ ```tsx
114
+ <Progress value={75} tone="strong" aria-label="Profile completion" />
115
+ ```
116
+
117
+ ## 10. Accessibility
118
+
119
+ - Role: `progressbar` (Radix), with `aria-valuemin="0"` and `aria-valuemax` from `max` (100 by default).
120
+ - Label: none by default. Add `aria-label` or `aria-labelledby`.
121
+ - Value: Radix would set `aria-valuenow` and `aria-valuetext` from `value`, but progress.tsx keeps `value` for its own fill and never passes it to the Radix root. The bar therefore reports no value and its `data-state` is always `indeterminate`. Pass `aria-valuenow` (and `aria-valuetext` if helpful) yourself; they're spread onto the root.
122
+ - Keyboard: not focusable; no keys.
123
+ - Focus: Progress never takes or moves focus.
124
+ - Updates: screen readers don't announce value changes on their own. Announce completion in text (a `role="status"` line or a [Toast](./toast.md)).
125
+ - Contrast: handled by the theme. Don't override colours.
126
+
127
+ ## 11. Behaviour
128
+
129
+ - Responsive: the track is 100% wide; control width with a wrapper you own.
130
+ - Overflow and truncation: the fill is clipped to the rounded track.
131
+ - Motion: the fill slides to each new value over 300ms. This transition isn't turned off under `prefers-reduced-motion`. Don't add your own.
132
+ - Density: both heights come from `--spacing-*`, so the bar gets thinner in compact density and thicker in wide.
133
+
134
+ ## 12. API
135
+
136
+ <!-- api:start -->
137
+ | Prop | Type | Default | Description |
138
+ | --- | --- | --- | --- |
139
+ | `value` | `number \| null` | | Percentage filled, 0 to 100. Drives the fill only; also pass `aria-valuenow`. |
140
+ | `size` | `"default" \| "sm"` | `"default"` | Bar height. |
141
+ | `tone` | `"default" \| "weak" \| "medium" \| "strong"` | `"default"` | Fill colour. Non-default tones are currently broken. |
142
+ | `max` | `number` | `100` | Radix maximum. Only sets `aria-valuemax`; the fill always assumes 100. |
143
+ | `aria-valuenow` | `number` | | Current value for assistive tech. Pass the same number as `value`. |
144
+ | `aria-valuetext` | `string` | | Spoken value, such as "3 of 5 files". |
145
+ | `aria-label` | `string` | | Accessible name when there's no visible label to reference. |
146
+ | `...props` | Radix `Progress.Root` props without `className`, `style` | | `aria-labelledby`, `id`. `getValueLabel` has no effect while `value` isn't forwarded. The ref goes to the root `<div>`. |
147
+ <!-- api:end -->
148
+
149
+ ## 13. Examples
150
+
151
+ ```tsx
152
+ import { useId } from "react";
153
+ import { Progress, Typography } from "@eluan/core";
154
+
155
+ export function UploadProgress({ fileName, percent }: { fileName: string; percent: number }) {
156
+ const value = Math.min(100, Math.max(0, Math.round(percent)));
157
+ const labelId = useId();
158
+
159
+ return (
160
+ <div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-xs)", width: "100%" }}>
161
+ <div style={{ display: "flex", justifyContent: "space-between", gap: "var(--spacing-sm)" }}>
162
+ <Typography variant="label" tone="muted" id={labelId}>
163
+ Uploading {fileName}
164
+ </Typography>
165
+ <Typography variant="label" tone="muted">
166
+ {value}%
167
+ </Typography>
168
+ </div>
169
+ <Progress value={value} aria-valuenow={value} aria-labelledby={labelId} />
170
+ </div>
171
+ );
172
+ }
173
+ ```
174
+
175
+ ## 14. Related components
176
+
177
+ - [Spinner](./spinner.md): work in progress with no known amount.
178
+ - [Skeleton](./skeleton.md): placeholders while content loads.
179
+ - [Stepper](./stepper.md): progress through named steps.
180
+ - [Slider](./slider.md): a bar the user drags to set a value.
181
+ - [Toast](./toast.md): confirm the task finished.
182
+
183
+ ## 15. Common agent mistakes
184
+
185
+ _Filled from evals._