@techzyapp/ui-library 1.0.29 → 1.0.31

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 (534) hide show
  1. package/dist/{Accordion-w-w_WxxV.js → Accordion-ClK2XpD7.js} +3 -3
  2. package/dist/{Accordion-w-w_WxxV.js.map → Accordion-ClK2XpD7.js.map} +1 -1
  3. package/dist/{Accordion-P3PNqSER.cjs → Accordion-CtvAYNKd.cjs} +2 -2
  4. package/dist/{Accordion-P3PNqSER.cjs.map → Accordion-CtvAYNKd.cjs.map} +1 -1
  5. package/dist/AdminRoot-BYkmCGNx.js +57 -0
  6. package/dist/AdminRoot-BYkmCGNx.js.map +1 -0
  7. package/dist/AdminRoot-BbkfFQEn.cjs +2 -0
  8. package/dist/AdminRoot-BbkfFQEn.cjs.map +1 -0
  9. package/dist/{Alert-CJono1TJ.js → Alert-BLqAcEoT.js} +5 -5
  10. package/dist/{Alert-CJono1TJ.js.map → Alert-BLqAcEoT.js.map} +1 -1
  11. package/dist/{Alert-VFQuuII6.cjs → Alert-BM5WOI_u.cjs} +2 -2
  12. package/dist/{Alert-VFQuuII6.cjs.map → Alert-BM5WOI_u.cjs.map} +1 -1
  13. package/dist/{AuthLayout-QAtW2GAT.cjs → AuthLayout-DIcR__vo.cjs} +2 -2
  14. package/dist/{AuthLayout-QAtW2GAT.cjs.map → AuthLayout-DIcR__vo.cjs.map} +1 -1
  15. package/dist/{AuthLayout-DOFYw_z5.js → AuthLayout-m1BQ6Ixx.js} +2 -2
  16. package/dist/{AuthLayout-DOFYw_z5.js.map → AuthLayout-m1BQ6Ixx.js.map} +1 -1
  17. package/dist/{Avatar-DrV_F7Ex.cjs → Avatar-CQ--wGWS.cjs} +2 -2
  18. package/dist/{Avatar-DrV_F7Ex.cjs.map → Avatar-CQ--wGWS.cjs.map} +1 -1
  19. package/dist/{Avatar-DXNPg23a.js → Avatar-MwWIcj8z.js} +3 -3
  20. package/dist/{Avatar-DXNPg23a.js.map → Avatar-MwWIcj8z.js.map} +1 -1
  21. package/dist/{AvatarGroup-CwlYqDCI.js → AvatarGroup-BxYQo0zZ.js} +2 -2
  22. package/dist/{AvatarGroup-CwlYqDCI.js.map → AvatarGroup-BxYQo0zZ.js.map} +1 -1
  23. package/dist/{AvatarGroup-CHesdo-M.cjs → AvatarGroup-Bzu2t6Sd.cjs} +2 -2
  24. package/dist/{AvatarGroup-CHesdo-M.cjs.map → AvatarGroup-Bzu2t6Sd.cjs.map} +1 -1
  25. package/dist/{Breadcrumbs-XWU8tRvs.js → Breadcrumbs-CzHGbN2c.js} +5 -5
  26. package/dist/{Breadcrumbs-XWU8tRvs.js.map → Breadcrumbs-CzHGbN2c.js.map} +1 -1
  27. package/dist/{Breadcrumbs-DCEHxpSi.cjs → Breadcrumbs-Di4-Acfb.cjs} +2 -2
  28. package/dist/{Breadcrumbs-DCEHxpSi.cjs.map → Breadcrumbs-Di4-Acfb.cjs.map} +1 -1
  29. package/dist/{Button-CWMNNiia.js → Button-9Qcdkw-y.js} +2 -2
  30. package/dist/{Button-CWMNNiia.js.map → Button-9Qcdkw-y.js.map} +1 -1
  31. package/dist/{Button-CusxDmfq.cjs → Button-BQhiJq8e.cjs} +2 -2
  32. package/dist/{Button-CusxDmfq.cjs.map → Button-BQhiJq8e.cjs.map} +1 -1
  33. package/dist/{Calendar-Db3rr1VD.js → Calendar-BB-C0qXO.js} +4 -4
  34. package/dist/{Calendar-Db3rr1VD.js.map → Calendar-BB-C0qXO.js.map} +1 -1
  35. package/dist/{Calendar-BEQbZixA.cjs → Calendar-dXhLgOUH.cjs} +2 -2
  36. package/dist/{Calendar-BEQbZixA.cjs.map → Calendar-dXhLgOUH.cjs.map} +1 -1
  37. package/dist/Card-BERQfyhJ.js +129 -0
  38. package/dist/Card-BERQfyhJ.js.map +1 -0
  39. package/dist/Card-DULpoOfj.cjs +2 -0
  40. package/dist/Card-DULpoOfj.cjs.map +1 -0
  41. package/dist/{Chip-D12KcV4_.cjs → Chip-BuydTI6V.cjs} +2 -2
  42. package/dist/{Chip-D12KcV4_.cjs.map → Chip-BuydTI6V.cjs.map} +1 -1
  43. package/dist/{Chip-Zh1OB9nV.js → Chip-DZ5Fz7jx.js} +3 -3
  44. package/dist/{Chip-Zh1OB9nV.js.map → Chip-DZ5Fz7jx.js.map} +1 -1
  45. package/dist/{ChoiceCardGroup-CEniY_HJ.js → ChoiceCardGroup-BTbKjJdp.js} +3 -3
  46. package/dist/{ChoiceCardGroup-CEniY_HJ.js.map → ChoiceCardGroup-BTbKjJdp.js.map} +1 -1
  47. package/dist/{ChoiceCardGroup-BSagRbPI.cjs → ChoiceCardGroup-Bg2jtFpe.cjs} +2 -2
  48. package/dist/{ChoiceCardGroup-BSagRbPI.cjs.map → ChoiceCardGroup-Bg2jtFpe.cjs.map} +1 -1
  49. package/dist/{CodeBlock-DAM7BkHK.cjs → CodeBlock-BPraYPoS.cjs} +2 -2
  50. package/dist/{CodeBlock-DAM7BkHK.cjs.map → CodeBlock-BPraYPoS.cjs.map} +1 -1
  51. package/dist/{CodeBlock-CkrTnpcj.js → CodeBlock-BySsTAtY.js} +5 -5
  52. package/dist/{CodeBlock-CkrTnpcj.js.map → CodeBlock-BySsTAtY.js.map} +1 -1
  53. package/dist/{ColorPicker-BcCozxIe.cjs → ColorPicker-BTBTQD39.cjs} +2 -2
  54. package/dist/{ColorPicker-BcCozxIe.cjs.map → ColorPicker-BTBTQD39.cjs.map} +1 -1
  55. package/dist/{ColorPicker-DqxVgUoD.js → ColorPicker-DJow7m2v.js} +4 -4
  56. package/dist/{ColorPicker-DqxVgUoD.js.map → ColorPicker-DJow7m2v.js.map} +1 -1
  57. package/dist/{ColorPickerPanel-DZjN8NNn.js → ColorPickerPanel-D6agWM6y.js} +3 -3
  58. package/dist/{ColorPickerPanel-DZjN8NNn.js.map → ColorPickerPanel-D6agWM6y.js.map} +1 -1
  59. package/dist/{ColorPickerPanel-DAOESLCe.cjs → ColorPickerPanel-DXIYwUoE.cjs} +2 -2
  60. package/dist/{ColorPickerPanel-DAOESLCe.cjs.map → ColorPickerPanel-DXIYwUoE.cjs.map} +1 -1
  61. package/dist/{ColorRamp-_KwlPQ-T.cjs → ColorRamp-B45Rtwgw.cjs} +2 -2
  62. package/dist/{ColorRamp-_KwlPQ-T.cjs.map → ColorRamp-B45Rtwgw.cjs.map} +1 -1
  63. package/dist/{ColorRamp-DS5LVpRF.js → ColorRamp-Bhj28c_6.js} +3 -3
  64. package/dist/{ColorRamp-DS5LVpRF.js.map → ColorRamp-Bhj28c_6.js.map} +1 -1
  65. package/dist/ConfigProvider-Ct0Pe3Ku.js +335 -0
  66. package/dist/ConfigProvider-Ct0Pe3Ku.js.map +1 -0
  67. package/dist/ConfigProvider-CtpfSy1i.cjs +2 -0
  68. package/dist/ConfigProvider-CtpfSy1i.cjs.map +1 -0
  69. package/dist/{CopyButton-SFwjKod9.cjs → CopyButton-Bfte6TJF.cjs} +2 -2
  70. package/dist/{CopyButton-SFwjKod9.cjs.map → CopyButton-Bfte6TJF.cjs.map} +1 -1
  71. package/dist/{CopyButton-D4s8aeSE.js → CopyButton-CBk85MQ7.js} +5 -5
  72. package/dist/{CopyButton-D4s8aeSE.js.map → CopyButton-CBk85MQ7.js.map} +1 -1
  73. package/dist/{DashedButton-iM7kzopW.js → DashedButton-BpiG8rab.js} +3 -3
  74. package/dist/{DashedButton-iM7kzopW.js.map → DashedButton-BpiG8rab.js.map} +1 -1
  75. package/dist/{DashedButton-B7xodc3N.cjs → DashedButton-DZmgxLMO.cjs} +2 -2
  76. package/dist/{DashedButton-B7xodc3N.cjs.map → DashedButton-DZmgxLMO.cjs.map} +1 -1
  77. package/dist/{DatePicker-ENbn2Vab.cjs → DatePicker-DBiU4Mb6.cjs} +2 -2
  78. package/dist/{DatePicker-ENbn2Vab.cjs.map → DatePicker-DBiU4Mb6.cjs.map} +1 -1
  79. package/dist/{DatePicker-DGwjCHfd.js → DatePicker-eAzDnO2Y.js} +6 -6
  80. package/dist/{DatePicker-DGwjCHfd.js.map → DatePicker-eAzDnO2Y.js.map} +1 -1
  81. package/dist/{DateTimePicker-BQUmsFwX.cjs → DateTimePicker-CvaD8IkF.cjs} +2 -2
  82. package/dist/{DateTimePicker-BQUmsFwX.cjs.map → DateTimePicker-CvaD8IkF.cjs.map} +1 -1
  83. package/dist/{DateTimePicker-CwVkQiun.js → DateTimePicker-M2UBjFVc.js} +9 -9
  84. package/dist/{DateTimePicker-CwVkQiun.js.map → DateTimePicker-M2UBjFVc.js.map} +1 -1
  85. package/dist/{DescriptionList-0qjKr6GN.js → DescriptionList-BhsmdtS1.js} +64 -64
  86. package/dist/{DescriptionList-0qjKr6GN.js.map → DescriptionList-BhsmdtS1.js.map} +1 -1
  87. package/dist/DescriptionList-DQHNOTWl.cjs +2 -0
  88. package/dist/{DescriptionList-U5z2Faf4.cjs.map → DescriptionList-DQHNOTWl.cjs.map} +1 -1
  89. package/dist/{Dropdown-DNZ9S_zQ.cjs → Dropdown-BbaU1WDC.cjs} +2 -2
  90. package/dist/{Dropdown-DNZ9S_zQ.cjs.map → Dropdown-BbaU1WDC.cjs.map} +1 -1
  91. package/dist/{Dropdown--1mNTVZJ.js → Dropdown-BlmbYp1X.js} +2 -2
  92. package/dist/{Dropdown--1mNTVZJ.js.map → Dropdown-BlmbYp1X.js.map} +1 -1
  93. package/dist/{EmptyState-DwT9_HW7.js → EmptyState-2pA3XlOX.js} +4 -4
  94. package/dist/{EmptyState-DwT9_HW7.js.map → EmptyState-2pA3XlOX.js.map} +1 -1
  95. package/dist/{EmptyState-B2_4BN4l.cjs → EmptyState-ByBpy2vN.cjs} +2 -2
  96. package/dist/{EmptyState-B2_4BN4l.cjs.map → EmptyState-ByBpy2vN.cjs.map} +1 -1
  97. package/dist/{ErrorBoundary-CsDHKYB4.js → ErrorBoundary-B-37hGZW.js} +6 -6
  98. package/dist/{ErrorBoundary-CsDHKYB4.js.map → ErrorBoundary-B-37hGZW.js.map} +1 -1
  99. package/dist/{ErrorBoundary-CYSOAQlB.cjs → ErrorBoundary-gRGxeuM1.cjs} +2 -2
  100. package/dist/{ErrorBoundary-CYSOAQlB.cjs.map → ErrorBoundary-gRGxeuM1.cjs.map} +1 -1
  101. package/dist/{FileCard-B9f9RoXS.js → FileCard-BNfUAgsF.js} +5 -5
  102. package/dist/{FileCard-B9f9RoXS.js.map → FileCard-BNfUAgsF.js.map} +1 -1
  103. package/dist/{FileCard-zuUYik-F.cjs → FileCard-BYNJVmp0.cjs} +2 -2
  104. package/dist/{FileCard-zuUYik-F.cjs.map → FileCard-BYNJVmp0.cjs.map} +1 -1
  105. package/dist/{FileUploader-Y8hiyIpp.cjs → FileUploader-DdICa5UC.cjs} +2 -2
  106. package/dist/{FileUploader-Y8hiyIpp.cjs.map → FileUploader-DdICa5UC.cjs.map} +1 -1
  107. package/dist/{FileUploader-Dh2zA50t.js → FileUploader-TOWwDOSS.js} +6 -6
  108. package/dist/{FileUploader-Dh2zA50t.js.map → FileUploader-TOWwDOSS.js.map} +1 -1
  109. package/dist/{Flag-CmDXvd7j.js → Flag-DDR6OANA.js} +2 -2
  110. package/dist/{Flag-CmDXvd7j.js.map → Flag-DDR6OANA.js.map} +1 -1
  111. package/dist/{Flag-BpTQAgbD.cjs → Flag-DXPQ2t8z.cjs} +2 -2
  112. package/dist/{Flag-BpTQAgbD.cjs.map → Flag-DXPQ2t8z.cjs.map} +1 -1
  113. package/dist/FloatingPanel-C5c_eMQ0.js +135 -0
  114. package/dist/{FloatingPanel-CeSOtE_D.js.map → FloatingPanel-C5c_eMQ0.js.map} +1 -1
  115. package/dist/FloatingPanel-tGCG2nhA.cjs +2 -0
  116. package/dist/{FloatingPanel-BIC4WrFa.cjs.map → FloatingPanel-tGCG2nhA.cjs.map} +1 -1
  117. package/dist/{FullscreenToggle-CeGgw3z1.cjs → FullscreenToggle-BKo1lDSE.cjs} +2 -2
  118. package/dist/{FullscreenToggle-CeGgw3z1.cjs.map → FullscreenToggle-BKo1lDSE.cjs.map} +1 -1
  119. package/dist/{FullscreenToggle-2IYIS5KF.js → FullscreenToggle-DmH1541W.js} +4 -4
  120. package/dist/{FullscreenToggle-2IYIS5KF.js.map → FullscreenToggle-DmH1541W.js.map} +1 -1
  121. package/dist/Icon-BUP5_kRs.cjs +2 -0
  122. package/dist/Icon-BUP5_kRs.cjs.map +1 -0
  123. package/dist/{Icon-DaTvzLBu.js → Icon-CGQ5yGSZ.js} +4 -3
  124. package/dist/Icon-CGQ5yGSZ.js.map +1 -0
  125. package/dist/{IconButton-GU3Ud4Zg.js → IconButton-CL_6iMQh.js} +2 -2
  126. package/dist/{IconButton-GU3Ud4Zg.js.map → IconButton-CL_6iMQh.js.map} +1 -1
  127. package/dist/{IconButton-BNa0yLcv.cjs → IconButton-CvIXSFsr.cjs} +2 -2
  128. package/dist/{IconButton-BNa0yLcv.cjs.map → IconButton-CvIXSFsr.cjs.map} +1 -1
  129. package/dist/{List-CZwNGxuP.js → List-BLPB3-B8.js} +3 -3
  130. package/dist/{List-CZwNGxuP.js.map → List-BLPB3-B8.js.map} +1 -1
  131. package/dist/{List-9lUjapQ5.cjs → List-ah2PNWeY.cjs} +2 -2
  132. package/dist/{List-9lUjapQ5.cjs.map → List-ah2PNWeY.cjs.map} +1 -1
  133. package/dist/{Loader-Cpr9-OOZ.cjs → Loader-CI1j71X8.cjs} +2 -2
  134. package/dist/{Loader-Cpr9-OOZ.cjs.map → Loader-CI1j71X8.cjs.map} +1 -1
  135. package/dist/{Loader-C1uaCtx6.js → Loader-Czzb450N.js} +2 -2
  136. package/dist/{Loader-C1uaCtx6.js.map → Loader-Czzb450N.js.map} +1 -1
  137. package/dist/{Modal-DHP2R3K3.js → Modal-DMJMw6kT.js} +5 -5
  138. package/dist/{Modal-DHP2R3K3.js.map → Modal-DMJMw6kT.js.map} +1 -1
  139. package/dist/{Modal-DFeBHv-Q.cjs → Modal-DPObz0b-.cjs} +2 -2
  140. package/dist/{Modal-DFeBHv-Q.cjs.map → Modal-DPObz0b-.cjs.map} +1 -1
  141. package/dist/{MultiSelect-B-FPQ08c.js → MultiSelect-BTR6w5Ot.js} +5 -5
  142. package/dist/{MultiSelect-B-FPQ08c.js.map → MultiSelect-BTR6w5Ot.js.map} +1 -1
  143. package/dist/{MultiSelect-S5VG9g3l.cjs → MultiSelect-IDAJ5a5K.cjs} +2 -2
  144. package/dist/{MultiSelect-S5VG9g3l.cjs.map → MultiSelect-IDAJ5a5K.cjs.map} +1 -1
  145. package/dist/{NumberField-SSGXlF8U.cjs → NumberField-Cg0XEDgW.cjs} +2 -2
  146. package/dist/{NumberField-SSGXlF8U.cjs.map → NumberField-Cg0XEDgW.cjs.map} +1 -1
  147. package/dist/{NumberField-CzyvDMRV.js → NumberField-DlaW-g3Z.js} +4 -4
  148. package/dist/{NumberField-CzyvDMRV.js.map → NumberField-DlaW-g3Z.js.map} +1 -1
  149. package/dist/{OtpField-Pr7Ch0El.cjs → OtpField-DsedK1nQ.cjs} +2 -2
  150. package/dist/{OtpField-Pr7Ch0El.cjs.map → OtpField-DsedK1nQ.cjs.map} +1 -1
  151. package/dist/{OtpField-CMoJqcx1.js → OtpField-vxQuo-uR.js} +2 -2
  152. package/dist/{OtpField-CMoJqcx1.js.map → OtpField-vxQuo-uR.js.map} +1 -1
  153. package/dist/{PageLayout-BIMkjq-q.cjs → PageLayout-BPbjTYS3.cjs} +2 -2
  154. package/dist/{PageLayout-BIMkjq-q.cjs.map → PageLayout-BPbjTYS3.cjs.map} +1 -1
  155. package/dist/{PageLayout-Ctr-IEzX.js → PageLayout-Rk6KSxmn.js} +2 -2
  156. package/dist/{PageLayout-Ctr-IEzX.js.map → PageLayout-Rk6KSxmn.js.map} +1 -1
  157. package/dist/{PageNotFound-KKJTeaRF.js → PageNotFound-CBNhKZ9Y.js} +5 -5
  158. package/dist/{PageNotFound-KKJTeaRF.js.map → PageNotFound-CBNhKZ9Y.js.map} +1 -1
  159. package/dist/{PageNotFound-CnhBheI4.cjs → PageNotFound-PUQ1o9R4.cjs} +2 -2
  160. package/dist/{PageNotFound-CnhBheI4.cjs.map → PageNotFound-PUQ1o9R4.cjs.map} +1 -1
  161. package/dist/{Pagination-Oyms2ERd.js → Pagination-CNdkfXp2.js} +3 -3
  162. package/dist/{Pagination-Oyms2ERd.js.map → Pagination-CNdkfXp2.js.map} +1 -1
  163. package/dist/{Pagination-BD5WOW98.cjs → Pagination-DNGKNQy0.cjs} +2 -2
  164. package/dist/{Pagination-BD5WOW98.cjs.map → Pagination-DNGKNQy0.cjs.map} +1 -1
  165. package/dist/{PaletteField-CCQGW5LC.cjs → PaletteField-BSIF5jI6.cjs} +2 -2
  166. package/dist/{PaletteField-CCQGW5LC.cjs.map → PaletteField-BSIF5jI6.cjs.map} +1 -1
  167. package/dist/{PaletteField-BHzzzdou.js → PaletteField-Bp5Fgygh.js} +3 -3
  168. package/dist/{PaletteField-BHzzzdou.js.map → PaletteField-Bp5Fgygh.js.map} +1 -1
  169. package/dist/{PhoneField-5zGY4Wko.cjs → PhoneField-BMhZeZkW.cjs} +2 -2
  170. package/dist/{PhoneField-5zGY4Wko.cjs.map → PhoneField-BMhZeZkW.cjs.map} +1 -1
  171. package/dist/{PhoneField-CBfmChPx.js → PhoneField-BdmvslXQ.js} +5 -5
  172. package/dist/{PhoneField-CBfmChPx.js.map → PhoneField-BdmvslXQ.js.map} +1 -1
  173. package/dist/{Popconfirm-BtGDhqrc.js → Popconfirm-Cyaeybtj.js} +6 -6
  174. package/dist/{Popconfirm-BtGDhqrc.js.map → Popconfirm-Cyaeybtj.js.map} +1 -1
  175. package/dist/{Popconfirm-CkBdntxV.cjs → Popconfirm-IhlIINtZ.cjs} +2 -2
  176. package/dist/{Popconfirm-CkBdntxV.cjs.map → Popconfirm-IhlIINtZ.cjs.map} +1 -1
  177. package/dist/{Popover-DAT6DcM9.cjs → Popover-DsYUT23r.cjs} +2 -2
  178. package/dist/{Popover-DAT6DcM9.cjs.map → Popover-DsYUT23r.cjs.map} +1 -1
  179. package/dist/{Popover-B82Id9Ut.js → Popover-WaVH3jsN.js} +2 -2
  180. package/dist/{Popover-B82Id9Ut.js.map → Popover-WaVH3jsN.js.map} +1 -1
  181. package/dist/{Progress-Bwxx71Ns.cjs → Progress-CAY1p06_.cjs} +2 -2
  182. package/dist/{Progress-Bwxx71Ns.cjs.map → Progress-CAY1p06_.cjs.map} +1 -1
  183. package/dist/{Progress-pTbaOSDd.js → Progress-T7PLrJ0Y.js} +2 -2
  184. package/dist/{Progress-pTbaOSDd.js.map → Progress-T7PLrJ0Y.js.map} +1 -1
  185. package/dist/{QueryError-C01oichG.cjs → QueryError-DP22IUnp.cjs} +2 -2
  186. package/dist/{QueryError-C01oichG.cjs.map → QueryError-DP22IUnp.cjs.map} +1 -1
  187. package/dist/{QueryError-Bu_MNGek.js → QueryError-Dtspj9l4.js} +2 -2
  188. package/dist/{QueryError-Bu_MNGek.js.map → QueryError-Dtspj9l4.js.map} +1 -1
  189. package/dist/RadioGroup-CTAayuMv.js +142 -0
  190. package/dist/RadioGroup-CTAayuMv.js.map +1 -0
  191. package/dist/RadioGroup-CvC2yc4p.cjs +2 -0
  192. package/dist/RadioGroup-CvC2yc4p.cjs.map +1 -0
  193. package/dist/{RemoveDialog-Bm2mJB3l.cjs → RemoveDialog-D12B4x80.cjs} +2 -2
  194. package/dist/{RemoveDialog-Bm2mJB3l.cjs.map → RemoveDialog-D12B4x80.cjs.map} +1 -1
  195. package/dist/{RemoveDialog-C2uJzWi-.js → RemoveDialog-DdGsqaWV.js} +6 -6
  196. package/dist/{RemoveDialog-C2uJzWi-.js.map → RemoveDialog-DdGsqaWV.js.map} +1 -1
  197. package/dist/RichTextEditor-BVXY25sz.cjs +2 -0
  198. package/dist/RichTextEditor-BVXY25sz.cjs.map +1 -0
  199. package/dist/RichTextEditor-DL4y5xVv.js +916 -0
  200. package/dist/RichTextEditor-DL4y5xVv.js.map +1 -0
  201. package/dist/RootLayout-BK3t6Mm0.js +604 -0
  202. package/dist/RootLayout-BK3t6Mm0.js.map +1 -0
  203. package/dist/RootLayout-DDuzPlJe.cjs +2 -0
  204. package/dist/RootLayout-DDuzPlJe.cjs.map +1 -0
  205. package/dist/{Select-CVVJKAtS.cjs → Select-DlFDOZtn.cjs} +2 -2
  206. package/dist/{Select-CVVJKAtS.cjs.map → Select-DlFDOZtn.cjs.map} +1 -1
  207. package/dist/{Select-d9LDI8O3.js → Select-tVI_qer3.js} +5 -5
  208. package/dist/{Select-d9LDI8O3.js.map → Select-tVI_qer3.js.map} +1 -1
  209. package/dist/{Sidebar-BgCfnZBF.js → Sidebar-CjrD3nNp.js} +7 -6
  210. package/dist/Sidebar-CjrD3nNp.js.map +1 -0
  211. package/dist/Sidebar-gB-X4VLX.cjs +2 -0
  212. package/dist/Sidebar-gB-X4VLX.cjs.map +1 -0
  213. package/dist/{SpeedDial-CEr2JWQb.cjs → SpeedDial-BIOkkLKO.cjs} +2 -2
  214. package/dist/{SpeedDial-CEr2JWQb.cjs.map → SpeedDial-BIOkkLKO.cjs.map} +1 -1
  215. package/dist/{SpeedDial-CBVwgnFp.js → SpeedDial-xQr4JH0x.js} +5 -5
  216. package/dist/{SpeedDial-CBVwgnFp.js.map → SpeedDial-xQr4JH0x.js.map} +1 -1
  217. package/dist/Stepper-CBdhvPoz.cjs +2 -0
  218. package/dist/Stepper-CBdhvPoz.cjs.map +1 -0
  219. package/dist/Stepper-CkYcIc15.js +169 -0
  220. package/dist/Stepper-CkYcIc15.js.map +1 -0
  221. package/dist/{SwatchPicker-Bpxk0IOe.js → SwatchPicker-BAKslSY4.js} +2 -2
  222. package/dist/{SwatchPicker-Bpxk0IOe.js.map → SwatchPicker-BAKslSY4.js.map} +1 -1
  223. package/dist/{SwatchPicker-BWXqgsEy.cjs → SwatchPicker-CpwVq0xp.cjs} +2 -2
  224. package/dist/{SwatchPicker-BWXqgsEy.cjs.map → SwatchPicker-CpwVq0xp.cjs.map} +1 -1
  225. package/dist/Table-CwQKfXGn.js +1210 -0
  226. package/dist/Table-CwQKfXGn.js.map +1 -0
  227. package/dist/Table-Cwxqo7Br.cjs +2 -0
  228. package/dist/Table-Cwxqo7Br.cjs.map +1 -0
  229. package/dist/Tabs-651xbRe4.cjs +2 -0
  230. package/dist/Tabs-651xbRe4.cjs.map +1 -0
  231. package/dist/Tabs-Bztnezt9.js +194 -0
  232. package/dist/Tabs-Bztnezt9.js.map +1 -0
  233. package/dist/{TagsField-DcuSn7wL.cjs → TagsField-B7ZARHzD.cjs} +2 -2
  234. package/dist/{TagsField-DcuSn7wL.cjs.map → TagsField-B7ZARHzD.cjs.map} +1 -1
  235. package/dist/{TagsField-DuQEFHZ3.js → TagsField-CdymON69.js} +5 -5
  236. package/dist/{TagsField-DuQEFHZ3.js.map → TagsField-CdymON69.js.map} +1 -1
  237. package/dist/{TextField-E85pvJQC.cjs → TextField-B22NRQ91.cjs} +2 -2
  238. package/dist/{TextField-E85pvJQC.cjs.map → TextField-B22NRQ91.cjs.map} +1 -1
  239. package/dist/{TextField-SGYWviFf.js → TextField-DkaYK1DI.js} +4 -4
  240. package/dist/{TextField-SGYWviFf.js.map → TextField-DkaYK1DI.js.map} +1 -1
  241. package/dist/{ThemeToggle-BdlxzYNt.cjs → ThemeToggle-D5dWHQFb.cjs} +2 -2
  242. package/dist/{ThemeToggle-BdlxzYNt.cjs.map → ThemeToggle-D5dWHQFb.cjs.map} +1 -1
  243. package/dist/{ThemeToggle-C2kjFrD_.js → ThemeToggle-DqzUvcK5.js} +4 -4
  244. package/dist/{ThemeToggle-C2kjFrD_.js.map → ThemeToggle-DqzUvcK5.js.map} +1 -1
  245. package/dist/{TimeColumns-BS1d0qOp.js → TimeColumns-BEoHh961.js} +2 -2
  246. package/dist/{TimeColumns-BS1d0qOp.js.map → TimeColumns-BEoHh961.js.map} +1 -1
  247. package/dist/{TimeColumns-D7-O4Qyt.cjs → TimeColumns-o2xhvSGE.cjs} +2 -2
  248. package/dist/{TimeColumns-D7-O4Qyt.cjs.map → TimeColumns-o2xhvSGE.cjs.map} +1 -1
  249. package/dist/{TimePicker-Dzb3gycP.cjs → TimePicker-CACmHwNn.cjs} +2 -2
  250. package/dist/{TimePicker-Dzb3gycP.cjs.map → TimePicker-CACmHwNn.cjs.map} +1 -1
  251. package/dist/{TimePicker-DlzYNDN1.js → TimePicker-DCryZCmh.js} +7 -7
  252. package/dist/{TimePicker-DlzYNDN1.js.map → TimePicker-DCryZCmh.js.map} +1 -1
  253. package/dist/{Timeline-CKEosWka.cjs → Timeline-CMP93APm.cjs} +2 -2
  254. package/dist/{Timeline-CKEosWka.cjs.map → Timeline-CMP93APm.cjs.map} +1 -1
  255. package/dist/{Timeline-ufVXmpMY.js → Timeline-Dri2dPsK.js} +3 -3
  256. package/dist/{Timeline-ufVXmpMY.js.map → Timeline-Dri2dPsK.js.map} +1 -1
  257. package/dist/{Toaster-Cummylmj.cjs → Toaster-BwREV06e.cjs} +2 -2
  258. package/dist/{Toaster-Cummylmj.cjs.map → Toaster-BwREV06e.cjs.map} +1 -1
  259. package/dist/{Toaster-cu5XyKeE.js → Toaster-DwVLab3k.js} +2 -2
  260. package/dist/{Toaster-cu5XyKeE.js.map → Toaster-DwVLab3k.js.map} +1 -1
  261. package/dist/{ToggleButtonGroup-D9odYMzD.js → ToggleButtonGroup-BtVDnQIF.js} +3 -3
  262. package/dist/{ToggleButtonGroup-D9odYMzD.js.map → ToggleButtonGroup-BtVDnQIF.js.map} +1 -1
  263. package/dist/{ToggleButtonGroup-M2oj_3mc.cjs → ToggleButtonGroup-UylpGJ16.cjs} +2 -2
  264. package/dist/{ToggleButtonGroup-M2oj_3mc.cjs.map → ToggleButtonGroup-UylpGJ16.cjs.map} +1 -1
  265. package/dist/Tooltip-Bw-1Xk2Z.cjs +2 -0
  266. package/dist/Tooltip-Bw-1Xk2Z.cjs.map +1 -0
  267. package/dist/Tooltip-DsDv4NOq.js +135 -0
  268. package/dist/Tooltip-DsDv4NOq.js.map +1 -0
  269. package/dist/{TranslatedFields-Ccjhq2YL.js → TranslatedFields-B0LMXgiu.js} +5 -5
  270. package/dist/{TranslatedFields-Ccjhq2YL.js.map → TranslatedFields-B0LMXgiu.js.map} +1 -1
  271. package/dist/{TranslatedFields-CbTlgKnh.cjs → TranslatedFields-sio1Qfy7.cjs} +2 -2
  272. package/dist/{TranslatedFields-CbTlgKnh.cjs.map → TranslatedFields-sio1Qfy7.cjs.map} +1 -1
  273. package/dist/{UserCard-Bs8kuV2j.js → UserCard-B5FVcJaK.js} +5 -5
  274. package/dist/{UserCard-Bs8kuV2j.js.map → UserCard-B5FVcJaK.js.map} +1 -1
  275. package/dist/{UserCard-BfHHfkDr.cjs → UserCard-Dzc4zmPj.cjs} +2 -2
  276. package/dist/{UserCard-BfHHfkDr.cjs.map → UserCard-Dzc4zmPj.cjs.map} +1 -1
  277. package/dist/app/AdminRoot.d.cts +7 -2
  278. package/dist/app/AdminRoot.d.ts +7 -2
  279. package/dist/components/Accordion/index.cjs +1 -1
  280. package/dist/components/Accordion/index.js +1 -1
  281. package/dist/components/Alert/index.cjs +1 -1
  282. package/dist/components/Alert/index.js +1 -1
  283. package/dist/components/AuthLayout/index.cjs +1 -1
  284. package/dist/components/AuthLayout/index.js +1 -1
  285. package/dist/components/Avatar/index.cjs +1 -1
  286. package/dist/components/Avatar/index.js +2 -2
  287. package/dist/components/Breadcrumbs/index.cjs +1 -1
  288. package/dist/components/Breadcrumbs/index.js +1 -1
  289. package/dist/components/Button/index.cjs +1 -1
  290. package/dist/components/Button/index.js +1 -1
  291. package/dist/components/Card/Card.d.cts +9 -1
  292. package/dist/components/Card/Card.d.ts +9 -1
  293. package/dist/components/Card/index.cjs +1 -1
  294. package/dist/components/Card/index.js +1 -1
  295. package/dist/components/Chip/index.cjs +1 -1
  296. package/dist/components/Chip/index.js +1 -1
  297. package/dist/components/ChoiceCard/index.cjs +1 -1
  298. package/dist/components/ChoiceCard/index.js +1 -1
  299. package/dist/components/CodeBlock/index.cjs +1 -1
  300. package/dist/components/CodeBlock/index.js +1 -1
  301. package/dist/components/ColorPicker/index.cjs +1 -1
  302. package/dist/components/ColorPicker/index.js +1 -1
  303. package/dist/components/ColorRamp/index.cjs +1 -1
  304. package/dist/components/ColorRamp/index.js +1 -1
  305. package/dist/components/CopyButton/index.cjs +1 -1
  306. package/dist/components/CopyButton/index.js +1 -1
  307. package/dist/components/DashedButton/index.cjs +1 -1
  308. package/dist/components/DashedButton/index.js +1 -1
  309. package/dist/components/DatePicker/index.cjs +1 -1
  310. package/dist/components/DatePicker/index.js +1 -1
  311. package/dist/components/DateTimePicker/index.cjs +1 -1
  312. package/dist/components/DateTimePicker/index.js +1 -1
  313. package/dist/components/DescriptionList/index.cjs +1 -1
  314. package/dist/components/DescriptionList/index.js +1 -1
  315. package/dist/components/Dropdown/index.cjs +1 -1
  316. package/dist/components/Dropdown/index.js +1 -1
  317. package/dist/components/EmptyState/index.cjs +1 -1
  318. package/dist/components/EmptyState/index.js +1 -1
  319. package/dist/components/ErrorState/index.cjs +1 -1
  320. package/dist/components/ErrorState/index.js +2 -2
  321. package/dist/components/FileCard/index.cjs +1 -1
  322. package/dist/components/FileCard/index.js +1 -1
  323. package/dist/components/FileUploader/index.cjs +1 -1
  324. package/dist/components/FileUploader/index.js +1 -1
  325. package/dist/components/Flag/index.cjs +1 -1
  326. package/dist/components/Flag/index.js +1 -1
  327. package/dist/components/FullscreenToggle/index.cjs +1 -1
  328. package/dist/components/FullscreenToggle/index.js +1 -1
  329. package/dist/components/Icon/index.cjs +1 -1
  330. package/dist/components/Icon/index.js +2 -2
  331. package/dist/components/IconButton/index.cjs +1 -1
  332. package/dist/components/IconButton/index.js +1 -1
  333. package/dist/components/List/index.cjs +1 -1
  334. package/dist/components/List/index.js +1 -1
  335. package/dist/components/Loader/index.cjs +1 -1
  336. package/dist/components/Loader/index.js +1 -1
  337. package/dist/components/Modal/index.cjs +1 -1
  338. package/dist/components/Modal/index.js +1 -1
  339. package/dist/components/MultiSelect/index.cjs +1 -1
  340. package/dist/components/MultiSelect/index.js +1 -1
  341. package/dist/components/NumberField/index.cjs +1 -1
  342. package/dist/components/NumberField/index.js +1 -1
  343. package/dist/components/OtpField/index.cjs +1 -1
  344. package/dist/components/OtpField/index.js +1 -1
  345. package/dist/components/PageLayout/index.cjs +1 -1
  346. package/dist/components/PageLayout/index.js +1 -1
  347. package/dist/components/PageNotFound/index.cjs +1 -1
  348. package/dist/components/PageNotFound/index.js +1 -1
  349. package/dist/components/Pagination/index.cjs +1 -1
  350. package/dist/components/Pagination/index.js +1 -1
  351. package/dist/components/PaletteField/index.cjs +1 -1
  352. package/dist/components/PaletteField/index.js +1 -1
  353. package/dist/components/PhoneField/index.cjs +1 -1
  354. package/dist/components/PhoneField/index.js +1 -1
  355. package/dist/components/Popconfirm/index.cjs +1 -1
  356. package/dist/components/Popconfirm/index.js +1 -1
  357. package/dist/components/Popover/index.cjs +1 -1
  358. package/dist/components/Popover/index.js +1 -1
  359. package/dist/components/Progress/index.cjs +1 -1
  360. package/dist/components/Progress/index.js +1 -1
  361. package/dist/components/Radio/RadioGroup.d.cts +1 -1
  362. package/dist/components/Radio/RadioGroup.d.ts +1 -1
  363. package/dist/components/Radio/index.cjs +1 -1
  364. package/dist/components/Radio/index.js +1 -1
  365. package/dist/components/RemoveDialog/index.cjs +1 -1
  366. package/dist/components/RemoveDialog/index.js +1 -1
  367. package/dist/components/RichTextEditor/RichTextEditor.d.cts +16 -1
  368. package/dist/components/RichTextEditor/RichTextEditor.d.ts +16 -1
  369. package/dist/components/RichTextEditor/index.cjs +1 -1
  370. package/dist/components/RichTextEditor/index.js +1 -1
  371. package/dist/components/RootLayout/RootLayout.d.cts +8 -1
  372. package/dist/components/RootLayout/RootLayout.d.ts +8 -1
  373. package/dist/components/RootLayout/SettingsDrawer.d.cts +4 -1
  374. package/dist/components/RootLayout/SettingsDrawer.d.ts +4 -1
  375. package/dist/components/RootLayout/index.cjs +1 -1
  376. package/dist/components/RootLayout/index.js +1 -1
  377. package/dist/components/Select/index.cjs +1 -1
  378. package/dist/components/Select/index.js +1 -1
  379. package/dist/components/Sidebar/Sidebar.d.cts +2 -0
  380. package/dist/components/Sidebar/Sidebar.d.ts +2 -0
  381. package/dist/components/Sidebar/index.cjs +1 -1
  382. package/dist/components/Sidebar/index.js +1 -1
  383. package/dist/components/SpeedDial/index.cjs +1 -1
  384. package/dist/components/SpeedDial/index.js +1 -1
  385. package/dist/components/Stepper/Stepper.d.cts +8 -1
  386. package/dist/components/Stepper/Stepper.d.ts +8 -1
  387. package/dist/components/Stepper/index.cjs +1 -1
  388. package/dist/components/Stepper/index.js +1 -1
  389. package/dist/components/SwatchPicker/index.cjs +1 -1
  390. package/dist/components/SwatchPicker/index.js +1 -1
  391. package/dist/components/Table/Table.d.cts +20 -3
  392. package/dist/components/Table/Table.d.ts +20 -3
  393. package/dist/components/Table/index.cjs +1 -1
  394. package/dist/components/Table/index.js +1 -1
  395. package/dist/components/Table/tableFilter.d.cts +12 -2
  396. package/dist/components/Table/tableFilter.d.ts +12 -2
  397. package/dist/components/Tabs/Tabs.d.cts +8 -1
  398. package/dist/components/Tabs/Tabs.d.ts +8 -1
  399. package/dist/components/Tabs/index.cjs +1 -1
  400. package/dist/components/Tabs/index.js +1 -1
  401. package/dist/components/TagsField/index.cjs +1 -1
  402. package/dist/components/TagsField/index.js +1 -1
  403. package/dist/components/TextField/index.cjs +1 -1
  404. package/dist/components/TextField/index.js +1 -1
  405. package/dist/components/ThemeToggle/index.cjs +1 -1
  406. package/dist/components/ThemeToggle/index.js +1 -1
  407. package/dist/components/TimePicker/index.cjs +1 -1
  408. package/dist/components/TimePicker/index.js +1 -1
  409. package/dist/components/Timeline/index.cjs +1 -1
  410. package/dist/components/Timeline/index.js +1 -1
  411. package/dist/components/Toast/index.cjs +1 -1
  412. package/dist/components/Toast/index.js +1 -1
  413. package/dist/components/ToggleButton/index.cjs +1 -1
  414. package/dist/components/ToggleButton/index.js +1 -1
  415. package/dist/components/Tooltip/Tooltip.d.cts +10 -3
  416. package/dist/components/Tooltip/Tooltip.d.ts +10 -3
  417. package/dist/components/Tooltip/index.cjs +1 -1
  418. package/dist/components/Tooltip/index.js +1 -1
  419. package/dist/components/TranslatedFields/index.cjs +1 -1
  420. package/dist/components/TranslatedFields/index.js +1 -1
  421. package/dist/components/UserCard/index.cjs +1 -1
  422. package/dist/components/UserCard/index.js +1 -1
  423. package/dist/entries/app.cjs +1 -1
  424. package/dist/entries/app.js +1 -1
  425. package/dist/entries/components.cjs +1 -1
  426. package/dist/entries/components.js +64 -64
  427. package/dist/entries/hooks.cjs +1 -1
  428. package/dist/entries/hooks.d.cts +2 -0
  429. package/dist/entries/hooks.d.ts +2 -0
  430. package/dist/entries/hooks.js +9 -8
  431. package/dist/entries/i18n.cjs +1 -1
  432. package/dist/entries/i18n.js +2 -2
  433. package/dist/entries/icons.cjs +1 -1
  434. package/dist/entries/icons.js +2 -2
  435. package/dist/entries/theme.cjs +1 -1
  436. package/dist/entries/theme.d.cts +1 -1
  437. package/dist/entries/theme.d.ts +1 -1
  438. package/dist/entries/theme.js +1 -1
  439. package/dist/hooks/index.d.cts +2 -0
  440. package/dist/hooks/index.d.ts +2 -0
  441. package/dist/hooks/useClearUrlOnUnmount.d.cts +19 -0
  442. package/dist/hooks/useClearUrlOnUnmount.d.ts +19 -0
  443. package/dist/hooks/useQueryModal.d.cts +40 -0
  444. package/dist/hooks/useQueryModal.d.ts +40 -0
  445. package/dist/i18n/messages.d.cts +12 -0
  446. package/dist/i18n/messages.d.ts +12 -0
  447. package/dist/icons/names.d.cts +3 -3
  448. package/dist/icons/names.d.ts +3 -3
  449. package/dist/index.cjs +1 -1
  450. package/dist/index.css +1 -1
  451. package/dist/index.js +251 -250
  452. package/dist/{messages-FiUqCKjJ.cjs → messages-DS38X5W2.cjs} +9 -9
  453. package/dist/messages-DS38X5W2.cjs.map +1 -0
  454. package/dist/{messages-DCefu6Pn.js → messages-DswDgGe2.js} +52 -10
  455. package/dist/messages-DswDgGe2.js.map +1 -0
  456. package/dist/{names-r21QPjcU.js → names-BR1uJs0-.js} +5 -4
  457. package/dist/names-BR1uJs0-.js.map +1 -0
  458. package/dist/names-YOCJ4B5J.cjs +2 -0
  459. package/dist/names-YOCJ4B5J.cjs.map +1 -0
  460. package/dist/theme/ConfigProvider.d.cts +48 -0
  461. package/dist/theme/ConfigProvider.d.ts +48 -0
  462. package/dist/theme/index.d.cts +1 -1
  463. package/dist/theme/index.d.ts +1 -1
  464. package/dist/useClearUrlOnUnmount-Cg7v2y5B.cjs +2 -0
  465. package/dist/useClearUrlOnUnmount-Cg7v2y5B.cjs.map +1 -0
  466. package/dist/useClearUrlOnUnmount-DOeh6CUN.js +37 -0
  467. package/dist/useClearUrlOnUnmount-DOeh6CUN.js.map +1 -0
  468. package/dist/useForm-CGbJ44Gp.js +194 -0
  469. package/dist/useForm-CGbJ44Gp.js.map +1 -0
  470. package/dist/useForm-CSw6r1n1.cjs +2 -0
  471. package/dist/useForm-CSw6r1n1.cjs.map +1 -0
  472. package/dist/{useOptionMenu-BoWyPgbY.cjs → useOptionMenu-BYeSUee6.cjs} +2 -2
  473. package/dist/{useOptionMenu-BoWyPgbY.cjs.map → useOptionMenu-BYeSUee6.cjs.map} +1 -1
  474. package/dist/{useOptionMenu-D7EbYG9A.js → useOptionMenu-DtTvY9EC.js} +6 -6
  475. package/dist/{useOptionMenu-D7EbYG9A.js.map → useOptionMenu-DtTvY9EC.js.map} +1 -1
  476. package/package.json +1 -1
  477. package/dist/AdminRoot-9HGp3Mds.js +0 -55
  478. package/dist/AdminRoot-9HGp3Mds.js.map +0 -1
  479. package/dist/AdminRoot-D24UJ-4a.cjs +0 -2
  480. package/dist/AdminRoot-D24UJ-4a.cjs.map +0 -1
  481. package/dist/Card-CUUh4mlB.cjs +0 -2
  482. package/dist/Card-CUUh4mlB.cjs.map +0 -1
  483. package/dist/Card-MxYfQTOY.js +0 -121
  484. package/dist/Card-MxYfQTOY.js.map +0 -1
  485. package/dist/ConfigProvider-BbsI15b-.js +0 -320
  486. package/dist/ConfigProvider-BbsI15b-.js.map +0 -1
  487. package/dist/ConfigProvider-ByLHqXpv.cjs +0 -2
  488. package/dist/ConfigProvider-ByLHqXpv.cjs.map +0 -1
  489. package/dist/DescriptionList-U5z2Faf4.cjs +0 -2
  490. package/dist/FloatingPanel-BIC4WrFa.cjs +0 -2
  491. package/dist/FloatingPanel-CeSOtE_D.js +0 -135
  492. package/dist/Icon-BVULqOJD.cjs +0 -2
  493. package/dist/Icon-BVULqOJD.cjs.map +0 -1
  494. package/dist/Icon-DaTvzLBu.js.map +0 -1
  495. package/dist/RadioGroup-BcFBdFhh.cjs +0 -2
  496. package/dist/RadioGroup-BcFBdFhh.cjs.map +0 -1
  497. package/dist/RadioGroup-dVx_hMCY.js +0 -141
  498. package/dist/RadioGroup-dVx_hMCY.js.map +0 -1
  499. package/dist/RichTextEditor-BDAWmQrN.js +0 -806
  500. package/dist/RichTextEditor-BDAWmQrN.js.map +0 -1
  501. package/dist/RichTextEditor-D4HpPT3C.cjs +0 -2
  502. package/dist/RichTextEditor-D4HpPT3C.cjs.map +0 -1
  503. package/dist/RootLayout-CxncyjCz.js +0 -515
  504. package/dist/RootLayout-CxncyjCz.js.map +0 -1
  505. package/dist/RootLayout-XEcU_MBs.cjs +0 -2
  506. package/dist/RootLayout-XEcU_MBs.cjs.map +0 -1
  507. package/dist/Sidebar-B8ecHwZr.cjs +0 -2
  508. package/dist/Sidebar-B8ecHwZr.cjs.map +0 -1
  509. package/dist/Sidebar-BgCfnZBF.js.map +0 -1
  510. package/dist/Stepper-DOSc03YV.cjs +0 -2
  511. package/dist/Stepper-DOSc03YV.cjs.map +0 -1
  512. package/dist/Stepper-DtYamv1q.js +0 -165
  513. package/dist/Stepper-DtYamv1q.js.map +0 -1
  514. package/dist/Table-AzNzUAkl.js +0 -1170
  515. package/dist/Table-AzNzUAkl.js.map +0 -1
  516. package/dist/Table-CrpWhZUg.cjs +0 -2
  517. package/dist/Table-CrpWhZUg.cjs.map +0 -1
  518. package/dist/Tabs-CMnLXRjA.cjs +0 -2
  519. package/dist/Tabs-CMnLXRjA.cjs.map +0 -1
  520. package/dist/Tabs-D1RGhKsa.js +0 -190
  521. package/dist/Tabs-D1RGhKsa.js.map +0 -1
  522. package/dist/Tooltip-Ao7az09p.cjs +0 -2
  523. package/dist/Tooltip-Ao7az09p.cjs.map +0 -1
  524. package/dist/Tooltip-Cb_FKxT9.js +0 -65
  525. package/dist/Tooltip-Cb_FKxT9.js.map +0 -1
  526. package/dist/messages-DCefu6Pn.js.map +0 -1
  527. package/dist/messages-FiUqCKjJ.cjs.map +0 -1
  528. package/dist/names-BJnFU_5m.cjs +0 -2
  529. package/dist/names-BJnFU_5m.cjs.map +0 -1
  530. package/dist/names-r21QPjcU.js.map +0 -1
  531. package/dist/useForm-CN-qCrP7.js +0 -144
  532. package/dist/useForm-CN-qCrP7.js.map +0 -1
  533. package/dist/useForm-WvV361y6.cjs +0 -2
  534. package/dist/useForm-WvV361y6.cjs.map +0 -1
@@ -2,11 +2,11 @@ import { jsxs as k, jsx as t } from "react/jsx-runtime";
2
2
  import { forwardRef as ce, useId as ie, useState as ue, useRef as P, useCallback as de } from "react";
3
3
  import { clsx as B } from "clsx";
4
4
  import { u as me } from "./formContext-B7ln1Miy.js";
5
- import { C as he } from "./Chip-Zh1OB9nV.js";
6
- import { I as W } from "./Icon-DaTvzLBu.js";
7
- import { u as _e, O as pe } from "./useOptionMenu-D7EbYG9A.js";
5
+ import { C as he } from "./Chip-DZ5Fz7jx.js";
6
+ import { I as W } from "./Icon-CGQ5yGSZ.js";
7
+ import { u as _e, O as pe } from "./useOptionMenu-DtTvY9EC.js";
8
8
  import { T as j } from "./Typography-CJv5AnRP.js";
9
- import { a as fe } from "./ConfigProvider-BbsI15b-.js";
9
+ import { a as fe } from "./ConfigProvider-Ct0Pe3Ku.js";
10
10
  const ve = "_field_um3uh_1", be = "_fullWidth_um3uh_7", ye = "_label_um3uh_12", ge = "_required_um3uh_21", xe = "_control_um3uh_27", Ie = "_filled_um3uh_47", Ne = "_open_um3uh_51", we = "_error_um3uh_56", De = "_disabled_um3uh_64", Se = "_chips_um3uh_31", Te = "_value_um3uh_84", ke = "_valueLabel_um3uh_91", Be = "_placeholder_um3uh_96", Ce = "_clear_um3uh_100", Me = "_chevron_um3uh_117", Re = "_sm_um3uh_127", Le = "_md_um3uh_131", Ve = "_lg_um3uh_135", qe = "_helper_um3uh_140", r = {
11
11
  field: ve,
12
12
  fullWidth: be,
@@ -216,4 +216,4 @@ const ve = "_field_um3uh_1", be = "_fullWidth_um3uh_7", ye = "_label_um3uh_12",
216
216
  export {
217
217
  Qe as M
218
218
  };
219
- //# sourceMappingURL=MultiSelect-B-FPQ08c.js.map
219
+ //# sourceMappingURL=MultiSelect-BTR6w5Ot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect-B-FPQ08c.js","sources":["../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useId,\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 { useT, type ThemeColor } from '../../theme'\nimport { Chip } from '../Chip'\nimport { Icon } from '../Icon'\nimport { OptionMenu } from '../OptionMenu/OptionMenu'\nimport { useOptionMenu } from '../OptionMenu/useOptionMenu'\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 helperId = `${id}-helper`\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 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 // ── the option popover (state + keys shared with Select / PhoneField) — stays open on pick ─────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const fieldBlur = useRef<(() => void) | undefined>(undefined)\n fieldBlur.current = bound ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\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 const removeValue = (v: string) => commit(selectedValues.filter((x) => x !== v))\n\n const menu = useOptionMenu({\n idBase: id,\n options,\n isSelected: (o) => selectedValues.includes(o.value),\n onPick: (o) =>\n commit(\n selectedValues.includes(o.value)\n ? selectedValues.filter((v) => v !== o.value)\n : [...selectedValues, o.value],\n ),\n closeOnPick: false,\n highlightSelected: false,\n searchable,\n onSearchChange,\n disabled,\n focusRef: triggerRef,\n onClose: () => fieldBlur.current?.(),\n })\n const { open } = menu\n\n // Backspace removes the last chip while the search box is empty (or there's none); else the shared keys\n const handleKeyDown = (event: ReactKeyboardEvent) => {\n if (\n event.key === 'Backspace' &&\n open &&\n (!searchable || menu.searchQuery === '') &&\n selectedValues.length > 0\n ) {\n event.preventDefault()\n removeValue(selectedValues[selectedValues.length - 1])\n return\n }\n menu.handleKeyDown(event)\n }\n\n const handleTriggerBlur = (event: FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget as Node | null\n if (next && (menu.popoverRef.current?.contains(next) || triggerRef.current?.contains(next)))\n return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\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 ? menu.listboxId : undefined}\n aria-activedescendant={searchable ? undefined : menu.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={menu.toggleMenu}\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={t('fileUploader.remove', { name: 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 <OptionMenu\n menu={menu}\n anchorRef={triggerRef}\n size={size}\n searchPlaceholder={searchPlaceholder}\n loading={loading}\n loadingText={loadingText}\n noOptionsText={noOptionsText}\n multiselectable\n labelledBy={label != null ? labelId : undefined}\n onSearchKeyDown={handleKeyDown}\n />\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","helperId","t","useT","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","selectedValues","resolvedError","resolvedHelperText","commit","next","triggerRef","useRef","fieldBlur","setTriggerRef","useCallback","node","removeValue","v","x","menu","useOptionMenu","o","_a","open","handleKeyDown","event","handleTriggerBlur","_b","chevronPx","hasValue","jsxs","clsx","styles","jsx","Typography","opt","Chip","Icon","OptionMenu"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FaA,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,IAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC,IAAU;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,KAAUI,IACfG,IAAU,GAAGD,CAAE,UACfE,IAAW,GAAGF,CAAE,WAIhBG,IAAIC,GAAA,GACJC,IAAOC,GAAA,GACPC,IAAc,GAAQF,KAAQZ,IAC9Be,IAAQD,IAAcF,EAAM,MAAMZ,CAAK,IAAI,QAC3CgB,KACJ5B,MAAU,SACNA,IACA0B,IAC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AACC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAIzC;AAAA,YACJ,SAAQ;AAAA,YACR,OAAOa,IAAgB,UAAU;AAAA,YACjC,WAAW0B,EAAO;AAAA,YAEjB,UAAAzB;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
1
+ {"version":3,"file":"MultiSelect-BTR6w5Ot.js","sources":["../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useId,\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 { useT, type ThemeColor } from '../../theme'\nimport { Chip } from '../Chip'\nimport { Icon } from '../Icon'\nimport { OptionMenu } from '../OptionMenu/OptionMenu'\nimport { useOptionMenu } from '../OptionMenu/useOptionMenu'\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 helperId = `${id}-helper`\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 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 // ── the option popover (state + keys shared with Select / PhoneField) — stays open on pick ─────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const fieldBlur = useRef<(() => void) | undefined>(undefined)\n fieldBlur.current = bound ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\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 const removeValue = (v: string) => commit(selectedValues.filter((x) => x !== v))\n\n const menu = useOptionMenu({\n idBase: id,\n options,\n isSelected: (o) => selectedValues.includes(o.value),\n onPick: (o) =>\n commit(\n selectedValues.includes(o.value)\n ? selectedValues.filter((v) => v !== o.value)\n : [...selectedValues, o.value],\n ),\n closeOnPick: false,\n highlightSelected: false,\n searchable,\n onSearchChange,\n disabled,\n focusRef: triggerRef,\n onClose: () => fieldBlur.current?.(),\n })\n const { open } = menu\n\n // Backspace removes the last chip while the search box is empty (or there's none); else the shared keys\n const handleKeyDown = (event: ReactKeyboardEvent) => {\n if (\n event.key === 'Backspace' &&\n open &&\n (!searchable || menu.searchQuery === '') &&\n selectedValues.length > 0\n ) {\n event.preventDefault()\n removeValue(selectedValues[selectedValues.length - 1])\n return\n }\n menu.handleKeyDown(event)\n }\n\n const handleTriggerBlur = (event: FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget as Node | null\n if (next && (menu.popoverRef.current?.contains(next) || triggerRef.current?.contains(next)))\n return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\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 ? menu.listboxId : undefined}\n aria-activedescendant={searchable ? undefined : menu.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={menu.toggleMenu}\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={t('fileUploader.remove', { name: 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 <OptionMenu\n menu={menu}\n anchorRef={triggerRef}\n size={size}\n searchPlaceholder={searchPlaceholder}\n loading={loading}\n loadingText={loadingText}\n noOptionsText={noOptionsText}\n multiselectable\n labelledBy={label != null ? labelId : undefined}\n onSearchKeyDown={handleKeyDown}\n />\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","helperId","t","useT","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","selectedValues","resolvedError","resolvedHelperText","commit","next","triggerRef","useRef","fieldBlur","setTriggerRef","useCallback","node","removeValue","v","x","menu","useOptionMenu","o","_a","open","handleKeyDown","event","handleTriggerBlur","_b","chevronPx","hasValue","jsxs","clsx","styles","jsx","Typography","opt","Chip","Icon","OptionMenu"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FaA,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,IAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC,IAAU;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,KAAUI,IACfG,IAAU,GAAGD,CAAE,UACfE,IAAW,GAAGF,CAAE,WAIhBG,IAAIC,GAAA,GACJC,IAAOC,GAAA,GACPC,IAAc,GAAQF,KAAQZ,IAC9Be,IAAQD,IAAcF,EAAM,MAAMZ,CAAK,IAAI,QAC3CgB,KACJ5B,MAAU,SACNA,IACA0B,IACIF,EAAM,OAAOZ,CAAK,KAA8B,CAAA,IAClD,QACFiB,IAAe7B,MAAU,UAAa0B,GACtC,CAACI,IAAUC,EAAW,IAAIC,GAAmB/B,KAAgB,CAAA,CAAE,GAC/DgC,IAAiBJ,IAAeD,KAAiBE,IAEjDI,IAAgBvC,MAASgC,KAAA,gBAAAA,EAAO,UAAS,IACzCQ,IAAqBvC,M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 @@
1
- "use strict";const o=require("react/jsx-runtime"),i=require("react"),C=require("clsx"),ae=require("./formContext-bTWrqdEV.cjs"),ue=require("./Chip-D12KcV4_.cjs"),K=require("./Icon-BVULqOJD.cjs"),O=require("./useOptionMenu-BoWyPgbY.cjs"),W=require("./Typography-B6ASPrzT.cjs"),ie=require("./ConfigProvider-ByLHqXpv.cjs"),de="_field_um3uh_1",he="_fullWidth_um3uh_7",_e="_label_um3uh_12",me="_required_um3uh_21",pe="_control_um3uh_27",fe="_filled_um3uh_47",ve="_open_um3uh_51",xe="_error_um3uh_56",ye="_disabled_um3uh_64",be="_chips_um3uh_31",ge="_value_um3uh_84",je="_valueLabel_um3uh_91",qe="_placeholder_um3uh_96",Ie="_clear_um3uh_100",Ne="_chevron_um3uh_117",Se="_sm_um3uh_127",Te="_md_um3uh_131",we="_lg_um3uh_135",Ce="_helper_um3uh_140",r={field:de,fullWidth:he,label:_e,required:me,control:pe,filled:fe,open:ve,error:xe,disabled:ye,chips:be,value:ge,valueLabel:je,placeholder:qe,clear:Ie,chevron:Ne,sm:Se,md:Te,lg:we,helper:Ce},De=i.forwardRef(function({label:_,options:D,size:d="md",error:A,helperText:F,required:R=!1,fullWidth:$=!0,disabled:c=!1,value:b,defaultValue:E,onChange:g,placeholder:H,color:Q="primary",clearable:U=!0,searchable:j=!1,searchPlaceholder:G,onSearchChange:J,loading:X=!1,loadingText:Y,noOptionsText:Z,name:a,id:z,className:ee,style:le},h){const re=i.useId(),m=z??re,q=`${m}-label`,k=`${m}-helper`,I=ie.useT(),p=ae.useFormContext(),f=!!(p&&a),s=f?p.field(a):void 0,oe=b!==void 0?b:f?p.values[a]??[]:void 0,B=b!==void 0||f,[se,ne]=i.useState(E??[]),n=B?oe:se,N=A??(s==null?void 0:s.error)??!1,S=F??(s==null?void 0:s.helperText),T=e=>{B||ne(e),f&&p.setValue(a,e),g==null||g(e)},u=i.useRef(null),v=i.useRef(void 0);v.current=s?()=>s.onBlur({}):void 0;const te=i.useCallback(e=>{u.current=e,typeof h=="function"?h(e):h&&(h.current=e)},[h]),M=e=>T(n.filter(l=>l!==e)),t=O.useOptionMenu({idBase:m,options:D,isSelected:e=>n.includes(e.value),onPick:e=>T(n.includes(e.value)?n.filter(l=>l!==e.value):[...n,e.value]),closeOnPick:!1,highlightSelected:!1,searchable:j,onSearchChange:J,disabled:c,focusRef:u,onClose:()=>{var e;return(e=v.current)==null?void 0:e.call(v)}}),{open:x}=t,L=e=>{if(e.key==="Backspace"&&x&&(!j||t.searchQuery==="")&&n.length>0){e.preventDefault(),M(n[n.length-1]);return}t.handleKeyDown(e)},ce=e=>{var y,V;const l=e.relatedTarget;l&&((y=t.popoverRef.current)!=null&&y.contains(l)||(V=u.current)!=null&&V.contains(l))||s==null||s.onBlur(e)},P=d==="sm"?16:d==="md"?14:12,w=n.length>0;return o.jsxs("div",{className:C.clsx(r.field,r[d],$&&r.fullWidth,N&&r.error,c&&r.disabled,ee),style:le,children:[_!=null&&o.jsxs("span",{id:q,className:r.label,onClick:()=>{var e;return!c&&((e=u.current)==null?void 0:e.focus())},children:[o.jsx(W.Typography,{as:"span",variant:"bodySmall",color:"muted",children:_}),R&&o.jsx("span",{className:r.required,"aria-hidden":"true",children:"*"})]}),o.jsxs("div",{ref:te,id:m,...a?{name:a}:{},role:"combobox",tabIndex:c?-1:0,"aria-haspopup":"listbox","aria-expanded":x,"aria-controls":x?t.listboxId:void 0,"aria-activedescendant":j?void 0:t.activeId,"aria-labelledby":_!=null?q:void 0,"aria-disabled":c||void 0,"aria-required":R||void 0,"aria-invalid":N||void 0,"aria-describedby":S!=null?k:void 0,className:C.clsx(r.control,x&&r.open,w&&r.filled),onClick:t.toggleMenu,onKeyDown:L,onBlur:ce,children:[w?o.jsx("span",{className:r.chips,children:n.map(e=>{const l=D.find(y=>y.value===e);return o.jsx(ue.Chip,{size:d,color:Q,disabled:c,onDelete:()=>M(e),deleteLabel:I("fileUploader.remove",{name:(l==null?void 0:l.label)??e}),deleteTabIndex:-1,children:(l==null?void 0:l.label)??e},e)})}):o.jsx("span",{className:C.clsx(r.value,r.placeholder),children:o.jsx("span",{className:r.valueLabel,children:H??I("select.placeholder")})}),U&&w&&!c&&o.jsx("button",{type:"button",className:r.clear,"aria-label":I("multiSelect.clearAll"),tabIndex:-1,onMouseDown:e=>e.preventDefault(),onClick:e=>{var l;e.stopPropagation(),T([]),(l=u.current)==null||l.focus()},children:o.jsx(K.Icon,{name:"CloseCircle",size:"sm"})}),o.jsx(K.Icon,{name:"ArrowDown4",className:r.chevron,style:{width:P,height:P},"aria-hidden":"true"})]}),o.jsx(O.OptionMenu,{menu:t,anchorRef:u,size:d,searchPlaceholder:G,loading:X,loadingText:Y,noOptionsText:Z,multiselectable:!0,labelledBy:_!=null?q:void 0,onSearchKeyDown:L}),S!=null&&o.jsx(W.Typography,{as:"span",id:k,variant:"bodySmall",color:N?"error":"muted",className:r.helper,children:S})]})});exports.MultiSelect=De;
2
- //# sourceMappingURL=MultiSelect-S5VG9g3l.cjs.map
1
+ "use strict";const o=require("react/jsx-runtime"),i=require("react"),C=require("clsx"),ae=require("./formContext-bTWrqdEV.cjs"),ue=require("./Chip-BuydTI6V.cjs"),K=require("./Icon-BUP5_kRs.cjs"),O=require("./useOptionMenu-BYeSUee6.cjs"),W=require("./Typography-B6ASPrzT.cjs"),ie=require("./ConfigProvider-CtpfSy1i.cjs"),de="_field_um3uh_1",he="_fullWidth_um3uh_7",_e="_label_um3uh_12",me="_required_um3uh_21",pe="_control_um3uh_27",fe="_filled_um3uh_47",ve="_open_um3uh_51",xe="_error_um3uh_56",ye="_disabled_um3uh_64",be="_chips_um3uh_31",ge="_value_um3uh_84",je="_valueLabel_um3uh_91",qe="_placeholder_um3uh_96",Ie="_clear_um3uh_100",Ne="_chevron_um3uh_117",Se="_sm_um3uh_127",Te="_md_um3uh_131",we="_lg_um3uh_135",Ce="_helper_um3uh_140",r={field:de,fullWidth:he,label:_e,required:me,control:pe,filled:fe,open:ve,error:xe,disabled:ye,chips:be,value:ge,valueLabel:je,placeholder:qe,clear:Ie,chevron:Ne,sm:Se,md:Te,lg:we,helper:Ce},De=i.forwardRef(function({label:_,options:D,size:d="md",error:A,helperText:F,required:R=!1,fullWidth:$=!0,disabled:c=!1,value:b,defaultValue:E,onChange:g,placeholder:H,color:Q="primary",clearable:U=!0,searchable:j=!1,searchPlaceholder:G,onSearchChange:J,loading:X=!1,loadingText:Y,noOptionsText:Z,name:a,id:z,className:ee,style:le},h){const re=i.useId(),m=z??re,q=`${m}-label`,k=`${m}-helper`,I=ie.useT(),p=ae.useFormContext(),f=!!(p&&a),s=f?p.field(a):void 0,oe=b!==void 0?b:f?p.values[a]??[]:void 0,B=b!==void 0||f,[se,ne]=i.useState(E??[]),n=B?oe:se,N=A??(s==null?void 0:s.error)??!1,S=F??(s==null?void 0:s.helperText),T=e=>{B||ne(e),f&&p.setValue(a,e),g==null||g(e)},u=i.useRef(null),v=i.useRef(void 0);v.current=s?()=>s.onBlur({}):void 0;const te=i.useCallback(e=>{u.current=e,typeof h=="function"?h(e):h&&(h.current=e)},[h]),M=e=>T(n.filter(l=>l!==e)),t=O.useOptionMenu({idBase:m,options:D,isSelected:e=>n.includes(e.value),onPick:e=>T(n.includes(e.value)?n.filter(l=>l!==e.value):[...n,e.value]),closeOnPick:!1,highlightSelected:!1,searchable:j,onSearchChange:J,disabled:c,focusRef:u,onClose:()=>{var e;return(e=v.current)==null?void 0:e.call(v)}}),{open:x}=t,L=e=>{if(e.key==="Backspace"&&x&&(!j||t.searchQuery==="")&&n.length>0){e.preventDefault(),M(n[n.length-1]);return}t.handleKeyDown(e)},ce=e=>{var y,V;const l=e.relatedTarget;l&&((y=t.popoverRef.current)!=null&&y.contains(l)||(V=u.current)!=null&&V.contains(l))||s==null||s.onBlur(e)},P=d==="sm"?16:d==="md"?14:12,w=n.length>0;return o.jsxs("div",{className:C.clsx(r.field,r[d],$&&r.fullWidth,N&&r.error,c&&r.disabled,ee),style:le,children:[_!=null&&o.jsxs("span",{id:q,className:r.label,onClick:()=>{var e;return!c&&((e=u.current)==null?void 0:e.focus())},children:[o.jsx(W.Typography,{as:"span",variant:"bodySmall",color:"muted",children:_}),R&&o.jsx("span",{className:r.required,"aria-hidden":"true",children:"*"})]}),o.jsxs("div",{ref:te,id:m,...a?{name:a}:{},role:"combobox",tabIndex:c?-1:0,"aria-haspopup":"listbox","aria-expanded":x,"aria-controls":x?t.listboxId:void 0,"aria-activedescendant":j?void 0:t.activeId,"aria-labelledby":_!=null?q:void 0,"aria-disabled":c||void 0,"aria-required":R||void 0,"aria-invalid":N||void 0,"aria-describedby":S!=null?k:void 0,className:C.clsx(r.control,x&&r.open,w&&r.filled),onClick:t.toggleMenu,onKeyDown:L,onBlur:ce,children:[w?o.jsx("span",{className:r.chips,children:n.map(e=>{const l=D.find(y=>y.value===e);return o.jsx(ue.Chip,{size:d,color:Q,disabled:c,onDelete:()=>M(e),deleteLabel:I("fileUploader.remove",{name:(l==null?void 0:l.label)??e}),deleteTabIndex:-1,children:(l==null?void 0:l.label)??e},e)})}):o.jsx("span",{className:C.clsx(r.value,r.placeholder),children:o.jsx("span",{className:r.valueLabel,children:H??I("select.placeholder")})}),U&&w&&!c&&o.jsx("button",{type:"button",className:r.clear,"aria-label":I("multiSelect.clearAll"),tabIndex:-1,onMouseDown:e=>e.preventDefault(),onClick:e=>{var l;e.stopPropagation(),T([]),(l=u.current)==null||l.focus()},children:o.jsx(K.Icon,{name:"CloseCircle",size:"sm"})}),o.jsx(K.Icon,{name:"ArrowDown4",className:r.chevron,style:{width:P,height:P},"aria-hidden":"true"})]}),o.jsx(O.OptionMenu,{menu:t,anchorRef:u,size:d,searchPlaceholder:G,loading:X,loadingText:Y,noOptionsText:Z,multiselectable:!0,labelledBy:_!=null?q:void 0,onSearchKeyDown:L}),S!=null&&o.jsx(W.Typography,{as:"span",id:k,variant:"bodySmall",color:N?"error":"muted",className:r.helper,children:S})]})});exports.MultiSelect=De;
2
+ //# sourceMappingURL=MultiSelect-IDAJ5a5K.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect-S5VG9g3l.cjs","sources":["../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useId,\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 { useT, type ThemeColor } from '../../theme'\nimport { Chip } from '../Chip'\nimport { Icon } from '../Icon'\nimport { OptionMenu } from '../OptionMenu/OptionMenu'\nimport { useOptionMenu } from '../OptionMenu/useOptionMenu'\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 helperId = `${id}-helper`\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 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 // ── the option popover (state + keys shared with Select / PhoneField) — stays open on pick ─────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const fieldBlur = useRef<(() => void) | undefined>(undefined)\n fieldBlur.current = bound ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\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 const removeValue = (v: string) => commit(selectedValues.filter((x) => x !== v))\n\n const menu = useOptionMenu({\n idBase: id,\n options,\n isSelected: (o) => selectedValues.includes(o.value),\n onPick: (o) =>\n commit(\n selectedValues.includes(o.value)\n ? selectedValues.filter((v) => v !== o.value)\n : [...selectedValues, o.value],\n ),\n closeOnPick: false,\n highlightSelected: false,\n searchable,\n onSearchChange,\n disabled,\n focusRef: triggerRef,\n onClose: () => fieldBlur.current?.(),\n })\n const { open } = menu\n\n // Backspace removes the last chip while the search box is empty (or there's none); else the shared keys\n const handleKeyDown = (event: ReactKeyboardEvent) => {\n if (\n event.key === 'Backspace' &&\n open &&\n (!searchable || menu.searchQuery === '') &&\n selectedValues.length > 0\n ) {\n event.preventDefault()\n removeValue(selectedValues[selectedValues.length - 1])\n return\n }\n menu.handleKeyDown(event)\n }\n\n const handleTriggerBlur = (event: FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget as Node | null\n if (next && (menu.popoverRef.current?.contains(next) || triggerRef.current?.contains(next)))\n return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\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 ? menu.listboxId : undefined}\n aria-activedescendant={searchable ? undefined : menu.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={menu.toggleMenu}\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={t('fileUploader.remove', { name: 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 <OptionMenu\n menu={menu}\n anchorRef={triggerRef}\n size={size}\n searchPlaceholder={searchPlaceholder}\n loading={loading}\n loadingText={loadingText}\n noOptionsText={noOptionsText}\n multiselectable\n labelledBy={label != null ? labelId : undefined}\n onSearchKeyDown={handleKeyDown}\n />\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","helperId","t","useT","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","selectedValues","resolvedError","resolvedHelperText","commit","next","triggerRef","useRef","fieldBlur","setTriggerRef","useCallback","node","removeValue","v","x","menu","useOptionMenu","o","_a","open","handleKeyDown","event","handleTriggerBlur","_b","chevronPx","hasValue","jsxs","clsx","styles","jsx","Typography","opt","Chip","Icon","OptionMenu"],"mappings":"o6BA2FaA,GAAcC,EAAAA,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DAJ5a5K.cjs","sources":["../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useId,\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 { useT, type ThemeColor } from '../../theme'\nimport { Chip } from '../Chip'\nimport { Icon } from '../Icon'\nimport { OptionMenu } from '../OptionMenu/OptionMenu'\nimport { useOptionMenu } from '../OptionMenu/useOptionMenu'\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 helperId = `${id}-helper`\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 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 // ── the option popover (state + keys shared with Select / PhoneField) — stays open on pick ─────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const fieldBlur = useRef<(() => void) | undefined>(undefined)\n fieldBlur.current = bound ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\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 const removeValue = (v: string) => commit(selectedValues.filter((x) => x !== v))\n\n const menu = useOptionMenu({\n idBase: id,\n options,\n isSelected: (o) => selectedValues.includes(o.value),\n onPick: (o) =>\n commit(\n selectedValues.includes(o.value)\n ? selectedValues.filter((v) => v !== o.value)\n : [...selectedValues, o.value],\n ),\n closeOnPick: false,\n highlightSelected: false,\n searchable,\n onSearchChange,\n disabled,\n focusRef: triggerRef,\n onClose: () => fieldBlur.current?.(),\n })\n const { open } = menu\n\n // Backspace removes the last chip while the search box is empty (or there's none); else the shared keys\n const handleKeyDown = (event: ReactKeyboardEvent) => {\n if (\n event.key === 'Backspace' &&\n open &&\n (!searchable || menu.searchQuery === '') &&\n selectedValues.length > 0\n ) {\n event.preventDefault()\n removeValue(selectedValues[selectedValues.length - 1])\n return\n }\n menu.handleKeyDown(event)\n }\n\n const handleTriggerBlur = (event: FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget as Node | null\n if (next && (menu.popoverRef.current?.contains(next) || triggerRef.current?.contains(next)))\n return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\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 ? menu.listboxId : undefined}\n aria-activedescendant={searchable ? undefined : menu.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={menu.toggleMenu}\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={t('fileUploader.remove', { name: 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 <OptionMenu\n menu={menu}\n anchorRef={triggerRef}\n size={size}\n searchPlaceholder={searchPlaceholder}\n loading={loading}\n loadingText={loadingText}\n noOptionsText={noOptionsText}\n multiselectable\n labelledBy={label != null ? labelId : undefined}\n onSearchKeyDown={handleKeyDown}\n />\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","helperId","t","useT","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","selectedValues","resolvedError","resolvedHelperText","commit","next","triggerRef","useRef","fieldBlur","setTriggerRef","useCallback","node","removeValue","v","x","menu","useOptionMenu","o","_a","open","handleKeyDown","event","handleTriggerBlur","_b","chevronPx","hasValue","jsxs","clsx","styles","jsx","Typography","opt","Chip","Icon","OptionMenu"],"mappings":"o6BA2FaA,GAAcC,EAAAA,WAA6C,SACtE,CACE,MAAAC,EACA,QAAAC,EACA,KAAAC,EAAO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,QAASlB,EAAG,EAE/D,eAAgB,GAEf,2BAAK,QAASA,CAAA,EATVA,CAAA,CAYX,CAAC,EACH,EAEAgB,EAAAA,IAAC,QAAK,UAAWF,EAAAA,KAAKC,EAAO,MAAOA,EAAO,WAAW,EACpD,SAAAC,EAAAA,IAAC,QAAK,UAAWD,EAAO,WAAa,SAAAzD,GAAemB,EAAE,oBAAoB,CAAA,CAAE,CAAA,CAC9E,EAGDjB,GAAaoD,GAAY,CAAC1D,GACzB8D,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,UAAWD,EAAO,MAClB,aAAYtC,EAAE,sBAAsB,EACpC,SAAU,GACV,YAAc,GAAM,EAAE,eAAA,EACtB,QAAU,GAAM,OACd,EAAE,gBAAA,EACFc,EAAO,CAAA,CAAE,GACTc,EAAAZ,EAAW,UAAX,MAAAY,EAAoB,OACtB,EAEA,SAAAW,EAAAA,IAACI,OAAA,CAAK,KAAK,cAAc,KAAK,IAAA,CAAK,CAAA,CAAA,EAIvCJ,EAAAA,IAACI,EAAAA,KAAA,CACC,KAAK,aACL,UAAWL,EAAO,QAClB,MAAO,CAAE,MAAOJ,EAAW,OAAQA,CAAA,EACnC,cAAY,MAAA,CAAA,CACd,CAAA,CAAA,EAGFK,EAAAA,IAACK,EAAAA,WAAA,CACC,KAAAnB,EACA,UAAWT,EACX,KAAA5C,EACA,kBAAAa,EACA,QAAAE,EACA,YAAAC,EACA,cAAAC,EACA,gBAAe,GACf,WAAYnB,GAAS,KAAO4B,EAAU,OACtC,gBAAiBgC,CAAA,CAAA,EAGlBjB,GAAsB,MACrB0B,EAAAA,IAACC,EAAAA,WAAA,CACC,GAAG,OACH,GAAIzC,EACJ,QAAQ,YACR,MAAOa,EAAgB,QAAU,QACjC,UAAW0B,EAAO,OAEjB,SAAAzB,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,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-BVULqOJD.cjs"),O=require("./IconButton-BNa0yLcv.cjs"),Q=require("./Typography-B6ASPrzT.cjs"),r=require("./TextField.module-DsNCo8vN.cjs"),xe=require("./ConfigProvider-ByLHqXpv.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-SSGXlF8U.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-BUP5_kRs.cjs"),O=require("./IconButton-CvIXSFsr.cjs"),Q=require("./Typography-B6ASPrzT.cjs"),r=require("./TextField.module-DsNCo8vN.cjs"),xe=require("./ConfigProvider-CtpfSy1i.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-Cg0XEDgW.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumberField-SSGXlF8U.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,QAA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AAA,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"}
1
+ {"version":3,"file":"NumberField-Cg0XEDgW.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,S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UAAWmB,EAAAA,YAAY,OAEtB,SAAAlB,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC"}
@@ -2,11 +2,11 @@ import { jsxs as x, jsx as a, Fragment as Ne } from "react/jsx-runtime";
2
2
  import { forwardRef as ye, useId as be, useState as J, useEffect as Ie, useRef as K, useCallback as Re, useLayoutEffect as xe } from "react";
3
3
  import { clsx as O } from "clsx";
4
4
  import { u as Fe } from "./formContext-B7ln1Miy.js";
5
- import { I as Q } from "./Icon-DaTvzLBu.js";
6
- import { I as X } from "./IconButton-GU3Ud4Zg.js";
5
+ import { I as Q } from "./Icon-CGQ5yGSZ.js";
6
+ import { I as X } from "./IconButton-CL_6iMQh.js";
7
7
  import { T as Y } from "./Typography-CJv5AnRP.js";
8
8
  import { f as r } from "./TextField.module-6gYcR9TL.js";
9
- import { a as Me } from "./ConfigProvider-BbsI15b-.js";
9
+ import { a as Me } from "./ConfigProvider-Ct0Pe3Ku.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-CzyvDMRV.js.map
183
+ //# sourceMappingURL=NumberField-DlaW-g3Z.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumberField-CzyvDMRV.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;A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AAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
1
+ {"version":3,"file":"NumberField-DlaW-g3Z.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,IAAOF,EAAQ,WAAW,GAAG,IAAI,MAAM,IAEvCG,KADSD,IAAOF,EAAQ,MAAM,CAAC,IAAIA,GAClB,QAAQ,yBAAyBD,CAAS;AACjE,SAAOE,KAAW,OAAO,GAAGC,CAAI,GAAGC,CAAO,IAAIF,CAAO,KAAK,GAAGC,CAAI,GAAGC,CAAO;AAC7E;AAGA,SAASC,GAAYC,GAAWC,GAAqB;AACnD,MAAIb,IAAI;AACR,aAAWc,KAAKF,EAAG,CAAIE,MAAMD,KAAKb;AAClC,SAAOA;AACT;AAGA,SAASe,GAAoBC,GAAaH,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AUxD,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,2 +1,2 @@
1
- "use strict";const n=require("react/jsx-runtime"),_=require("react"),k=require("clsx"),ee=require("./formContext-bTWrqdEV.cjs"),R=require("./Typography-B6ASPrzT.cjs"),u=require("./TextField.module-DsNCo8vN.cjs"),te=require("./ConfigProvider-ByLHqXpv.cjs"),se="_row_1bbms_2",re="_center_1bbms_14",oe="_end_1bbms_15",le="_sm_1bbms_27",ce="_md_1bbms_31",ne="_lg_1bbms_35",ae="_box_1bbms_41",ie="_filled_1bbms_65",de="_invalid_1bbms_82",m={row:se,center:re,end:oe,sm:le,md:ce,lg:ne,box:ae,filled:ie,invalid:de},fe={numeric:/[0-9]/,alphabetic:/[A-Za-z]/,alphanumeric:/[A-Za-z0-9]/};function ue(S,l){const a=[...S].slice(0,l);for(;a.length<l;)a.push("");return a}const me=_.forwardRef(function({length:l=4,type:a="numeric",value:v,defaultValue:A,onChange:g,onComplete:T,name:i,label:y,helperText:I,error:z,required:O=!1,disabled:q=!1,autoFocus:P=!1,placeholder:C,size:E="md",align:M="start",color:V="primary",className:K,style:Z},$){const H=te.useT(),F=`${_.useId()}-helper`,B=fe[a],p=ee.useFormContext(),w=!!(p&&i),o=p&&i?p.field(i):void 0,L=v!==void 0?v:w?p.values[i]:void 0,N=v!==void 0||w,[G,J]=_.useState(A??""),Q=N?L??"":G,x=z??(o==null?void 0:o.error)??!1,D=I??(o==null?void 0:o.helperText),d=ue(Q,l),j=_.useRef([]);_.useEffect(()=>{var t;P&&((t=j.current[0])==null||t.focus())},[]);const f=t=>{const e=j.current[Math.max(0,Math.min(t,l-1))];e==null||e.focus(),e==null||e.select()},b=t=>{const e=t.join("");N||J(e),w&&p.setValue(i,e),g==null||g(e),t.every(s=>s!=="")&&(T==null||T(e))},U=(t,e)=>{const s=[...e].filter(r=>B.test(r));if(e!==""&&s.length===0)return;const c=[...d];if(s.length<=1)c[t]=s[0]??"",b(c),s[0]&&f(t+1);else{let r=t;for(const h of s){if(r>=l)break;c[r]=h,r++}b(c),f(r)}},W=(t,e)=>{if(e.key==="Backspace"){if(d[t]===""&&t>0){e.preventDefault();const s=[...d];s[t-1]="",b(s),f(t-1)}}else if(e.key==="ArrowLeft")e.preventDefault(),f(t-1);else if(e.key==="ArrowRight")e.preventDefault(),f(t+1);else if(e.key==="Delete"){e.preventDefault();const s=[...d];s[t]="",b(s)}},X=(t,e)=>{e.preventDefault();const s=[...e.clipboardData.getData("text")].filter(h=>B.test(h));if(s.length===0)return;const c=[...d];let r=t;for(const h of s){if(r>=l)break;c[r]=h,r++}b(c),f(r)},Y=t=>{t.currentTarget.contains(t.relatedTarget)||o==null||o.onBlur(t)};return n.jsxs("div",{ref:$,className:k.clsx(u.fieldStyles.field,x&&u.fieldStyles.error,q&&u.fieldStyles.disabled,K),style:{"--tz-btn-rgb":`var(--tz-color-${V}-rgb)`,...Z},children:[y!=null&&n.jsxs("span",{className:u.fieldStyles.label,children:[n.jsx(R.Typography,{as:"span",variant:"bodySmall",color:"muted",children:y}),O&&n.jsx("span",{className:u.fieldStyles.required,"aria-hidden":"true",children:"*"})]}),n.jsx("div",{role:"group","aria-label":typeof y=="string"?y:"One-time code","aria-invalid":x||void 0,"aria-describedby":D!=null?F:void 0,className:k.clsx(m.row,m[E],m[M],x&&m.invalid),onBlur:Y,children:d.map((t,e)=>n.jsx("input",{ref:s=>{j.current[e]=s},name:e===0?i:void 0,type:"text",inputMode:a==="numeric"?"numeric":"text",autoComplete:e===0?"one-time-code":"off","aria-label":H("otpField.digit",{index:e+1,total:l}),className:k.clsx(m.box,t!==""&&m.filled),value:t,placeholder:C,disabled:q,onChange:s=>U(e,s.target.value),onKeyDown:s=>W(e,s),onPaste:s=>X(e,s),onFocus:s=>s.target.select()},e))}),D!=null&&n.jsx(R.Typography,{as:"span",id:F,variant:"bodySmall",color:x?"error":"muted",className:u.fieldStyles.helper,children:D})]})});exports.OtpField=me;
2
- //# sourceMappingURL=OtpField-Pr7Ch0El.cjs.map
1
+ "use strict";const n=require("react/jsx-runtime"),_=require("react"),k=require("clsx"),ee=require("./formContext-bTWrqdEV.cjs"),R=require("./Typography-B6ASPrzT.cjs"),u=require("./TextField.module-DsNCo8vN.cjs"),te=require("./ConfigProvider-CtpfSy1i.cjs"),se="_row_1bbms_2",re="_center_1bbms_14",oe="_end_1bbms_15",le="_sm_1bbms_27",ce="_md_1bbms_31",ne="_lg_1bbms_35",ae="_box_1bbms_41",ie="_filled_1bbms_65",de="_invalid_1bbms_82",m={row:se,center:re,end:oe,sm:le,md:ce,lg:ne,box:ae,filled:ie,invalid:de},fe={numeric:/[0-9]/,alphabetic:/[A-Za-z]/,alphanumeric:/[A-Za-z0-9]/};function ue(S,l){const a=[...S].slice(0,l);for(;a.length<l;)a.push("");return a}const me=_.forwardRef(function({length:l=4,type:a="numeric",value:v,defaultValue:A,onChange:g,onComplete:T,name:i,label:y,helperText:I,error:z,required:O=!1,disabled:q=!1,autoFocus:P=!1,placeholder:C,size:E="md",align:M="start",color:V="primary",className:K,style:Z},$){const H=te.useT(),F=`${_.useId()}-helper`,B=fe[a],p=ee.useFormContext(),w=!!(p&&i),o=p&&i?p.field(i):void 0,L=v!==void 0?v:w?p.values[i]:void 0,N=v!==void 0||w,[G,J]=_.useState(A??""),Q=N?L??"":G,x=z??(o==null?void 0:o.error)??!1,D=I??(o==null?void 0:o.helperText),d=ue(Q,l),j=_.useRef([]);_.useEffect(()=>{var t;P&&((t=j.current[0])==null||t.focus())},[]);const f=t=>{const e=j.current[Math.max(0,Math.min(t,l-1))];e==null||e.focus(),e==null||e.select()},b=t=>{const e=t.join("");N||J(e),w&&p.setValue(i,e),g==null||g(e),t.every(s=>s!=="")&&(T==null||T(e))},U=(t,e)=>{const s=[...e].filter(r=>B.test(r));if(e!==""&&s.length===0)return;const c=[...d];if(s.length<=1)c[t]=s[0]??"",b(c),s[0]&&f(t+1);else{let r=t;for(const h of s){if(r>=l)break;c[r]=h,r++}b(c),f(r)}},W=(t,e)=>{if(e.key==="Backspace"){if(d[t]===""&&t>0){e.preventDefault();const s=[...d];s[t-1]="",b(s),f(t-1)}}else if(e.key==="ArrowLeft")e.preventDefault(),f(t-1);else if(e.key==="ArrowRight")e.preventDefault(),f(t+1);else if(e.key==="Delete"){e.preventDefault();const s=[...d];s[t]="",b(s)}},X=(t,e)=>{e.preventDefault();const s=[...e.clipboardData.getData("text")].filter(h=>B.test(h));if(s.length===0)return;const c=[...d];let r=t;for(const h of s){if(r>=l)break;c[r]=h,r++}b(c),f(r)},Y=t=>{t.currentTarget.contains(t.relatedTarget)||o==null||o.onBlur(t)};return n.jsxs("div",{ref:$,className:k.clsx(u.fieldStyles.field,x&&u.fieldStyles.error,q&&u.fieldStyles.disabled,K),style:{"--tz-btn-rgb":`var(--tz-color-${V}-rgb)`,...Z},children:[y!=null&&n.jsxs("span",{className:u.fieldStyles.label,children:[n.jsx(R.Typography,{as:"span",variant:"bodySmall",color:"muted",children:y}),O&&n.jsx("span",{className:u.fieldStyles.required,"aria-hidden":"true",children:"*"})]}),n.jsx("div",{role:"group","aria-label":typeof y=="string"?y:"One-time code","aria-invalid":x||void 0,"aria-describedby":D!=null?F:void 0,className:k.clsx(m.row,m[E],m[M],x&&m.invalid),onBlur:Y,children:d.map((t,e)=>n.jsx("input",{ref:s=>{j.current[e]=s},name:e===0?i:void 0,type:"text",inputMode:a==="numeric"?"numeric":"text",autoComplete:e===0?"one-time-code":"off","aria-label":H("otpField.digit",{index:e+1,total:l}),className:k.clsx(m.box,t!==""&&m.filled),value:t,placeholder:C,disabled:q,onChange:s=>U(e,s.target.value),onKeyDown:s=>W(e,s),onPaste:s=>X(e,s),onFocus:s=>s.target.select()},e))}),D!=null&&n.jsx(R.Typography,{as:"span",id:F,variant:"bodySmall",color:x?"error":"muted",className:u.fieldStyles.helper,children:D})]})});exports.OtpField=me;
2
+ //# sourceMappingURL=OtpField-DsedK1nQ.cjs.map