@techzyapp/ui-library 1.0.17 → 1.0.18

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 (299) hide show
  1. package/dist/{AdminRoot-uVDhWjN8.js → AdminRoot-B2J1cHK5.js} +4 -4
  2. package/dist/{AdminRoot-uVDhWjN8.js.map → AdminRoot-B2J1cHK5.js.map} +1 -1
  3. package/dist/{AdminRoot-D866Bc0e.cjs → AdminRoot-DlpMJNTx.cjs} +2 -2
  4. package/dist/{AdminRoot-D866Bc0e.cjs.map → AdminRoot-DlpMJNTx.cjs.map} +1 -1
  5. package/dist/{Alert-D99G0StL.cjs → Alert-DRZdNwDm.cjs} +2 -2
  6. package/dist/{Alert-D99G0StL.cjs.map → Alert-DRZdNwDm.cjs.map} +1 -1
  7. package/dist/{Alert-B3rDvpbO.js → Alert-yldGvhVM.js} +3 -3
  8. package/dist/{Alert-B3rDvpbO.js.map → Alert-yldGvhVM.js.map} +1 -1
  9. package/dist/AuthLayout-B1tzhzHo.cjs +2 -0
  10. package/dist/{AuthLayout-pvqB9w-B.cjs.map → AuthLayout-B1tzhzHo.cjs.map} +1 -1
  11. package/dist/AuthLayout-j7EAPPXT.js +43 -0
  12. package/dist/{AuthLayout-DGCe90w0.js.map → AuthLayout-j7EAPPXT.js.map} +1 -1
  13. package/dist/{Breadcrumbs-C1crufqj.js → Breadcrumbs-FpIOHx_q.js} +3 -3
  14. package/dist/{Breadcrumbs-C1crufqj.js.map → Breadcrumbs-FpIOHx_q.js.map} +1 -1
  15. package/dist/{Breadcrumbs-s90MO0PD.cjs → Breadcrumbs-f0GE4lCI.cjs} +2 -2
  16. package/dist/{Breadcrumbs-s90MO0PD.cjs.map → Breadcrumbs-f0GE4lCI.cjs.map} +1 -1
  17. package/dist/{Button-CUsXYM-m.js → Button-BkjZ7wEu.js} +2 -2
  18. package/dist/{Button-CUsXYM-m.js.map → Button-BkjZ7wEu.js.map} +1 -1
  19. package/dist/{Button-Cj6pckNl.cjs → Button-Cu0XdnW6.cjs} +2 -2
  20. package/dist/{Button-Cj6pckNl.cjs.map → Button-Cu0XdnW6.cjs.map} +1 -1
  21. package/dist/{Calendar-Br4C0x0n.cjs → Calendar-CGQCditF.cjs} +2 -2
  22. package/dist/{Calendar-Br4C0x0n.cjs.map → Calendar-CGQCditF.cjs.map} +1 -1
  23. package/dist/{Calendar-CE_9WNAB.js → Calendar-DsJ6GICt.js} +3 -3
  24. package/dist/{Calendar-CE_9WNAB.js.map → Calendar-DsJ6GICt.js.map} +1 -1
  25. package/dist/{Card-DhpudGvF.js → Card-CumMi_XB.js} +2 -2
  26. package/dist/{Card-DhpudGvF.js.map → Card-CumMi_XB.js.map} +1 -1
  27. package/dist/{Card-DD9SWHzZ.cjs → Card-DGTGdaTZ.cjs} +2 -2
  28. package/dist/{Card-DD9SWHzZ.cjs.map → Card-DGTGdaTZ.cjs.map} +1 -1
  29. package/dist/{Chip-B2lY4TJ0.cjs → Chip-CJuAvgst.cjs} +2 -2
  30. package/dist/{Chip-B2lY4TJ0.cjs.map → Chip-CJuAvgst.cjs.map} +1 -1
  31. package/dist/{Chip-DulHqhuf.js → Chip-D83svOCW.js} +2 -2
  32. package/dist/{Chip-DulHqhuf.js.map → Chip-D83svOCW.js.map} +1 -1
  33. package/dist/{CodeBlock-DwBMghs2.js → CodeBlock-BK_KXhos.js} +3 -3
  34. package/dist/{CodeBlock-DwBMghs2.js.map → CodeBlock-BK_KXhos.js.map} +1 -1
  35. package/dist/{CodeBlock-EhB7v9-R.cjs → CodeBlock-C_UDrrY6.cjs} +2 -2
  36. package/dist/{CodeBlock-EhB7v9-R.cjs.map → CodeBlock-C_UDrrY6.cjs.map} +1 -1
  37. package/dist/{ColorPicker-Dc1y9Zuu.cjs → ColorPicker-BmxZnsNC.cjs} +2 -2
  38. package/dist/{ColorPicker-Dc1y9Zuu.cjs.map → ColorPicker-BmxZnsNC.cjs.map} +1 -1
  39. package/dist/{ColorPicker-DJgTeHht.js → ColorPicker-DLnB_AvZ.js} +3 -3
  40. package/dist/{ColorPicker-DJgTeHht.js.map → ColorPicker-DLnB_AvZ.js.map} +1 -1
  41. package/dist/{ColorPickerPanel-9tOQUL38.js → ColorPickerPanel-CG9idF4A.js} +2 -2
  42. package/dist/{ColorPickerPanel-9tOQUL38.js.map → ColorPickerPanel-CG9idF4A.js.map} +1 -1
  43. package/dist/{ColorPickerPanel-nXEliruE.cjs → ColorPickerPanel-CoyKplF5.cjs} +2 -2
  44. package/dist/{ColorPickerPanel-nXEliruE.cjs.map → ColorPickerPanel-CoyKplF5.cjs.map} +1 -1
  45. package/dist/{ConfigProvider-BYruQYHC.js → ConfigProvider-DDuIJSM7.js} +2 -2
  46. package/dist/{ConfigProvider-BYruQYHC.js.map → ConfigProvider-DDuIJSM7.js.map} +1 -1
  47. package/dist/{ConfigProvider-BHNx-NHV.cjs → ConfigProvider-h1WoGC3R.cjs} +2 -2
  48. package/dist/{ConfigProvider-BHNx-NHV.cjs.map → ConfigProvider-h1WoGC3R.cjs.map} +1 -1
  49. package/dist/{CopyButton-B4-OYsYr.js → CopyButton-DdQ-8ExN.js} +3 -3
  50. package/dist/{CopyButton-B4-OYsYr.js.map → CopyButton-DdQ-8ExN.js.map} +1 -1
  51. package/dist/{CopyButton-D_DCLHhb.cjs → CopyButton-tRMAy59I.cjs} +2 -2
  52. package/dist/{CopyButton-D_DCLHhb.cjs.map → CopyButton-tRMAy59I.cjs.map} +1 -1
  53. package/dist/{DatePicker-CEczjGZy.cjs → DatePicker-eryY6Xmx.cjs} +2 -2
  54. package/dist/{DatePicker-CEczjGZy.cjs.map → DatePicker-eryY6Xmx.cjs.map} +1 -1
  55. package/dist/{DatePicker-DkvfSN1K.js → DatePicker-pz634ktl.js} +4 -4
  56. package/dist/{DatePicker-DkvfSN1K.js.map → DatePicker-pz634ktl.js.map} +1 -1
  57. package/dist/{DateTimePicker-DPomyrnN.js → DateTimePicker-BJLq9Fud.js} +7 -7
  58. package/dist/{DateTimePicker-DPomyrnN.js.map → DateTimePicker-BJLq9Fud.js.map} +1 -1
  59. package/dist/{DateTimePicker-CDyGxUBX.cjs → DateTimePicker-CmH3ZuzN.cjs} +2 -2
  60. package/dist/{DateTimePicker-CDyGxUBX.cjs.map → DateTimePicker-CmH3ZuzN.cjs.map} +1 -1
  61. package/dist/{EmptyState-CVyFXprK.js → EmptyState-B2QPNhWW.js} +2 -2
  62. package/dist/{EmptyState-CVyFXprK.js.map → EmptyState-B2QPNhWW.js.map} +1 -1
  63. package/dist/{EmptyState-B77utgEn.cjs → EmptyState-Cxf4H8Cc.cjs} +2 -2
  64. package/dist/{EmptyState-B77utgEn.cjs.map → EmptyState-Cxf4H8Cc.cjs.map} +1 -1
  65. package/dist/{FileCard-CsGW2sxE.cjs → FileCard-D0Sa7WJt.cjs} +2 -2
  66. package/dist/{FileCard-CsGW2sxE.cjs.map → FileCard-D0Sa7WJt.cjs.map} +1 -1
  67. package/dist/{FileCard-Cpc5frNm.js → FileCard-Do9D72NA.js} +3 -3
  68. package/dist/{FileCard-Cpc5frNm.js.map → FileCard-Do9D72NA.js.map} +1 -1
  69. package/dist/{FileUploader-B_nKMh_K.js → FileUploader-4900qKEE.js} +5 -5
  70. package/dist/{FileUploader-B_nKMh_K.js.map → FileUploader-4900qKEE.js.map} +1 -1
  71. package/dist/{FileUploader-DDi_uzIx.cjs → FileUploader-B1Arfj1a.cjs} +2 -2
  72. package/dist/{FileUploader-DDi_uzIx.cjs.map → FileUploader-B1Arfj1a.cjs.map} +1 -1
  73. package/dist/{Flag-BJLWKB9J.cjs → Flag-D7Vlczlw.cjs} +2 -2
  74. package/dist/{Flag-BJLWKB9J.cjs.map → Flag-D7Vlczlw.cjs.map} +1 -1
  75. package/dist/{Flag-Ck1xK22A.js → Flag-DNhhLtCC.js} +2 -2
  76. package/dist/{Flag-Ck1xK22A.js.map → Flag-DNhhLtCC.js.map} +1 -1
  77. package/dist/{FullscreenToggle-DmC0jTay.js → FullscreenToggle-Bc4fB-Mi.js} +3 -3
  78. package/dist/{FullscreenToggle-DmC0jTay.js.map → FullscreenToggle-Bc4fB-Mi.js.map} +1 -1
  79. package/dist/{FullscreenToggle-MCxGzAEe.cjs → FullscreenToggle-dU2ai_OZ.cjs} +2 -2
  80. package/dist/{FullscreenToggle-MCxGzAEe.cjs.map → FullscreenToggle-dU2ai_OZ.cjs.map} +1 -1
  81. package/dist/{IconButton-B8FPGgDn.js → IconButton-DpTxmj3d.js} +2 -2
  82. package/dist/{IconButton-B8FPGgDn.js.map → IconButton-DpTxmj3d.js.map} +1 -1
  83. package/dist/{IconButton-BoY2y_pV.cjs → IconButton-DyRC514t.cjs} +2 -2
  84. package/dist/{IconButton-BoY2y_pV.cjs.map → IconButton-DyRC514t.cjs.map} +1 -1
  85. package/dist/{Loader-Cwb1bOHj.cjs → Loader-B45H2SMP.cjs} +2 -2
  86. package/dist/{Loader-Cwb1bOHj.cjs.map → Loader-B45H2SMP.cjs.map} +1 -1
  87. package/dist/{Loader-UzzqvFyo.js → Loader-B9VXX401.js} +2 -2
  88. package/dist/{Loader-UzzqvFyo.js.map → Loader-B9VXX401.js.map} +1 -1
  89. package/dist/{Modal-CO3c3sGY.cjs → Modal-DsoSz0Sp.cjs} +2 -2
  90. package/dist/{Modal-CO3c3sGY.cjs.map → Modal-DsoSz0Sp.cjs.map} +1 -1
  91. package/dist/{Modal-XMRDPHvQ.js → Modal-Us_E-lb2.js} +3 -3
  92. package/dist/{Modal-XMRDPHvQ.js.map → Modal-Us_E-lb2.js.map} +1 -1
  93. package/dist/{MultiSelect-DVOVHuIm.cjs → MultiSelect-CtLpWaBX.cjs} +2 -2
  94. package/dist/{MultiSelect-DVOVHuIm.cjs.map → MultiSelect-CtLpWaBX.cjs.map} +1 -1
  95. package/dist/{MultiSelect-BPLctumx.js → MultiSelect-sKk2KzOd.js} +4 -4
  96. package/dist/{MultiSelect-BPLctumx.js.map → MultiSelect-sKk2KzOd.js.map} +1 -1
  97. package/dist/{NumberField-BH237Vt2.cjs → NumberField-C6qj3nCa.cjs} +2 -2
  98. package/dist/{NumberField-BH237Vt2.cjs.map → NumberField-C6qj3nCa.cjs.map} +1 -1
  99. package/dist/{NumberField-X2HsSpu9.js → NumberField-Cz03nksO.js} +3 -3
  100. package/dist/{NumberField-X2HsSpu9.js.map → NumberField-Cz03nksO.js.map} +1 -1
  101. package/dist/{OtpField-CXP59zM2.cjs → OtpField-B46P6aMy.cjs} +2 -2
  102. package/dist/{OtpField-CXP59zM2.cjs.map → OtpField-B46P6aMy.cjs.map} +1 -1
  103. package/dist/{OtpField-CB05q0NX.js → OtpField-DLXQYMw1.js} +2 -2
  104. package/dist/{OtpField-CB05q0NX.js.map → OtpField-DLXQYMw1.js.map} +1 -1
  105. package/dist/{PageLayout-WKWnj5cw.js → PageLayout-BWU-p_N9.js} +2 -2
  106. package/dist/{PageLayout-WKWnj5cw.js.map → PageLayout-BWU-p_N9.js.map} +1 -1
  107. package/dist/{PageLayout-CuVuZEbR.cjs → PageLayout-BfeRjBek.cjs} +2 -2
  108. package/dist/{PageLayout-CuVuZEbR.cjs.map → PageLayout-BfeRjBek.cjs.map} +1 -1
  109. package/dist/{PageNotFound-DVh_Tyqf.js → PageNotFound-B_nTMrCD.js} +5 -5
  110. package/dist/{PageNotFound-DVh_Tyqf.js.map → PageNotFound-B_nTMrCD.js.map} +1 -1
  111. package/dist/{PageNotFound-D3ZjMKYD.cjs → PageNotFound-nvZm-UCG.cjs} +2 -2
  112. package/dist/{PageNotFound-D3ZjMKYD.cjs.map → PageNotFound-nvZm-UCG.cjs.map} +1 -1
  113. package/dist/{Pagination-BuP4N1bj.js → Pagination-BYXUhmSz.js} +2 -2
  114. package/dist/{Pagination-BuP4N1bj.js.map → Pagination-BYXUhmSz.js.map} +1 -1
  115. package/dist/{Pagination-Dcs_Znx3.cjs → Pagination-CsClNqIu.cjs} +2 -2
  116. package/dist/{Pagination-Dcs_Znx3.cjs.map → Pagination-CsClNqIu.cjs.map} +1 -1
  117. package/dist/{RemoveDialog-Cwtq9wAt.cjs → RemoveDialog-D5J9TYap.cjs} +2 -2
  118. package/dist/{RemoveDialog-Cwtq9wAt.cjs.map → RemoveDialog-D5J9TYap.cjs.map} +1 -1
  119. package/dist/{RemoveDialog-DU6MqkO8.js → RemoveDialog-PHdZi9-d.js} +4 -4
  120. package/dist/{RemoveDialog-DU6MqkO8.js.map → RemoveDialog-PHdZi9-d.js.map} +1 -1
  121. package/dist/{RichTextEditor-k-NlWb4Y.js → RichTextEditor-BcmsnYGJ.js} +7 -7
  122. package/dist/{RichTextEditor-k-NlWb4Y.js.map → RichTextEditor-BcmsnYGJ.js.map} +1 -1
  123. package/dist/{RichTextEditor-GxbnzLRe.cjs → RichTextEditor-jWv0t3vJ.cjs} +2 -2
  124. package/dist/{RichTextEditor-GxbnzLRe.cjs.map → RichTextEditor-jWv0t3vJ.cjs.map} +1 -1
  125. package/dist/RootLayout-DtZcqk9N.cjs +2 -0
  126. package/dist/RootLayout-DtZcqk9N.cjs.map +1 -0
  127. package/dist/RootLayout-q_oWf5et.js +422 -0
  128. package/dist/RootLayout-q_oWf5et.js.map +1 -0
  129. package/dist/{Select-DjMZec8c.cjs → Select-CWCeBQ8Q.cjs} +2 -2
  130. package/dist/{Select-DjMZec8c.cjs.map → Select-CWCeBQ8Q.cjs.map} +1 -1
  131. package/dist/{Select-D7KJ-YMU.js → Select-UygxT1Ry.js} +3 -3
  132. package/dist/{Select-D7KJ-YMU.js.map → Select-UygxT1Ry.js.map} +1 -1
  133. package/dist/Sidebar-BfBggyuh.cjs +2 -0
  134. package/dist/Sidebar-BfBggyuh.cjs.map +1 -0
  135. package/dist/Sidebar-C0OJK29L.js +513 -0
  136. package/dist/Sidebar-C0OJK29L.js.map +1 -0
  137. package/dist/{SpeedDial-DEWzAGXi.js → SpeedDial-DbvOJ4no.js} +2 -2
  138. package/dist/{SpeedDial-DEWzAGXi.js.map → SpeedDial-DbvOJ4no.js.map} +1 -1
  139. package/dist/{SpeedDial-CyiPagdu.cjs → SpeedDial-cKvuSMuk.cjs} +2 -2
  140. package/dist/{SpeedDial-CyiPagdu.cjs.map → SpeedDial-cKvuSMuk.cjs.map} +1 -1
  141. package/dist/{Stepper-CS6s0dMF.js → Stepper-BxGrP6JZ.js} +2 -2
  142. package/dist/{Stepper-CS6s0dMF.js.map → Stepper-BxGrP6JZ.js.map} +1 -1
  143. package/dist/{Stepper-PW7c45PV.cjs → Stepper-Db_ALAc4.cjs} +2 -2
  144. package/dist/{Stepper-PW7c45PV.cjs.map → Stepper-Db_ALAc4.cjs.map} +1 -1
  145. package/dist/{Table-C_Ov-kvK.cjs → Table-Dvna5_TR.cjs} +2 -2
  146. package/dist/{Table-C_Ov-kvK.cjs.map → Table-Dvna5_TR.cjs.map} +1 -1
  147. package/dist/{Table-IIAKXYOh.js → Table-tPOJ9umi.js} +15 -15
  148. package/dist/{Table-IIAKXYOh.js.map → Table-tPOJ9umi.js.map} +1 -1
  149. package/dist/{Tabs-D3wztVB1.js → Tabs-B0mWCNaC.js} +2 -2
  150. package/dist/{Tabs-D3wztVB1.js.map → Tabs-B0mWCNaC.js.map} +1 -1
  151. package/dist/{Tabs-CaHTJ99w.cjs → Tabs-ozklGWmX.cjs} +2 -2
  152. package/dist/{Tabs-CaHTJ99w.cjs.map → Tabs-ozklGWmX.cjs.map} +1 -1
  153. package/dist/{TagsField-BQIwSX5m.cjs → TagsField-BIxwLfSJ.cjs} +2 -2
  154. package/dist/{TagsField-BQIwSX5m.cjs.map → TagsField-BIxwLfSJ.cjs.map} +1 -1
  155. package/dist/{TagsField-BR9Z5pik.js → TagsField-CGFm17lP.js} +4 -4
  156. package/dist/{TagsField-BR9Z5pik.js.map → TagsField-CGFm17lP.js.map} +1 -1
  157. package/dist/{TextField-Bg4TwkVD.js → TextField-CRCYLPpr.js} +3 -3
  158. package/dist/{TextField-Bg4TwkVD.js.map → TextField-CRCYLPpr.js.map} +1 -1
  159. package/dist/{TextField-fmt7aacg.cjs → TextField-DvKEj36A.cjs} +2 -2
  160. package/dist/{TextField-fmt7aacg.cjs.map → TextField-DvKEj36A.cjs.map} +1 -1
  161. package/dist/{ThemeToggle-DEfXczDs.js → ThemeToggle-BwW9L115.js} +3 -3
  162. package/dist/{ThemeToggle-DEfXczDs.js.map → ThemeToggle-BwW9L115.js.map} +1 -1
  163. package/dist/{ThemeToggle-Cz5I2-DL.cjs → ThemeToggle-DxxLN79b.cjs} +2 -2
  164. package/dist/{ThemeToggle-Cz5I2-DL.cjs.map → ThemeToggle-DxxLN79b.cjs.map} +1 -1
  165. package/dist/{TimeColumns-B-vtakk8.js → TimeColumns-D3nqkQbh.js} +2 -2
  166. package/dist/{TimeColumns-B-vtakk8.js.map → TimeColumns-D3nqkQbh.js.map} +1 -1
  167. package/dist/{TimeColumns-IBmjExao.cjs → TimeColumns-DB-V4KpQ.cjs} +2 -2
  168. package/dist/{TimeColumns-IBmjExao.cjs.map → TimeColumns-DB-V4KpQ.cjs.map} +1 -1
  169. package/dist/{TimePicker-i2RnZHV1.js → TimePicker-D51QkQYy.js} +5 -5
  170. package/dist/{TimePicker-i2RnZHV1.js.map → TimePicker-D51QkQYy.js.map} +1 -1
  171. package/dist/{TimePicker-B-c6uIaY.cjs → TimePicker-D__72q2J.cjs} +2 -2
  172. package/dist/{TimePicker-B-c6uIaY.cjs.map → TimePicker-D__72q2J.cjs.map} +1 -1
  173. package/dist/{Toaster-Da8F_SFV.js → Toaster-BynCHvUr.js} +2 -2
  174. package/dist/{Toaster-Da8F_SFV.js.map → Toaster-BynCHvUr.js.map} +1 -1
  175. package/dist/{Toaster-qdS8Urgy.cjs → Toaster-tHet1M-T.cjs} +2 -2
  176. package/dist/{Toaster-qdS8Urgy.cjs.map → Toaster-tHet1M-T.cjs.map} +1 -1
  177. package/dist/{TranslatedFields-C30ww45c.cjs → TranslatedFields-B3Gli3TZ.cjs} +2 -2
  178. package/dist/{TranslatedFields-C30ww45c.cjs.map → TranslatedFields-B3Gli3TZ.cjs.map} +1 -1
  179. package/dist/{TranslatedFields-Ck9JTF27.js → TranslatedFields-DHRFcB3n.js} +5 -5
  180. package/dist/{TranslatedFields-Ck9JTF27.js.map → TranslatedFields-DHRFcB3n.js.map} +1 -1
  181. package/dist/{UserCard-0ZF29bkK.js → UserCard-D7U-CLbM.js} +3 -3
  182. package/dist/{UserCard-0ZF29bkK.js.map → UserCard-D7U-CLbM.js.map} +1 -1
  183. package/dist/{UserCard-C8rC_gzD.cjs → UserCard-GHw2gTx9.cjs} +2 -2
  184. package/dist/{UserCard-C8rC_gzD.cjs.map → UserCard-GHw2gTx9.cjs.map} +1 -1
  185. package/dist/components/Alert/index.cjs +1 -1
  186. package/dist/components/Alert/index.js +1 -1
  187. package/dist/components/AuthLayout/index.cjs +1 -1
  188. package/dist/components/AuthLayout/index.js +1 -1
  189. package/dist/components/Breadcrumbs/index.cjs +1 -1
  190. package/dist/components/Breadcrumbs/index.js +1 -1
  191. package/dist/components/Button/index.cjs +1 -1
  192. package/dist/components/Button/index.js +1 -1
  193. package/dist/components/Card/index.cjs +1 -1
  194. package/dist/components/Card/index.js +1 -1
  195. package/dist/components/Chip/index.cjs +1 -1
  196. package/dist/components/Chip/index.js +1 -1
  197. package/dist/components/CodeBlock/index.cjs +1 -1
  198. package/dist/components/CodeBlock/index.js +1 -1
  199. package/dist/components/ColorPicker/index.cjs +1 -1
  200. package/dist/components/ColorPicker/index.js +1 -1
  201. package/dist/components/CopyButton/index.cjs +1 -1
  202. package/dist/components/CopyButton/index.js +1 -1
  203. package/dist/components/DatePicker/index.cjs +1 -1
  204. package/dist/components/DatePicker/index.js +1 -1
  205. package/dist/components/DateTimePicker/index.cjs +1 -1
  206. package/dist/components/DateTimePicker/index.js +1 -1
  207. package/dist/components/EmptyState/index.cjs +1 -1
  208. package/dist/components/EmptyState/index.js +1 -1
  209. package/dist/components/FileCard/index.cjs +1 -1
  210. package/dist/components/FileCard/index.js +1 -1
  211. package/dist/components/FileUploader/index.cjs +1 -1
  212. package/dist/components/FileUploader/index.js +1 -1
  213. package/dist/components/Flag/index.cjs +1 -1
  214. package/dist/components/Flag/index.js +1 -1
  215. package/dist/components/FullscreenToggle/index.cjs +1 -1
  216. package/dist/components/FullscreenToggle/index.js +1 -1
  217. package/dist/components/IconButton/index.cjs +1 -1
  218. package/dist/components/IconButton/index.js +1 -1
  219. package/dist/components/Loader/index.cjs +1 -1
  220. package/dist/components/Loader/index.js +1 -1
  221. package/dist/components/Modal/index.cjs +1 -1
  222. package/dist/components/Modal/index.js +1 -1
  223. package/dist/components/MultiSelect/index.cjs +1 -1
  224. package/dist/components/MultiSelect/index.js +1 -1
  225. package/dist/components/NumberField/index.cjs +1 -1
  226. package/dist/components/NumberField/index.js +1 -1
  227. package/dist/components/OtpField/index.cjs +1 -1
  228. package/dist/components/OtpField/index.js +1 -1
  229. package/dist/components/PageLayout/index.cjs +1 -1
  230. package/dist/components/PageLayout/index.js +1 -1
  231. package/dist/components/PageNotFound/index.cjs +1 -1
  232. package/dist/components/PageNotFound/index.js +1 -1
  233. package/dist/components/Pagination/index.cjs +1 -1
  234. package/dist/components/Pagination/index.js +1 -1
  235. package/dist/components/RemoveDialog/index.cjs +1 -1
  236. package/dist/components/RemoveDialog/index.js +1 -1
  237. package/dist/components/RichTextEditor/index.cjs +1 -1
  238. package/dist/components/RichTextEditor/index.js +1 -1
  239. package/dist/components/RootLayout/index.cjs +1 -1
  240. package/dist/components/RootLayout/index.js +1 -1
  241. package/dist/components/Select/index.cjs +1 -1
  242. package/dist/components/Select/index.js +1 -1
  243. package/dist/components/Sidebar/Sidebar.d.cts +47 -6
  244. package/dist/components/Sidebar/Sidebar.d.ts +47 -6
  245. package/dist/components/Sidebar/index.cjs +1 -1
  246. package/dist/components/Sidebar/index.js +1 -1
  247. package/dist/components/SpeedDial/index.cjs +1 -1
  248. package/dist/components/SpeedDial/index.js +1 -1
  249. package/dist/components/Stepper/index.cjs +1 -1
  250. package/dist/components/Stepper/index.js +1 -1
  251. package/dist/components/Table/index.cjs +1 -1
  252. package/dist/components/Table/index.js +1 -1
  253. package/dist/components/Tabs/index.cjs +1 -1
  254. package/dist/components/Tabs/index.js +1 -1
  255. package/dist/components/TagsField/index.cjs +1 -1
  256. package/dist/components/TagsField/index.js +1 -1
  257. package/dist/components/TextField/index.cjs +1 -1
  258. package/dist/components/TextField/index.js +1 -1
  259. package/dist/components/ThemeToggle/index.cjs +1 -1
  260. package/dist/components/ThemeToggle/index.js +1 -1
  261. package/dist/components/TimePicker/index.cjs +1 -1
  262. package/dist/components/TimePicker/index.js +1 -1
  263. package/dist/components/Toast/index.cjs +1 -1
  264. package/dist/components/Toast/index.js +1 -1
  265. package/dist/components/TranslatedFields/index.cjs +1 -1
  266. package/dist/components/TranslatedFields/index.js +1 -1
  267. package/dist/components/UserCard/index.cjs +1 -1
  268. package/dist/components/UserCard/index.js +1 -1
  269. package/dist/entries/app.cjs +1 -1
  270. package/dist/entries/app.js +1 -1
  271. package/dist/entries/components.cjs +1 -1
  272. package/dist/entries/components.js +41 -41
  273. package/dist/entries/i18n.cjs +1 -1
  274. package/dist/entries/i18n.js +2 -2
  275. package/dist/entries/theme.cjs +1 -1
  276. package/dist/entries/theme.js +1 -1
  277. package/dist/i18n/messages.d.cts +1 -0
  278. package/dist/i18n/messages.d.ts +1 -0
  279. package/dist/index.cjs +1 -1
  280. package/dist/index.css +1 -1
  281. package/dist/index.js +44 -44
  282. package/dist/messages-C0YutUM1.cjs +36 -0
  283. package/dist/messages-C0YutUM1.cjs.map +1 -0
  284. package/dist/{messages-BOKick2l.js → messages-FciBtnCL.js} +8 -1
  285. package/dist/messages-FciBtnCL.js.map +1 -0
  286. package/package.json +1 -1
  287. package/dist/AuthLayout-DGCe90w0.js +0 -43
  288. package/dist/AuthLayout-pvqB9w-B.cjs +0 -2
  289. package/dist/RootLayout-BEOofnxb.js +0 -407
  290. package/dist/RootLayout-BEOofnxb.js.map +0 -1
  291. package/dist/RootLayout-DGYOCwOK.cjs +0 -2
  292. package/dist/RootLayout-DGYOCwOK.cjs.map +0 -1
  293. package/dist/Sidebar-BYqUTa8D.cjs +0 -2
  294. package/dist/Sidebar-BYqUTa8D.cjs.map +0 -1
  295. package/dist/Sidebar-D2RZH5m5.js +0 -484
  296. package/dist/Sidebar-D2RZH5m5.js.map +0 -1
  297. package/dist/messages-BOKick2l.js.map +0 -1
  298. package/dist/messages-Jxz2YMcA.cjs +0 -36
  299. package/dist/messages-Jxz2YMcA.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect-BPLctumx.js","sources":["../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Chip } from '../Chip'\nimport { Icon } from '../Icon'\nimport { List, ListItem } from '../List'\nimport { Loader } from '../Loader'\nimport { Typography } from '../Typography'\nimport type { SelectOption, SelectSize } from '../Select'\nimport styles from './MultiSelect.module.css'\n\nexport interface MultiSelectProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** The selectable options. */\n options: SelectOption[]\n /** Preset size — control height, font, chips and option density. */\n size?: SelectSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — the chosen options' `value`s. */\n value?: string[]\n /** Initial value for uncontrolled use. */\n defaultValue?: string[]\n /** Fires with the next array of selected values. */\n onChange?: (value: string[]) => void\n /** Text shown in the trigger when nothing is selected. Defaults to `\"Select…\"`. */\n placeholder?: string\n /** Theme palette token tinting the selected chips. Defaults to `primary`. */\n color?: ThemeColor\n /** Shows a clear (×) button in the trigger when anything is selected. Defaults to `true`. */\n clearable?: boolean\n /** Adds a search box inside the popover that filters options by label. */\n searchable?: boolean\n /** Placeholder for the search box. Defaults to `\"Search…\"`. */\n searchPlaceholder?: string\n /**\n * Fires with the search query as the user types. **Providing this switches off the built-in\n * local filtering** — you own `options` (e.g. fetch them from a server for the current query).\n */\n onSearchChange?: (query: string) => void\n /** Shows a loading indicator in the popover (e.g. while fetching server-side search results). */\n loading?: boolean\n /** Text shown next to the loader while `loading`. Defaults to `\"Loading…\"`. */\n loadingText?: ReactNode\n /**\n * Shown in the popover when no option matches. Defaults to `\"No options\"`. Pass a function\n * `(query) => node` to vary the message by the current search text — e.g. a \"Type to search\" hint\n * while it's empty vs a \"No results\" message after typing.\n */\n noOptionsText?: ReactNode | ((query: string) => ReactNode)\n /** Form field name — auto-binds to a surrounding `<Form>` (value is a `string[]`). */\n name?: string\n /** Id for the trigger (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A labeled multi-select — the `string[]` sibling of `Select`. The trigger shows the chosen options\n * as deletable `Chip`s (wrapping, growing like `TagsField`) or a placeholder; clicking it opens the\n * same `Dropdown`-style popover (portaled, flips, scroll-locked, trigger-width, animated — shared via\n * `useFloatingPanel`). Options render as `ListItem`s in a `role=\"listbox\"` `aria-multiselectable`\n * list; selecting **toggles** an option and keeps the popover open, the chosen ones showing a tick.\n * Full keyboard support (Arrow/Home/End, Enter/Space to toggle, Escape to close, type-ahead) and\n * ARIA. Optionally `searchable` + `clearable`; pass `onSearchChange` to drive the search\n * **server-side** (you own `options` — local filtering is skipped) with a `loading` indicator.\n * Controlled (`value` + `onChange`) or uncontrolled\n * (`defaultValue`), and binds to a surrounding `<Form>` by `name` (value = `string[]`; validate with\n * e.g. `z.array(z.string()).min(1, 'Pick at least one')`). Token-only styling.\n */\nexport const MultiSelect = forwardRef<HTMLDivElement, MultiSelectProps>(function MultiSelect(\n {\n label,\n options,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n placeholder,\n color = 'primary',\n clearable = true,\n searchable = false,\n searchPlaceholder,\n onSearchChange,\n loading = false,\n loadingText,\n noOptionsText,\n name,\n id: idProp,\n className,\n style,\n },\n ref,\n) {\n const reactId = useId()\n const id = idProp ?? reactId\n const labelId = `${id}-label`\n const listboxId = `${id}-listbox`\n const helperId = `${id}-helper`\n const optionId = (index: number) => `${id}-opt-${index}`\n\n // ── value (controlled / form-bound / uncontrolled) — always a string[] ─────────────────────────\n // Read the RAW form value (field().value String-coerces, which would flatten the array).\n const t = useT()\n const searchPh = searchPlaceholder ?? t('common.search')\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = isFormBound ? form!.field(name!) : undefined\n const externalValue =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string[] | undefined) ?? [])\n : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string[]>(defaultValue ?? [])\n const selectedValues = isControlled ? externalValue! : internal\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const commit = (next: string[]) => {\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n // ── popover open state ─────────────────────────────────────────────────────────────────────────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const searchInputRef = useRef<HTMLInputElement | null>(null)\n const typeahead = useRef({ buffer: '', timer: 0 })\n const fieldBlur = useRef<(() => void) | undefined>(undefined)\n fieldBlur.current = bound ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\n const [open, setOpen] = useState(false)\n const [searchQuery, setSearchQuery] = useState('')\n const [highlightedIndex, setHighlightedIndex] = useState(-1)\n\n const setTriggerRef = useCallback(\n (node: HTMLDivElement | null) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLDivElement | null }).current = node\n },\n [ref],\n )\n\n // when `onSearchChange` is set the consumer owns `options` (server-side search) — skip local filter\n const filteredOptions = useMemo(() => {\n if (!searchable || onSearchChange || !searchQuery.trim()) return options\n const q = searchQuery.trim().toLowerCase()\n return options.filter((o) => o.label.toLowerCase().includes(q))\n }, [searchable, onSearchChange, searchQuery, options])\n\n const findEnabled = useCallback(\n (start: number, delta: number) => {\n let i = start\n while (i >= 0 && i < filteredOptions.length) {\n if (!filteredOptions[i].disabled) return i\n i += delta\n }\n return -1\n },\n [filteredOptions],\n )\n\n // the floating panel forwards its node here, for the focus-leaves-the-widget check on blur\n const popoverRef = useRef<HTMLDivElement | null>(null)\n\n const closeMenu = useCallback((refocus: boolean) => {\n setOpen(false)\n setSearchQuery('')\n window.clearTimeout(typeahead.current.timer)\n typeahead.current.buffer = ''\n fieldBlur.current?.()\n if (refocus) triggerRef.current?.focus()\n }, [])\n\n // on open: highlight the first enabled option, focus the search box if searchable\n useEffect(() => {\n if (!open) return\n setHighlightedIndex(findEnabled(0, 1))\n if (searchable) requestAnimationFrame(() => searchInputRef.current?.focus())\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n useEffect(() => {\n if (!open || highlightedIndex < 0) return\n document.getElementById(optionId(highlightedIndex))?.scrollIntoView?.({ block: 'nearest' })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, highlightedIndex])\n\n // search filter → re-anchor to the first match\n useEffect(() => {\n if (open && searchable) setHighlightedIndex(findEnabled(0, 1))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchQuery])\n\n // keep the highlight in range if the option count changes while open\n useEffect(() => {\n if (open) setHighlightedIndex((i) => (i < filteredOptions.length ? i : findEnabled(0, 1)))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filteredOptions.length])\n\n const openMenu = () => {\n if (!disabled) setOpen(true)\n }\n const toggleOption = (opt: SelectOption | undefined) => {\n if (!opt || opt.disabled) return\n commit(\n selectedValues.includes(opt.value)\n ? selectedValues.filter((v) => v !== opt.value)\n : [...selectedValues, opt.value],\n )\n // multi-select stays open\n }\n const removeValue = (v: string) => commit(selectedValues.filter((x) => x !== v))\n const moveHighlight = (delta: number) => {\n setHighlightedIndex((cur) => {\n const start = cur < 0 ? (delta > 0 ? 0 : filteredOptions.length - 1) : cur + delta\n const found = findEnabled(start, delta)\n return found === -1 ? cur : found\n })\n }\n\n const handleTypeahead = (char: string) => {\n const t = typeahead.current\n window.clearTimeout(t.timer)\n t.buffer += char.toLowerCase()\n t.timer = window.setTimeout(() => (t.buffer = ''), 500)\n const match = filteredOptions.findIndex(\n (o) => !o.disabled && o.label.toLowerCase().startsWith(t.buffer),\n )\n if (match >= 0) setHighlightedIndex(match)\n }\n\n const handleKeyDown = (event: ReactKeyboardEvent) => {\n if (disabled) return\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n open ? moveHighlight(1) : openMenu()\n break\n case 'ArrowUp':\n event.preventDefault()\n open ? moveHighlight(-1) : openMenu()\n break\n case 'Enter':\n event.preventDefault()\n if (!open) openMenu()\n else toggleOption(filteredOptions[highlightedIndex])\n break\n case ' ':\n // Space opens a closed menu (any mode); toggles only when open & not searchable\n if (!open) {\n event.preventDefault()\n openMenu()\n } else if (!searchable) {\n event.preventDefault()\n toggleOption(filteredOptions[highlightedIndex])\n }\n break\n case 'Escape':\n if (open) {\n event.preventDefault()\n event.stopPropagation() // don't let FloatingPanel's own Escape also fire closeMenu/onBlur\n closeMenu(true)\n }\n break\n case 'Tab':\n // refocus the trigger so Tab continues from the field's visual location, not the portaled\n // search input's DOM position (end of <body>); don't preventDefault — let Tab move on\n if (open) closeMenu(true)\n break\n case 'Backspace':\n // remove the last chip when the (search) input is empty or there's no search box\n if (open && (!searchable || searchQuery === '') && selectedValues.length > 0) {\n event.preventDefault()\n removeValue(selectedValues[selectedValues.length - 1])\n }\n break\n case 'Home':\n if (open) {\n event.preventDefault()\n setHighlightedIndex(findEnabled(0, 1))\n }\n break\n case 'End':\n if (open) {\n event.preventDefault()\n setHighlightedIndex(findEnabled(filteredOptions.length - 1, -1))\n }\n break\n default:\n if (\n !searchable &&\n open &&\n event.key.length === 1 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.altKey\n ) {\n handleTypeahead(event.key)\n }\n }\n }\n\n const handleTriggerBlur = (event: FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget as Node | null\n if (next && (popoverRef.current?.contains(next) || triggerRef.current?.contains(next))) return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\n const activeId = open && highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined\n // chevron size per field size: sm 16 · md 14 · lg 12\n const chevronPx = size === 'sm' ? 16 : size === 'md' ? 14 : 12\n const hasValue = selectedValues.length > 0\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <span\n id={labelId}\n className={styles.label}\n onClick={() => !disabled && triggerRef.current?.focus()}\n >\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n )}\n\n <div\n ref={setTriggerRef}\n id={id}\n {...(name ? { name } : {})}\n role=\"combobox\"\n tabIndex={disabled ? -1 : 0}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listboxId : undefined}\n aria-activedescendant={searchable ? undefined : activeId}\n aria-labelledby={label != null ? labelId : undefined}\n aria-disabled={disabled || undefined}\n aria-required={required || undefined}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n className={clsx(styles.control, open && styles.open, hasValue && styles.filled)}\n onClick={() => (open ? closeMenu(false) : openMenu())}\n onKeyDown={handleKeyDown}\n onBlur={handleTriggerBlur}\n >\n {hasValue ? (\n <span className={styles.chips}>\n {selectedValues.map((v) => {\n const opt = options.find((o) => o.value === v)\n return (\n <Chip\n key={v}\n size={size}\n color={color}\n disabled={disabled}\n onDelete={() => removeValue(v)}\n deleteLabel={`Remove ${opt?.label ?? v}`}\n // the combobox owns keyboard focus — keep chip deletes out of the tab order\n deleteTabIndex={-1}\n >\n {opt?.label ?? v}\n </Chip>\n )\n })}\n </span>\n ) : (\n <span className={clsx(styles.value, styles.placeholder)}>\n <span className={styles.valueLabel}>{placeholder ?? t('select.placeholder')}</span>\n </span>\n )}\n\n {clearable && hasValue && !disabled && (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={t('multiSelect.clearAll')}\n tabIndex={-1}\n onMouseDown={(e) => e.preventDefault()}\n onClick={(e) => {\n e.stopPropagation()\n commit([])\n triggerRef.current?.focus()\n }}\n >\n <Icon name=\"CloseCircle\" size=\"sm\" />\n </button>\n )}\n\n <Icon\n name=\"ArrowDown4\"\n className={styles.chevron}\n style={{ width: chevronPx, height: chevronPx }}\n aria-hidden=\"true\"\n />\n </div>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closeMenu}\n matchTriggerWidth\n className={styles.popover}\n >\n {searchable && (\n <div className={styles.search}>\n <Icon name=\"SearchNormal\" size=\"sm\" className={styles.searchIcon} aria-hidden=\"true\" />\n <input\n ref={searchInputRef}\n className={styles.searchInput}\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-controls={listboxId}\n aria-activedescendant={activeId}\n aria-autocomplete=\"list\"\n aria-label={searchPh}\n placeholder={searchPh}\n value={searchQuery}\n spellCheck={false}\n onChange={(e) => {\n setSearchQuery(e.target.value)\n onSearchChange?.(e.target.value)\n }}\n onKeyDown={handleKeyDown}\n />\n </div>\n )}\n\n <List\n role=\"listbox\"\n id={listboxId}\n aria-labelledby={label != null ? labelId : undefined}\n aria-multiselectable=\"true\"\n size={size}\n className={styles.listbox}\n // clear the mouse highlight when the pointer leaves the list (no lingering hover)\n onMouseLeave={() => setHighlightedIndex(-1)}\n >\n {loading ? (\n <div className={styles.loading}>\n <Loader size=\"sm\" />\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {loadingText ?? t('common.loading')}\n </Typography>\n </div>\n ) : filteredOptions.length === 0 ? (\n <div className={styles.noOptions}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {noOptionsText == null\n ? t('select.noOptions')\n : typeof noOptionsText === 'function'\n ? noOptionsText(searchQuery)\n : noOptionsText}\n </Typography>\n </div>\n ) : (\n filteredOptions.map((opt, index) => {\n const isSelected = selectedValues.includes(opt.value)\n return (\n <ListItem\n key={opt.value}\n id={optionId(index)}\n role=\"option\"\n tabIndex={-1}\n aria-selected={isSelected}\n aria-current={undefined}\n clickable\n selected={isSelected}\n disabled={opt.disabled}\n icon={opt.icon}\n className={clsx(index === highlightedIndex && styles.active)}\n trailing={isSelected ? <Icon name=\"TickCircle\" size=\"sm\" /> : undefined}\n onMouseEnter={() => !opt.disabled && setHighlightedIndex(index)}\n // keep focus on the search input (menu stays open on toggle) so typing keeps working\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => toggleOption(opt)}\n >\n {opt.label}\n </ListItem>\n )\n })\n )}\n </List>\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["MultiSelect","forwardRef","label","options","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","placeholder","color","clearable","searchable","searchPlaceholder","onSearchChange","loading","loadingText","noOptionsText","name","idProp","className","style","ref","reactId","useId","id","labelId","listboxId","helperId","optionId","index","t","useT","searchPh","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","selectedValues","resolvedError","resolvedHelperText","commit","next","triggerRef","useRef","searchInputRef","typeahead","fieldBlur","open","setOpen","searchQuery","setSearchQuery","highlightedIndex","setHighlightedIndex","setTriggerRef","useCallback","node","filteredOptions","useMemo","q","o","findEnabled","start","delta","i","popoverRef","closeMenu","refocus","_a","_b","useEffect","openMenu","toggleOption","opt","v","removeValue","x","moveHighlight","cur","found","handleTypeahead","char","match","handleKeyDown","event","handleTriggerBlur","activeId","chevronPx","hasValue","jsxs","clsx","styles","jsx","Typography","Chip","Icon","FloatingPanel","List","Loader","isSelected","ListItem","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8FaA,KAAcC,GAA6C,SACtE;AAAA,EACE,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAAAC,KAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC,KAAQ;AAAA,EACR,WAAAC,KAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC,KAAU;AAAA,EACV,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,MAAAC;AAAA,EACA,IAAIC;AAAA,EACJ,WAAAC;AAAA,EACA,OAAAC;AACF,GACAC,GACA;AACA,QAAMC,KAAUC,GAAA,GACVC,IAAKN,MAAUI,IACfG,IAAU,GAAGD,CAAE,UACfE,IAAY,GAAGF,CAAE,YACjBG,IAAW,GAAGH,CAAE,WAChBI,IAAW,CAACC,MAAkB,GAAGL,CAAE,QAAQK,CAAK,IAIhDC,IAAIC,GAAA,GACJC,IAAWpB,MAAqBkB,EAAE,eAAe,GACjDG,IAAOC,GAAA,GACPC,IAAc,GAAQF,KAAQhB,IAC9BmB,IAAQD,IAAcF,EAAM,MAAMhB,CAAK,IAAI,QAC3CoB,K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AK,IAAK;AAAA,wBAC9D,cAAc,MAAM,CAACtB,EAAI,YAAYpB,EAAoB5B,CAAK;AAAA,wBAE9D,aAAa,CAAC4E,MAAMA,EAAE,eAAA;AAAA,wBACtB,SAAS,MAAM7B,EAAaC,CAAG;AAAA,wBAE9B,UAAAA,EAAI;AAAA,sBAAA;AAAA,sBAjBAA,EAAI;AAAA,oBAAA;AAAA,kBAoBf,CAAC;AAAA,gBAAA;AAAA,cAAA;AAAA,YAEL;AAAA,UAAA;AAAA,QAAA;AAAA,QAGDjC,KAAsB,QACrB,gBAAAoD;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAItE;AAAA,YACJ,SAAQ;AAAA,YACR,OAAOgB,IAAgB,UAAU;AAAA,YACjC,WAAWoD,EAAO;AAAA,YAEjB,UAAAnD;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
1
+ {"version":3,"file":"MultiSelect-sKk2KzOd.js","sources":["../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Chip } from '../Chip'\nimport { Icon } from '../Icon'\nimport { List, ListItem } from '../List'\nimport { Loader } from '../Loader'\nimport { Typography } from '../Typography'\nimport type { SelectOption, SelectSize } from '../Select'\nimport styles from './MultiSelect.module.css'\n\nexport interface MultiSelectProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** The selectable options. */\n options: SelectOption[]\n /** Preset size — control height, font, chips and option density. */\n size?: SelectSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — the chosen options' `value`s. */\n value?: string[]\n /** Initial value for uncontrolled use. */\n defaultValue?: string[]\n /** Fires with the next array of selected values. */\n onChange?: (value: string[]) => void\n /** Text shown in the trigger when nothing is selected. Defaults to `\"Select…\"`. */\n placeholder?: string\n /** Theme palette token tinting the selected chips. Defaults to `primary`. */\n color?: ThemeColor\n /** Shows a clear (×) button in the trigger when anything is selected. Defaults to `true`. */\n clearable?: boolean\n /** Adds a search box inside the popover that filters options by label. */\n searchable?: boolean\n /** Placeholder for the search box. Defaults to `\"Search…\"`. */\n searchPlaceholder?: string\n /**\n * Fires with the search query as the user types. **Providing this switches off the built-in\n * local filtering** — you own `options` (e.g. fetch them from a server for the current query).\n */\n onSearchChange?: (query: string) => void\n /** Shows a loading indicator in the popover (e.g. while fetching server-side search results). */\n loading?: boolean\n /** Text shown next to the loader while `loading`. Defaults to `\"Loading…\"`. */\n loadingText?: ReactNode\n /**\n * Shown in the popover when no option matches. Defaults to `\"No options\"`. Pass a function\n * `(query) => node` to vary the message by the current search text — e.g. a \"Type to search\" hint\n * while it's empty vs a \"No results\" message after typing.\n */\n noOptionsText?: ReactNode | ((query: string) => ReactNode)\n /** Form field name — auto-binds to a surrounding `<Form>` (value is a `string[]`). */\n name?: string\n /** Id for the trigger (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A labeled multi-select — the `string[]` sibling of `Select`. The trigger shows the chosen options\n * as deletable `Chip`s (wrapping, growing like `TagsField`) or a placeholder; clicking it opens the\n * same `Dropdown`-style popover (portaled, flips, scroll-locked, trigger-width, animated — shared via\n * `useFloatingPanel`). Options render as `ListItem`s in a `role=\"listbox\"` `aria-multiselectable`\n * list; selecting **toggles** an option and keeps the popover open, the chosen ones showing a tick.\n * Full keyboard support (Arrow/Home/End, Enter/Space to toggle, Escape to close, type-ahead) and\n * ARIA. Optionally `searchable` + `clearable`; pass `onSearchChange` to drive the search\n * **server-side** (you own `options` — local filtering is skipped) with a `loading` indicator.\n * Controlled (`value` + `onChange`) or uncontrolled\n * (`defaultValue`), and binds to a surrounding `<Form>` by `name` (value = `string[]`; validate with\n * e.g. `z.array(z.string()).min(1, 'Pick at least one')`). Token-only styling.\n */\nexport const MultiSelect = forwardRef<HTMLDivElement, MultiSelectProps>(function MultiSelect(\n {\n label,\n options,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n placeholder,\n color = 'primary',\n clearable = true,\n searchable = false,\n searchPlaceholder,\n onSearchChange,\n loading = false,\n loadingText,\n noOptionsText,\n name,\n id: idProp,\n className,\n style,\n },\n ref,\n) {\n const reactId = useId()\n const id = idProp ?? reactId\n const labelId = `${id}-label`\n const listboxId = `${id}-listbox`\n const helperId = `${id}-helper`\n const optionId = (index: number) => `${id}-opt-${index}`\n\n // ── value (controlled / form-bound / uncontrolled) — always a string[] ─────────────────────────\n // Read the RAW form value (field().value String-coerces, which would flatten the array).\n const t = useT()\n const searchPh = searchPlaceholder ?? t('common.search')\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = isFormBound ? form!.field(name!) : undefined\n const externalValue =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string[] | undefined) ?? [])\n : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string[]>(defaultValue ?? [])\n const selectedValues = isControlled ? externalValue! : internal\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const commit = (next: string[]) => {\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n // ── popover open state ─────────────────────────────────────────────────────────────────────────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const searchInputRef = useRef<HTMLInputElement | null>(null)\n const typeahead = useRef({ buffer: '', timer: 0 })\n const fieldBlur = useRef<(() => void) | undefined>(undefined)\n fieldBlur.current = bound ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\n const [open, setOpen] = useState(false)\n const [searchQuery, setSearchQuery] = useState('')\n const [highlightedIndex, setHighlightedIndex] = useState(-1)\n\n const setTriggerRef = useCallback(\n (node: HTMLDivElement | null) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLDivElement | null }).current = node\n },\n [ref],\n )\n\n // when `onSearchChange` is set the consumer owns `options` (server-side search) — skip local filter\n const filteredOptions = useMemo(() => {\n if (!searchable || onSearchChange || !searchQuery.trim()) return options\n const q = searchQuery.trim().toLowerCase()\n return options.filter((o) => o.label.toLowerCase().includes(q))\n }, [searchable, onSearchChange, searchQuery, options])\n\n const findEnabled = useCallback(\n (start: number, delta: number) => {\n let i = start\n while (i >= 0 && i < filteredOptions.length) {\n if (!filteredOptions[i].disabled) return i\n i += delta\n }\n return -1\n },\n [filteredOptions],\n )\n\n // the floating panel forwards its node here, for the focus-leaves-the-widget check on blur\n const popoverRef = useRef<HTMLDivElement | null>(null)\n\n const closeMenu = useCallback((refocus: boolean) => {\n setOpen(false)\n setSearchQuery('')\n window.clearTimeout(typeahead.current.timer)\n typeahead.current.buffer = ''\n fieldBlur.current?.()\n if (refocus) triggerRef.current?.focus()\n }, [])\n\n // on open: highlight the first enabled option, focus the search box if searchable\n useEffect(() => {\n if (!open) return\n setHighlightedIndex(findEnabled(0, 1))\n if (searchable) requestAnimationFrame(() => searchInputRef.current?.focus())\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n useEffect(() => {\n if (!open || highlightedIndex < 0) return\n document.getElementById(optionId(highlightedIndex))?.scrollIntoView?.({ block: 'nearest' })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, highlightedIndex])\n\n // search filter → re-anchor to the first match\n useEffect(() => {\n if (open && searchable) setHighlightedIndex(findEnabled(0, 1))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchQuery])\n\n // keep the highlight in range if the option count changes while open\n useEffect(() => {\n if (open) setHighlightedIndex((i) => (i < filteredOptions.length ? i : findEnabled(0, 1)))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filteredOptions.length])\n\n const openMenu = () => {\n if (!disabled) setOpen(true)\n }\n const toggleOption = (opt: SelectOption | undefined) => {\n if (!opt || opt.disabled) return\n commit(\n selectedValues.includes(opt.value)\n ? selectedValues.filter((v) => v !== opt.value)\n : [...selectedValues, opt.value],\n )\n // multi-select stays open\n }\n const removeValue = (v: string) => commit(selectedValues.filter((x) => x !== v))\n const moveHighlight = (delta: number) => {\n setHighlightedIndex((cur) => {\n const start = cur < 0 ? (delta > 0 ? 0 : filteredOptions.length - 1) : cur + delta\n const found = findEnabled(start, delta)\n return found === -1 ? cur : found\n })\n }\n\n const handleTypeahead = (char: string) => {\n const t = typeahead.current\n window.clearTimeout(t.timer)\n t.buffer += char.toLowerCase()\n t.timer = window.setTimeout(() => (t.buffer = ''), 500)\n const match = filteredOptions.findIndex(\n (o) => !o.disabled && o.label.toLowerCase().startsWith(t.buffer),\n )\n if (match >= 0) setHighlightedIndex(match)\n }\n\n const handleKeyDown = (event: ReactKeyboardEvent) => {\n if (disabled) return\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n open ? moveHighlight(1) : openMenu()\n break\n case 'ArrowUp':\n event.preventDefault()\n open ? moveHighlight(-1) : openMenu()\n break\n case 'Enter':\n event.preventDefault()\n if (!open) openMenu()\n else toggleOption(filteredOptions[highlightedIndex])\n break\n case ' ':\n // Space opens a closed menu (any mode); toggles only when open & not searchable\n if (!open) {\n event.preventDefault()\n openMenu()\n } else if (!searchable) {\n event.preventDefault()\n toggleOption(filteredOptions[highlightedIndex])\n }\n break\n case 'Escape':\n if (open) {\n event.preventDefault()\n event.stopPropagation() // don't let FloatingPanel's own Escape also fire closeMenu/onBlur\n closeMenu(true)\n }\n break\n case 'Tab':\n // refocus the trigger so Tab continues from the field's visual location, not the portaled\n // search input's DOM position (end of <body>); don't preventDefault — let Tab move on\n if (open) closeMenu(true)\n break\n case 'Backspace':\n // remove the last chip when the (search) input is empty or there's no search box\n if (open && (!searchable || searchQuery === '') && selectedValues.length > 0) {\n event.preventDefault()\n removeValue(selectedValues[selectedValues.length - 1])\n }\n break\n case 'Home':\n if (open) {\n event.preventDefault()\n setHighlightedIndex(findEnabled(0, 1))\n }\n break\n case 'End':\n if (open) {\n event.preventDefault()\n setHighlightedIndex(findEnabled(filteredOptions.length - 1, -1))\n }\n break\n default:\n if (\n !searchable &&\n open &&\n event.key.length === 1 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.altKey\n ) {\n handleTypeahead(event.key)\n }\n }\n }\n\n const handleTriggerBlur = (event: FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget as Node | null\n if (next && (popoverRef.current?.contains(next) || triggerRef.current?.contains(next))) return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\n const activeId = open && highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined\n // chevron size per field size: sm 16 · md 14 · lg 12\n const chevronPx = size === 'sm' ? 16 : size === 'md' ? 14 : 12\n const hasValue = selectedValues.length > 0\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <span\n id={labelId}\n className={styles.label}\n onClick={() => !disabled && triggerRef.current?.focus()}\n >\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n )}\n\n <div\n ref={setTriggerRef}\n id={id}\n {...(name ? { name } : {})}\n role=\"combobox\"\n tabIndex={disabled ? -1 : 0}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listboxId : undefined}\n aria-activedescendant={searchable ? undefined : activeId}\n aria-labelledby={label != null ? labelId : undefined}\n aria-disabled={disabled || undefined}\n aria-required={required || undefined}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n className={clsx(styles.control, open && styles.open, hasValue && styles.filled)}\n onClick={() => (open ? closeMenu(false) : openMenu())}\n onKeyDown={handleKeyDown}\n onBlur={handleTriggerBlur}\n >\n {hasValue ? (\n <span className={styles.chips}>\n {selectedValues.map((v) => {\n const opt = options.find((o) => o.value === v)\n return (\n <Chip\n key={v}\n size={size}\n color={color}\n disabled={disabled}\n onDelete={() => removeValue(v)}\n deleteLabel={`Remove ${opt?.label ?? v}`}\n // the combobox owns keyboard focus — keep chip deletes out of the tab order\n deleteTabIndex={-1}\n >\n {opt?.label ?? v}\n </Chip>\n )\n })}\n </span>\n ) : (\n <span className={clsx(styles.value, styles.placeholder)}>\n <span className={styles.valueLabel}>{placeholder ?? t('select.placeholder')}</span>\n </span>\n )}\n\n {clearable && hasValue && !disabled && (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={t('multiSelect.clearAll')}\n tabIndex={-1}\n onMouseDown={(e) => e.preventDefault()}\n onClick={(e) => {\n e.stopPropagation()\n commit([])\n triggerRef.current?.focus()\n }}\n >\n <Icon name=\"CloseCircle\" size=\"sm\" />\n </button>\n )}\n\n <Icon\n name=\"ArrowDown4\"\n className={styles.chevron}\n style={{ width: chevronPx, height: chevronPx }}\n aria-hidden=\"true\"\n />\n </div>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closeMenu}\n matchTriggerWidth\n className={styles.popover}\n >\n {searchable && (\n <div className={styles.search}>\n <Icon name=\"SearchNormal\" size=\"sm\" className={styles.searchIcon} aria-hidden=\"true\" />\n <input\n ref={searchInputRef}\n className={styles.searchInput}\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-controls={listboxId}\n aria-activedescendant={activeId}\n aria-autocomplete=\"list\"\n aria-label={searchPh}\n placeholder={searchPh}\n value={searchQuery}\n spellCheck={false}\n onChange={(e) => {\n setSearchQuery(e.target.value)\n onSearchChange?.(e.target.value)\n }}\n onKeyDown={handleKeyDown}\n />\n </div>\n )}\n\n <List\n role=\"listbox\"\n id={listboxId}\n aria-labelledby={label != null ? labelId : undefined}\n aria-multiselectable=\"true\"\n size={size}\n className={styles.listbox}\n // clear the mouse highlight when the pointer leaves the list (no lingering hover)\n onMouseLeave={() => setHighlightedIndex(-1)}\n >\n {loading ? (\n <div className={styles.loading}>\n <Loader size=\"sm\" />\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {loadingText ?? t('common.loading')}\n </Typography>\n </div>\n ) : filteredOptions.length === 0 ? (\n <div className={styles.noOptions}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {noOptionsText == null\n ? t('select.noOptions')\n : typeof noOptionsText === 'function'\n ? noOptionsText(searchQuery)\n : noOptionsText}\n </Typography>\n </div>\n ) : (\n filteredOptions.map((opt, index) => {\n const isSelected = selectedValues.includes(opt.value)\n return (\n <ListItem\n key={opt.value}\n id={optionId(index)}\n role=\"option\"\n tabIndex={-1}\n aria-selected={isSelected}\n aria-current={undefined}\n clickable\n selected={isSelected}\n disabled={opt.disabled}\n icon={opt.icon}\n className={clsx(index === highlightedIndex && styles.active)}\n trailing={isSelected ? <Icon name=\"TickCircle\" size=\"sm\" /> : undefined}\n onMouseEnter={() => !opt.disabled && setHighlightedIndex(index)}\n // keep focus on the search input (menu stays open on toggle) so typing keeps working\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => toggleOption(opt)}\n >\n {opt.label}\n </ListItem>\n )\n })\n )}\n </List>\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["MultiSelect","forwardRef","label","options","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","placeholder","color","clearable","searchable","searchPlaceholder","onSearchChange","loading","loadingText","noOptionsText","name","idProp","className","style","ref","reactId","useId","id","labelId","listboxId","helperId","optionId","index","t","useT","searchPh","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","selectedValues","resolvedError","resolvedHelperText","commit","next","triggerRef","useRef","searchInputRef","typeahead","fieldBlur","open","setOpen","searchQuery","setSearchQuery","highlightedIndex","setHighlightedIndex","setTriggerRef","useCallback","node","filteredOptions","useMemo","q","o","findEnabled","start","delta","i","popoverRef","closeMenu","refocus","_a","_b","useEffect","openMenu","toggleOption","opt","v","removeValue","x","moveHighlight","cur","found","handleTypeahead","char","match","handleKeyDown","event","handleTriggerBlur","activeId","chevronPx","hasValue","jsxs","clsx","styles","jsx","Typography","Chip","Icon","FloatingPanel","List","Loader","isSelected","ListItem","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8FaA,KAAcC,GAA6C,SACtE;AAAA,EACE,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAAAC,KAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC,KAAQ;AAAA,EACR,WAAAC,KAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC,KAAU;AAAA,EACV,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,MAAAC;AAAA,EACA,IAAIC;AAAA,EACJ,WAAAC;AAAA,EACA,OAAAC;AACF,GACAC,GACA;AACA,QAAMC,KAAUC,GAAA,GACVC,IAAKN,MAA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AAA,wBAClB,MAAK;AAAA,wBACL,UAAU;AAAA,wBACV,iBAAe0E;AAAA,wBACf,gBAAc;AAAA,wBACd,WAAS;AAAA,wBACT,UAAUA;AAAA,wBACV,UAAU1B,EAAI;AAAA,wBACd,MAAMA,EAAI;AAAA,wBACV,WAAWiB,EAAKjE,MAAU2B,KAAoBuC,EAAO,MAAM;AAAA,wBAC3D,UAAUQ,IAAa,gBAAAP,EAACG,GAAA,EAAK,MAAK,cAAa,MAAK,MAAK,IAAK;AAAA,wBAC9D,cAAc,MAAM,CAACtB,EAAI,YAAYpB,EAAoB5B,CAAK;AAAA,wBAE9D,aAAa,CAAC4E,MAAMA,EAAE,eAAA;AAAA,wBACtB,SAAS,MAAM7B,EAAaC,CAAG;AAAA,wBAE9B,UAAAA,EAAI;AAAA,sBAAA;AAAA,sBAjBAA,EAAI;AAAA,oBAAA;AAAA,kBAoBf,CAAC;AAAA,gBAAA;AAAA,cAAA;AAAA,YAEL;AAAA,UAAA;AAAA,QAAA;AAAA,QAGDjC,KAAsB,QACrB,gBAAAoD;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAItE;AAAA,YACJ,SAAQ;AAAA,YACR,OAAOgB,IAAgB,UAAU;AAAA,YACjC,WAAWoD,EAAO;AAAA,YAEjB,UAAAnD;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";const s=require("react/jsx-runtime"),d=require("react"),J=require("clsx"),he=require("./formContext-bTWrqdEV.cjs"),K=require("./Icon-CXTl_QAP.cjs"),O=require("./IconButton-BoY2y_pV.cjs"),Q=require("./Typography-BFatE1_A.cjs"),r=require("./TextField.module-m-UllwzG.cjs"),xe=require("./ConfigProvider-BHNx-NHV.cjs"),X=/^-?\d*\.?\d*$/;function E(t){if(t===""||t==="-"||t==="."||t==="-.")return null;const l=Number(t);return Number.isNaN(l)?null:l}function Y(t,l,n){return l!=null&&t<l?l:n!=null&&t>n?n:t}function ge(t){return Math.round(t*1e6)/1e6}function Z(t,l){const[n,o]=String(t).split("."),c=n.startsWith("-")?"-":"",g=(c?n.slice(1):n).replace(/\B(?=(\d{3})+(?!\d))/g,l);return o!=null?`${c}${g}.${o}`:`${c}${g}`}function ve(t,l){let n=0;for(const o of t)o!==l&&n++;return n}function Ne(t,l,n){if(n<=0)return 0;let o=0;for(let c=0;c<t.length;c++)if(t[c]!==l&&(o+=1,o===n))return c+1;return t.length}const Se=d.forwardRef(function({label:l,size:n="md",error:o,helperText:c,required:$=!1,fullWidth:g=!0,value:D,defaultValue:w=null,onChange:I,min:m=0,max:v,step:ee=1,hideStepper:V=!1,thousandSeparator:p,name:y,onBlur:R,disabled:N=!1,id:te,className:le,style:ne,...se},h){const k=xe.useT(),re=d.useId(),q=te??re,A=`${q}-helper`,x=he.useFormContext(),P=!!(x&&y),u=x&&y?x.field(y):void 0,W=D!==void 0?D:P?x.values[y]??null:void 0,_=W!==void 0,[ie,ce]=d.useState(w),i=_?W:ie,H=e=>e==null?"":p!=null?Z(e,p):String(e),oe=e=>E(p!=null?e.split(p).join(""):e),[L,F]=d.useState(()=>H(i));d.useEffect(()=>{oe(L)!==i&&F(H(i))},[i]);const U=d.useRef(null),B=d.useRef(null),ue=d.useCallback(e=>{U.current=e,typeof h=="function"?h(e):h&&(h.current=e)},[h]);d.useLayoutEffect(()=>{var a;const e=B.current;e!=null&&(B.current=null,(a=U.current)==null||a.setSelectionRange(e,e))});const T=o??(u==null?void 0:u.error)??!1,M=c??(u==null?void 0:u.helperText),S=e=>{_||ce(e),P&&x.setValue(y,e),I==null||I(e)},ae=e=>{const a=e.target,f=a.value;if(p==null){if(f!==""&&!X.test(f))return;F(f),S(E(f));return}const j=p,b=f.split(j).join("");if(b!==""&&!X.test(b))return;const ye=a.selectionStart??f.length,me=ve(f.slice(0,ye),j),C=E(b),G=C==null?b:Z(C,j);F(G),S(C),B.current=Ne(G,j,me)},de=e=>{if(i!=null){const a=Y(i,m,v);a!==i&&S(a)}u==null||u.onBlur(e),R==null||R(e)},z=e=>{S(Y(ge((i??m??0)+e*ee),m,v))},fe=v!=null&&i!=null&&i>=v,pe=m!=null&&i!=null&&i<=m;return s.jsxs("div",{className:J.clsx(r.fieldStyles.field,r.fieldStyles[n],g&&r.fieldStyles.fullWidth,T&&r.fieldStyles.error,N&&r.fieldStyles.disabled,le),style:ne,children:[l!=null&&s.jsxs("label",{htmlFor:q,className:r.fieldStyles.label,children:[s.jsx(Q.Typography,{as:"span",variant:"bodySmall",color:"muted",children:l}),$&&s.jsx("span",{className:r.fieldStyles.required,"aria-hidden":"true",children:"*"})]}),s.jsxs("div",{className:J.clsx(r.fieldStyles.control,!V&&r.fieldStyles.hasRightAdornment),children:[s.jsx("input",{ref:ue,id:q,name:y,type:"text",inputMode:"decimal",className:r.fieldStyles.input,value:L,onChange:ae,onBlur:de,disabled:N,"aria-invalid":T||void 0,"aria-describedby":M!=null?A:void 0,...se}),!V&&s.jsxs(s.Fragment,{children:[s.jsx(O.IconButton,{variant:"filled",color:"primary",className:r.fieldStyles.iconButton,style:{marginRight:-2},disabled:N||pe,"aria-label":k("numberField.decrease"),onMouseDown:e=>e.preventDefault(),onClick:()=>z(-1),children:s.jsx(K.Icon,{name:"Minus"})}),s.jsx(O.IconButton,{variant:"filled",color:"primary",className:r.fieldStyles.iconButton,disabled:N||fe,"aria-label":k("numberField.increase"),onMouseDown:e=>e.preventDefault(),onClick:()=>z(1),children:s.jsx(K.Icon,{name:"Add"})})]})]}),M!=null&&s.jsx(Q.Typography,{as:"span",id:A,variant:"bodySmall",color:T?"error":"muted",className:r.fieldStyles.helper,children:M})]})});exports.NumberField=Se;
2
- //# sourceMappingURL=NumberField-BH237Vt2.cjs.map
1
+ "use strict";const s=require("react/jsx-runtime"),d=require("react"),J=require("clsx"),he=require("./formContext-bTWrqdEV.cjs"),K=require("./Icon-CXTl_QAP.cjs"),O=require("./IconButton-DyRC514t.cjs"),Q=require("./Typography-BFatE1_A.cjs"),r=require("./TextField.module-m-UllwzG.cjs"),xe=require("./ConfigProvider-h1WoGC3R.cjs"),X=/^-?\d*\.?\d*$/;function E(t){if(t===""||t==="-"||t==="."||t==="-.")return null;const l=Number(t);return Number.isNaN(l)?null:l}function Y(t,l,n){return l!=null&&t<l?l:n!=null&&t>n?n:t}function ge(t){return Math.round(t*1e6)/1e6}function Z(t,l){const[n,o]=String(t).split("."),c=n.startsWith("-")?"-":"",g=(c?n.slice(1):n).replace(/\B(?=(\d{3})+(?!\d))/g,l);return o!=null?`${c}${g}.${o}`:`${c}${g}`}function ve(t,l){let n=0;for(const o of t)o!==l&&n++;return n}function Ne(t,l,n){if(n<=0)return 0;let o=0;for(let c=0;c<t.length;c++)if(t[c]!==l&&(o+=1,o===n))return c+1;return t.length}const Se=d.forwardRef(function({label:l,size:n="md",error:o,helperText:c,required:$=!1,fullWidth:g=!0,value:D,defaultValue:w=null,onChange:I,min:m=0,max:v,step:ee=1,hideStepper:V=!1,thousandSeparator:p,name:y,onBlur:R,disabled:N=!1,id:te,className:le,style:ne,...se},h){const k=xe.useT(),re=d.useId(),q=te??re,A=`${q}-helper`,x=he.useFormContext(),P=!!(x&&y),u=x&&y?x.field(y):void 0,W=D!==void 0?D:P?x.values[y]??null:void 0,_=W!==void 0,[ie,ce]=d.useState(w),i=_?W:ie,H=e=>e==null?"":p!=null?Z(e,p):String(e),oe=e=>E(p!=null?e.split(p).join(""):e),[L,F]=d.useState(()=>H(i));d.useEffect(()=>{oe(L)!==i&&F(H(i))},[i]);const U=d.useRef(null),B=d.useRef(null),ue=d.useCallback(e=>{U.current=e,typeof h=="function"?h(e):h&&(h.current=e)},[h]);d.useLayoutEffect(()=>{var a;const e=B.current;e!=null&&(B.current=null,(a=U.current)==null||a.setSelectionRange(e,e))});const T=o??(u==null?void 0:u.error)??!1,M=c??(u==null?void 0:u.helperText),S=e=>{_||ce(e),P&&x.setValue(y,e),I==null||I(e)},ae=e=>{const a=e.target,f=a.value;if(p==null){if(f!==""&&!X.test(f))return;F(f),S(E(f));return}const j=p,b=f.split(j).join("");if(b!==""&&!X.test(b))return;const ye=a.selectionStart??f.length,me=ve(f.slice(0,ye),j),C=E(b),G=C==null?b:Z(C,j);F(G),S(C),B.current=Ne(G,j,me)},de=e=>{if(i!=null){const a=Y(i,m,v);a!==i&&S(a)}u==null||u.onBlur(e),R==null||R(e)},z=e=>{S(Y(ge((i??m??0)+e*ee),m,v))},fe=v!=null&&i!=null&&i>=v,pe=m!=null&&i!=null&&i<=m;return s.jsxs("div",{className:J.clsx(r.fieldStyles.field,r.fieldStyles[n],g&&r.fieldStyles.fullWidth,T&&r.fieldStyles.error,N&&r.fieldStyles.disabled,le),style:ne,children:[l!=null&&s.jsxs("label",{htmlFor:q,className:r.fieldStyles.label,children:[s.jsx(Q.Typography,{as:"span",variant:"bodySmall",color:"muted",children:l}),$&&s.jsx("span",{className:r.fieldStyles.required,"aria-hidden":"true",children:"*"})]}),s.jsxs("div",{className:J.clsx(r.fieldStyles.control,!V&&r.fieldStyles.hasRightAdornment),children:[s.jsx("input",{ref:ue,id:q,name:y,type:"text",inputMode:"decimal",className:r.fieldStyles.input,value:L,onChange:ae,onBlur:de,disabled:N,"aria-invalid":T||void 0,"aria-describedby":M!=null?A:void 0,...se}),!V&&s.jsxs(s.Fragment,{children:[s.jsx(O.IconButton,{variant:"filled",color:"primary",className:r.fieldStyles.iconButton,style:{marginRight:-2},disabled:N||pe,"aria-label":k("numberField.decrease"),onMouseDown:e=>e.preventDefault(),onClick:()=>z(-1),children:s.jsx(K.Icon,{name:"Minus"})}),s.jsx(O.IconButton,{variant:"filled",color:"primary",className:r.fieldStyles.iconButton,disabled:N||fe,"aria-label":k("numberField.increase"),onMouseDown:e=>e.preventDefault(),onClick:()=>z(1),children:s.jsx(K.Icon,{name:"Add"})})]})]}),M!=null&&s.jsx(Q.Typography,{as:"span",id:A,variant:"bodySmall",color:T?"error":"muted",className:r.fieldStyles.helper,children:M})]})});exports.NumberField=Se;
2
+ //# sourceMappingURL=NumberField-C6qj3nCa.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumberField-BH237Vt2.cjs","sources":["../src/components/NumberField/NumberField.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ChangeEvent,\n type CSSProperties,\n type FocusEvent,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { useT } from '../../theme'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Typography } from '../Typography'\n// shared field chrome (label/control/helper) AND the `.control .iconButton` styling for the steppers\nimport fieldStyles from '../TextField/TextField.module.css'\n\nexport type NumberFieldSize = 'sm' | 'md' | 'lg'\n\n/** Allowed while typing — digits, an optional leading `-`, and one decimal point. */\nconst NUMERIC_RE = /^-?\\d*\\.?\\d*$/\n\n/** Parses the display string to a number, treating empty / in-progress input (`\"\"`, `\"-\"`, `\".\"`) as null. */\nfunction parseValue(raw: string): number | null {\n if (raw === '' || raw === '-' || raw === '.' || raw === '-.') return null\n const n = Number(raw)\n return Number.isNaN(n) ? null : n\n}\n\nfunction clampValue(n: number, min?: number, max?: number): number {\n if (min != null && n < min) return min\n if (max != null && n > max) return max\n return n\n}\n\n/** Kills binary float drift from repeated stepping (e.g. 0.1 + 0.2). */\nfunction roundStep(n: number): number {\n return Math.round(n * 1e6) / 1e6\n}\n\n/** Groups the integer part with `separator` for display (e.g. 32345345 → \"32.345.345\"). */\nfunction groupThousands(value: number, separator: string): string {\n const [intPart, decPart] = String(value).split('.')\n const sign = intPart.startsWith('-') ? '-' : ''\n const digits = sign ? intPart.slice(1) : intPart\n const grouped = digits.replace(/\\B(?=(\\d{3})+(?!\\d))/g, separator)\n return decPart != null ? `${sign}${grouped}.${decPart}` : `${sign}${grouped}`\n}\n\n/** Counts the \"significant\" (non-separator) chars — used to keep the caret stable across regrouping. */\nfunction countExcept(s: string, sep: string): number {\n let n = 0\n for (const c of s) if (c !== sep) n++\n return n\n}\n\n/** Index just after the `n`-th non-separator char in `str` (where the caret should land after regrouping). */\nfunction positionAfterExcept(str: string, sep: string, n: number): number {\n if (n <= 0) return 0\n let count = 0\n for (let i = 0; i < str.length; i++) {\n if (str[i] !== sep) {\n count += 1\n if (count === n) return i + 1\n }\n }\n return str.length\n}\n\nexport interface NumberFieldProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'value' | 'defaultValue' | 'onChange' | 'type' | 'min' | 'max' | 'step' | 'prefix'\n> {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — drives the control height, font size and padding. */\n size?: NumberFieldSize\n /** Marks the field invalid: red border/focus ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Controlled numeric value (`null` = empty). */\n value?: number | null\n /** Initial value for uncontrolled use (`null` = empty). Defaults to `null`. */\n defaultValue?: number | null\n /** Fires with the parsed numeric value (or `null` when the field is empty). */\n onChange?: (value: number | null) => void\n /** Minimum value — clamps on blur and on the stepper, and disables `−` at the floor. Defaults to `0`; pass a negative `min` to allow negatives. */\n min?: number\n /** Maximum value — clamps on blur and on the stepper, and disables `+` at the ceiling. */\n max?: number\n /** Amount the `+`/`−` buttons add or subtract. Defaults to `1`. */\n step?: number\n /** Hides the `+`/`−` stepper buttons (keyboard entry only). */\n hideStepper?: boolean\n /**\n * Thousands-group separator shown **live** as you type, e.g. `\".\"` displays `32345345` as\n * `32.345.345` (or `\",\"`). The caret is preserved across regrouping; the `value`/`onChange`/form\n * value stay a plain `number`. Best for integers — with `\".\"` decimals aren't supported (the dot is\n * the group separator).\n */\n thousandSeparator?: string\n}\n\n/**\n * A numeric input with `+`/`−` stepper buttons. Supports `min`/`max` clamping, a `step` amount,\n * controlled (`value` + `onChange`) or uncontrolled (`defaultValue`) use, optional live thousands\n * grouping, and — like `TextField` — binds to a surrounding `<Form>` by `name` (its form value is a\n * real `number`, validated by the Zod schema). `onChange` emits a `number` or `null` (empty). Shares\n * `TextField`'s field chrome, so label, sizing, error and focus styling are identical.\n */\nexport const NumberField = forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n value,\n defaultValue = null,\n onChange,\n min = 0,\n max,\n step = 1,\n hideStepper = false,\n thousandSeparator,\n name,\n onBlur,\n disabled = false,\n id: idProp,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n\n // Auto-bind to a surrounding <Form> by `name`. The form stores a real number; we use field() for\n // touched/error/helper and read/write the numeric value through values/setValue.\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue: number | null | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as number | null | undefined) ?? null)\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<number | null>(defaultValue)\n const numValue: number | null = isControlled ? externalValue! : internal\n\n // number <-> display string, applying live thousands grouping when `thousandSeparator` is set.\n const toDisplay = (v: number | null): string =>\n v == null ? '' : thousandSeparator != null ? groupThousands(v, thousandSeparator) : String(v)\n const fromDisplay = (raw: string): number | null =>\n parseValue(thousandSeparator != null ? raw.split(thousandSeparator).join('') : raw)\n\n // The display string mirrors `numValue` but tolerates in-progress input (\"-\", \"1.\" …).\n const [text, setText] = useState<string>(() => toDisplay(numValue))\n useEffect(() => {\n if (fromDisplay(text) !== numValue) setText(toDisplay(numValue))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [numValue]) // re-sync only when the value changes from the outside (stepper, form, reset)\n\n // Caret restoration after regrouping (the formatted string length changes as separators move).\n const innerRef = useRef<HTMLInputElement>(null)\n const pendingCaret = useRef<number | null>(null)\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n innerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n useLayoutEffect(() => {\n const pos = pendingCaret.current\n if (pos == null) return\n pendingCaret.current = null\n innerRef.current?.setSelectionRange(pos, pos)\n })\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const commit = (next: number | null) => {\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const el = event.target\n const raw = el.value\n\n if (thousandSeparator == null) {\n if (raw !== '' && !NUMERIC_RE.test(raw)) return // reject non-numeric keystrokes\n setText(raw)\n commit(parseValue(raw))\n return\n }\n\n // Live grouping: strip separators, validate, regroup, and remember where the caret should land.\n const sep = thousandSeparator\n const cleaned = raw.split(sep).join('')\n if (cleaned !== '' && !NUMERIC_RE.test(cleaned)) return\n const caret = el.selectionStart ?? raw.length\n const significantBefore = countExcept(raw.slice(0, caret), sep)\n const next = parseValue(cleaned)\n const formatted = next == null ? cleaned : groupThousands(next, sep)\n setText(formatted)\n commit(next)\n pendingCaret.current = positionAfterExcept(formatted, sep, significantBefore)\n }\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n if (numValue != null) {\n const clamped = clampValue(numValue, min, max)\n if (clamped !== numValue) commit(clamped)\n }\n bound?.onBlur(event)\n onBlur?.(event)\n }\n\n const stepBy = (direction: 1 | -1) => {\n const base = numValue ?? min ?? 0\n commit(clampValue(roundStep(base + direction * step), min, max))\n }\n\n const atMax = max != null && numValue != null && numValue >= max\n const atMin = min != null && numValue != null && numValue <= min\n\n return (\n <div\n className={clsx(\n fieldStyles.field,\n fieldStyles[size],\n fullWidth && fieldStyles.fullWidth,\n resolvedError && fieldStyles.error,\n disabled && fieldStyles.disabled,\n className,\n )}\n style={style as CSSProperties}\n >\n {label != null && (\n <label htmlFor={id} className={fieldStyles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div className={clsx(fieldStyles.control, !hideStepper && fieldStyles.hasRightAdornment)}>\n <input\n ref={setInputRef}\n id={id}\n name={name}\n type=\"text\"\n inputMode=\"decimal\"\n className={fieldStyles.input}\n value={text}\n onChange={handleChange}\n onBlur={handleBlur}\n disabled={disabled}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n {...props}\n />\n {!hideStepper && (\n <>\n {/* Filled icon buttons, sized via the shared `.control .iconButton` rule (flush square,\n stretched to the control height, scaled). The minus glyph is nudged for optical centering. */}\n <IconButton\n variant=\"filled\"\n color=\"primary\"\n className={fieldStyles.iconButton}\n style={{ marginRight: -2 }}\n disabled={disabled || atMin}\n aria-label={t('numberField.decrease')}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => stepBy(-1)}\n >\n <Icon name=\"Minus\" />\n </IconButton>\n <IconButton\n variant=\"filled\"\n color=\"primary\"\n className={fieldStyles.iconButton}\n disabled={disabled || atMax}\n aria-label={t('numberField.increase')}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => stepBy(1)}\n >\n <Icon name=\"Add\" />\n </IconButton>\n </>\n )}\n </div>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={fieldStyles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["NUMERIC_RE","parseValue","raw","n","clampValue","min","max","roundStep","groupThousands","value","separator","intPart","decPart","sign","grouped","countExcept","s","sep","c","positionAfterExcept","str","count","i","NumberField","forwardRef","label","size","error","helperText","required","fullWidth","defaultValue","onChange","step","hideStepper","thousandSeparator","name","onBlur","disabled","idProp","className","style","props","ref","t","useT","reactId","useId","id","helperId","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","numValue","toDisplay","v","fromDisplay","text","setText","useEffect","innerRef","useRef","pendingCaret","setInputRef","useCallback","node","useLayoutEffect","pos","_a","resolvedError","resolvedHelperText","commit","next","handleChange","event","el","cleaned","caret","significantBefore","formatted","handleBlur","clamped","stepBy","direction","atMax","atMin","jsxs","clsx","fieldStyles","jsx","Typography","Fragment","IconButton","Icon"],"mappings":"wUA0BMA,EAAa,gBAGnB,SAASC,EAAWC,EAA4B,CAC9C,GAAIA,IAAQ,IAAMA,IAAQ,KAAOA,IAAQ,KAAOA,IAAQ,KAAM,OAAO,KACrE,MAAMC,EAAI,OAAOD,CAAG,EACpB,OAAO,OAAO,MAAMC,CAAC,EAAI,KAAOA,CAClC,CAEA,SAASC,EAAWD,EAAWE,EAAcC,EAAsB,CACjE,OAAID,GAAO,MAAQF,EAAIE,EAAYA,EAC/BC,GAAO,MAAQH,EAAIG,EAAYA,EAC5BH,CACT,CAGA,SAASI,GAAUJ,EAAmB,CACpC,OAAO,KAAK,MAAMA,EAAI,GAAG,EAAI,GAC/B,CAGA,SAASK,EAAeC,EAAeC,EAA2B,CAChE,KAAM,CAACC,EAASC,CAAO,EAAI,OAAOH,CAAK,EAAE,MAAM,GAAG,EAC5CI,EAAOF,EAAQ,WAAW,GAAG,EAAI,IAAM,GAEvCG,GADSD,EAAOF,EAAQ,MAAM,CAAC,EAAIA,GAClB,QAAQ,wBAAyBD,CAAS,EACjE,OAAOE,GAAW,KAAO,GAAGC,CAAI,GAAGC,CAAO,IAAIF,CAAO,GAAK,GAAGC,CAAI,GAAGC,CAAO,EAC7E,CAGA,SAASC,GAAYC,EAAWC,EAAqB,CACnD,IAAI,EAAI,EACR,UAAWC,KAAKF,EAAOE,IAAMD,GAAK,IAClC,OAAO,CACT,CAGA,SAASE,GAAoBC,EAAaH,EAAa,EAA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berField.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ChangeEvent,\n type CSSProperties,\n type FocusEvent,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { useT } from '../../theme'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Typography } from '../Typography'\n// shared field chrome (label/control/helper) AND the `.control .iconButton` styling for the steppers\nimport fieldStyles from '../TextField/TextField.module.css'\n\nexport type NumberFieldSize = 'sm' | 'md' | 'lg'\n\n/** Allowed while typing — digits, an optional leading `-`, and one decimal point. */\nconst NUMERIC_RE = /^-?\\d*\\.?\\d*$/\n\n/** Parses the display string to a number, treating empty / in-progress input (`\"\"`, `\"-\"`, `\".\"`) as null. */\nfunction parseValue(raw: string): number | null {\n if (raw === '' || raw === '-' || raw === '.' || raw === '-.') return null\n const n = Number(raw)\n return Number.isNaN(n) ? null : n\n}\n\nfunction clampValue(n: number, min?: number, max?: number): number {\n if (min != null && n < min) return min\n if (max != null && n > max) return max\n return n\n}\n\n/** Kills binary float drift from repeated stepping (e.g. 0.1 + 0.2). */\nfunction roundStep(n: number): number {\n return Math.round(n * 1e6) / 1e6\n}\n\n/** Groups the integer part with `separator` for display (e.g. 32345345 → \"32.345.345\"). */\nfunction groupThousands(value: number, separator: string): string {\n const [intPart, decPart] = String(value).split('.')\n const sign = intPart.startsWith('-') ? '-' : ''\n const digits = sign ? intPart.slice(1) : intPart\n const grouped = digits.replace(/\\B(?=(\\d{3})+(?!\\d))/g, separator)\n return decPart != null ? `${sign}${grouped}.${decPart}` : `${sign}${grouped}`\n}\n\n/** Counts the \"significant\" (non-separator) chars — used to keep the caret stable across regrouping. */\nfunction countExcept(s: string, sep: string): number {\n let n = 0\n for (const c of s) if (c !== sep) n++\n return n\n}\n\n/** Index just after the `n`-th non-separator char in `str` (where the caret should land after regrouping). */\nfunction positionAfterExcept(str: string, sep: string, n: number): number {\n if (n <= 0) return 0\n let count = 0\n for (let i = 0; i < str.length; i++) {\n if (str[i] !== sep) {\n count += 1\n if (count === n) return i + 1\n }\n }\n return str.length\n}\n\nexport interface NumberFieldProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'value' | 'defaultValue' | 'onChange' | 'type' | 'min' | 'max' | 'step' | 'prefix'\n> {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — drives the control height, font size and padding. */\n size?: NumberFieldSize\n /** Marks the field invalid: red border/focus ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Controlled numeric value (`null` = empty). */\n value?: number | null\n /** Initial value for uncontrolled use (`null` = empty). Defaults to `null`. */\n defaultValue?: number | null\n /** Fires with the parsed numeric value (or `null` when the field is empty). */\n onChange?: (value: number | null) => void\n /** Minimum value — clamps on blur and on the stepper, and disables `−` at the floor. Defaults to `0`; pass a negative `min` to allow negatives. */\n min?: number\n /** Maximum value — clamps on blur and on the stepper, and disables `+` at the ceiling. */\n max?: number\n /** Amount the `+`/`−` buttons add or subtract. Defaults to `1`. */\n step?: number\n /** Hides the `+`/`−` stepper buttons (keyboard entry only). */\n hideStepper?: boolean\n /**\n * Thousands-group separator shown **live** as you type, e.g. `\".\"` displays `32345345` as\n * `32.345.345` (or `\",\"`). The caret is preserved across regrouping; the `value`/`onChange`/form\n * value stay a plain `number`. Best for integers — with `\".\"` decimals aren't supported (the dot is\n * the group separator).\n */\n thousandSeparator?: string\n}\n\n/**\n * A numeric input with `+`/`−` stepper buttons. Supports `min`/`max` clamping, a `step` amount,\n * controlled (`value` + `onChange`) or uncontrolled (`defaultValue`) use, optional live thousands\n * grouping, and — like `TextField` — binds to a surrounding `<Form>` by `name` (its form value is a\n * real `number`, validated by the Zod schema). `onChange` emits a `number` or `null` (empty). Shares\n * `TextField`'s field chrome, so label, sizing, error and focus styling are identical.\n */\nexport const NumberField = forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n value,\n defaultValue = null,\n onChange,\n min = 0,\n max,\n step = 1,\n hideStepper = false,\n thousandSeparator,\n name,\n onBlur,\n disabled = false,\n id: idProp,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n\n // Auto-bind to a surrounding <Form> by `name`. The form stores a real number; we use field() for\n // touched/error/helper and read/write the numeric value through values/setValue.\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue: number | null | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as number | null | undefined) ?? null)\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<number | null>(defaultValue)\n const numValue: number | null = isControlled ? externalValue! : internal\n\n // number <-> display string, applying live thousands grouping when `thousandSeparator` is set.\n const toDisplay = (v: number | null): string =>\n v == null ? '' : thousandSeparator != null ? groupThousands(v, thousandSeparator) : String(v)\n const fromDisplay = (raw: string): number | null =>\n parseValue(thousandSeparator != null ? raw.split(thousandSeparator).join('') : raw)\n\n // The display string mirrors `numValue` but tolerates in-progress input (\"-\", \"1.\" …).\n const [text, setText] = useState<string>(() => toDisplay(numValue))\n useEffect(() => {\n if (fromDisplay(text) !== numValue) setText(toDisplay(numValue))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [numValue]) // re-sync only when the value changes from the outside (stepper, form, reset)\n\n // Caret restoration after regrouping (the formatted string length changes as separators move).\n const innerRef = useRef<HTMLInputElement>(null)\n const pendingCaret = useRef<number | null>(null)\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n innerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n useLayoutEffect(() => {\n const pos = pendingCaret.current\n if (pos == null) return\n pendingCaret.current = null\n innerRef.current?.setSelectionRange(pos, pos)\n })\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const commit = (next: number | null) => {\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const el = event.target\n const raw = el.value\n\n if (thousandSeparator == null) {\n if (raw !== '' && !NUMERIC_RE.test(raw)) return // reject non-numeric keystrokes\n setText(raw)\n commit(parseValue(raw))\n return\n }\n\n // Live grouping: strip separators, validate, regroup, and remember where the caret should land.\n const sep = thousandSeparator\n const cleaned = raw.split(sep).join('')\n if (cleaned !== '' && !NUMERIC_RE.test(cleaned)) return\n const caret = el.selectionStart ?? raw.length\n const significantBefore = countExcept(raw.slice(0, caret), sep)\n const next = parseValue(cleaned)\n const formatted = next == null ? cleaned : groupThousands(next, sep)\n setText(formatted)\n commit(next)\n pendingCaret.current = positionAfterExcept(formatted, sep, significantBefore)\n }\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n if (numValue != null) {\n const clamped = clampValue(numValue, min, max)\n if (clamped !== numValue) commit(clamped)\n }\n bound?.onBlur(event)\n onBlur?.(event)\n }\n\n const stepBy = (direction: 1 | -1) => {\n const base = numValue ?? min ?? 0\n commit(clampValue(roundStep(base + direction * step), min, max))\n }\n\n const atMax = max != null && numValue != null && numValue >= max\n const atMin = min != null && numValue != null && numValue <= min\n\n return (\n <div\n className={clsx(\n fieldStyles.field,\n fieldStyles[size],\n fullWidth && fieldStyles.fullWidth,\n resolvedError && fieldStyles.error,\n disabled && fieldStyles.disabled,\n className,\n )}\n style={style as CSSProperties}\n >\n {label != null && (\n <label htmlFor={id} className={fieldStyles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div className={clsx(fieldStyles.control, !hideStepper && fieldStyles.hasRightAdornment)}>\n <input\n ref={setInputRef}\n id={id}\n name={name}\n type=\"text\"\n inputMode=\"decimal\"\n className={fieldStyles.input}\n value={text}\n onChange={handleChange}\n onBlur={handleBlur}\n disabled={disabled}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n {...props}\n />\n {!hideStepper && (\n <>\n {/* Filled icon buttons, sized via the shared `.control .iconButton` rule (flush square,\n stretched to the control height, scaled). The minus glyph is nudged for optical centering. */}\n <IconButton\n variant=\"filled\"\n color=\"primary\"\n className={fieldStyles.iconButton}\n style={{ marginRight: -2 }}\n disabled={disabled || atMin}\n aria-label={t('numberField.decrease')}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => stepBy(-1)}\n >\n <Icon name=\"Minus\" />\n </IconButton>\n <IconButton\n variant=\"filled\"\n color=\"primary\"\n className={fieldStyles.iconButton}\n disabled={disabled || atMax}\n aria-label={t('numberField.increase')}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => stepBy(1)}\n >\n <Icon name=\"Add\" />\n </IconButton>\n </>\n )}\n </div>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={fieldStyles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["NUMERIC_RE","parseValue","raw","n","clampValue","min","max","roundStep","groupThousands","value","separator","intPart","decPart","sign","grouped","countExcept","s","sep","c","positionAfterExcept","str","count","i","NumberField","forwardRef","label","size","error","helperText","required","fullWidth","defaultValue","onChange","step","hideStepper","thousandSeparator","name","onBlur","disabled","idProp","className","style","props","ref","t","useT","reactId","useId","id","helperId","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","numValue","toDisplay","v","fromDisplay","text","setText","useEffect","innerRef","useRef","pendingCaret","setInputRef","useCallback","node","useLayoutEffect","pos","_a","resolvedError","resolvedHelperText","commit","next","handleChange","event","el","cleaned","caret","significantBefore","formatted","handleBlur","clamped","stepBy","direction","atMax","atMin","jsxs","clsx","fieldStyles","jsx","Typography","Fragment","IconButton","Icon"],"mappings":"wUA0BMA,EAAa,gBAGnB,SAASC,EAAWC,EAA4B,CAC9C,GAAIA,IAAQ,IAAMA,IAAQ,KAAOA,IAAQ,KAAOA,IAAQ,KAAM,OAAO,KACrE,MAAMC,EAAI,OAAOD,CAAG,EACpB,OAAO,OAAO,MAAMC,CAAC,EAAI,KAAOA,CAClC,CAEA,SAASC,EAAWD,EAAWE,EAAcC,EAAsB,CACjE,OAAID,GAAO,MAAQF,EAAIE,EAAYA,EAC/BC,GAAO,MAAQH,EAAIG,EAAYA,EAC5BH,CACT,CAGA,SAASI,GAAUJ,EAAmB,CACpC,OAAO,KAAK,MAAMA,EAAI,GAAG,EAAI,GAC/B,CAGA,SAASK,EAAeC,EAAeC,EAA2B,CAChE,KAAM,CAACC,EAASC,CAAO,EAAI,OAAOH,CAAK,EAAE,MAAM,GAAG,EAC5CI,EAAOF,EAAQ,WAAW,GAAG,EAAI,IAAM,GAEvCG,GADSD,EAAOF,EAAQ,MAAM,CAAC,EAAIA,GAClB,QAAQ,wBAAyBD,CAAS,EACjE,OAAOE,GAAW,KAAO,GAAGC,CAAI,GAAGC,CAAO,IAAIF,CAAO,GAAK,GAAGC,CAAI,GAAGC,CAAO,EAC7E,CAGA,SAASC,GAAYC,EAAWC,EAAqB,CACnD,IAAI,EAAI,EACR,UAAWC,KAAKF,EAAOE,IAAMD,GAAK,IAClC,OAAO,CACT,CAGA,SAASE,GAAoBC,EAAaH,EAAa,EAAmB,CACxE,GAAI,GAAK,EAAG,MAAO,GACnB,IAAII,EAAQ,EACZ,QAASC,EAAI,EAAGA,EAAIF,EAAI,OAAQE,IAC9B,GAAIF,EAAIE,CAAC,IAAML,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UACV,UAAW0D,EAAAA,YAAY,MACvB,MAAO/B,EACP,SAAUgB,GACV,OAAQO,GACR,SAAAhD,EACA,eAAcqC,GAAiB,OAC/B,mBAAkBC,GAAsB,KAAO3B,EAAW,OACzD,GAAGP,EAAA,CAAA,EAEL,CAACR,GACA0D,EAAAA,KAAAK,EAAAA,SAAA,CAGE,SAAA,CAAAF,EAAAA,IAACG,EAAAA,WAAA,CACC,QAAQ,SACR,MAAM,UACN,UAAWJ,EAAAA,YAAY,WACvB,MAAO,CAAE,YAAa,EAAA,EACtB,SAAUxD,GAAYqD,GACtB,aAAY/C,EAAE,sBAAsB,EACpC,YAAcoC,GAAUA,EAAM,eAAA,EAC9B,QAAS,IAAMQ,EAAO,EAAE,EAExB,SAAAO,EAAAA,IAACI,EAAAA,KAAA,CAAK,KAAK,OAAA,CAAQ,CAAA,CAAA,EAErBJ,EAAAA,IAACG,EAAAA,WAAA,CACC,QAAQ,SACR,MAAM,UACN,UAAWJ,EAAAA,YAAY,WACvB,SAAUxD,GAAYoD,GACtB,aAAY9C,EAAE,sBAAsB,EACpC,YAAcoC,GAAUA,EAAM,eAAA,EAC9B,QAAS,IAAMQ,EAAO,CAAC,EAEvB,SAAAO,EAAAA,IAACI,EAAAA,KAAA,CAAK,KAAK,KAAA,CAAM,CAAA,CAAA,CACnB,CAAA,CACF,CAAA,EAEJ,EAECvB,GAAsB,MACrBmB,EAAAA,IAACC,EAAAA,WAAA,CACC,GAAG,OACH,GAAI/C,EACJ,QAAQ,YACR,MAAO0B,EAAgB,QAAU,QACjC,UAAWmB,EAAAA,YAAY,OAEtB,SAAAlB,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC"}
@@ -3,10 +3,10 @@ import { forwardRef as ye, useId as be, useState as J, useEffect as Ie, useRef a
3
3
  import { clsx as O } from "clsx";
4
4
  import { u as Fe } from "./formContext-B7ln1Miy.js";
5
5
  import { I as Q } from "./Icon-CophpkHo.js";
6
- import { I as X } from "./IconButton-B8FPGgDn.js";
6
+ import { I as X } from "./IconButton-DpTxmj3d.js";
7
7
  import { T as Y } from "./Typography-Cta6Rg4L.js";
8
8
  import { f as r } from "./TextField.module-QePvGeJ3.js";
9
- import { a as Me } from "./ConfigProvider-BYruQYHC.js";
9
+ import { a as Me } from "./ConfigProvider-DDuIJSM7.js";
10
10
  const Z = /^-?\d*\.?\d*$/;
11
11
  function V(t) {
12
12
  if (t === "" || t === "-" || t === "." || t === "-.") return null;
@@ -180,4 +180,4 @@ const We = ye(function({
180
180
  export {
181
181
  We as N
182
182
  };
183
- //# sourceMappingURL=NumberField-X2HsSpu9.js.map
183
+ //# sourceMappingURL=NumberField-Cz03nksO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumberField-X2HsSpu9.js","sources":["../src/components/NumberField/NumberField.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ChangeEvent,\n type CSSProperties,\n type FocusEvent,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { useT } from '../../theme'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Typography } from '../Typography'\n// shared field chrome (label/control/helper) AND the `.control .iconButton` styling for the steppers\nimport fieldStyles from '../TextField/TextField.module.css'\n\nexport type NumberFieldSize = 'sm' | 'md' | 'lg'\n\n/** Allowed while typing — digits, an optional leading `-`, and one decimal point. */\nconst NUMERIC_RE = /^-?\\d*\\.?\\d*$/\n\n/** Parses the display string to a number, treating empty / in-progress input (`\"\"`, `\"-\"`, `\".\"`) as null. */\nfunction parseValue(raw: string): number | null {\n if (raw === '' || raw === '-' || raw === '.' || raw === '-.') return null\n const n = Number(raw)\n return Number.isNaN(n) ? null : n\n}\n\nfunction clampValue(n: number, min?: number, max?: number): number {\n if (min != null && n < min) return min\n if (max != null && n > max) return max\n return n\n}\n\n/** Kills binary float drift from repeated stepping (e.g. 0.1 + 0.2). */\nfunction roundStep(n: number): number {\n return Math.round(n * 1e6) / 1e6\n}\n\n/** Groups the integer part with `separator` for display (e.g. 32345345 → \"32.345.345\"). */\nfunction groupThousands(value: number, separator: string): string {\n const [intPart, decPart] = String(value).split('.')\n const sign = intPart.startsWith('-') ? '-' : ''\n const digits = sign ? intPart.slice(1) : intPart\n const grouped = digits.replace(/\\B(?=(\\d{3})+(?!\\d))/g, separator)\n return decPart != null ? `${sign}${grouped}.${decPart}` : `${sign}${grouped}`\n}\n\n/** Counts the \"significant\" (non-separator) chars — used to keep the caret stable across regrouping. */\nfunction countExcept(s: string, sep: string): number {\n let n = 0\n for (const c of s) if (c !== sep) n++\n return n\n}\n\n/** Index just after the `n`-th non-separator char in `str` (where the caret should land after regrouping). */\nfunction positionAfterExcept(str: string, sep: string, n: number): number {\n if (n <= 0) return 0\n let count = 0\n for (let i = 0; i < str.length; i++) {\n if (str[i] !== sep) {\n count += 1\n if (count === n) return i + 1\n }\n }\n return str.length\n}\n\nexport interface NumberFieldProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'value' | 'defaultValue' | 'onChange' | 'type' | 'min' | 'max' | 'step' | 'prefix'\n> {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — drives the control height, font size and padding. */\n size?: NumberFieldSize\n /** Marks the field invalid: red border/focus ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Controlled numeric value (`null` = empty). */\n value?: number | null\n /** Initial value for uncontrolled use (`null` = empty). Defaults to `null`. */\n defaultValue?: number | null\n /** Fires with the parsed numeric value (or `null` when the field is empty). */\n onChange?: (value: number | null) => void\n /** Minimum value — clamps on blur and on the stepper, and disables `−` at the floor. Defaults to `0`; pass a negative `min` to allow negatives. */\n min?: number\n /** Maximum value — clamps on blur and on the stepper, and disables `+` at the ceiling. */\n max?: number\n /** Amount the `+`/`−` buttons add or subtract. Defaults to `1`. */\n step?: number\n /** Hides the `+`/`−` stepper buttons (keyboard entry only). */\n hideStepper?: boolean\n /**\n * Thousands-group separator shown **live** as you type, e.g. `\".\"` displays `32345345` as\n * `32.345.345` (or `\",\"`). The caret is preserved across regrouping; the `value`/`onChange`/form\n * value stay a plain `number`. Best for integers — with `\".\"` decimals aren't supported (the dot is\n * the group separator).\n */\n thousandSeparator?: string\n}\n\n/**\n * A numeric input with `+`/`−` stepper buttons. Supports `min`/`max` clamping, a `step` amount,\n * controlled (`value` + `onChange`) or uncontrolled (`defaultValue`) use, optional live thousands\n * grouping, and — like `TextField` — binds to a surrounding `<Form>` by `name` (its form value is a\n * real `number`, validated by the Zod schema). `onChange` emits a `number` or `null` (empty). Shares\n * `TextField`'s field chrome, so label, sizing, error and focus styling are identical.\n */\nexport const NumberField = forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n value,\n defaultValue = null,\n onChange,\n min = 0,\n max,\n step = 1,\n hideStepper = false,\n thousandSeparator,\n name,\n onBlur,\n disabled = false,\n id: idProp,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n\n // Auto-bind to a surrounding <Form> by `name`. The form stores a real number; we use field() for\n // touched/error/helper and read/write the numeric value through values/setValue.\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue: number | null | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as number | null | undefined) ?? null)\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<number | null>(defaultValue)\n const numValue: number | null = isControlled ? externalValue! : internal\n\n // number <-> display string, applying live thousands grouping when `thousandSeparator` is set.\n const toDisplay = (v: number | null): string =>\n v == null ? '' : thousandSeparator != null ? groupThousands(v, thousandSeparator) : String(v)\n const fromDisplay = (raw: string): number | null =>\n parseValue(thousandSeparator != null ? raw.split(thousandSeparator).join('') : raw)\n\n // The display string mirrors `numValue` but tolerates in-progress input (\"-\", \"1.\" …).\n const [text, setText] = useState<string>(() => toDisplay(numValue))\n useEffect(() => {\n if (fromDisplay(text) !== numValue) setText(toDisplay(numValue))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [numValue]) // re-sync only when the value changes from the outside (stepper, form, reset)\n\n // Caret restoration after regrouping (the formatted string length changes as separators move).\n const innerRef = useRef<HTMLInputElement>(null)\n const pendingCaret = useRef<number | null>(null)\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n innerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n useLayoutEffect(() => {\n const pos = pendingCaret.current\n if (pos == null) return\n pendingCaret.current = null\n innerRef.current?.setSelectionRange(pos, pos)\n })\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const commit = (next: number | null) => {\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const el = event.target\n const raw = el.value\n\n if (thousandSeparator == null) {\n if (raw !== '' && !NUMERIC_RE.test(raw)) return // reject non-numeric keystrokes\n setText(raw)\n commit(parseValue(raw))\n return\n }\n\n // Live grouping: strip separators, validate, regroup, and remember where the caret should land.\n const sep = thousandSeparator\n const cleaned = raw.split(sep).join('')\n if (cleaned !== '' && !NUMERIC_RE.test(cleaned)) return\n const caret = el.selectionStart ?? raw.length\n const significantBefore = countExcept(raw.slice(0, caret), sep)\n const next = parseValue(cleaned)\n const formatted = next == null ? cleaned : groupThousands(next, sep)\n setText(formatted)\n commit(next)\n pendingCaret.current = positionAfterExcept(formatted, sep, significantBefore)\n }\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n if (numValue != null) {\n const clamped = clampValue(numValue, min, max)\n if (clamped !== numValue) commit(clamped)\n }\n bound?.onBlur(event)\n onBlur?.(event)\n }\n\n const stepBy = (direction: 1 | -1) => {\n const base = numValue ?? min ?? 0\n commit(clampValue(roundStep(base + direction * step), min, max))\n }\n\n const atMax = max != null && numValue != null && numValue >= max\n const atMin = min != null && numValue != null && numValue <= min\n\n return (\n <div\n className={clsx(\n fieldStyles.field,\n fieldStyles[size],\n fullWidth && fieldStyles.fullWidth,\n resolvedError && fieldStyles.error,\n disabled && fieldStyles.disabled,\n className,\n )}\n style={style as CSSProperties}\n >\n {label != null && (\n <label htmlFor={id} className={fieldStyles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div className={clsx(fieldStyles.control, !hideStepper && fieldStyles.hasRightAdornment)}>\n <input\n ref={setInputRef}\n id={id}\n name={name}\n type=\"text\"\n inputMode=\"decimal\"\n className={fieldStyles.input}\n value={text}\n onChange={handleChange}\n onBlur={handleBlur}\n disabled={disabled}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n {...props}\n />\n {!hideStepper && (\n <>\n {/* Filled icon buttons, sized via the shared `.control .iconButton` rule (flush square,\n stretched to the control height, scaled). The minus glyph is nudged for optical centering. */}\n <IconButton\n variant=\"filled\"\n color=\"primary\"\n className={fieldStyles.iconButton}\n style={{ marginRight: -2 }}\n disabled={disabled || atMin}\n aria-label={t('numberField.decrease')}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => stepBy(-1)}\n >\n <Icon name=\"Minus\" />\n </IconButton>\n <IconButton\n variant=\"filled\"\n color=\"primary\"\n className={fieldStyles.iconButton}\n disabled={disabled || atMax}\n aria-label={t('numberField.increase')}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => stepBy(1)}\n >\n <Icon name=\"Add\" />\n </IconButton>\n </>\n )}\n </div>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={fieldStyles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["NUMERIC_RE","parseValue","raw","clampValue","n","min","max","roundStep","groupThousands","value","separator","intPart","decPart","sign","grouped","countExcept","s","sep","c","positionAfterExcept","str","count","i","NumberField","forwardRef","label","size","error","helperText","required","fullWidth","defaultValue","onChange","step","hideStepper","thousandSeparator","name","onBlur","disabled","idProp","className","style","props","ref","t","useT","reactId","useId","id","helperId","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","numValue","toDisplay","v","fromDisplay","text","setText","useEffect","innerRef","useRef","pendingCaret","setInputRef","useCallback","node","useLayoutEffect","pos","_a","resolvedError","resolvedHelperText","commit","next","handleChange","event","el","cleaned","caret","significantBefore","formatted","handleBlur","clamped","stepBy","direction","atMax","atMin","jsxs","clsx","fieldStyles","jsx","Typography","Fragment","IconButton","Icon"],"mappings":";;;;;;;;;AA0BA,MAAMA,IAAa;AAGnB,SAASC,EAAWC,GAA4B;AAC9C,MAAIA,MAAQ,MAAMA,MAAQ,OAAOA,MAAQ,OAAOA,MAAQ,KAAM,QAAO;AACrE,QAAM,IAAI,OAAOA,CAAG;AACpB,SAAO,OAAO,MAAM,CAAC,IAAI,OAAO;AAClC;AAEA,SAASC,EAAWC,GAAWC,GAAcC,GAAsB;AACjE,SAAID,KAAO,QAAQD,IAAIC,IAAYA,IAC/BC,KAAO,QAAQF,IAAIE,IAAYA,IAC5BF;AACT;AAGA,SAASG,GAAUH,GAAmB;AACpC,SAAO,KAAK,MAAMA,IAAI,GAAG,IAAI;AAC/B;AAGA,SAASI,GAAeC,GAAeC,GAA2B;AAChE,QAAM,CAACC,GAASC,CAAO,IAAI,OAAOH,CAAK,EAAE,MAAM,GAAG,GAC5CI,IAA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,gBACtB,UAAUxD,KAAYqD;AAAA,gBACtB,cAAY/C,EAAE,sBAAsB;AAAA,gBACpC,aAAa,CAACoC,MAAUA,EAAM,eAAA;AAAA,gBAC9B,SAAS,MAAMQ,EAAO,EAAE;AAAA,gBAExB,UAAA,gBAAAO,EAACI,GAAA,EAAK,MAAK,QAAA,CAAQ;AAAA,cAAA;AAAA,YAAA;AAAA,YAErB,gBAAAJ;AAAA,cAACG;AAAA,cAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,OAAM;AAAA,gBACN,WAAWJ,EAAY;AAAA,gBACvB,UAAUxD,KAAYoD;AAAA,gBACtB,cAAY9C,EAAE,sBAAsB;AAAA,gBACpC,aAAa,CAACoC,MAAUA,EAAM,eAAA;AAAA,gBAC9B,SAAS,MAAMQ,EAAO,CAAC;AAAA,gBAEvB,UAAA,gBAAAO,EAACI,GAAA,EAAK,MAAK,MAAA,CAAM;AAAA,cAAA;AAAA,YAAA;AAAA,UACnB,EAAA,CACF;AAAA,QAAA,GAEJ;AAAA,QAECvB,KAAsB,QACrB,gBAAAmB;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAI/C;AAAA,YACJ,SAAQ;AAAA,YACR,OAAO0B,IAAgB,UAAU;AAAA,YACjC,WAAWmB,EAAY;AAAA,YAEtB,UAAAlB;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
1
+ {"version":3,"file":"NumberField-Cz03nksO.js","sources":["../src/components/NumberField/NumberField.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ChangeEvent,\n type CSSProperties,\n type FocusEvent,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { useT } from '../../theme'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Typography } from '../Typography'\n// shared field chrome (label/control/helper) AND the `.control .iconButton` styling for the steppers\nimport fieldStyles from '../TextField/TextField.module.css'\n\nexport type NumberFieldSize = 'sm' | 'md' | 'lg'\n\n/** Allowed while typing — digits, an optional leading `-`, and one decimal point. */\nconst NUMERIC_RE = /^-?\\d*\\.?\\d*$/\n\n/** Parses the display string to a number, treating empty / in-progress input (`\"\"`, `\"-\"`, `\".\"`) as null. */\nfunction parseValue(raw: string): number | null {\n if (raw === '' || raw === '-' || raw === '.' || raw === '-.') return null\n const n = Number(raw)\n return Number.isNaN(n) ? null : n\n}\n\nfunction clampValue(n: number, min?: number, max?: number): number {\n if (min != null && n < min) return min\n if (max != null && n > max) return max\n return n\n}\n\n/** Kills binary float drift from repeated stepping (e.g. 0.1 + 0.2). */\nfunction roundStep(n: number): number {\n return Math.round(n * 1e6) / 1e6\n}\n\n/** Groups the integer part with `separator` for display (e.g. 32345345 → \"32.345.345\"). */\nfunction groupThousands(value: number, separator: string): string {\n const [intPart, decPart] = String(value).split('.')\n const sign = intPart.startsWith('-') ? '-' : ''\n const digits = sign ? intPart.slice(1) : intPart\n const grouped = digits.replace(/\\B(?=(\\d{3})+(?!\\d))/g, separator)\n return decPart != null ? `${sign}${grouped}.${decPart}` : `${sign}${grouped}`\n}\n\n/** Counts the \"significant\" (non-separator) chars — used to keep the caret stable across regrouping. */\nfunction countExcept(s: string, sep: string): number {\n let n = 0\n for (const c of s) if (c !== sep) n++\n return n\n}\n\n/** Index just after the `n`-th non-separator char in `str` (where the caret should land after regrouping). */\nfunction positionAfterExcept(str: string, sep: string, n: number): number {\n if (n <= 0) return 0\n let count = 0\n for (let i = 0; i < str.length; i++) {\n if (str[i] !== sep) {\n count += 1\n if (count === n) return i + 1\n }\n }\n return str.length\n}\n\nexport interface NumberFieldProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'value' | 'defaultValue' | 'onChange' | 'type' | 'min' | 'max' | 'step' | 'prefix'\n> {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — drives the control height, font size and padding. */\n size?: NumberFieldSize\n /** Marks the field invalid: red border/focus ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Controlled numeric value (`null` = empty). */\n value?: number | null\n /** Initial value for uncontrolled use (`null` = empty). Defaults to `null`. */\n defaultValue?: number | null\n /** Fires with the parsed numeric value (or `null` when the field is empty). */\n onChange?: (value: number | null) => void\n /** Minimum value — clamps on blur and on the stepper, and disables `−` at the floor. Defaults to `0`; pass a negative `min` to allow negatives. */\n min?: number\n /** Maximum value — clamps on blur and on the stepper, and disables `+` at the ceiling. */\n max?: number\n /** Amount the `+`/`−` buttons add or subtract. Defaults to `1`. */\n step?: number\n /** Hides the `+`/`−` stepper buttons (keyboard entry only). */\n hideStepper?: boolean\n /**\n * Thousands-group separator shown **live** as you type, e.g. `\".\"` displays `32345345` as\n * `32.345.345` (or `\",\"`). The caret is preserved across regrouping; the `value`/`onChange`/form\n * value stay a plain `number`. Best for integers — with `\".\"` decimals aren't supported (the dot is\n * the group separator).\n */\n thousandSeparator?: string\n}\n\n/**\n * A numeric input with `+`/`−` stepper buttons. Supports `min`/`max` clamping, a `step` amount,\n * controlled (`value` + `onChange`) or uncontrolled (`defaultValue`) use, optional live thousands\n * grouping, and — like `TextField` — binds to a surrounding `<Form>` by `name` (its form value is a\n * real `number`, validated by the Zod schema). `onChange` emits a `number` or `null` (empty). Shares\n * `TextField`'s field chrome, so label, sizing, error and focus styling are identical.\n */\nexport const NumberField = forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n value,\n defaultValue = null,\n onChange,\n min = 0,\n max,\n step = 1,\n hideStepper = false,\n thousandSeparator,\n name,\n onBlur,\n disabled = false,\n id: idProp,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n\n // Auto-bind to a surrounding <Form> by `name`. The form stores a real number; we use field() for\n // touched/error/helper and read/write the numeric value through values/setValue.\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue: number | null | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as number | null | undefined) ?? null)\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<number | null>(defaultValue)\n const numValue: number | null = isControlled ? externalValue! : internal\n\n // number <-> display string, applying live thousands grouping when `thousandSeparator` is set.\n const toDisplay = (v: number | null): string =>\n v == null ? '' : thousandSeparator != null ? groupThousands(v, thousandSeparator) : String(v)\n const fromDisplay = (raw: string): number | null =>\n parseValue(thousandSeparator != null ? raw.split(thousandSeparator).join('') : raw)\n\n // The display string mirrors `numValue` but tolerates in-progress input (\"-\", \"1.\" …).\n const [text, setText] = useState<string>(() => toDisplay(numValue))\n useEffect(() => {\n if (fromDisplay(text) !== numValue) setText(toDisplay(numValue))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [numValue]) // re-sync only when the value changes from the outside (stepper, form, reset)\n\n // Caret restoration after regrouping (the formatted string length changes as separators move).\n const innerRef = useRef<HTMLInputElement>(null)\n const pendingCaret = useRef<number | null>(null)\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n innerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n useLayoutEffect(() => {\n const pos = pendingCaret.current\n if (pos == null) return\n pendingCaret.current = null\n innerRef.current?.setSelectionRange(pos, pos)\n })\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const commit = (next: number | null) => {\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const el = event.target\n const raw = el.value\n\n if (thousandSeparator == null) {\n if (raw !== '' && !NUMERIC_RE.test(raw)) return // reject non-numeric keystrokes\n setText(raw)\n commit(parseValue(raw))\n return\n }\n\n // Live grouping: strip separators, validate, regroup, and remember where the caret should land.\n const sep = thousandSeparator\n const cleaned = raw.split(sep).join('')\n if (cleaned !== '' && !NUMERIC_RE.test(cleaned)) return\n const caret = el.selectionStart ?? raw.length\n const significantBefore = countExcept(raw.slice(0, caret), sep)\n const next = parseValue(cleaned)\n const formatted = next == null ? cleaned : groupThousands(next, sep)\n setText(formatted)\n commit(next)\n pendingCaret.current = positionAfterExcept(formatted, sep, significantBefore)\n }\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n if (numValue != null) {\n const clamped = clampValue(numValue, min, max)\n if (clamped !== numValue) commit(clamped)\n }\n bound?.onBlur(event)\n onBlur?.(event)\n }\n\n const stepBy = (direction: 1 | -1) => {\n const base = numValue ?? min ?? 0\n commit(clampValue(roundStep(base + direction * step), min, max))\n }\n\n const atMax = max != null && numValue != null && numValue >= max\n const atMin = min != null && numValue != null && numValue <= min\n\n return (\n <div\n className={clsx(\n fieldStyles.field,\n fieldStyles[size],\n fullWidth && fieldStyles.fullWidth,\n resolvedError && fieldStyles.error,\n disabled && fieldStyles.disabled,\n className,\n )}\n style={style as CSSProperties}\n >\n {label != null && (\n <label htmlFor={id} className={fieldStyles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div className={clsx(fieldStyles.control, !hideStepper && fieldStyles.hasRightAdornment)}>\n <input\n ref={setInputRef}\n id={id}\n name={name}\n type=\"text\"\n inputMode=\"decimal\"\n className={fieldStyles.input}\n value={text}\n onChange={handleChange}\n onBlur={handleBlur}\n disabled={disabled}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n {...props}\n />\n {!hideStepper && (\n <>\n {/* Filled icon buttons, sized via the shared `.control .iconButton` rule (flush square,\n stretched to the control height, scaled). The minus glyph is nudged for optical centering. */}\n <IconButton\n variant=\"filled\"\n color=\"primary\"\n className={fieldStyles.iconButton}\n style={{ marginRight: -2 }}\n disabled={disabled || atMin}\n aria-label={t('numberField.decrease')}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => stepBy(-1)}\n >\n <Icon name=\"Minus\" />\n </IconButton>\n <IconButton\n variant=\"filled\"\n color=\"primary\"\n className={fieldStyles.iconButton}\n disabled={disabled || atMax}\n aria-label={t('numberField.increase')}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => stepBy(1)}\n >\n <Icon name=\"Add\" />\n </IconButton>\n </>\n )}\n </div>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={fieldStyles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["NUMERIC_RE","parseValue","raw","clampValue","n","min","max","roundStep","groupThousands","value","separator","intPart","decPart","sign","grouped","countExcept","s","sep","c","positionAfterExcept","str","count","i","NumberField","forwardRef","label","size","error","helperText","required","fullWidth","defaultValue","onChange","step","hideStepper","thousandSeparator","name","onBlur","disabled","idProp","className","style","props","ref","t","useT","reactId","useId","id","helperId","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","numValue","toDisplay","v","fromDisplay","text","setText","useEffect","innerRef","useRef","pendingCaret","setInputRef","useCallback","node","useLayoutEffect","pos","_a","resolvedError","resolvedHelperText","commit","next","handleChange","event","el","cleaned","caret","significantBefore","formatted","handleBlur","clamped","stepBy","direction","atMax","atMin","jsxs","clsx","fieldStyles","jsx","Typography","Fragment","IconButton","Icon"],"mappings":";;;;;;;;;AA0BA,MAAMA,IAAa;AAGnB,SAASC,EAAWC,GAA4B;AAC9C,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B,IAAgB,UAAU;AAAA,YACjC,WAAWmB,EAAY;AAAA,YAEtB,UAAAlB;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";const n=require("react/jsx-runtime"),y=require("react"),j=require("clsx"),Y=require("./formContext-bTWrqdEV.cjs"),R=require("./Typography-BFatE1_A.cjs"),u=require("./TextField.module-m-UllwzG.cjs"),ee=require("./ConfigProvider-BHNx-NHV.cjs"),te="_row_1tqpn_2",re="_sm_1tqpn_8",se="_md_1tqpn_12",oe="_lg_1tqpn_16",le="_box_1tqpn_22",ce="_filled_1tqpn_46",ne="_invalid_1tqpn_63",x={row:te,sm:re,md:se,lg:oe,box:le,filled:ce,invalid:ne},ie={numeric:/[0-9]/,alphabetic:/[A-Za-z]/,alphanumeric:/[A-Za-z0-9]/};function ae(k,l){const i=[...k].slice(0,l);for(;i.length<l;)i.push("");return i}const fe=y.forwardRef(function({length:l=4,type:i="numeric",value:g,defaultValue:A,onChange:q,onComplete:T,name:a,label:_,helperText:I,error:z,required:O=!1,disabled:S=!1,autoFocus:P=!1,placeholder:C,size:E="md",color:M="primary",className:V,style:K},Z){const $=ee.useT(),F=`${y.useId()}-helper`,B=ie[i],p=Y.useFormContext(),b=!!(p&&a),o=p&&a?p.field(a):void 0,H=g!==void 0?g:b?p.values[a]:void 0,N=g!==void 0||b,[L,G]=y.useState(A??""),J=N?H??"":L,v=z??(o==null?void 0:o.error)??!1,w=I??(o==null?void 0:o.helperText),f=ae(J,l),D=y.useRef([]);y.useEffect(()=>{var t;P&&((t=D.current[0])==null||t.focus())},[]);const d=t=>{const e=D.current[Math.max(0,Math.min(t,l-1))];e==null||e.focus(),e==null||e.select()},m=t=>{const e=t.join("");N||G(e),b&&p.setValue(a,e),q==null||q(e),t.every(r=>r!=="")&&(T==null||T(e))},Q=(t,e)=>{const r=[...e].filter(s=>B.test(s));if(e!==""&&r.length===0)return;const c=[...f];if(r.length<=1)c[t]=r[0]??"",m(c),r[0]&&d(t+1);else{let s=t;for(const h of r){if(s>=l)break;c[s]=h,s++}m(c),d(s)}},U=(t,e)=>{if(e.key==="Backspace"){if(f[t]===""&&t>0){e.preventDefault();const r=[...f];r[t-1]="",m(r),d(t-1)}}else if(e.key==="ArrowLeft")e.preventDefault(),d(t-1);else if(e.key==="ArrowRight")e.preventDefault(),d(t+1);else if(e.key==="Delete"){e.preventDefault();const r=[...f];r[t]="",m(r)}},W=(t,e)=>{e.preventDefault();const r=[...e.clipboardData.getData("text")].filter(h=>B.test(h));if(r.length===0)return;const c=[...f];let s=t;for(const h of r){if(s>=l)break;c[s]=h,s++}m(c),d(s)},X=t=>{t.currentTarget.contains(t.relatedTarget)||o==null||o.onBlur(t)};return n.jsxs("div",{ref:Z,className:j.clsx(u.fieldStyles.field,v&&u.fieldStyles.error,S&&u.fieldStyles.disabled,V),style:{"--tz-btn-rgb":`var(--tz-color-${M}-rgb)`,...K},children:[_!=null&&n.jsxs("span",{className:u.fieldStyles.label,children:[n.jsx(R.Typography,{as:"span",variant:"bodySmall",color:"muted",children:_}),O&&n.jsx("span",{className:u.fieldStyles.required,"aria-hidden":"true",children:"*"})]}),n.jsx("div",{role:"group","aria-label":typeof _=="string"?_:"One-time code","aria-invalid":v||void 0,"aria-describedby":w!=null?F:void 0,className:j.clsx(x.row,x[E],v&&x.invalid),onBlur:X,children:f.map((t,e)=>n.jsx("input",{ref:r=>{D.current[e]=r},name:e===0?a:void 0,type:"text",inputMode:i==="numeric"?"numeric":"text",autoComplete:e===0?"one-time-code":"off","aria-label":$("otpField.digit",{index:e+1,total:l}),className:j.clsx(x.box,t!==""&&x.filled),value:t,placeholder:C,disabled:S,onChange:r=>Q(e,r.target.value),onKeyDown:r=>U(e,r),onPaste:r=>W(e,r),onFocus:r=>r.target.select()},e))}),w!=null&&n.jsx(R.Typography,{as:"span",id:F,variant:"bodySmall",color:v?"error":"muted",className:u.fieldStyles.helper,children:w})]})});exports.OtpField=fe;
2
- //# sourceMappingURL=OtpField-CXP59zM2.cjs.map
1
+ "use strict";const n=require("react/jsx-runtime"),y=require("react"),j=require("clsx"),Y=require("./formContext-bTWrqdEV.cjs"),R=require("./Typography-BFatE1_A.cjs"),u=require("./TextField.module-m-UllwzG.cjs"),ee=require("./ConfigProvider-h1WoGC3R.cjs"),te="_row_1tqpn_2",re="_sm_1tqpn_8",se="_md_1tqpn_12",oe="_lg_1tqpn_16",le="_box_1tqpn_22",ce="_filled_1tqpn_46",ne="_invalid_1tqpn_63",x={row:te,sm:re,md:se,lg:oe,box:le,filled:ce,invalid:ne},ie={numeric:/[0-9]/,alphabetic:/[A-Za-z]/,alphanumeric:/[A-Za-z0-9]/};function ae(k,l){const i=[...k].slice(0,l);for(;i.length<l;)i.push("");return i}const fe=y.forwardRef(function({length:l=4,type:i="numeric",value:g,defaultValue:A,onChange:q,onComplete:T,name:a,label:_,helperText:I,error:z,required:O=!1,disabled:S=!1,autoFocus:P=!1,placeholder:C,size:E="md",color:M="primary",className:V,style:K},Z){const $=ee.useT(),F=`${y.useId()}-helper`,B=ie[i],p=Y.useFormContext(),b=!!(p&&a),o=p&&a?p.field(a):void 0,H=g!==void 0?g:b?p.values[a]:void 0,N=g!==void 0||b,[L,G]=y.useState(A??""),J=N?H??"":L,v=z??(o==null?void 0:o.error)??!1,w=I??(o==null?void 0:o.helperText),f=ae(J,l),D=y.useRef([]);y.useEffect(()=>{var t;P&&((t=D.current[0])==null||t.focus())},[]);const d=t=>{const e=D.current[Math.max(0,Math.min(t,l-1))];e==null||e.focus(),e==null||e.select()},m=t=>{const e=t.join("");N||G(e),b&&p.setValue(a,e),q==null||q(e),t.every(r=>r!=="")&&(T==null||T(e))},Q=(t,e)=>{const r=[...e].filter(s=>B.test(s));if(e!==""&&r.length===0)return;const c=[...f];if(r.length<=1)c[t]=r[0]??"",m(c),r[0]&&d(t+1);else{let s=t;for(const h of r){if(s>=l)break;c[s]=h,s++}m(c),d(s)}},U=(t,e)=>{if(e.key==="Backspace"){if(f[t]===""&&t>0){e.preventDefault();const r=[...f];r[t-1]="",m(r),d(t-1)}}else if(e.key==="ArrowLeft")e.preventDefault(),d(t-1);else if(e.key==="ArrowRight")e.preventDefault(),d(t+1);else if(e.key==="Delete"){e.preventDefault();const r=[...f];r[t]="",m(r)}},W=(t,e)=>{e.preventDefault();const r=[...e.clipboardData.getData("text")].filter(h=>B.test(h));if(r.length===0)return;const c=[...f];let s=t;for(const h of r){if(s>=l)break;c[s]=h,s++}m(c),d(s)},X=t=>{t.currentTarget.contains(t.relatedTarget)||o==null||o.onBlur(t)};return n.jsxs("div",{ref:Z,className:j.clsx(u.fieldStyles.field,v&&u.fieldStyles.error,S&&u.fieldStyles.disabled,V),style:{"--tz-btn-rgb":`var(--tz-color-${M}-rgb)`,...K},children:[_!=null&&n.jsxs("span",{className:u.fieldStyles.label,children:[n.jsx(R.Typography,{as:"span",variant:"bodySmall",color:"muted",children:_}),O&&n.jsx("span",{className:u.fieldStyles.required,"aria-hidden":"true",children:"*"})]}),n.jsx("div",{role:"group","aria-label":typeof _=="string"?_:"One-time code","aria-invalid":v||void 0,"aria-describedby":w!=null?F:void 0,className:j.clsx(x.row,x[E],v&&x.invalid),onBlur:X,children:f.map((t,e)=>n.jsx("input",{ref:r=>{D.current[e]=r},name:e===0?a:void 0,type:"text",inputMode:i==="numeric"?"numeric":"text",autoComplete:e===0?"one-time-code":"off","aria-label":$("otpField.digit",{index:e+1,total:l}),className:j.clsx(x.box,t!==""&&x.filled),value:t,placeholder:C,disabled:S,onChange:r=>Q(e,r.target.value),onKeyDown:r=>U(e,r),onPaste:r=>W(e,r),onFocus:r=>r.target.select()},e))}),w!=null&&n.jsx(R.Typography,{as:"span",id:F,variant:"bodySmall",color:v?"error":"muted",className:u.fieldStyles.helper,children:w})]})});exports.OtpField=fe;
2
+ //# sourceMappingURL=OtpField-B46P6aMy.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"OtpField-CXP59zM2.cjs","sources":["../src/components/OtpField/OtpField.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type ClipboardEvent,\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Typography } from '../Typography'\nimport fieldStyles from '../TextField/TextField.module.css'\nimport styles from './OtpField.module.css'\n\nexport type OtpFieldSize = 'sm' | 'md' | 'lg'\n/** Which characters the code accepts. */\nexport type OtpFieldType = 'numeric' | 'alphabetic' | 'alphanumeric'\n\n/** Allowed-character matcher per `type`. */\nconst PATTERN: Record<OtpFieldType, RegExp> = {\n numeric: /[0-9]/,\n alphabetic: /[A-Za-z]/,\n alphanumeric: /[A-Za-z0-9]/,\n}\n\n/** Split a code string into exactly `length` single-char slots, padded with empties. */\nfunction toChars(value: string, length: number): string[] {\n const out = [...value].slice(0, length)\n while (out.length < length) out.push('')\n return out\n}\n\nexport interface OtpFieldProps {\n /** Number of input boxes (the code length). Defaults to `4`. */\n length?: number\n /** Which characters are accepted (also drives the mobile keyboard). Defaults to `'numeric'`. */\n type?: OtpFieldType\n /** Controlled value — the concatenated code string. */\n value?: string\n /** Initial value for uncontrolled use. */\n defaultValue?: string\n /** Fires with the full code string on every change. */\n onChange?: (value: string) => void\n /** Fires with the code once every box is filled. */\n onComplete?: (value: string) => void\n /** Field name — the `<Form>` binding key (form value is the code `string`). */\n name?: string\n /** Label rendered above the boxes. */\n label?: ReactNode\n /** Helper / error text under the boxes (shown in the error color while `error`). */\n helperText?: ReactNode\n /** Marks the field invalid — reddens the boxes + helper. */\n error?: boolean\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Disables every box. */\n disabled?: boolean\n /** Focus the first box on mount. */\n autoFocus?: boolean\n /** Placeholder character shown in empty boxes (e.g. `'•'`). */\n placeholder?: string\n /** Preset size. Defaults to `'md'`. */\n size?: OtpFieldSize\n /** Theme palette token for the focus ring / active box. Defaults to `'primary'`. */\n color?: ThemeColor\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A one-time-passcode input — a row of single-character boxes for verification codes. **`length`**\n * (default `4`) sets the box count; **`type`** (`'numeric'` default · `'alphabetic'` · `'alphanumeric'`)\n * restricts the accepted characters and the mobile keyboard. Typing advances to the next box, Backspace\n * clears + steps back, Arrows navigate, and **paste / SMS autofill** (`autocomplete=\"one-time-code\"`)\n * distributes the whole code across the boxes. The value is the concatenated string — controlled\n * (`value` + `onChange`) or uncontrolled (`defaultValue`); **`onComplete`** fires when all boxes are\n * filled. Shares the field-family chrome (`label` · `error` + `helperText` · `required` · `disabled` ·\n * `size`) and binds to a surrounding `<Form>` by **`name`** (form value = the code string; validate with\n * e.g. `z.string().length(4)` or a `type`-matching regex). Tinted by `color` via the shared\n * `--tz-btn-rgb` pattern; `role=\"group\"` with per-box `aria-label`s. Own CSS module (+ TextField's for\n * the label/helper chrome).\n */\nexport const OtpField = forwardRef<HTMLDivElement, OtpFieldProps>(function OtpField(\n {\n length = 4,\n type = 'numeric',\n value,\n defaultValue,\n onChange,\n onComplete,\n name,\n label,\n helperText,\n error,\n required = false,\n disabled = false,\n autoFocus = false,\n placeholder,\n size = 'md',\n color = 'primary',\n className,\n style,\n },\n ref,\n) {\n const t = useT()\n const reactId = useId()\n const helperId = `${reactId}-helper`\n const allowed = PATTERN[type]\n\n // bind to a surrounding <Form> by `name` — form value is the code string; error/touched via field()\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue =\n value !== undefined ? value : isFormBound ? (form!.values[name!] as string) : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentValue = isControlled ? (externalValue ?? '') : internal\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n // the code split into exactly `length` single-char slots (padded with empties)\n const chars = toChars(currentValue, length)\n\n const inputsRef = useRef<(HTMLInputElement | null)[]>([])\n\n useEffect(() => {\n if (autoFocus) inputsRef.current[0]?.focus()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n const focusBox = (i: number) => {\n const el = inputsRef.current[Math.max(0, Math.min(i, length - 1))]\n el?.focus()\n el?.select()\n }\n\n const commit = (nextChars: string[]) => {\n const next = nextChars.join('')\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n if (nextChars.every((c) => c !== '')) onComplete?.(next)\n }\n\n const handleChange = (index: number, raw: string) => {\n const filtered = [...raw].filter((c) => allowed.test(c))\n // a disallowed keystroke (raw non-empty but nothing survives the filter) is ignored\n if (raw !== '' && filtered.length === 0) return\n const nextChars = [...chars]\n if (filtered.length <= 1) {\n // a single typed char (boxes select-on-focus, so this replaces) — or a clear ('')\n nextChars[index] = filtered[0] ?? ''\n commit(nextChars)\n if (filtered[0]) focusBox(index + 1)\n } else {\n // multiple chars (SMS autofill dumps the whole code into one box) → distribute from here\n let k = index\n for (const ch of filtered) {\n if (k >= length) break\n nextChars[k] = ch\n k++\n }\n commit(nextChars)\n focusBox(k)\n }\n }\n\n const handleKeyDown = (index: number, event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Backspace') {\n if (chars[index] === '' && index > 0) {\n // empty box → step back and clear the previous one\n event.preventDefault()\n const nextChars = [...chars]\n nextChars[index - 1] = ''\n commit(nextChars)\n focusBox(index - 1)\n }\n // a non-empty box lets the native delete run → onChange fires with '' (stays put)\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault()\n focusBox(index - 1)\n } else if (event.key === 'ArrowRight') {\n event.preventDefault()\n focusBox(index + 1)\n } else if (event.key === 'Delete') {\n event.preventDefault()\n const nextChars = [...chars]\n nextChars[index] = ''\n commit(nextChars)\n }\n }\n\n const handlePaste = (index: number, event: ClipboardEvent<HTMLInputElement>) => {\n event.preventDefault()\n const filtered = [...event.clipboardData.getData('text')].filter((c) => allowed.test(c))\n if (filtered.length === 0) return\n const nextChars = [...chars]\n let k = index\n for (const ch of filtered) {\n if (k >= length) break\n nextChars[k] = ch\n k++\n }\n commit(nextChars)\n focusBox(k)\n }\n\n // mark the field touched when focus leaves the whole widget (not when it hops between boxes)\n const handleBlur = (event: FocusEvent<HTMLDivElement>) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n }\n\n return (\n <div\n ref={ref}\n className={clsx(\n fieldStyles.field,\n resolvedError && fieldStyles.error,\n disabled && fieldStyles.disabled,\n className,\n )}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`,\n ...style,\n } as CSSProperties\n }\n >\n {label != null && (\n <span className={fieldStyles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n )}\n\n <div\n role=\"group\"\n aria-label={typeof label === 'string' ? label : 'One-time code'}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n className={clsx(styles.row, styles[size], resolvedError && styles.invalid)}\n onBlur={handleBlur}\n >\n {chars.map((char, i) => (\n <input\n key={i}\n ref={(el) => {\n inputsRef.current[i] = el\n }}\n // the name goes on the first box only, so the form's scroll-to-error can target it\n name={i === 0 ? name : undefined}\n type=\"text\"\n inputMode={type === 'numeric' ? 'numeric' : 'text'}\n autoComplete={i === 0 ? 'one-time-code' : 'off'}\n aria-label={t('otpField.digit', { index: i + 1, total: length })}\n className={clsx(styles.box, char !== '' && styles.filled)}\n value={char}\n placeholder={placeholder}\n disabled={disabled}\n onChange={(e) => handleChange(i, e.target.value)}\n onKeyDown={(e) => handleKeyDown(i, e)}\n onPaste={(e) => handlePaste(i, e)}\n onFocus={(e) => e.target.select()}\n />\n ))}\n </div>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={fieldStyles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["PATTERN","toChars","value","length","out","OtpField","forwardRef","type","defaultValue","onChange","onComplete","name","label","helperText","error","required","disabled","autoFocus","placeholder","size","color","className","style","ref","t","useT","helperId","useId","allowed","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","resolvedError","resolvedHelperText","chars","inputsRef","useRef","useEffect","_a","focusBox","i","el","commit","nextChars","next","c","handleChange","index","raw","filtered","k","ch","handleKeyDown","event","handlePaste","handleBlur","jsxs","clsx","fieldStyles","jsx","Typography","styles","char","e"],"mappings":"+bAwBMA,GAAwC,CAC5C,QAAS,QACT,WAAY,WACZ,aAAc,aAChB,EAGA,SAASC,GAAQC,EAAeC,EAA0B,CACxD,MAAMC,EAAM,CAAC,GAAGF,CAAK,EAAE,MAAM,EAAGC,CAAM,EACtC,KAAOC,EAAI,OAASD,GAAQC,EAAI,KAAK,EAAE,EACvC,OAAOA,CACT,CAoDO,MAAMC,GAAWC,EAAAA,WAA0C,SAChE,CACE,OAAAH,EAAS,EACT,KAAAI,EAAO,UACP,MAAAL,EACA,aAAAM,EACA,SAAAC,EACA,WAAAC,EACA,KAAAC,EACA,MAAAC,EACA,WAAAC,EACA,MAAAC,EACA,SAAAC,EAAW,GACX,SAAAC,EAAW,GACX,UAAAC,EAAY,GACZ,YAAAC,EACA,KAAAC,EAAO,KACP,MAAAC,EAAQ,UACR,UAAAC,EACA,MAAAC,CACF,EACAC,EACA,CACA,MAAMC,EAAIC,GAAAA,KAAA,EAEJC,EAAW,GADDC,EAAAA,MAAA,CACW,UACrBC,EAAU5B,GAAQO,CAAI,EAGtBsB,EAAOC,EAAAA,eAAA,EACPC,EAAc,GAAQF,GAAQlB,GAC9BqB,EAAQH,GAAQlB,EAAOkB,EAAK,MAAMlB,CAAI,EAAI,OAE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AAC,EACpC,QAAUA,GAAMT,EAAYd,EAAGuB,CAAC,EAChC,QAAUA,GAAMA,EAAE,OAAO,OAAA,CAAO,EAjB3BvB,CAAA,CAmBR,CAAA,CAAA,EAGFP,GAAsB,MACrB0B,EAAAA,IAACC,EAAAA,WAAA,CACC,GAAG,OACH,GAAIzC,EACJ,QAAQ,YACR,MAAOa,EAAgB,QAAU,QACjC,UAAW0B,EAAAA,YAAY,OAEtB,SAAAzB,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC"}
1
+ {"version":3,"file":"OtpField-B46P6aMy.cjs","sources":["../src/components/OtpField/OtpField.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type ClipboardEvent,\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Typography } from '../Typography'\nimport fieldStyles from '../TextField/TextField.module.css'\nimport styles from './OtpField.module.css'\n\nexport type OtpFieldSize = 'sm' | 'md' | 'lg'\n/** Which characters the code accepts. */\nexport type OtpFieldType = 'numeric' | 'alphabetic' | 'alphanumeric'\n\n/** Allowed-character matcher per `type`. */\nconst PATTERN: Record<OtpFieldType, RegExp> = {\n numeric: /[0-9]/,\n alphabetic: /[A-Za-z]/,\n alphanumeric: /[A-Za-z0-9]/,\n}\n\n/** Split a code string into exactly `length` single-char slots, padded with empties. */\nfunction toChars(value: string, length: number): string[] {\n const out = [...value].slice(0, length)\n while (out.length < length) out.push('')\n return out\n}\n\nexport interface OtpFieldProps {\n /** Number of input boxes (the code length). Defaults to `4`. */\n length?: number\n /** Which characters are accepted (also drives the mobile keyboard). Defaults to `'numeric'`. */\n type?: OtpFieldType\n /** Controlled value — the concatenated code string. */\n value?: string\n /** Initial value for uncontrolled use. */\n defaultValue?: string\n /** Fires with the full code string on every change. */\n onChange?: (value: string) => void\n /** Fires with the code once every box is filled. */\n onComplete?: (value: string) => void\n /** Field name — the `<Form>` binding key (form value is the code `string`). */\n name?: string\n /** Label rendered above the boxes. */\n label?: ReactNode\n /** Helper / error text under the boxes (shown in the error color while `error`). */\n helperText?: ReactNode\n /** Marks the field invalid — reddens the boxes + helper. */\n error?: boolean\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Disables every box. */\n disabled?: boolean\n /** Focus the first box on mount. */\n autoFocus?: boolean\n /** Placeholder character shown in empty boxes (e.g. `'•'`). */\n placeholder?: string\n /** Preset size. Defaults to `'md'`. */\n size?: OtpFieldSize\n /** Theme palette token for the focus ring / active box. Defaults to `'primary'`. */\n color?: ThemeColor\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A one-time-passcode input — a row of single-character boxes for verification codes. **`length`**\n * (default `4`) sets the box count; **`type`** (`'numeric'` default · `'alphabetic'` · `'alphanumeric'`)\n * restricts the accepted characters and the mobile keyboard. Typing advances to the next box, Backspace\n * clears + steps back, Arrows navigate, and **paste / SMS autofill** (`autocomplete=\"one-time-code\"`)\n * distributes the whole code across the boxes. The value is the concatenated string — controlled\n * (`value` + `onChange`) or uncontrolled (`defaultValue`); **`onComplete`** fires when all boxes are\n * filled. Shares the field-family chrome (`label` · `error` + `helperText` · `required` · `disabled` ·\n * `size`) and binds to a surrounding `<Form>` by **`name`** (form value = the code string; validate with\n * e.g. `z.string().length(4)` or a `type`-matching regex). Tinted by `color` via the shared\n * `--tz-btn-rgb` pattern; `role=\"group\"` with per-box `aria-label`s. Own CSS module (+ TextField's for\n * the label/helper chrome).\n */\nexport const OtpField = forwardRef<HTMLDivElement, OtpFieldProps>(function OtpField(\n {\n length = 4,\n type = 'numeric',\n value,\n defaultValue,\n onChange,\n onComplete,\n name,\n label,\n helperText,\n error,\n required = false,\n disabled = false,\n autoFocus = false,\n placeholder,\n size = 'md',\n color = 'primary',\n className,\n style,\n },\n ref,\n) {\n const t = useT()\n const reactId = useId()\n const helperId = `${reactId}-helper`\n const allowed = PATTERN[type]\n\n // bind to a surrounding <Form> by `name` — form value is the code string; error/touched via field()\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue =\n value !== undefined ? value : isFormBound ? (form!.values[name!] as string) : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentValue = isControlled ? (externalValue ?? '') : internal\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n // the code split into exactly `length` single-char slots (padded with empties)\n const chars = toChars(currentValue, length)\n\n const inputsRef = useRef<(HTMLInputElement | null)[]>([])\n\n useEffect(() => {\n if (autoFocus) inputsRef.current[0]?.focus()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n const focusBox = (i: number) => {\n const el = inputsRef.current[Math.max(0, Math.min(i, length - 1))]\n el?.focus()\n el?.select()\n }\n\n const commit = (nextChars: string[]) => {\n const next = nextChars.join('')\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n if (nextChars.every((c) => c !== '')) onComplete?.(next)\n }\n\n const handleChange = (index: number, raw: string) => {\n const filtered = [...raw].filter((c) => allowed.test(c))\n // a disallowed keystroke (raw non-empty but nothing survives the filter) is ignored\n if (raw !== '' && filtered.length === 0) return\n const nextChars = [...chars]\n if (filtered.length <= 1) {\n // a single typed char (boxes select-on-focus, so this replaces) — or a clear ('')\n nextChars[index] = filtered[0] ?? ''\n commit(nextChars)\n if (filtered[0]) focusBox(index + 1)\n } else {\n // multiple chars (SMS autofill dumps the whole code into one box) → distribute from here\n let k = index\n for (const ch of filtered) {\n if (k >= length) break\n nextChars[k] = ch\n k++\n }\n commit(nextChars)\n focusBox(k)\n }\n }\n\n const handleKeyDown = (index: number, event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Backspace') {\n if (chars[index] === '' && index > 0) {\n // empty box → step back and clear the previous one\n event.preventDefault()\n const nextChars = [...chars]\n nextChars[index - 1] = ''\n commit(nextChars)\n focusBox(index - 1)\n }\n // a non-empty box lets the native delete run → onChange fires with '' (stays put)\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault()\n focusBox(index - 1)\n } else if (event.key === 'ArrowRight') {\n event.preventDefault()\n focusBox(index + 1)\n } else if (event.key === 'Delete') {\n event.preventDefault()\n const nextChars = [...chars]\n nextChars[index] = ''\n commit(nextChars)\n }\n }\n\n const handlePaste = (index: number, event: ClipboardEvent<HTMLInputElement>) => {\n event.preventDefault()\n const filtered = [...event.clipboardData.getData('text')].filter((c) => allowed.test(c))\n if (filtered.length === 0) return\n const nextChars = [...chars]\n let k = index\n for (const ch of filtered) {\n if (k >= length) break\n nextChars[k] = ch\n k++\n }\n commit(nextChars)\n focusBox(k)\n }\n\n // mark the field touched when focus leaves the whole widget (not when it hops between boxes)\n const handleBlur = (event: FocusEvent<HTMLDivElement>) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n }\n\n return (\n <div\n ref={ref}\n className={clsx(\n fieldStyles.field,\n resolvedError && fieldStyles.error,\n disabled && fieldStyles.disabled,\n className,\n )}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`,\n ...style,\n } as CSSProperties\n }\n >\n {label != null && (\n <span className={fieldStyles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n )}\n\n <div\n role=\"group\"\n aria-label={typeof label === 'string' ? label : 'One-time code'}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n className={clsx(styles.row, styles[size], resolvedError && styles.invalid)}\n onBlur={handleBlur}\n >\n {chars.map((char, i) => (\n <input\n key={i}\n ref={(el) => {\n inputsRef.current[i] = el\n }}\n // the name goes on the first box only, so the form's scroll-to-error can target it\n name={i === 0 ? name : undefined}\n type=\"text\"\n inputMode={type === 'numeric' ? 'numeric' : 'text'}\n autoComplete={i === 0 ? 'one-time-code' : 'off'}\n aria-label={t('otpField.digit', { index: i + 1, total: length })}\n className={clsx(styles.box, char !== '' && styles.filled)}\n value={char}\n placeholder={placeholder}\n disabled={disabled}\n onChange={(e) => handleChange(i, e.target.value)}\n onKeyDown={(e) => handleKeyDown(i, e)}\n onPaste={(e) => handlePaste(i, e)}\n onFocus={(e) => e.target.select()}\n />\n ))}\n </div>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={fieldStyles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["PATTERN","toChars","value","length","out","OtpField","forwardRef","type","defaultValue","onChange","onComplete","name","label","helperText","error","required","disabled","autoFocus","placeholder","size","color","className","style","ref","t","useT","helperId","useId","allowed","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","resolvedError","resolvedHelperText","chars","inputsRef","useRef","useEffect","_a","focusBox","i","el","commit","nextChars","next","c","handleChange","index","raw","filtered","k","ch","handleKeyDown","event","handlePaste","handleBlur","jsxs","clsx","fieldStyles","jsx","Typography","styles","char","e"],"mappings":"+bAwBMA,GAAwC,CAC5C,QAAS,QACT,WAAY,WACZ,aAAc,aAChB,EAGA,SAASC,GAAQC,EAAeC,EAA0B,CACxD,MAAMC,EAAM,CAAC,GAAGF,CAAK,EAAE,MAAM,EAAGC,CAAM,EACtC,KAAOC,EAAI,OAASD,GAAQC,EAAI,KAAK,EAAE,EACvC,OAAOA,CACT,CAoDO,MAAMC,GAAWC,EAAAA,WAA0C,SAChE,CACE,OAAAH,EAAS,EACT,KAAAI,EAAO,UACP,MAAAL,EACA,aAAAM,EACA,SAAAC,EACA,WAAAC,EACA,KAAAC,EACA,MAAAC,EACA,WAAAC,EACA,MAAAC,EACA,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EAAO,OACvB,KAAK,OACL,UAAWJ,IAAS,UAAY,UAAY,OAC5C,aAAcwC,IAAM,EAAI,gBAAkB,MAC1C,aAAYvB,EAAE,iBAAkB,CAAE,MAAOuB,EAAI,EAAG,MAAO5C,EAAQ,EAC/D,UAAW6D,EAAAA,KAAKI,EAAO,IAAKC,IAAS,IAAMD,EAAO,MAAM,EACxD,MAAOC,EACP,YAAAnD,EACA,SAAAF,EACA,SAAWsD,GAAMjB,EAAaN,EAAGuB,EAAE,OAAO,KAAK,EAC/C,UAAYA,GAAMX,EAAcZ,EAAGuB,CAAC,EACpC,QAAUA,GAAMT,EAAYd,EAAGuB,CAAC,EAChC,QAAUA,GAAMA,EAAE,OAAO,OAAA,CAAO,EAjB3BvB,CAAA,CAmBR,CAAA,CAAA,EAGFP,GAAsB,MACrB0B,EAAAA,IAACC,EAAAA,WAAA,CACC,GAAG,OACH,GAAIzC,EACJ,QAAQ,YACR,MAAOa,EAAgB,QAAU,QACjC,UAAW0B,EAAAA,YAAY,OAEtB,SAAAzB,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC"}
@@ -4,7 +4,7 @@ import { clsx as T } from "clsx";
4
4
  import { u as st } from "./formContext-B7ln1Miy.js";
5
5
  import { T as R } from "./Typography-Cta6Rg4L.js";
6
6
  import { f as d } from "./TextField.module-QePvGeJ3.js";
7
- import { a as at } from "./ConfigProvider-BYruQYHC.js";
7
+ import { a as at } from "./ConfigProvider-DDuIJSM7.js";
8
8
  const lt = "_row_1tqpn_2", nt = "_sm_1tqpn_8", ct = "_md_1tqpn_12", it = "_lg_1tqpn_16", ft = "_box_1tqpn_22", dt = "_filled_1tqpn_46", ut = "_invalid_1tqpn_63", _ = {
9
9
  row: lt,
10
10
  sm: nt,
@@ -168,4 +168,4 @@ const Dt = Y(function({
168
168
  export {
169
169
  Dt as O
170
170
  };
171
- //# sourceMappingURL=OtpField-CB05q0NX.js.map
171
+ //# sourceMappingURL=OtpField-DLXQYMw1.js.map