@fuf-stack/uniform 1.11.3 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/dist/Checkboxes/index.cjs +1 -1
  2. package/dist/Checkboxes/index.d.cts +1 -1
  3. package/dist/Checkboxes/index.d.ts +1 -1
  4. package/dist/Checkboxes/index.js +1 -1
  5. package/dist/{Checkboxes-BvW4D5Nm.js → Checkboxes-BQI2kTIb.js} +2 -2
  6. package/dist/{Checkboxes-BvW4D5Nm.js.map → Checkboxes-BQI2kTIb.js.map} +1 -1
  7. package/dist/{Checkboxes-Cvdazf25.cjs → Checkboxes-mc1ZItR5.cjs} +4 -4
  8. package/dist/{Checkboxes-Cvdazf25.cjs.map → Checkboxes-mc1ZItR5.cjs.map} +1 -1
  9. package/dist/FieldArray/index.cjs +1 -1
  10. package/dist/FieldArray/index.d.cts +1 -1
  11. package/dist/FieldArray/index.d.ts +1 -1
  12. package/dist/FieldArray/index.js +1 -1
  13. package/dist/{FieldArray-CJpDgK_t.cjs → FieldArray-CsAyIsw9.cjs} +7 -7
  14. package/dist/{FieldArray-CJpDgK_t.cjs.map → FieldArray-CsAyIsw9.cjs.map} +1 -1
  15. package/dist/{FieldArray-omRNwxgy.js → FieldArray-D4eGdGXA.js} +4 -4
  16. package/dist/{FieldArray-omRNwxgy.js.map → FieldArray-D4eGdGXA.js.map} +1 -1
  17. package/dist/FieldCard/index.cjs +1 -1
  18. package/dist/FieldCard/index.d.cts +1 -1
  19. package/dist/FieldCard/index.d.ts +1 -1
  20. package/dist/FieldCard/index.js +1 -1
  21. package/dist/{FieldCard-Dyi-2qr6.js → FieldCard-BPQIqqW5.js} +2 -2
  22. package/dist/{FieldCard-Dyi-2qr6.js.map → FieldCard-BPQIqqW5.js.map} +1 -1
  23. package/dist/{FieldCard-Dt6QU7o7.cjs → FieldCard-CgWjzrRD.cjs} +4 -4
  24. package/dist/{FieldCard-Dt6QU7o7.cjs.map → FieldCard-CgWjzrRD.cjs.map} +1 -1
  25. package/dist/{FieldCopyTestIdButton-By-hEZgA.cjs → FieldCopyTestIdButton-DxJYKqrz.cjs} +2 -2
  26. package/dist/{FieldCopyTestIdButton-By-hEZgA.cjs.map → FieldCopyTestIdButton-DxJYKqrz.cjs.map} +1 -1
  27. package/dist/{FieldValidationError-D64j5gnH.cjs → FieldValidationError-A384-L3Y.cjs} +2 -2
  28. package/dist/{FieldValidationError-D64j5gnH.cjs.map → FieldValidationError-A384-L3Y.cjs.map} +1 -1
  29. package/dist/Form/index.cjs +1 -1
  30. package/dist/Form/index.d.cts +1 -1
  31. package/dist/Form/index.d.ts +1 -1
  32. package/dist/Form/index.js +1 -1
  33. package/dist/{Form-B1fvbnxi.js → Form-B7bv9fDO.js} +3 -3
  34. package/dist/{Form-B1fvbnxi.js.map → Form-B7bv9fDO.js.map} +1 -1
  35. package/dist/{Form-CvnnGF45.cjs → Form-Ca3RxssB.cjs} +3 -3
  36. package/dist/{Form-CvnnGF45.cjs.map → Form-Ca3RxssB.cjs.map} +1 -1
  37. package/dist/{FormContext-Lw4YL4-B.cjs → FormContext-CeFKQmVH.cjs} +2 -2
  38. package/dist/{FormContext-Lw4YL4-B.cjs.map → FormContext-CeFKQmVH.cjs.map} +1 -1
  39. package/dist/{FormContext-Dl3k1r_k.js → FormContext-DHYlCZ2u.js} +2 -2
  40. package/dist/{FormContext-Dl3k1r_k.js.map → FormContext-DHYlCZ2u.js.map} +1 -1
  41. package/dist/Grid/index.cjs +1 -1
  42. package/dist/Grid/index.d.cts +1 -1
  43. package/dist/Grid/index.d.ts +1 -1
  44. package/dist/{Grid-DezBAZbx.cjs → Grid-CRURvciu.cjs} +2 -2
  45. package/dist/{Grid-DezBAZbx.cjs.map → Grid-CRURvciu.cjs.map} +1 -1
  46. package/dist/Input/index.cjs +1 -1
  47. package/dist/Input/index.d.cts +1 -1
  48. package/dist/Input/index.d.ts +1 -1
  49. package/dist/Input/index.js +1 -1
  50. package/dist/{Input-DR0gCf9q.cjs → Input-7TmTrrV7.cjs} +4 -4
  51. package/dist/{Input-DR0gCf9q.cjs.map → Input-7TmTrrV7.cjs.map} +1 -1
  52. package/dist/{Input-DksaHK1Y.js → Input-BUfOTtDR.js} +3 -3
  53. package/dist/{Input-DksaHK1Y.js.map → Input-BUfOTtDR.js.map} +1 -1
  54. package/dist/RadioBoxes/index.cjs +1 -1
  55. package/dist/RadioBoxes/index.d.cts +1 -1
  56. package/dist/RadioBoxes/index.d.ts +1 -1
  57. package/dist/RadioBoxes/index.js +1 -1
  58. package/dist/{RadioBoxes-h-VLhJ9d.cjs → RadioBoxes-CjxWldIR.cjs} +11 -7
  59. package/dist/RadioBoxes-CjxWldIR.cjs.map +1 -0
  60. package/dist/{RadioBoxes-DdIHH6B5.js → RadioBoxes-Dpd71z1S.js} +10 -6
  61. package/dist/RadioBoxes-Dpd71z1S.js.map +1 -0
  62. package/dist/RadioTabs/index.cjs +1 -1
  63. package/dist/RadioTabs/index.d.cts +1 -1
  64. package/dist/RadioTabs/index.d.ts +1 -1
  65. package/dist/RadioTabs/index.js +1 -1
  66. package/dist/{RadioTabs-D6yF9jE3.cjs → RadioTabs-BA-EMFRc.cjs} +11 -7
  67. package/dist/RadioTabs-BA-EMFRc.cjs.map +1 -0
  68. package/dist/{RadioTabs-dLdlF91p.js → RadioTabs-BZlC19z0.js} +10 -6
  69. package/dist/RadioTabs-BZlC19z0.js.map +1 -0
  70. package/dist/Radios/index.cjs +1 -1
  71. package/dist/Radios/index.d.cts +1 -1
  72. package/dist/Radios/index.d.ts +1 -1
  73. package/dist/Radios/index.js +1 -1
  74. package/dist/{Radios-D8alyG2f.cjs → Radios-Bfxy-Vnf.cjs} +11 -7
  75. package/dist/Radios-Bfxy-Vnf.cjs.map +1 -0
  76. package/dist/{Radios-DiZ0Dfmp.js → Radios-ClBrO7QR.js} +10 -6
  77. package/dist/Radios-ClBrO7QR.js.map +1 -0
  78. package/dist/Select/index.cjs +1 -1
  79. package/dist/Select/index.d.cts +1 -1
  80. package/dist/Select/index.d.ts +1 -1
  81. package/dist/Select/index.js +1 -1
  82. package/dist/{Select-C9otN8uu.js → Select-9MyYYGeZ.js} +12 -7
  83. package/dist/Select-9MyYYGeZ.js.map +1 -0
  84. package/dist/{Select-DQVskslz.cjs → Select-CdTgOiUU.cjs} +13 -8
  85. package/dist/Select-CdTgOiUU.cjs.map +1 -0
  86. package/dist/Slider/index.cjs +1 -1
  87. package/dist/Slider/index.d.cts +1 -1
  88. package/dist/Slider/index.d.ts +1 -1
  89. package/dist/Slider/index.js +1 -1
  90. package/dist/{Slider-DwfyCQDM.cjs → Slider-CK9n0ryX.cjs} +3 -3
  91. package/dist/{Slider-DwfyCQDM.cjs.map → Slider-CK9n0ryX.cjs.map} +1 -1
  92. package/dist/{Slider-meuLEC2k.js → Slider-Cy5vz5as.js} +2 -2
  93. package/dist/{Slider-meuLEC2k.js.map → Slider-Cy5vz5as.js.map} +1 -1
  94. package/dist/SubmitButton/index.cjs +1 -1
  95. package/dist/SubmitButton/index.d.cts +1 -1
  96. package/dist/SubmitButton/index.d.ts +1 -1
  97. package/dist/SubmitButton/index.js +1 -1
  98. package/dist/{SubmitButton-BHP9J9ml.js → SubmitButton-BrbHJcb4.js} +2 -2
  99. package/dist/{SubmitButton-BHP9J9ml.js.map → SubmitButton-BrbHJcb4.js.map} +1 -1
  100. package/dist/{SubmitButton-B0kvUqkd.cjs → SubmitButton-C6sgPR8K.cjs} +3 -3
  101. package/dist/{SubmitButton-B0kvUqkd.cjs.map → SubmitButton-C6sgPR8K.cjs.map} +1 -1
  102. package/dist/Switch/index.cjs +1 -1
  103. package/dist/Switch/index.d.cts +1 -1
  104. package/dist/Switch/index.d.ts +1 -1
  105. package/dist/Switch/index.js +1 -1
  106. package/dist/{Switch-Ds0gDzjR.cjs → Switch-BBhxgBHh.cjs} +3 -3
  107. package/dist/{Switch-Ds0gDzjR.cjs.map → Switch-BBhxgBHh.cjs.map} +1 -1
  108. package/dist/{Switch-DkciIYnD.js → Switch-s64WUP5i.js} +2 -2
  109. package/dist/{Switch-DkciIYnD.js.map → Switch-s64WUP5i.js.map} +1 -1
  110. package/dist/SwitchBox/index.cjs +1 -1
  111. package/dist/SwitchBox/index.d.cts +1 -1
  112. package/dist/SwitchBox/index.d.ts +1 -1
  113. package/dist/SwitchBox/index.js +1 -1
  114. package/dist/{SwitchBox-B9JqwDtN.cjs → SwitchBox-BwdvgHpG.cjs} +3 -3
  115. package/dist/{SwitchBox-B9JqwDtN.cjs.map → SwitchBox-BwdvgHpG.cjs.map} +1 -1
  116. package/dist/{SwitchBox-B6Z4rtWt.js → SwitchBox-CMw1MGJ0.js} +2 -2
  117. package/dist/{SwitchBox-B6Z4rtWt.js.map → SwitchBox-CMw1MGJ0.js.map} +1 -1
  118. package/dist/TextArea/index.cjs +1 -1
  119. package/dist/TextArea/index.d.cts +1 -1
  120. package/dist/TextArea/index.d.ts +1 -1
  121. package/dist/TextArea/index.js +1 -1
  122. package/dist/{TextArea-BqQtlPSV.cjs → TextArea-COe8XP7f.cjs} +4 -4
  123. package/dist/{TextArea-BqQtlPSV.cjs.map → TextArea-COe8XP7f.cjs.map} +1 -1
  124. package/dist/{TextArea-DAx49KI6.js → TextArea-DTkDJr6g.js} +3 -3
  125. package/dist/{TextArea-DAx49KI6.js.map → TextArea-DTkDJr6g.js.map} +1 -1
  126. package/dist/helpers/index.cjs +2 -1
  127. package/dist/helpers/index.d.cts +23 -1
  128. package/dist/helpers/index.d.cts.map +1 -1
  129. package/dist/helpers/index.d.ts +23 -1
  130. package/dist/helpers/index.d.ts.map +1 -1
  131. package/dist/helpers/index.js +2 -2
  132. package/dist/{helpers-nYTmL2gX.cjs → helpers-CncbgvW_.cjs} +52 -2
  133. package/dist/helpers-CncbgvW_.cjs.map +1 -0
  134. package/dist/{helpers-CCINRgQk.js → helpers-D3A5d3M1.js} +46 -2
  135. package/dist/helpers-D3A5d3M1.js.map +1 -0
  136. package/dist/hooks/useClientValidation/index.cjs +1 -1
  137. package/dist/hooks/useClientValidation/index.js +1 -1
  138. package/dist/hooks/useController/index.cjs +1 -1
  139. package/dist/hooks/useController/index.js +1 -1
  140. package/dist/hooks/useFormContext/index.cjs +1 -1
  141. package/dist/hooks/useFormContext/index.d.cts +1 -1
  142. package/dist/hooks/useFormContext/index.d.ts +1 -1
  143. package/dist/hooks/useFormContext/index.js +1 -1
  144. package/dist/hooks/useInput/index.cjs +1 -1
  145. package/dist/hooks/useInputValueDebounce/index.cjs +1 -1
  146. package/dist/hooks/useInputValueDebounce/index.js +1 -1
  147. package/dist/hooks/useInputValueTransform/index.cjs +1 -1
  148. package/dist/hooks/useUniformField/index.cjs +1 -1
  149. package/dist/hooks/useUniformField/index.d.cts +1 -1
  150. package/dist/hooks/useUniformField/index.d.ts +2 -2
  151. package/dist/hooks/useUniformField/index.js +1 -1
  152. package/dist/hooks/useUniformFieldArray/index.cjs +1 -1
  153. package/dist/hooks/useUniformFieldArray/index.d.cts +1 -1
  154. package/dist/hooks/useUniformFieldArray/index.d.ts +2 -2
  155. package/dist/hooks/useUniformFieldArray/index.js +1 -1
  156. package/dist/hooks/useWatchUserChange/index.cjs +1 -1
  157. package/dist/hooks/useWatchUserChange/index.js +1 -1
  158. package/dist/{index-BGXgvZKr.d.ts → index--J1-cUWg.d.cts} +8 -9
  159. package/dist/index--J1-cUWg.d.cts.map +1 -0
  160. package/dist/{index-BDV3JVoX.d.cts → index-7C539UUH.d.cts} +6 -6
  161. package/dist/{index-BDV3JVoX.d.cts.map → index-7C539UUH.d.cts.map} +1 -1
  162. package/dist/{index-CUn9q5KD.d.ts → index-BFeKALeM.d.ts} +4 -4
  163. package/dist/{index-CUn9q5KD.d.ts.map → index-BFeKALeM.d.ts.map} +1 -1
  164. package/dist/{index-CZyNkPDq.d.ts → index-BHmMP-ps.d.ts} +21 -21
  165. package/dist/{index-CZyNkPDq.d.ts.map → index-BHmMP-ps.d.ts.map} +1 -1
  166. package/dist/{index-B_aIzCcx.d.cts → index-BNu0EV5x.d.cts} +3 -3
  167. package/dist/{index-B_aIzCcx.d.cts.map → index-BNu0EV5x.d.cts.map} +1 -1
  168. package/dist/{index-CHXv_rNR.d.ts → index-Bd7H1tdb.d.cts} +3 -3
  169. package/dist/{index-cadUZZIY.d.cts.map → index-Bd7H1tdb.d.cts.map} +1 -1
  170. package/dist/{index-D_WidR7r.d.cts → index-BhqOFcsS.d.cts} +6 -6
  171. package/dist/{index-D_WidR7r.d.cts.map → index-BhqOFcsS.d.cts.map} +1 -1
  172. package/dist/{index-DnzC0GCS.d.ts → index-CASoDHjE.d.cts} +21 -21
  173. package/dist/{index-C2A_i57R.d.cts.map → index-CASoDHjE.d.cts.map} +1 -1
  174. package/dist/index-CNFk4ygb.d.ts +264 -0
  175. package/dist/index-CNFk4ygb.d.ts.map +1 -0
  176. package/dist/{index-C2A_i57R.d.cts → index-CPbrUN5A.d.ts} +20 -20
  177. package/dist/{index-DnzC0GCS.d.ts.map → index-CPbrUN5A.d.ts.map} +1 -1
  178. package/dist/{index-cadUZZIY.d.cts → index-CVY05bZf.d.ts} +2 -2
  179. package/dist/{index-CHXv_rNR.d.ts.map → index-CVY05bZf.d.ts.map} +1 -1
  180. package/dist/{index-DVRtBywt.d.ts → index-CXkSuHEL.d.ts} +3 -3
  181. package/dist/{index-DVRtBywt.d.ts.map → index-CXkSuHEL.d.ts.map} +1 -1
  182. package/dist/{index-CHNp5R5N.d.cts → index-CrpdF1Xw.d.cts} +6 -6
  183. package/dist/{index-CHNp5R5N.d.cts.map → index-CrpdF1Xw.d.cts.map} +1 -1
  184. package/dist/{index-CuvvZMop.d.cts → index-Cs-7Ptqc.d.cts} +3 -3
  185. package/dist/{index-CuvvZMop.d.cts.map → index-Cs-7Ptqc.d.cts.map} +1 -1
  186. package/dist/{index-CqGabrzW.d.cts → index-D3o2YTBb.d.ts} +38 -38
  187. package/dist/index-D3o2YTBb.d.ts.map +1 -0
  188. package/dist/{index-CeYRsehb.d.cts → index-D9VXD1rv.d.cts} +21 -21
  189. package/dist/index-D9VXD1rv.d.cts.map +1 -0
  190. package/dist/{index-yVkU2v6b.d.ts → index-DCZwOjSs.d.cts} +37 -37
  191. package/dist/index-DCZwOjSs.d.cts.map +1 -0
  192. package/dist/{index-op7zETAQ.d.ts → index-DEtF7ckd.d.ts} +35 -35
  193. package/dist/index-DEtF7ckd.d.ts.map +1 -0
  194. package/dist/{index-DcYFLiul.d.cts → index-DMVoX5pj.d.cts} +48 -48
  195. package/dist/{index-DcYFLiul.d.cts.map → index-DMVoX5pj.d.cts.map} +1 -1
  196. package/dist/{index-DNFUttM8.d.ts → index-DMojDmML.d.ts} +48 -48
  197. package/dist/index-DMojDmML.d.ts.map +1 -0
  198. package/dist/{index-0wXxS5M7.d.ts → index-DsuMjcQk.d.ts} +6 -6
  199. package/dist/{index-0wXxS5M7.d.ts.map → index-DsuMjcQk.d.ts.map} +1 -1
  200. package/dist/{index-g9TZhGnE.d.cts → index-DsyY9X04.d.cts} +3 -3
  201. package/dist/{index-g9TZhGnE.d.cts.map → index-DsyY9X04.d.cts.map} +1 -1
  202. package/dist/index-DtWIiEFa.d.cts +264 -0
  203. package/dist/index-DtWIiEFa.d.cts.map +1 -0
  204. package/dist/{index-1Egh73pR.d.ts → index-DvB46QAb.d.ts} +3 -3
  205. package/dist/{index-1Egh73pR.d.ts.map → index-DvB46QAb.d.ts.map} +1 -1
  206. package/dist/{index-3v_vja2i.d.ts → index-JdksqsGh.d.ts} +4 -4
  207. package/dist/{index-3v_vja2i.d.ts.map → index-JdksqsGh.d.ts.map} +1 -1
  208. package/dist/{index-CnsR8nkm.d.cts → index-JfAmWj81.d.cts} +35 -35
  209. package/dist/index-JfAmWj81.d.cts.map +1 -0
  210. package/dist/{index-BFLKkqA3.d.ts → index-KgMMIPyM.d.cts} +3 -3
  211. package/dist/{index-DvF_C1Bz.d.cts.map → index-KgMMIPyM.d.cts.map} +1 -1
  212. package/dist/{index-Bcppi5O7.d.ts → index-OwPGP648.d.ts} +5 -5
  213. package/dist/{index-BSjUaHEO.d.cts.map → index-OwPGP648.d.ts.map} +1 -1
  214. package/dist/{index-DvF_C1Bz.d.cts → index-TbDhDIfv.d.ts} +3 -3
  215. package/dist/{index-BFLKkqA3.d.ts.map → index-TbDhDIfv.d.ts.map} +1 -1
  216. package/dist/{index-7mx-IcDp.d.ts → index-Z0IxHoXS.d.ts} +3 -3
  217. package/dist/{index-7mx-IcDp.d.ts.map → index-Z0IxHoXS.d.ts.map} +1 -1
  218. package/dist/{index-CiF2KXB7.d.cts → index-_njc33cQ.d.cts} +6 -6
  219. package/dist/{index-CiF2KXB7.d.cts.map → index-_njc33cQ.d.cts.map} +1 -1
  220. package/dist/{index-CjJHVJwD.d.cts → index-_zWAtv8G.d.ts} +37 -36
  221. package/dist/index-_zWAtv8G.d.ts.map +1 -0
  222. package/dist/{index-BSjUaHEO.d.cts → index-acwVBMcR.d.cts} +5 -5
  223. package/dist/index-acwVBMcR.d.cts.map +1 -0
  224. package/dist/{index-CTp4vdDb.d.ts → index-rK5GxEPh.d.ts} +6 -6
  225. package/dist/{index-CTp4vdDb.d.ts.map → index-rK5GxEPh.d.ts.map} +1 -1
  226. package/dist/index.cjs +28 -27
  227. package/dist/index.d.cts +22 -22
  228. package/dist/index.d.ts +22 -22
  229. package/dist/index.js +23 -23
  230. package/dist/partials/FieldCopyTestIdButton/index.cjs +1 -1
  231. package/dist/partials/FieldCopyTestIdButton/index.d.cts +1 -1
  232. package/dist/partials/FieldCopyTestIdButton/index.d.ts +1 -1
  233. package/dist/partials/FieldValidationError/index.cjs +1 -1
  234. package/dist/partials/FieldValidationError/index.d.cts +1 -1
  235. package/dist/partials/FieldValidationError/index.d.ts +1 -1
  236. package/dist/{useClientValidation-BrTtRnqi.js → useClientValidation-C6Daq53C.js} +3 -3
  237. package/dist/{useClientValidation-BrTtRnqi.js.map → useClientValidation-C6Daq53C.js.map} +1 -1
  238. package/dist/{useClientValidation-CdC7lEYP.cjs → useClientValidation-DzomULfo.cjs} +4 -4
  239. package/dist/{useClientValidation-CdC7lEYP.cjs.map → useClientValidation-DzomULfo.cjs.map} +1 -1
  240. package/dist/useController-BArZd2Vp.d.cts.map +1 -1
  241. package/dist/{useController-g0AlWM__.js → useController-BPDcwfTj.js} +3 -3
  242. package/dist/{useController-g0AlWM__.js.map → useController-BPDcwfTj.js.map} +1 -1
  243. package/dist/{useController-BBxji1nQ.cjs → useController-DHRkSHem.cjs} +3 -3
  244. package/dist/{useController-BBxji1nQ.cjs.map → useController-DHRkSHem.cjs.map} +1 -1
  245. package/dist/{useFormContext-Cw6aAhos.d.ts → useFormContext-B2TS6xq0.d.ts} +3 -3
  246. package/dist/useFormContext-B2TS6xq0.d.ts.map +1 -0
  247. package/dist/{useFormContext-CEr3zcL6.cjs → useFormContext-DJiJlfGJ.cjs} +3 -3
  248. package/dist/{useFormContext-CEr3zcL6.cjs.map → useFormContext-DJiJlfGJ.cjs.map} +1 -1
  249. package/dist/{useFormContext-BFoXZNkp.js → useFormContext-UFBqUfOr.js} +3 -3
  250. package/dist/{useFormContext-BFoXZNkp.js.map → useFormContext-UFBqUfOr.js.map} +1 -1
  251. package/dist/{useFormContext--yod5xzQ.d.cts → useFormContext-n3WYgGkW.d.cts} +19 -19
  252. package/dist/useFormContext-n3WYgGkW.d.cts.map +1 -0
  253. package/dist/{useInputValueDebounce-Dop_8_OK.js → useInputValueDebounce-D9wArTKz.js} +2 -2
  254. package/dist/{useInputValueDebounce-Dop_8_OK.js.map → useInputValueDebounce-D9wArTKz.js.map} +1 -1
  255. package/dist/{useInputValueDebounce-TiNR4jtG.cjs → useInputValueDebounce-KIKsvSLm.cjs} +3 -3
  256. package/dist/{useInputValueDebounce-TiNR4jtG.cjs.map → useInputValueDebounce-KIKsvSLm.cjs.map} +1 -1
  257. package/dist/{useInputValueTransform-BNmfaj5D.cjs → useInputValueTransform-DuhPVE4L.cjs} +2 -2
  258. package/dist/{useInputValueTransform-BNmfaj5D.cjs.map → useInputValueTransform-DuhPVE4L.cjs.map} +1 -1
  259. package/dist/{useUniformField-RxZqXMuD.d.ts → useUniformField-Bzv-6MG1.d.ts} +2 -2
  260. package/dist/{useUniformField-RxZqXMuD.d.ts.map → useUniformField-Bzv-6MG1.d.ts.map} +1 -1
  261. package/dist/{useUniformField-D6fwSjrH.cjs → useUniformField-CGiibqg4.cjs} +8 -8
  262. package/dist/{useUniformField-D6fwSjrH.cjs.map → useUniformField-CGiibqg4.cjs.map} +1 -1
  263. package/dist/{useUniformField-B2zQtEbr.d.cts → useUniformField-CrEz5lkV.d.cts} +2 -2
  264. package/dist/{useUniformField-B2zQtEbr.d.cts.map → useUniformField-CrEz5lkV.d.cts.map} +1 -1
  265. package/dist/{useUniformField-BKVVns0E.js → useUniformField-D2NgevBI.js} +4 -4
  266. package/dist/{useUniformField-BKVVns0E.js.map → useUniformField-D2NgevBI.js.map} +1 -1
  267. package/dist/{useUniformFieldArray-WRuIMhw6.d.cts → useUniformFieldArray-B2-Bfl74.d.cts} +13 -13
  268. package/dist/{useUniformFieldArray-WRuIMhw6.d.cts.map → useUniformFieldArray-B2-Bfl74.d.cts.map} +1 -1
  269. package/dist/{useUniformFieldArray-Byfmzq97.cjs → useUniformFieldArray-Ct8jD7JJ.cjs} +5 -5
  270. package/dist/{useUniformFieldArray-Byfmzq97.cjs.map → useUniformFieldArray-Ct8jD7JJ.cjs.map} +1 -1
  271. package/dist/{useUniformFieldArray-BwE634m6.js → useUniformFieldArray-DcoVYtqx.js} +4 -4
  272. package/dist/{useUniformFieldArray-BwE634m6.js.map → useUniformFieldArray-DcoVYtqx.js.map} +1 -1
  273. package/dist/{useUniformFieldArray-B_c55CnX.d.ts → useUniformFieldArray-jUCzsveX.d.ts} +2 -2
  274. package/dist/{useUniformFieldArray-B_c55CnX.d.ts.map → useUniformFieldArray-jUCzsveX.d.ts.map} +1 -1
  275. package/dist/{useWatchUserChange-fZy6nGtD.js → useWatchUserChange-1ELFYX_F.js} +2 -2
  276. package/dist/{useWatchUserChange-fZy6nGtD.js.map → useWatchUserChange-1ELFYX_F.js.map} +1 -1
  277. package/dist/{useWatchUserChange-TMfaTCcp.cjs → useWatchUserChange-C1zOvSSU.cjs} +3 -3
  278. package/dist/{useWatchUserChange-TMfaTCcp.cjs.map → useWatchUserChange-C1zOvSSU.cjs.map} +1 -1
  279. package/package.json +5 -5
  280. package/dist/RadioBoxes-DdIHH6B5.js.map +0 -1
  281. package/dist/RadioBoxes-h-VLhJ9d.cjs.map +0 -1
  282. package/dist/RadioTabs-D6yF9jE3.cjs.map +0 -1
  283. package/dist/RadioTabs-dLdlF91p.js.map +0 -1
  284. package/dist/Radios-D8alyG2f.cjs.map +0 -1
  285. package/dist/Radios-DiZ0Dfmp.js.map +0 -1
  286. package/dist/Select-C9otN8uu.js.map +0 -1
  287. package/dist/Select-DQVskslz.cjs.map +0 -1
  288. package/dist/helpers-CCINRgQk.js.map +0 -1
  289. package/dist/helpers-nYTmL2gX.cjs.map +0 -1
  290. package/dist/index-BGXgvZKr.d.ts.map +0 -1
  291. package/dist/index-Bcppi5O7.d.ts.map +0 -1
  292. package/dist/index-CeYRsehb.d.cts.map +0 -1
  293. package/dist/index-CjJHVJwD.d.cts.map +0 -1
  294. package/dist/index-CnsR8nkm.d.cts.map +0 -1
  295. package/dist/index-CqGabrzW.d.cts.map +0 -1
  296. package/dist/index-DNFUttM8.d.ts.map +0 -1
  297. package/dist/index-D_egu-QT.d.cts +0 -264
  298. package/dist/index-D_egu-QT.d.cts.map +0 -1
  299. package/dist/index-DajjPPWM.d.ts +0 -264
  300. package/dist/index-DajjPPWM.d.ts.map +0 -1
  301. package/dist/index-op7zETAQ.d.ts.map +0 -1
  302. package/dist/index-yVkU2v6b.d.ts.map +0 -1
  303. package/dist/useFormContext--yod5xzQ.d.cts.map +0 -1
  304. package/dist/useFormContext-Cw6aAhos.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioBoxes-Dpd71z1S.js","names":["HeroRadioGroup","RadioBoxes"],"sources":["../src/RadioBoxes/RadioBox.tsx","../src/RadioBoxes/RadioBoxes.tsx","../src/RadioBoxes/index.ts"],"sourcesContent":["import type { TVClassName } from '@fuf-stack/pixel-utils';\nimport type { RadioProps as HeroRadioProps } from '@heroui/radio';\nimport type { ReactNode } from 'react';\n\nimport { useRadio } from '@heroui/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nexport const radioBoxVariants = tv({\n slots: {\n base: 'group inline-flex flex-auto cursor-pointer items-center justify-between gap-4 rounded-lg border-2 border-default p-4 hover:bg-content2 data-[selected=true]:border-focus',\n control: '',\n description: 'text-foreground opacity-70 text-small',\n icon: '',\n label: '',\n labelWrapper: 'grow',\n },\n variants: {\n isDisabled: {\n true: {\n base: 'pointer-events-none opacity-disabled',\n },\n },\n isInvalid: {\n true: {\n base: '!border-danger',\n },\n },\n },\n});\n\ntype ClassName = TVClassName<typeof radioBoxVariants>;\n\nexport interface RadioBoxProps extends Omit<HeroRadioProps, 'className'> {\n /** CSS class name */\n className?: ClassName;\n /** icon for the option */\n icon?: ReactNode;\n /** whether the radio is invalid */\n isInvalid?: boolean;\n}\n\nexport const RadioBox = ({\n classNames: _classNames = undefined,\n icon = undefined,\n isInvalid = false,\n ...props\n}: RadioBoxProps) => {\n const {\n children,\n Component,\n description,\n getBaseProps,\n getControlProps,\n getInputProps,\n getLabelProps,\n getLabelWrapperProps,\n getWrapperProps,\n isDisabled,\n } = useRadio(props as HeroRadioProps);\n\n // classNames from slots\n const variants = radioBoxVariants({\n isDisabled,\n isInvalid,\n });\n const classNames = variantsToClassNames(\n variants,\n // @ts-expect-error not sure here, but it works\n _classNames,\n 'base',\n );\n\n return (\n <Component {...getBaseProps()} className={classNames.base}>\n <VisuallyHidden>\n <input {...getInputProps()} />\n </VisuallyHidden>\n {!icon ? (\n <span {...getWrapperProps()}>\n <span\n {...getControlProps()}\n className={cn(getControlProps().className, classNames.control)}\n />\n </span>\n ) : null}\n {icon ? <div className={classNames.icon}>{icon}</div> : null}\n <div\n {...getLabelWrapperProps()}\n className={cn(\n getLabelWrapperProps().className,\n classNames.labelWrapper,\n )}\n >\n {children ? (\n <span\n {...getLabelProps()}\n className={cn(getLabelProps().className, classNames.label)}\n >\n {children}\n </span>\n ) : null}\n {description ? (\n <div className={classNames.description}>{description}</div>\n ) : null}\n </div>\n {icon ? (\n <span {...getWrapperProps()}>\n <span\n {...getControlProps()}\n className={cn(getControlProps().className, classNames.control)}\n />\n </span>\n ) : null}\n </Component>\n );\n};\n\nexport default RadioBox;\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n//\nimport type { RadioBoxProps } from './RadioBox';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\nimport { RadioBox } from './RadioBox';\n\nexport const radioBoxesVariants = tv({\n slots: {\n base: 'group gap-0', // Needs group for group-data condition\n boxBase: '',\n boxControl: '',\n boxDescription: '',\n boxLabel: '',\n boxLabelWrapper: '',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'mb-2 inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n wrapper: '',\n },\n});\n\ntype VariantProps = TVProps<typeof radioBoxesVariants>;\ntype ClassName = TVClassName<typeof radioBoxesVariants>;\n\nexport interface RadioBoxesOption {\n /** Description of the value. Works with variant radioBox. */\n description?: ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: ReactNode;\n /** option icon */\n icon?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string | number;\n}\n\nexport interface RadioBoxesProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** determines orientation of the Buttons. */\n inline?: boolean;\n /** Label displayed next to the RadioButton. */\n label?: ReactNode;\n /** Name the RadioButtons are registered at in HTML forms (react-hook-form). */\n name: string;\n /** Radio button configuration. */\n options: RadioBoxesOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * RadioBoxes component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n */\nconst RadioBoxes = ({\n className = undefined,\n inline = false,\n name,\n options,\n ...uniformFieldProps\n}: RadioBoxesProps) => {\n const {\n ariaLabel,\n defaultValue,\n errorMessage,\n invalid,\n disabled,\n label,\n onBlur,\n onChange,\n ref,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = radioBoxesVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n const boxClassNames: RadioBoxProps['classNames'] = {\n base: classNames.boxBase,\n control: classNames.boxControl,\n description: classNames.boxDescription,\n label: classNames.boxLabel,\n labelWrapper: classNames.boxLabelWrapper,\n };\n\n return (\n <HeroRadioGroup\n ref={ref}\n aria-label={ariaLabel}\n classNames={classNames}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n defaultValue={defaultValue != null ? String(defaultValue) : undefined}\n errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={name}\n onBlur={onBlur}\n orientation={inline ? 'horizontal' : 'vertical'}\n onValueChange={(value) => {\n onChange(convertToOriginalType(value));\n }}\n >\n {options.map((option) => {\n if ('value' in option) {\n const optionTestId = slugify(\n `${testId}_option_${option.testId ?? option.value}`,\n { replaceDots: true },\n );\n return (\n <RadioBox\n key={String(option.value)}\n classNames={boxClassNames}\n data-testid={optionTestId}\n description={option.description}\n icon={option.icon}\n isDisabled={!!disabled || option.disabled}\n isInvalid={invalid}\n value={String(option.value)}\n >\n {option.label ?? option.value}\n </RadioBox>\n );\n }\n return null;\n })}\n </HeroRadioGroup>\n );\n};\n\nexport default RadioBoxes;\n","import RadioBoxes from './RadioBoxes';\n\nexport type { RadioBoxesProps } from './RadioBoxes';\nexport { radioBoxVariants } from './RadioBox';\n\nexport { RadioBoxes };\n\nexport default RadioBoxes;\n"],"mappings":";;;;;;;;AASA,MAAa,mBAAmB,GAAG;CACjC,OAAO;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,OAAO;EACP,cAAc;EACf;CACD,UAAU;EACR,YAAY,EACV,MAAM,EACJ,MAAM,wCACP,EACF;EACD,WAAW,EACT,MAAM,EACJ,MAAM,kBACP,EACF;EACF;CACF,CAAC;AAaF,MAAa,YAAY,EACvB,YAAY,cAAc,QAC1B,OAAO,QACP,YAAY,OACZ,GAAG,YACgB;CACnB,MAAM,EACJ,UACA,WACA,aACA,cACA,iBACA,eACA,eACA,sBACA,iBACA,eACE,SAAS,MAAwB;CAOrC,MAAM,aAAa,qBAJF,iBAAiB;EAChC;EACA;EACD,CAAC,EAIA,aACA,OACD;AAED,QACE,qBAAC;EAAU,GAAI,cAAc;EAAE,WAAW,WAAW;;GACnD,oBAAC,4BACC,oBAAC,WAAM,GAAI,eAAe,GAAI,GACf;GAChB,CAAC,OACA,oBAAC;IAAK,GAAI,iBAAiB;cACzB,oBAAC;KACC,GAAI,iBAAiB;KACrB,WAAW,GAAG,iBAAiB,CAAC,WAAW,WAAW,QAAQ;MAC9D;KACG,GACL;GACH,OAAO,oBAAC;IAAI,WAAW,WAAW;cAAO;KAAW,GAAG;GACxD,qBAAC;IACC,GAAI,sBAAsB;IAC1B,WAAW,GACT,sBAAsB,CAAC,WACvB,WA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GAAG,OAAO,UAAU,OAAO,UAAU,OAAO,SAC5C,EAAE,aAAa,MAAM,CACtB;AACD,WACE,oBAAC;KAEC,YAAY;KACZ,eAAa;KACb,aAAa,OAAO;KACpB,MAAM,OAAO;KACb,YAAY,CAAC,CAAC,YAAY,OAAO;KACjC,WAAW;KACX,OAAO,OAAO,OAAO,MAAM;eAE1B,OAAO,SAAS,OAAO;OATnB,OAAO,OAAO,MAAM,CAUhB;;AAGf,UAAO;IACP;GACa;;AAIrB,2BAAe;;;;ACtJf,yBAAeC"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_RadioTabs = require('../RadioTabs-D6yF9jE3.cjs');
2
+ const require_RadioTabs = require('../RadioTabs-BA-EMFRc.cjs');
3
3
 
4
4
  exports.RadioTabs = require_RadioTabs.RadioTabs_default$1;
5
5
  exports.default = require_RadioTabs.RadioTabs_default;
@@ -1,2 +1,2 @@
1
- import { n as RadioTabsProps, t as RadioTabs } from "../index-BSjUaHEO.cjs";
1
+ import { n as RadioTabsProps, t as RadioTabs } from "../index-acwVBMcR.cjs";
2
2
  export { RadioTabs, RadioTabs as default, RadioTabsProps };
@@ -1,2 +1,2 @@
1
- import { n as RadioTabsProps, t as RadioTabs } from "../index-Bcppi5O7.js";
1
+ import { n as RadioTabsProps, t as RadioTabs } from "../index-OwPGP648.js";
2
2
  export { RadioTabs, RadioTabs as default, RadioTabsProps };
@@ -1,3 +1,3 @@
1
- import { n as RadioTabs_default, t as RadioTabs_default$1 } from "../RadioTabs-dLdlF91p.js";
1
+ import { n as RadioTabs_default, t as RadioTabs_default$1 } from "../RadioTabs-BZlC19z0.js";
2
2
 
3
3
  export { RadioTabs_default as RadioTabs, RadioTabs_default$1 as default };
@@ -1,5 +1,6 @@
1
- const require_FormContext = require('./FormContext-Lw4YL4-B.cjs');
2
- const require_useUniformField = require('./useUniformField-D6fwSjrH.cjs');
1
+ const require_FormContext = require('./FormContext-CeFKQmVH.cjs');
2
+ const require_helpers = require('./helpers-CncbgvW_.cjs');
3
+ const require_useUniformField = require('./useUniformField-CGiibqg4.cjs');
3
4
  let _fuf_stack_pixel_utils = require("@fuf-stack/pixel-utils");
4
5
  let react = require("react");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -42,11 +43,12 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
42
43
  ...uniformFieldProps
43
44
  });
44
45
  const visualRadioGroupRef = (0, react.useRef)(null);
46
+ const { convertToOriginalType } = require_helpers.createOptionValueConverter(options);
45
47
  const tabOptions = options.map((option) => {
46
48
  return {
47
49
  content: option?.content,
48
50
  disabled: option?.disabled,
49
- key: option.value,
51
+ key: String(option.value),
50
52
  label: option?.label ?? option?.value,
51
53
  testId: (0, _fuf_stack_pixel_utils.slugify)(`option_${option?.testId ?? option?.value}`, { replaceDots: true })
52
54
  };
@@ -68,7 +70,7 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
68
70
  onBlur,
69
71
  value: value ?? "",
70
72
  onChange: (e) => {
71
- onChange(e.target.value);
73
+ onChange(convertToOriginalType(e.target.value));
72
74
  },
73
75
  onFocus: () => {
74
76
  (visualRadioGroupRef.current?.querySelector("[role=\"tab\"]"))?.focus();
@@ -93,8 +95,7 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
93
95
  },
94
96
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_fuf_stack_pixels_Tabs.default, {
95
97
  disabledKeys: disabled ? disabledAllKeys : void 0,
96
- onSelectionChange: onChange,
97
- selectedKey: value ?? "",
98
+ selectedKey: value != null ? String(value) : "",
98
99
  tabs: tabOptions,
99
100
  testId,
100
101
  variant,
@@ -106,6 +107,9 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
106
107
  tabContent: classNames.tabContent,
107
108
  tabList: classNames.tabList,
108
109
  tabWrapper: classNames.tabWrapper
110
+ },
111
+ onSelectionChange: (key) => {
112
+ if (key != null) onChange(convertToOriginalType(key));
109
113
  }
110
114
  })
111
115
  })] });
@@ -129,4 +133,4 @@ Object.defineProperty(exports, 'RadioTabs_default$1', {
129
133
  return RadioTabs_default$1;
130
134
  }
131
135
  });
132
- //# sourceMappingURL=RadioTabs-D6yF9jE3.cjs.map
136
+ //# sourceMappingURL=RadioTabs-BA-EMFRc.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioTabs-BA-EMFRc.cjs","names":["useUniformField","createOptionValueConverter","VisuallyHidden","HeroRadioGroup","Tabs","RadioTabs"],"sources":["../src/RadioTabs/RadioTabs.tsx","../src/RadioTabs/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { TabsProps } from '@fuf-stack/pixels';\nimport type { TabProps } from '@fuf-stack/pixels/Tabs';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { useRef } from 'react';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\nimport Tabs from '@fuf-stack/pixels/Tabs';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const radioTabsVariants = tv({\n slots: {\n base: 'group gap-0', // Needs group for group-data condition\n cursor: '',\n label:\n 'mb-2 inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n tab: '',\n tabBase: '',\n tabContent: '',\n tabList: '',\n tabPanel: 'p-3',\n tabWrapper: '',\n wrapper: '',\n },\n variants: {\n hasContent: {\n true: {\n base: '',\n tabBase: 'p-1',\n tabWrapper: [\n // border style\n 'rounded-medium border border-divider',\n // full width\n 'w-full',\n ],\n },\n },\n fullWidth: {\n true: {\n tabWrapper: 'w-full',\n },\n },\n isInvalid: {\n true: {\n tabWrapper: 'rounded-medium border-2 !border-danger',\n },\n },\n },\n});\n\ntype VariantProps = TVProps<typeof radioTabsVariants>;\ntype ClassName = TVClassName<typeof radioTabsVariants>;\n\nexport interface RadioTabsOption {\n /** Optional content inside of the tab */\n content?: ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: ReactNode;\n /** option icon */\n icon?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string | number | boolean;\n}\n\nexport interface RadioTabsProps extends Omit<VariantProps, 'hasContent'> {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** Whether tabs should take up full container width */\n fullWidth?: boolean;\n /** determines orientation of the Buttons. */\n inline?: boolean;\n /** Label displayed next to the RadioButton. */\n label?: ReactNode;\n /** Name the RadioButtons are registered at in HTML forms (react-hook-form). */\n name: string;\n /** Radio button configuration. */\n options: RadioTabsOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n /** How the RadioTabs should look like. */\n variant?: TabsProps['variant'];\n}\n\n/**\n * RadioTabs component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n * and [HeroUI Tabs](https://www.heroui.com//docs/components/tabs)\n */\nconst RadioTabs = ({\n className = undefined,\n fullWidth = false,\n inline = false,\n name,\n options,\n variant = undefined,\n ...uniformFieldProps\n}: RadioTabsProps): ReactElement => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create a ref for the visual radio group to forward focus\n const visualRadioGroupRef = useRef<HTMLDivElement>(null);\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n const tabOptions = options.map<TabProps>((option) => {\n return {\n content: option?.content,\n disabled: option?.disabled,\n // Tabs component uses string keys internally\n key: String(option.value),\n label: option?.label ?? option?.value,\n testId: slugify(`option_${option?.testId ?? option?.value}`, {\n replaceDots: true,\n }),\n };\n });\n\n const disabledAllKeys: string[] | undefined = tabOptions?.map((option) => {\n return option.key as string;\n });\n\n // check if any option has content\n // eslint-disable-next-line @typescript-eslint/no-misused-promises, @typescript-eslint/promise-function-async\n const hasContent = options.some((option) => {\n return option.content;\n });\n\n // classNames from slots\n const variants = radioTabsVariants({\n fullWidth,\n hasContent,\n isInvalid: invalid,\n });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n return (\n <>\n {/* Visually hidden input for React Hook Form focus management */}\n <VisuallyHidden>\n <input\n ref={ref}\n aria-label={ariaLabel}\n name={name}\n onBlur={onBlur}\n value={value ?? ''}\n onChange={(e) => {\n onChange(convertToOriginalType(e.target.value));\n }}\n onFocus={() => {\n // Forward focus to the first tab when RHF focuses this input\n const firstTab = visualRadioGroupRef.current?.querySelector(\n '[role=\"tab\"]',\n ) as HTMLElement;\n firstTab?.focus();\n }}\n />\n </VisuallyHidden>\n\n <HeroRadioGroup\n ref={visualRadioGroupRef}\n aria-label={ariaLabel}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={`${name}_radiotabs`}\n orientation={inline ? 'horizontal' : 'vertical'}\n classNames={{\n base: classNames.base,\n label: classNames.label,\n wrapper: classNames.wrapper,\n }}\n >\n <Tabs\n disabledKeys={disabled ? disabledAllKeys : undefined}\n // make sure component is controlled (convert to string for Tabs)\n selectedKey={value != null ? String(value) : ''}\n tabs={tabOptions}\n testId={testId}\n variant={variant}\n className={{\n base: classNames.tabBase,\n cursor: classNames.cursor,\n panel: classNames.tabPanel,\n tab: classNames.tab,\n tabContent: classNames.tabContent,\n tabList: classNames.tabList,\n tabWrapper: classNames.tabWrapper,\n }}\n onSelectionChange={(key) => {\n if (key != null) {\n onChange(convertToOriginalType(key));\n }\n }}\n />\n </HeroRadioGroup>\n </>\n );\n};\n\nexport default RadioTabs;\n","import RadioTabs from './RadioTabs';\n\nexport type { RadioTabsProps } from './RadioTabs';\n\nexport { RadioTabs };\n\nexport default RadioTabs;\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAa,mDAAuB;CAClC,OAAO;EACL,MAAM;EACN,QAAQ;EACR,OACE;EACF,KAAK;EACL,SAAS;EACT,YAAY;EACZ,SAAS;EACT,UAAU;EACV,YAAY;EACZ,SAAS;EACV;CACD,UAAU;EACR,YAAY,EACV,MAAM;GACJ,MAAM;GACN,SAAS;GACT,YAAY,CAEV,wCAEA,SACD;GACF,EACF;EACD,WAAW,EACT,MAAM,EACJ,YAAY,UACb,EACF;EACD,WAAW,EACT,MAAM,EACJ,YAAY,0CACb,EACF;EACF;CACF,CAAC;;;;;AA+CF,MAAM,aAAa,EACjB,YAAY,QACZ,YAAY,OACZ,SAAS,OACT,MACA,SACA,UAAU,QACV,GAAG,wBAC+B;CAClC,MAAM,EACJ,WACA,UACA,cACA,OAAO,EAAE,QAAQ,UAAU,KAAK,SAChC,SACA,OACA,UACA,WACEA,wCAAgB;EAClB;EACA,GAAG;EACJ,CAAC;CAGF,MAAM,wCAA6C,KAAK;CAGxD,MAAM,EAAE,0BAA0BC,2CAA2B,QAAQ;CAErE,MAAM,aAAa,QAAQ,KAAe,WAAW;AACnD,SAAO;GACL,SAAS,QAAQ;GACjB,UAAU,QAAQ;GAElB,KAAK,OAAO,OAAO,MAAM;GACzB,OAAO,QAAQ,SAAS,QAAQ;GAChC,4CAAgB,UAAU,QAAQ,UAAU,QAAQ,SAAS,EAC3D,aAAa,MACd,CAAC;GACH;GACD;CAEF,MAAM,kBAAwC,YAAY,KAAK,WAAW;AACxE,SAAO,OAAO;GACd;CAcF,MAAM,8DALW,kBAAkB;EACjC;EACA,YAPiB,QAAQ,MAAM,WAAW;AAC1C,UAAO,OAAO;IACd;EAMA,WAAW;EACZ,CAAC,EACgD,WAAW,OAAO;AAEpE,QACE,qFAEE,2CAACC,wDACC,2CAAC;EACM;EACL,cAAY;EACN;EACE;EACR,OAAO,SAAS;EAChB,WAAW,MAAM;AACf,YAAS,sBAAsB,EAAE,OAAO,MAAM,CAAC;;EAEjD,eAAe;AAKb,IAHiB,oBAAoB,SAAS,cAC5C,iBACD,GACS,OAAO;;GAEnB,GACa,EAEjB,2CAACC;EACC,KAAK;EACL,cAAY;EAGZ,gBAAc;EACd,iBAAe;EACf,eAAa;EACC;EACd,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,OAAO,QAAQ,2CAAC,sBAAQ,QAAe,GAAG;EAC1C,MAAM,GAAG,KAAK;EACd,aAAa,SAAS,eAAe;EACrC,YAAY;GACV,MAAM,WAAW;GACjB,OAAO,WAAW;GAClB,SAAS,WAAW;GACrB;YAED,2CAACC;GACC,cAAc,WAAW,kBAAkB;GAE3C,aAAa,SAAS,OAAO,OAAO,MAAM,GAAG;GAC7C,MAAM;GACE;GACC;GACT,WAAW;IACT,MAAM,WAAW;IACjB,QAAQ,WAAW;IACnB,OAAO,WAAW;IAClB,KAAK,WAAW;IAChB,YAAY,WAAW;IACvB,SAAS,WAAW;IACpB,YAAY,WAAW;IACxB;GACD,oBAAoB,QAAQ;AAC1B,QAAI,OAAO,KACT,UAAS,sBAAsB,IAAI,CAAC;;IAGxC;GACa,IAChB;;AAIP,0BAAe;;;;AClOf,wBAAeC"}
@@ -1,4 +1,5 @@
1
- import { t as useUniformField } from "./useUniformField-BKVVns0E.js";
1
+ import { c as createOptionValueConverter } from "./helpers-D3A5d3M1.js";
2
+ import { t as useUniformField } from "./useUniformField-D2NgevBI.js";
2
3
  import { slugify, tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
3
4
  import { useRef } from "react";
4
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -40,11 +41,12 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
40
41
  ...uniformFieldProps
41
42
  });
42
43
  const visualRadioGroupRef = useRef(null);
44
+ const { convertToOriginalType } = createOptionValueConverter(options);
43
45
  const tabOptions = options.map((option) => {
44
46
  return {
45
47
  content: option?.content,
46
48
  disabled: option?.disabled,
47
- key: option.value,
49
+ key: String(option.value),
48
50
  label: option?.label ?? option?.value,
49
51
  testId: slugify(`option_${option?.testId ?? option?.value}`, { replaceDots: true })
50
52
  };
@@ -66,7 +68,7 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
66
68
  onBlur,
67
69
  value: value ?? "",
68
70
  onChange: (e) => {
69
- onChange(e.target.value);
71
+ onChange(convertToOriginalType(e.target.value));
70
72
  },
71
73
  onFocus: () => {
72
74
  (visualRadioGroupRef.current?.querySelector("[role=\"tab\"]"))?.focus();
@@ -91,8 +93,7 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
91
93
  },
92
94
  children: /* @__PURE__ */ jsx(Tabs, {
93
95
  disabledKeys: disabled ? disabledAllKeys : void 0,
94
- onSelectionChange: onChange,
95
- selectedKey: value ?? "",
96
+ selectedKey: value != null ? String(value) : "",
96
97
  tabs: tabOptions,
97
98
  testId,
98
99
  variant,
@@ -104,6 +105,9 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
104
105
  tabContent: classNames.tabContent,
105
106
  tabList: classNames.tabList,
106
107
  tabWrapper: classNames.tabWrapper
108
+ },
109
+ onSelectionChange: (key) => {
110
+ if (key != null) onChange(convertToOriginalType(key));
107
111
  }
108
112
  })
109
113
  })] });
@@ -116,4 +120,4 @@ var RadioTabs_default = RadioTabs_default$1;
116
120
 
117
121
  //#endregion
118
122
  export { RadioTabs_default$1 as n, RadioTabs_default as t };
119
- //# sourceMappingURL=RadioTabs-dLdlF91p.js.map
123
+ //# sourceMappingURL=RadioTabs-BZlC19z0.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioTabs-BZlC19z0.js","names":["HeroRadioGroup","RadioTabs"],"sources":["../src/RadioTabs/RadioTabs.tsx","../src/RadioTabs/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { TabsProps } from '@fuf-stack/pixels';\nimport type { TabProps } from '@fuf-stack/pixels/Tabs';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { useRef } from 'react';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\nimport Tabs from '@fuf-stack/pixels/Tabs';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const radioTabsVariants = tv({\n slots: {\n base: 'group gap-0', // Needs group for group-data condition\n cursor: '',\n label:\n 'mb-2 inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n tab: '',\n tabBase: '',\n tabContent: '',\n tabList: '',\n tabPanel: 'p-3',\n tabWrapper: '',\n wrapper: '',\n },\n variants: {\n hasContent: {\n true: {\n base: '',\n tabBase: 'p-1',\n tabWrapper: [\n // border style\n 'rounded-medium border border-divider',\n // full width\n 'w-full',\n ],\n },\n },\n fullWidth: {\n true: {\n tabWrapper: 'w-full',\n },\n },\n isInvalid: {\n true: {\n tabWrapper: 'rounded-medium border-2 !border-danger',\n },\n },\n },\n});\n\ntype VariantProps = TVProps<typeof radioTabsVariants>;\ntype ClassName = TVClassName<typeof radioTabsVariants>;\n\nexport interface RadioTabsOption {\n /** Optional content inside of the tab */\n content?: ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: ReactNode;\n /** option icon */\n icon?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string | number | boolean;\n}\n\nexport interface RadioTabsProps extends Omit<VariantProps, 'hasContent'> {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** Whether tabs should take up full container width */\n fullWidth?: boolean;\n /** determines orientation of the Buttons. */\n inline?: boolean;\n /** Label displayed next to the RadioButton. */\n label?: ReactNode;\n /** Name the RadioButtons are registered at in HTML forms (react-hook-form). */\n name: string;\n /** Radio button configuration. */\n options: RadioTabsOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n /** How the RadioTabs should look like. */\n variant?: TabsProps['variant'];\n}\n\n/**\n * RadioTabs component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n * and [HeroUI Tabs](https://www.heroui.com//docs/components/tabs)\n */\nconst RadioTabs = ({\n className = undefined,\n fullWidth = false,\n inline = false,\n name,\n options,\n variant = undefined,\n ...uniformFieldProps\n}: RadioTabsProps): ReactElement => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create a ref for the visual radio group to forward focus\n const visualRadioGroupRef = useRef<HTMLDivElement>(null);\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n const tabOptions = options.map<TabProps>((option) => {\n return {\n content: option?.content,\n disabled: option?.disabled,\n // Tabs component uses string keys internally\n key: String(option.value),\n label: option?.label ?? option?.value,\n testId: slugify(`option_${option?.testId ?? option?.value}`, {\n replaceDots: true,\n }),\n };\n });\n\n const disabledAllKeys: string[] | undefined = tabOptions?.map((option) => {\n return option.key as string;\n });\n\n // check if any option has content\n // eslint-disable-next-line @typescript-eslint/no-misused-promises, @typescript-eslint/promise-function-async\n const hasContent = options.some((option) => {\n return option.content;\n });\n\n // classNames from slots\n const variants = radioTabsVariants({\n fullWidth,\n hasContent,\n isInvalid: invalid,\n });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n return (\n <>\n {/* Visually hidden input for React Hook Form focus management */}\n <VisuallyHidden>\n <input\n ref={ref}\n aria-label={ariaLabel}\n name={name}\n onBlur={onBlur}\n value={value ?? ''}\n onChange={(e) => {\n onChange(convertToOriginalType(e.target.value));\n }}\n onFocus={() => {\n // Forward focus to the first tab when RHF focuses this input\n const firstTab = visualRadioGroupRef.current?.querySelector(\n '[role=\"tab\"]',\n ) as HTMLElement;\n firstTab?.focus();\n }}\n />\n </VisuallyHidden>\n\n <HeroRadioGroup\n ref={visualRadioGroupRef}\n aria-label={ariaLabel}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={`${name}_radiotabs`}\n orientation={inline ? 'horizontal' : 'vertical'}\n classNames={{\n base: classNames.base,\n label: classNames.label,\n wrapper: classNames.wrapper,\n }}\n >\n <Tabs\n disabledKeys={disabled ? disabledAllKeys : undefined}\n // make sure component is controlled (convert to string for Tabs)\n selectedKey={value != null ? String(value) : ''}\n tabs={tabOptions}\n testId={testId}\n variant={variant}\n className={{\n base: classNames.tabBase,\n cursor: classNames.cursor,\n panel: classNames.tabPanel,\n tab: classNames.tab,\n tabContent: classNames.tabContent,\n tabList: classNames.tabList,\n tabWrapper: classNames.tabWrapper,\n }}\n onSelectionChange={(key) => {\n if (key != null) {\n onChange(convertToOriginalType(key));\n }\n }}\n />\n </HeroRadioGroup>\n </>\n );\n};\n\nexport default RadioTabs;\n","import RadioTabs from './RadioTabs';\n\nexport type { RadioTabsProps } from './RadioTabs';\n\nexport { RadioTabs };\n\nexport default RadioTabs;\n"],"mappings":";;;;;;;;;;AAgBA,MAAa,oBAAoB,GAAG;CAClC,OAAO;EACL,MAAM;EACN,QAAQ;EACR,OACE;EACF,KAAK;EACL,SAAS;EACT,YAAY;EACZ,SAAS;EACT,UAAU;EACV,YAAY;EACZ,SAAS;EACV;CACD,UAAU;EACR,YAAY,EACV,MAAM;GACJ,MAAM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AAO,QAAQ,oBAAC,sBAAQ,QAAe,GAAG;EAC1C,MAAM,GAAG,KAAK;EACd,aAAa,SAAS,eAAe;EACrC,YAAY;GACV,MAAM,WAAW;GACjB,OAAO,WAAW;GAClB,SAAS,WAAW;GACrB;YAED,oBAAC;GACC,cAAc,WAAW,kBAAkB;GAE3C,aAAa,SAAS,OAAO,OAAO,MAAM,GAAG;GAC7C,MAAM;GACE;GACC;GACT,WAAW;IACT,MAAM,WAAW;IACjB,QAAQ,WAAW;IACnB,OAAO,WAAW;IAClB,KAAK,WAAW;IAChB,YAAY,WAAW;IACvB,SAAS,WAAW;IACpB,YAAY,WAAW;IACxB;GACD,oBAAoB,QAAQ;AAC1B,QAAI,OAAO,KACT,UAAS,sBAAsB,IAAI,CAAC;;IAGxC;GACa,IAChB;;AAIP,0BAAe;;;;AClOf,wBAAeC"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_Radios = require('../Radios-D8alyG2f.cjs');
2
+ const require_Radios = require('../Radios-Bfxy-Vnf.cjs');
3
3
 
4
4
  exports.Radios = require_Radios.Radios_default$1;
5
5
  exports.default = require_Radios.Radios_default;
@@ -1,2 +1,2 @@
1
- import { n as RadiosProps, t as Radios } from "../index-CnsR8nkm.cjs";
1
+ import { n as RadiosProps, t as Radios } from "../index-JfAmWj81.cjs";
2
2
  export { Radios, Radios as default, RadiosProps };
@@ -1,2 +1,2 @@
1
- import { n as RadiosProps, t as Radios } from "../index-op7zETAQ.js";
1
+ import { n as RadiosProps, t as Radios } from "../index-DEtF7ckd.js";
2
2
  export { Radios, Radios as default, RadiosProps };
@@ -1,3 +1,3 @@
1
- import { n as Radios_default, t as Radios_default$1 } from "../Radios-DiZ0Dfmp.js";
1
+ import { n as Radios_default, t as Radios_default$1 } from "../Radios-ClBrO7QR.js";
2
2
 
3
3
  export { Radios_default as Radios, Radios_default$1 as default };
@@ -1,5 +1,6 @@
1
- const require_FormContext = require('./FormContext-Lw4YL4-B.cjs');
2
- const require_useUniformField = require('./useUniformField-D6fwSjrH.cjs');
1
+ const require_FormContext = require('./FormContext-CeFKQmVH.cjs');
2
+ const require_helpers = require('./helpers-CncbgvW_.cjs');
3
+ const require_useUniformField = require('./useUniformField-CGiibqg4.cjs');
3
4
  let _fuf_stack_pixel_utils = require("@fuf-stack/pixel-utils");
4
5
  let react_jsx_runtime = require("react/jsx-runtime");
5
6
  let _heroui_radio = require("@heroui/radio");
@@ -24,6 +25,7 @@ const Radios = ({ className = void 0, inline = false, name, options, ...uniformF
24
25
  name,
25
26
  ...uniformFieldProps
26
27
  });
28
+ const { convertToOriginalType } = require_helpers.createOptionValueConverter(options);
27
29
  const classNames = (0, _fuf_stack_pixel_utils.variantsToClassNames)(radiosVariants(), className, "base");
28
30
  const itemClassNames = {
29
31
  base: classNames.itemBase,
@@ -40,7 +42,7 @@ const Radios = ({ className = void 0, inline = false, name, options, ...uniformF
40
42
  "data-invalid": invalid,
41
43
  "data-required": required,
42
44
  "data-testid": testId,
43
- defaultValue,
45
+ defaultValue: defaultValue != null ? String(defaultValue) : void 0,
44
46
  errorMessage,
45
47
  isDisabled: disabled,
46
48
  isInvalid: invalid,
@@ -49,6 +51,9 @@ const Radios = ({ className = void 0, inline = false, name, options, ...uniformF
49
51
  name,
50
52
  onBlur,
51
53
  orientation: inline ? "horizontal" : "vertical",
54
+ onValueChange: (value) => {
55
+ onChange(convertToOriginalType(value));
56
+ },
52
57
  children: options.map((option) => {
53
58
  if ("value" in option) {
54
59
  const optionTestId = (0, _fuf_stack_pixel_utils.slugify)(`${testId}_option_${option.testId ?? option.value}`, { replaceDots: true });
@@ -56,10 +61,9 @@ const Radios = ({ className = void 0, inline = false, name, options, ...uniformF
56
61
  classNames: itemClassNames,
57
62
  "data-testid": optionTestId,
58
63
  isDisabled: !!disabled || option.disabled,
59
- onChange,
60
- value: option.value,
64
+ value: String(option.value),
61
65
  children: option.label ?? option.value
62
- }, option.value);
66
+ }, String(option.value));
63
67
  }
64
68
  return null;
65
69
  })
@@ -84,4 +88,4 @@ Object.defineProperty(exports, 'Radios_default$1', {
84
88
  return Radios_default$1;
85
89
  }
86
90
  });
87
- //# sourceMappingURL=Radios-D8alyG2f.cjs.map
91
+ //# sourceMappingURL=Radios-Bfxy-Vnf.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Radios-Bfxy-Vnf.cjs","names":["useUniformField","createOptionValueConverter","HeroRadioGroup","HeroRadio","Radios"],"sources":["../src/Radios/Radios.tsx","../src/Radios/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport {\n Radio as HeroRadio,\n RadioGroup as HeroRadioGroup,\n} from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const radiosVariants = tv({\n slots: {\n // Needs group for group-data condition\n base: 'group gap-0',\n itemBase: '',\n itemControl: 'bg-focus group-data-[invalid=true]:bg-danger',\n itemDescription: '',\n itemLabel: 'text-sm',\n itemLabelWrapper: '',\n itemWrapper:\n 'group-data-[invalid=true]:border-danger! [&:not(group-data-[invalid=\"true\"]):not(group-data-[selected=\"false\"])]:border-focus',\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'mb-2 inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n wrapper: '',\n },\n});\n\ntype VariantProps = TVProps<typeof radiosVariants>;\ntype ClassName = TVClassName<typeof radiosVariants>;\n\nexport interface RadioOption {\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: ReactNode;\n /** option icon */\n icon?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string | number;\n}\n\nexport interface RadiosProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** determines orientation of the Buttons. */\n inline?: boolean;\n /** Label displayed next to the RadioButton. */\n label?: ReactNode;\n /** Name the RadioButtons are registered at in HTML forms (react-hook-form). */\n name: string;\n /** Radio button configuration. */\n options: RadioOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * Radios component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n */\nconst Radios = ({\n className = undefined,\n inline = false,\n name,\n options,\n ...uniformFieldProps\n}: RadiosProps): ReactElement => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref },\n invalid,\n label,\n required,\n defaultValue,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = radiosVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n const itemClassNames = {\n base: classNames.itemBase,\n control: classNames.itemControl,\n description: classNames.itemDescription,\n label: classNames.itemLabel,\n labelWrapper: classNames.itemLabelWrapper,\n wrapper: classNames.itemWrapper,\n };\n\n return (\n <HeroRadioGroup\n ref={ref}\n aria-label={ariaLabel}\n classNames={classNames}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n defaultValue={defaultValue != null ? String(defaultValue) : undefined}\n errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={name}\n onBlur={onBlur}\n orientation={inline ? 'horizontal' : 'vertical'}\n onValueChange={(value) => {\n onChange(convertToOriginalType(value));\n }}\n >\n {options.map((option) => {\n if ('value' in option) {\n const optionTestId = slugify(\n `${testId}_option_${option.testId ?? option.value}`,\n { replaceDots: true },\n );\n return (\n <HeroRadio\n key={String(option.value)}\n classNames={itemClassNames}\n data-testid={optionTestId}\n isDisabled={!!disabled || option.disabled}\n value={String(option.value)}\n >\n {option.label ?? option.value}\n </HeroRadio>\n );\n }\n return null;\n })}\n </HeroRadioGroup>\n );\n};\n\nexport default Radios;\n","import Radios from './Radios';\n\nexport type { RadiosProps } from './Radios';\n\nexport { Radios };\n\nexport default Radios;\n"],"mappings":";;;;;;;;AAaA,MAAa,gDAAoB,EAC/B,OAAO;CAEL,MAAM;CACN,UAAU;CACV,aAAa;CACb,iBAAiB;CACjB,WAAW;CACX,kBAAkB;CAClB,aACE;CAEF,OACE;CACF,SAAS;CACV,EACF,CAAC;;;;AAwCF,MAAM,UAAU,EACd,YAAY,QACZ,SAAS,OACT,MACA,SACA,GAAG,wBAC4B;CAC/B,MAAM,EACJ,WACA,UACA,cACA,OAAO,EAAE,QAAQ,UAAU,OAC3B,SACA,OACA,UACA,cACA,WACEA,wCAAgB;EAClB;EACA,GAAG;EACJ,CAAC;CAGF,MAAM,EAAE,0BAA0BC,2CAA2B,QAAQ;CAIrE,MAAM,8DADW,gBAAgB,EACiB,WAAW,OAAO;CAEpE,MAAM,iBAAiB;EACrB,MAAM,WAAW;EACjB,SAAS,WAAW;EACpB,aAAa,WAAW;EACxB,OAAO,WAAW;EAClB,cAAc,WAAW;EACzB,SAAS,WAAW;EACrB;AAED,QACE,2CAACC;EACM;EACL,cAAY;EACA;EAGZ,gBAAc;EACd,iBAAe;EACf,eAAa;EACb,cAAc,gBAAgB,OAAO,OAAO,aAAa,GAAG;EAC9C;EACd,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,OAAO,QAAQ,2CAAC,sBAAQ,QAAe,GAAG;EACpC;EACE;EACR,aAAa,SAAS,eAAe;EACrC,gBAAgB,UAAU;AACxB,YAAS,sBAAsB,MAAM,CAAC;;YAGvC,QAAQ,KAAK,WAAW;AACvB,OAAI,WAAW,QAAQ;IACrB,MAAM,mDACJ,GAAG,OAAO,UAAU,OAAO,UAAU,OAAO,SAC5C,EAAE,aAAa,MAAM,CACtB;AACD,WACE,2CAACC;KAEC,YAAY;KACZ,eAAa;KACb,YAAY,CAAC,CAAC,YAAY,OAAO;KACjC,OAAO,OAAO,OAAO,MAAM;eAE1B,OAAO,SAAS,OAAO;OANnB,OAAO,OAAO,MAAM,CAOf;;AAGhB,UAAO;IACP;GACa;;AAIrB,uBAAe;;;;ACpJf,qBAAeC"}
@@ -1,4 +1,5 @@
1
- import { t as useUniformField } from "./useUniformField-BKVVns0E.js";
1
+ import { c as createOptionValueConverter } from "./helpers-D3A5d3M1.js";
2
+ import { t as useUniformField } from "./useUniformField-D2NgevBI.js";
2
3
  import { slugify, tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
3
4
  import { jsx } from "react/jsx-runtime";
4
5
  import { Radio, RadioGroup } from "@heroui/radio";
@@ -23,6 +24,7 @@ const Radios = ({ className = void 0, inline = false, name, options, ...uniformF
23
24
  name,
24
25
  ...uniformFieldProps
25
26
  });
27
+ const { convertToOriginalType } = createOptionValueConverter(options);
26
28
  const classNames = variantsToClassNames(radiosVariants(), className, "base");
27
29
  const itemClassNames = {
28
30
  base: classNames.itemBase,
@@ -39,7 +41,7 @@ const Radios = ({ className = void 0, inline = false, name, options, ...uniformF
39
41
  "data-invalid": invalid,
40
42
  "data-required": required,
41
43
  "data-testid": testId,
42
- defaultValue,
44
+ defaultValue: defaultValue != null ? String(defaultValue) : void 0,
43
45
  errorMessage,
44
46
  isDisabled: disabled,
45
47
  isInvalid: invalid,
@@ -48,6 +50,9 @@ const Radios = ({ className = void 0, inline = false, name, options, ...uniformF
48
50
  name,
49
51
  onBlur,
50
52
  orientation: inline ? "horizontal" : "vertical",
53
+ onValueChange: (value) => {
54
+ onChange(convertToOriginalType(value));
55
+ },
51
56
  children: options.map((option) => {
52
57
  if ("value" in option) {
53
58
  const optionTestId = slugify(`${testId}_option_${option.testId ?? option.value}`, { replaceDots: true });
@@ -55,10 +60,9 @@ const Radios = ({ className = void 0, inline = false, name, options, ...uniformF
55
60
  classNames: itemClassNames,
56
61
  "data-testid": optionTestId,
57
62
  isDisabled: !!disabled || option.disabled,
58
- onChange,
59
- value: option.value,
63
+ value: String(option.value),
60
64
  children: option.label ?? option.value
61
- }, option.value);
65
+ }, String(option.value));
62
66
  }
63
67
  return null;
64
68
  })
@@ -72,4 +76,4 @@ var Radios_default = Radios_default$1;
72
76
 
73
77
  //#endregion
74
78
  export { Radios_default$1 as n, Radios_default as t };
75
- //# sourceMappingURL=Radios-DiZ0Dfmp.js.map
79
+ //# sourceMappingURL=Radios-ClBrO7QR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Radios-ClBrO7QR.js","names":["HeroRadioGroup","HeroRadio","Radios"],"sources":["../src/Radios/Radios.tsx","../src/Radios/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport {\n Radio as HeroRadio,\n RadioGroup as HeroRadioGroup,\n} from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const radiosVariants = tv({\n slots: {\n // Needs group for group-data condition\n base: 'group gap-0',\n itemBase: '',\n itemControl: 'bg-focus group-data-[invalid=true]:bg-danger',\n itemDescription: '',\n itemLabel: 'text-sm',\n itemLabelWrapper: '',\n itemWrapper:\n 'group-data-[invalid=true]:border-danger! [&:not(group-data-[invalid=\"true\"]):not(group-data-[selected=\"false\"])]:border-focus',\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'mb-2 inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n wrapper: '',\n },\n});\n\ntype VariantProps = TVProps<typeof radiosVariants>;\ntype ClassName = TVClassName<typeof radiosVariants>;\n\nexport interface RadioOption {\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: ReactNode;\n /** option icon */\n icon?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string | number;\n}\n\nexport interface RadiosProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** determines orientation of the Buttons. */\n inline?: boolean;\n /** Label displayed next to the RadioButton. */\n label?: ReactNode;\n /** Name the RadioButtons are registered at in HTML forms (react-hook-form). */\n name: string;\n /** Radio button configuration. */\n options: RadioOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * Radios component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n */\nconst Radios = ({\n className = undefined,\n inline = false,\n name,\n options,\n ...uniformFieldProps\n}: RadiosProps): ReactElement => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref },\n invalid,\n label,\n required,\n defaultValue,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = radiosVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n const itemClassNames = {\n base: classNames.itemBase,\n control: classNames.itemControl,\n description: classNames.itemDescription,\n label: classNames.itemLabel,\n labelWrapper: classNames.itemLabelWrapper,\n wrapper: classNames.itemWrapper,\n };\n\n return (\n <HeroRadioGroup\n ref={ref}\n aria-label={ariaLabel}\n classNames={classNames}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n defaultValue={defaultValue != null ? String(defaultValue) : undefined}\n errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={name}\n onBlur={onBlur}\n orientation={inline ? 'horizontal' : 'vertical'}\n onValueChange={(value) => {\n onChange(convertToOriginalType(value));\n }}\n >\n {options.map((option) => {\n if ('value' in option) {\n const optionTestId = slugify(\n `${testId}_option_${option.testId ?? option.value}`,\n { replaceDots: true },\n );\n return (\n <HeroRadio\n key={String(option.value)}\n classNames={itemClassNames}\n data-testid={optionTestId}\n isDisabled={!!disabled || option.disabled}\n value={String(option.value)}\n >\n {option.label ?? option.value}\n </HeroRadio>\n );\n }\n return null;\n })}\n </HeroRadioGroup>\n );\n};\n\nexport default Radios;\n","import Radios from './Radios';\n\nexport type { RadiosProps } from './Radios';\n\nexport { Radios };\n\nexport default Radios;\n"],"mappings":";;;;;;;AAaA,MAAa,iBAAiB,GAAG,EAC/B,OAAO;CAEL,MAAM;CACN,UAAU;CACV,aAAa;CACb,iBAAiB;CACjB,WAAW;CACX,kBAAkB;CAClB,aACE;CAEF,OACE;CACF,SAAS;CACV,EACF,CAAC;;;;AAwCF,MAAM,UAAU,EACd,YAAY,QACZ,SAAS,OACT,MACA,SACA,GAAG,wBAC4B;CAC/B,MAAM,EACJ,WACA,UACA,cACA,OAAO,EAAE,QAAQ,UAAU,OAC3B,SACA,OACA,UACA,cACA,WACE,gBAAgB;EAClB;EACA,GAAG;EACJ,CAAC;CAGF,MAAM,EAAE,0BAA0B,2BAA2B,QAAQ;CAIrE,MAAM,aAAa,qBADF,gBAAgB,EACiB,WAAW,OAAO;CAEpE,MAAM,iBAAiB;EACrB,MAAM,WAAW;EACjB,SAAS,WAAW;EACpB,aAAa,WAAW;EACxB,OAAO,WAAW;EAClB,cAAc,WAAW;EACzB,SAAS,WAAW;EACrB;AAED,QACE,oBAACA;EACM;EACL,cAAY;EACA;EAGZ,gBAAc;EACd,iBAAe;EACf,eAAa;EACb,cAAc,gBAAgB,OAAO,OAAO,aAAa,GAAG;EAC9C;EACd,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,OAAO,QAAQ,oBAAC,sBAAQ,QAAe,GAAG;EACpC;EACE;EACR,aAAa,SAAS,eAAe;EACrC,gBAAgB,UAAU;AACxB,YAAS,sBAAsB,MAAM,CAAC;;YAGvC,QAAQ,KAAK,WAAW;AACvB,OAAI,WAAW,QAAQ;IACrB,MAAM,eAAe,QACnB,GAAG,OAAO,UAAU,OAAO,UAAU,OAAO,SAC5C,EAAE,aAAa,MAAM,CACtB;AACD,WACE,oBAACC;KAEC,YAAY;KACZ,eAAa;KACb,YAAY,CAAC,CAAC,YAAY,OAAO;KACjC,OAAO,OAAO,OAAO,MAAM;eAE1B,OAAO,SAAS,OAAO;OANnB,OAAO,OAAO,MAAM,CAOf;;AAGhB,UAAO;IACP;GACa;;AAIrB,uBAAe;;;;ACpJf,qBAAeC"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_Select = require('../Select-DQVskslz.cjs');
2
+ const require_Select = require('../Select-CdTgOiUU.cjs');
3
3
 
4
4
  exports.Select = require_Select.Select_default$1;
5
5
  exports.default = require_Select.Select_default;
@@ -1,2 +1,2 @@
1
- import { n as SelectProps, t as Select } from "../index-D_egu-QT.cjs";
1
+ import { n as SelectProps, t as Select } from "../index-DtWIiEFa.cjs";
2
2
  export { Select, Select as default, SelectProps };
@@ -1,2 +1,2 @@
1
- import { n as SelectProps, t as Select } from "../index-DajjPPWM.js";
1
+ import { n as SelectProps, t as Select } from "../index-CNFk4ygb.js";
2
2
  export { Select, Select as default, SelectProps };
@@ -1,3 +1,3 @@
1
- import { n as Select_default, t as Select_default$1 } from "../Select-C9otN8uu.js";
1
+ import { n as Select_default, t as Select_default$1 } from "../Select-9MyYYGeZ.js";
2
2
 
3
3
  export { Select_default as Select, Select_default$1 as default };
@@ -1,5 +1,6 @@
1
- import { n as useFormContext } from "./useFormContext-BFoXZNkp.js";
2
- import { t as useUniformField } from "./useUniformField-BKVVns0E.js";
1
+ import { c as createOptionValueConverter } from "./helpers-D3A5d3M1.js";
2
+ import { n as useFormContext } from "./useFormContext-UFBqUfOr.js";
3
+ import { t as useUniformField } from "./useUniformField-D2NgevBI.js";
3
4
  import { cn, slugify, tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
4
5
  import { useState } from "react";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -54,7 +55,7 @@ const ControlComponent = (props) => {
54
55
  });
55
56
  };
56
57
  const OptionComponent = (props) => {
57
- const testId = `${props.selectProps["data-testid"]}_select_option_${slugify(props?.data?.testId ?? props?.data?.value, { replaceDots: true })}`;
58
+ const testId = `${props.selectProps["data-testid"]}_select_option_${slugify(String(props?.data?.testId ?? props?.data?.value), { replaceDots: true })}`;
58
59
  return /* @__PURE__ */ jsx("div", {
59
60
  "data-testid": testId,
60
61
  children: /* @__PURE__ */ jsx(components.Option, { ...props })
@@ -75,6 +76,7 @@ const Select = ({ className = void 0, clearable = true, filterOption = void 0, r
75
76
  });
76
77
  const { getFieldState } = useFormContext();
77
78
  const [isFocused, setIsFocused] = useState(false);
79
+ const { convertToOriginalType } = createOptionValueConverter(options);
78
80
  const classNames = variantsToClassNames(selectVariants(), className, "base");
79
81
  const { getBaseProps, getTriggerProps, getValueProps } = useSelect({
80
82
  children: [],
@@ -199,9 +201,12 @@ const Select = ({ className = void 0, clearable = true, filterOption = void 0, r
199
201
  },
200
202
  onChange: (option) => {
201
203
  if (multiSelect) onChange(option?.map((_option) => {
202
- return _option.value;
204
+ return convertToOriginalType(_option.value);
203
205
  }));
204
- else onChange(option?.value);
206
+ else {
207
+ const selectedValue = option?.value;
208
+ onChange(selectedValue != null ? convertToOriginalType(selectedValue) : selectedValue);
209
+ }
205
210
  const { isTouched: currentIsTouched } = getFieldState(name, testId);
206
211
  if (!currentIsTouched) onBlur();
207
212
  },
@@ -209,7 +214,7 @@ const Select = ({ className = void 0, clearable = true, filterOption = void 0, r
209
214
  setIsFocused(true);
210
215
  },
211
216
  value: options.find((option) => {
212
- return option.value === value;
217
+ return String(option.value) === String(value);
213
218
  })
214
219
  }),
215
220
  invalid ? /* @__PURE__ */ jsx("div", {
@@ -230,4 +235,4 @@ var Select_default = Select_default$1;
230
235
 
231
236
  //#endregion
232
237
  export { Select_default$1 as n, Select_default as t };
233
- //# sourceMappingURL=Select-C9otN8uu.js.map
238
+ //# sourceMappingURL=Select-9MyYYGeZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select-9MyYYGeZ.js","names":["Select"],"sources":["../src/Select/Select.tsx","../src/Select/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\nimport type { Props } from 'react-select';\n\nimport { useState } from 'react';\nimport ReactSelect, { components } from 'react-select';\n\nimport { useSelect } from '@heroui/select';\n\nimport { cn, slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useFormContext } from '../hooks/useFormContext';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const selectVariants = tv({\n slots: {\n base: 'group leading-normal',\n clearIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800',\n control:\n 'duration-150! rounded-lg border-2 border-default-200 bg-content1 transition-background hover:border-default-400 group-data-[invalid=true]:border-danger group-data-[invalid=true]:hover:border-danger motion-reduce:transition-none',\n control_focused: 'border-focus',\n crossIcon: '',\n downChevron: '',\n dropdownIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-foreground-500',\n indicatorsContainer: 'gap-1 p-1',\n indicatorSeparator: 'bg-default-300',\n input: 'py-0.5 pl-1',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'pointer-events-auto relative bottom-1.5 ml-1 subpixel-antialiased text-small group-data-[invalid=true]:!text-danger group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-[\"*\"]',\n loadingIndicator: '',\n loadingMessage: 'rounded-sm p-2 text-foreground-500',\n menu: 'mt-2 rounded-xl border border-default-200 bg-content1 p-1 shadow-lg',\n menuList: '',\n // ensure menu has same z-index as modal so it is visible when rendered in modal\n // see: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/modal.ts (see z-50)\n menuPortal: 'z-50!',\n multiValue: 'items-center gap-1.5 rounded bg-default-100 py-0.5 pl-2 pr-1',\n multiValueContainer: '',\n multiValueLabel: 'py-0.5 leading-6',\n multiValueRemove:\n 'rounded text-default-500 hover:cursor-pointer hover:border-default-300 hover:text-default-800',\n noOptionsMessage: 'rounded-sm p-2 text-foreground-500',\n option_focused: 'bg-default-100 active:bg-default-200',\n option_selected: 'bg-default-300',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n placeholder: 'ml-1 py-0.5 pl-1 text-sm text-foreground-500',\n selectContainer: '',\n singleValue: 'ml-1! leading-7!',\n valueContainer: 'gap-1 p-1',\n },\n});\n\ninterface SelectOption {\n /** option label */\n label?: ReactNode;\n /** option value */\n value: string | number;\n}\n\ntype VariantProps = TVProps<typeof selectVariants>;\ntype ClassName = TVClassName<typeof selectVariants>;\n\nexport interface SelectProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName; // string;\n /** Determine if the */\n clearable?: boolean;\n /** Set the select to disabled state. */\n disabled?: boolean;\n /** Filter Select Options */\n filterOption?:\n | undefined\n | ((option?: SelectOption, inputValue?: string) => boolean);\n /** Format the label of the option */\n renderOptionLabel?: undefined | Props['formatOptionLabel'];\n /** The value of the search input */\n inputValue?: string;\n /** Label that should be associated with the select. */\n label?: ReactNode;\n /** Set the select to a loading state. */\n loading?: boolean;\n /** switch between single and multi select mode. */\n multiSelect?: boolean;\n /** The name for the Select component, used by react-hook-form */\n name: string;\n /** Placeholder that is displayed when nothing is selected */\n placeholder?: string;\n /** The options for the Select component */\n options: SelectOption[];\n /** Handle change events on the input */\n onInputChange?: Props['onInputChange'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst InputComponent: typeof components.Input = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}`;\n\n return <components.Input data-testid={testId} {...props} />;\n};\n\nconst ControlComponent: typeof components.Control = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select`;\n return (\n <div data-testid={testId}>\n {}\n <components.Control {...props} />\n </div>\n );\n};\n\nconst OptionComponent: typeof components.Option = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select_option_${slugify(String(props?.data?.testId ?? props?.data?.value), { replaceDots: true })}`;\n return (\n <div data-testid={testId}>\n {}\n <components.Option {...props} />\n </div>\n );\n};\n\nconst DropdownIndicatorComponent: typeof components.DropdownIndicator = (\n props,\n) => {\n // @ts-expect-error data-testid is not a default prop\n\n const testId = props?.selectProps['data-testid'] as string;\n return (\n <div data-testid={`${testId}_select_dropdown`}>\n {}\n <components.DropdownIndicator {...props} />\n </div>\n );\n};\n\n/** Select component based on [HeroUI Select](https://www.heroui.com//docs/components/select) and [React-Select](https://react-select.com/home) */\nconst Select = ({\n className = undefined,\n clearable = true,\n filterOption = undefined,\n renderOptionLabel = undefined,\n inputValue = undefined,\n loading = false,\n multiSelect = false,\n name,\n onInputChange = undefined,\n options,\n placeholder = undefined,\n ...uniformFieldProps\n}: SelectProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Get getFieldState to check isTouched in onChange callback\n const { getFieldState } = useFormContext();\n\n // Track if the select is focused\n const [isFocused, setIsFocused] = useState(false);\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = selectVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n const { getBaseProps, getTriggerProps, getValueProps } = useSelect({\n children: [],\n classNames,\n errorMessage,\n isDisabled: disabled,\n isInvalid: invalid,\n isLoading: loading,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n return (\n <div\n {...getBaseProps()}\n className={cn(classNames.base)}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-required={required}\n data-testid={`${testId}_wrapper`}\n >\n {label ? (\n <label\n className={classNames.label}\n data-slot=\"label\"\n htmlFor={`react-select-${name}-input`}\n id={getLabelProps().id}\n >\n {label}\n </label>\n ) : null}\n <ReactSelect\n ref={ref}\n menuShouldBlockScroll\n unstyled\n aria-errormessage=\"\"\n aria-invalid={invalid}\n aria-label={ariaLabel}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={testId}\n filterOption={filterOption}\n formatOptionLabel={renderOptionLabel}\n inputValue={inputValue}\n instanceId={name}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n // set menuPosition to fixed so that menu can be rendered\n // inside Card / Modal components, menuShouldBlockScroll\n // prevents container scroll when menu is open\n menuPosition=\"fixed\"\n name={name}\n onInputChange={onInputChange}\n options={options}\n placeholder={placeholder}\n // set aria-labelledby to the label id so that the select is accessible\n aria-labelledby={\n label\n ? getTriggerProps()['aria-labelledby']?.split(' ')[1]\n : undefined\n }\n classNames={{\n control: () => {\n return cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n });\n },\n clearIndicator: () => {\n return classNames.clearIndicator;\n },\n dropdownIndicator: () => {\n return classNames.dropdownIndicator;\n },\n groupHeading: () => {\n return classNames.groupHeading;\n },\n indicatorsContainer: () => {\n return classNames.indicatorsContainer;\n },\n indicatorSeparator: () => {\n return classNames.indicatorSeparator;\n },\n loadingIndicator: () => {\n return classNames.loadingIndicator;\n },\n loadingMessage: () => {\n return classNames.loadingMessage;\n },\n input: () => {\n return classNames.input;\n },\n menu: () => {\n return classNames.menu;\n },\n menuList: () => {\n return classNames.menuList;\n },\n menuPortal: () => {\n return classNames.menuPortal;\n },\n multiValue: () => {\n return classNames.multiValue;\n },\n multiValueLabel: () => {\n return cn(\n classNames.multiValueLabel,\n `${getValueProps().className}`,\n );\n },\n multiValueRemove: () => {\n return classNames.multiValueRemove;\n },\n noOptionsMessage: () => {\n return classNames.noOptionsMessage;\n },\n option: ({\n isFocused: optionIsFocused,\n isSelected: optionIsSelected,\n }) => {\n return cn(classNames.option, {\n [classNames.option_focused]: optionIsFocused,\n [classNames.option_selected]: optionIsSelected,\n });\n },\n placeholder: () => {\n return classNames.placeholder;\n },\n singleValue: () => {\n return cn(classNames.singleValue, `${getValueProps().className}`);\n },\n valueContainer: () => {\n return classNames.valueContainer;\n },\n }}\n components={{\n Input: InputComponent,\n Option: OptionComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n Control: ControlComponent,\n }}\n onBlur={(_e) => {\n setIsFocused(false);\n onBlur();\n }}\n onChange={(option) => {\n if (multiSelect) {\n onChange(\n (option as SelectOption[])?.map((_option) => {\n return convertToOriginalType(_option.value);\n }),\n );\n } else {\n const selectedValue = (option as SelectOption)?.value;\n onChange(\n selectedValue != null\n ? convertToOriginalType(selectedValue)\n : selectedValue,\n );\n }\n // Mark field as touched immediately when a selection is made if not already touched\n // This ensures validation errors show right away (isTouched becomes true)\n // For Select components, selecting an option is a complete user action\n // (unlike text inputs where typing is ongoing), so we mark as touched immediately\n const { isTouched: currentIsTouched } = getFieldState(name, testId);\n if (!currentIsTouched) {\n onBlur();\n }\n }}\n onFocus={(_e) => {\n setIsFocused(true);\n }}\n // set complete option as value by current field value\n // Compare as strings to handle both string and number values\n value={options.find((option) => {\n return String(option.value) === String(value);\n })}\n />\n {invalid ? (\n <div {...getHelperWrapperProps()}>\n <div {...getErrorMessageProps()}>{errorMessage}</div>\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default Select;\n","import Select from './Select';\n\nexport type { SelectProps } from './Select';\n\nexport { Select };\n\nexport default Select;\n"],"mappings":";;;;;;;;;;AAeA,MAAa,iBAAiB,GAAG,EAC/B,OAAO;CACL,MAAM;CACN,gBACE;CACF,SACE;CACF,iBAAiB;CACjB,WAAW;CACX,aAAa;CACb,mBACE;CACF,OAAO;CACP,cAAc;CACd,qBAAqB;CACrB,oBAAoB;CACpB,OAAO;CAGP,OACE;CACF,kBAAkB;CAClB,gBAAgB;CAChB,MAAM;CACN,UAAU;CAGV,YAAY;CACZ,YAAY;CACZ,qBAAqB;CACrB,iBAAiB;CACjB,kBACE;CACF,kBAAkB;CAClB,gBAAgB;CAChB,iBAAiB;CACjB,QAAQ;CACR,aAAa;CACb,iBAAiB;CACjB,aAAa;CACb,gBAAgB;CACjB,EACF,CAAC;AA+CF,MAAM,kBAA2C,UAAU;CAGzD,MAAM,SAAS,GAAG,MAAM,YAAY;AAEpC,QAAO,oBAAC,WAAW;EAAM,eAAa;EAAQ,GAAI;GAAS;;AAG7D,MAAM,oBAA+C,UAAU;CAG7D,MAAM,SAAS,GAAG,MAAM,YAAY,eAAe;AACnD,QACE,oBAAC;EAAI,eAAa;YAEhB,oBAAC,WAAW,WAAQ,GAAI,QAAS;GAC7B;;AAIV,MAAM,mBAA6C,UAAU;CAG3D,MAAM,SAAS,GAAG,MAAM,YAAY,eAAe,iBAAiB,QAAQ,OAAO,OAAO,MAAM,UAAU,OAAO,MAAM,MAAM,EAAE,EAAE,aAAa,MAAM,CAAC;AACrJ,QACE,oBAAC;EAAI,eAAa;YAEhB,oBAAC,WAAW,UAAO,GAAI,QAAS;GAC5B;;AAIV,MAAM,8BACJ,UACG;CAGH,MAAM,SAAS,OAAO,YAAY;AACl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nE,SAAI,CAAC,iBACH,SAAQ;;IAGZ,UAAU,OAAO;AACf,kBAAa,KAAK;;IAIpB,OAAO,QAAQ,MAAM,WAAW;AAC9B,YAAO,OAAO,OAAO,MAAM,KAAK,OAAO,MAAM;MAC7C;KACF;GACD,UACC,oBAAC;IAAI,GAAI,uBAAuB;cAC9B,oBAAC;KAAI,GAAI,sBAAsB;eAAG;MAAmB;KACjD,GACJ;;GACA;;AAIV,uBAAe;;;;ACxXf,qBAAeA"}
@@ -1,6 +1,7 @@
1
- const require_FormContext = require('./FormContext-Lw4YL4-B.cjs');
2
- const require_useFormContext = require('./useFormContext-CEr3zcL6.cjs');
3
- const require_useUniformField = require('./useUniformField-D6fwSjrH.cjs');
1
+ const require_FormContext = require('./FormContext-CeFKQmVH.cjs');
2
+ const require_helpers = require('./helpers-CncbgvW_.cjs');
3
+ const require_useFormContext = require('./useFormContext-DJiJlfGJ.cjs');
4
+ const require_useUniformField = require('./useUniformField-CGiibqg4.cjs');
4
5
  let _fuf_stack_pixel_utils = require("@fuf-stack/pixel-utils");
5
6
  let react = require("react");
6
7
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -56,7 +57,7 @@ const ControlComponent = (props) => {
56
57
  });
57
58
  };
58
59
  const OptionComponent = (props) => {
59
- const testId = `${props.selectProps["data-testid"]}_select_option_${(0, _fuf_stack_pixel_utils.slugify)(props?.data?.testId ?? props?.data?.value, { replaceDots: true })}`;
60
+ const testId = `${props.selectProps["data-testid"]}_select_option_${(0, _fuf_stack_pixel_utils.slugify)(String(props?.data?.testId ?? props?.data?.value), { replaceDots: true })}`;
60
61
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61
62
  "data-testid": testId,
62
63
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_select.components.Option, { ...props })
@@ -77,6 +78,7 @@ const Select = ({ className = void 0, clearable = true, filterOption = void 0, r
77
78
  });
78
79
  const { getFieldState } = require_useFormContext.useFormContext();
79
80
  const [isFocused, setIsFocused] = (0, react.useState)(false);
81
+ const { convertToOriginalType } = require_helpers.createOptionValueConverter(options);
80
82
  const classNames = (0, _fuf_stack_pixel_utils.variantsToClassNames)(selectVariants(), className, "base");
81
83
  const { getBaseProps, getTriggerProps, getValueProps } = (0, _heroui_select.useSelect)({
82
84
  children: [],
@@ -201,9 +203,12 @@ const Select = ({ className = void 0, clearable = true, filterOption = void 0, r
201
203
  },
202
204
  onChange: (option) => {
203
205
  if (multiSelect) onChange(option?.map((_option) => {
204
- return _option.value;
206
+ return convertToOriginalType(_option.value);
205
207
  }));
206
- else onChange(option?.value);
208
+ else {
209
+ const selectedValue = option?.value;
210
+ onChange(selectedValue != null ? convertToOriginalType(selectedValue) : selectedValue);
211
+ }
207
212
  const { isTouched: currentIsTouched } = getFieldState(name, testId);
208
213
  if (!currentIsTouched) onBlur();
209
214
  },
@@ -211,7 +216,7 @@ const Select = ({ className = void 0, clearable = true, filterOption = void 0, r
211
216
  setIsFocused(true);
212
217
  },
213
218
  value: options.find((option) => {
214
- return option.value === value;
219
+ return String(option.value) === String(value);
215
220
  })
216
221
  }),
217
222
  invalid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -243,4 +248,4 @@ Object.defineProperty(exports, 'Select_default$1', {
243
248
  return Select_default$1;
244
249
  }
245
250
  });
246
- //# sourceMappingURL=Select-DQVskslz.cjs.map
251
+ //# sourceMappingURL=Select-CdTgOiUU.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select-CdTgOiUU.cjs","names":["components","useUniformField","useFormContext","createOptionValueConverter","ReactSelect","Select"],"sources":["../src/Select/Select.tsx","../src/Select/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\nimport type { Props } from 'react-select';\n\nimport { useState } from 'react';\nimport ReactSelect, { components } from 'react-select';\n\nimport { useSelect } from '@heroui/select';\n\nimport { cn, slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useFormContext } from '../hooks/useFormContext';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const selectVariants = tv({\n slots: {\n base: 'group leading-normal',\n clearIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800',\n control:\n 'duration-150! rounded-lg border-2 border-default-200 bg-content1 transition-background hover:border-default-400 group-data-[invalid=true]:border-danger group-data-[invalid=true]:hover:border-danger motion-reduce:transition-none',\n control_focused: 'border-focus',\n crossIcon: '',\n downChevron: '',\n dropdownIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-foreground-500',\n indicatorsContainer: 'gap-1 p-1',\n indicatorSeparator: 'bg-default-300',\n input: 'py-0.5 pl-1',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'pointer-events-auto relative bottom-1.5 ml-1 subpixel-antialiased text-small group-data-[invalid=true]:!text-danger group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-[\"*\"]',\n loadingIndicator: '',\n loadingMessage: 'rounded-sm p-2 text-foreground-500',\n menu: 'mt-2 rounded-xl border border-default-200 bg-content1 p-1 shadow-lg',\n menuList: '',\n // ensure menu has same z-index as modal so it is visible when rendered in modal\n // see: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/modal.ts (see z-50)\n menuPortal: 'z-50!',\n multiValue: 'items-center gap-1.5 rounded bg-default-100 py-0.5 pl-2 pr-1',\n multiValueContainer: '',\n multiValueLabel: 'py-0.5 leading-6',\n multiValueRemove:\n 'rounded text-default-500 hover:cursor-pointer hover:border-default-300 hover:text-default-800',\n noOptionsMessage: 'rounded-sm p-2 text-foreground-500',\n option_focused: 'bg-default-100 active:bg-default-200',\n option_selected: 'bg-default-300',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n placeholder: 'ml-1 py-0.5 pl-1 text-sm text-foreground-500',\n selectContainer: '',\n singleValue: 'ml-1! leading-7!',\n valueContainer: 'gap-1 p-1',\n },\n});\n\ninterface SelectOption {\n /** option label */\n label?: ReactNode;\n /** option value */\n value: string | number;\n}\n\ntype VariantProps = TVProps<typeof selectVariants>;\ntype ClassName = TVClassName<typeof selectVariants>;\n\nexport interface SelectProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName; // string;\n /** Determine if the */\n clearable?: boolean;\n /** Set the select to disabled state. */\n disabled?: boolean;\n /** Filter Select Options */\n filterOption?:\n | undefined\n | ((option?: SelectOption, inputValue?: string) => boolean);\n /** Format the label of the option */\n renderOptionLabel?: undefined | Props['formatOptionLabel'];\n /** The value of the search input */\n inputValue?: string;\n /** Label that should be associated with the select. */\n label?: ReactNode;\n /** Set the select to a loading state. */\n loading?: boolean;\n /** switch between single and multi select mode. */\n multiSelect?: boolean;\n /** The name for the Select component, used by react-hook-form */\n name: string;\n /** Placeholder that is displayed when nothing is selected */\n placeholder?: string;\n /** The options for the Select component */\n options: SelectOption[];\n /** Handle change events on the input */\n onInputChange?: Props['onInputChange'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst InputComponent: typeof components.Input = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}`;\n\n return <components.Input data-testid={testId} {...props} />;\n};\n\nconst ControlComponent: typeof components.Control = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select`;\n return (\n <div data-testid={testId}>\n {}\n <components.Control {...props} />\n </div>\n );\n};\n\nconst OptionComponent: typeof components.Option = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select_option_${slugify(String(props?.data?.testId ?? props?.data?.value), { replaceDots: true })}`;\n return (\n <div data-testid={testId}>\n {}\n <components.Option {...props} />\n </div>\n );\n};\n\nconst DropdownIndicatorComponent: typeof components.DropdownIndicator = (\n props,\n) => {\n // @ts-expect-error data-testid is not a default prop\n\n const testId = props?.selectProps['data-testid'] as string;\n return (\n <div data-testid={`${testId}_select_dropdown`}>\n {}\n <components.DropdownIndicator {...props} />\n </div>\n );\n};\n\n/** Select component based on [HeroUI Select](https://www.heroui.com//docs/components/select) and [React-Select](https://react-select.com/home) */\nconst Select = ({\n className = undefined,\n clearable = true,\n filterOption = undefined,\n renderOptionLabel = undefined,\n inputValue = undefined,\n loading = false,\n multiSelect = false,\n name,\n onInputChange = undefined,\n options,\n placeholder = undefined,\n ...uniformFieldProps\n}: SelectProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Get getFieldState to check isTouched in onChange callback\n const { getFieldState } = useFormContext();\n\n // Track if the select is focused\n const [isFocused, setIsFocused] = useState(false);\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = selectVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n const { getBaseProps, getTriggerProps, getValueProps } = useSelect({\n children: [],\n classNames,\n errorMessage,\n isDisabled: disabled,\n isInvalid: invalid,\n isLoading: loading,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n return (\n <div\n {...getBaseProps()}\n className={cn(classNames.base)}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-required={required}\n data-testid={`${testId}_wrapper`}\n >\n {label ? (\n <label\n className={classNames.label}\n data-slot=\"label\"\n htmlFor={`react-select-${name}-input`}\n id={getLabelProps().id}\n >\n {label}\n </label>\n ) : null}\n <ReactSelect\n ref={ref}\n menuShouldBlockScroll\n unstyled\n aria-errormessage=\"\"\n aria-invalid={invalid}\n aria-label={ariaLabel}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={testId}\n filterOption={filterOption}\n formatOptionLabel={renderOptionLabel}\n inputValue={inputValue}\n instanceId={name}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n // set menuPosition to fixed so that menu can be rendered\n // inside Card / Modal components, menuShouldBlockScroll\n // prevents container scroll when menu is open\n menuPosition=\"fixed\"\n name={name}\n onInputChange={onInputChange}\n options={options}\n placeholder={placeholder}\n // set aria-labelledby to the label id so that the select is accessible\n aria-labelledby={\n label\n ? getTriggerProps()['aria-labelledby']?.split(' ')[1]\n : undefined\n }\n classNames={{\n control: () => {\n return cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n });\n },\n clearIndicator: () => {\n return classNames.clearIndicator;\n },\n dropdownIndicator: () => {\n return classNames.dropdownIndicator;\n },\n groupHeading: () => {\n return classNames.groupHeading;\n },\n indicatorsContainer: () => {\n return classNames.indicatorsContainer;\n },\n indicatorSeparator: () => {\n return classNames.indicatorSeparator;\n },\n loadingIndicator: () => {\n return classNames.loadingIndicator;\n },\n loadingMessage: () => {\n return classNames.loadingMessage;\n },\n input: () => {\n return classNames.input;\n },\n menu: () => {\n return classNames.menu;\n },\n menuList: () => {\n return classNames.menuList;\n },\n menuPortal: () => {\n return classNames.menuPortal;\n },\n multiValue: () => {\n return classNames.multiValue;\n },\n multiValueLabel: () => {\n return cn(\n classNames.multiValueLabel,\n `${getValueProps().className}`,\n );\n },\n multiValueRemove: () => {\n return classNames.multiValueRemove;\n },\n noOptionsMessage: () => {\n return classNames.noOptionsMessage;\n },\n option: ({\n isFocused: optionIsFocused,\n isSelected: optionIsSelected,\n }) => {\n return cn(classNames.option, {\n [classNames.option_focused]: optionIsFocused,\n [classNames.option_selected]: optionIsSelected,\n });\n },\n placeholder: () => {\n return classNames.placeholder;\n },\n singleValue: () => {\n return cn(classNames.singleValue, `${getValueProps().className}`);\n },\n valueContainer: () => {\n return classNames.valueContainer;\n },\n }}\n components={{\n Input: InputComponent,\n Option: OptionComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n Control: ControlComponent,\n }}\n onBlur={(_e) => {\n setIsFocused(false);\n onBlur();\n }}\n onChange={(option) => {\n if (multiSelect) {\n onChange(\n (option as SelectOption[])?.map((_option) => {\n return convertToOriginalType(_option.value);\n }),\n );\n } else {\n const selectedValue = (option as SelectOption)?.value;\n onChange(\n selectedValue != null\n ? convertToOriginalType(selectedValue)\n : selectedValue,\n );\n }\n // Mark field as touched immediately when a selection is made if not already touched\n // This ensures validation errors show right away (isTouched becomes true)\n // For Select components, selecting an option is a complete user action\n // (unlike text inputs where typing is ongoing), so we mark as touched immediately\n const { isTouched: currentIsTouched } = getFieldState(name, testId);\n if (!currentIsTouched) {\n onBlur();\n }\n }}\n onFocus={(_e) => {\n setIsFocused(true);\n }}\n // set complete option as value by current field value\n // Compare as strings to handle both string and number values\n value={options.find((option) => {\n return String(option.value) === String(value);\n })}\n />\n {invalid ? (\n <div {...getHelperWrapperProps()}>\n <div {...getErrorMessageProps()}>{errorMessage}</div>\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default Select;\n","import Select from './Select';\n\nexport type { SelectProps } from './Select';\n\nexport { Select };\n\nexport default Select;\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,gDAAoB,EAC/B,OAAO;CACL,MAAM;CACN,gBACE;CACF,SACE;CACF,iBAAiB;CACjB,WAAW;CACX,aAAa;CACb,mBACE;CACF,OAAO;CACP,cAAc;CACd,qBAAqB;CACrB,oBAAoB;CACpB,OAAO;CAGP,OACE;CACF,kBAAkB;CAClB,gBAAgB;CAChB,MAAM;CACN,UAAU;CAGV,YAAY;CACZ,YAAY;CACZ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